Re: [PATCH 2/4] amdgpu: fix a race in kfd_mem_export_dmabuf()

2024-08-22 Thread Al Viro
On Wed, Aug 14, 2024 at 06:15:46PM -0400, Felix Kuehling wrote: > > On 2024-08-12 02:59, Al Viro wrote: > > Using drm_gem_prime_handle_to_fd() to set dmabuf up and insert it into > > descriptor table, only to have it looked up by file descriptor and > > remove it from desc

Re: [PATCH 1/4] new helper: drm_gem_prime_handle_to_dmabuf()

2024-08-23 Thread Al Viro
Do you have any problems with the variant below? The only changes are in commit message and added comment for new helper... commit 8c291056e3e88153ef4b6316d5247547da200757 Author: Al Viro Date: Fri Aug 2 09:56:28 2024 -0400 new helper: drm_gem_prime_handle_to_dmabuf() Once

Re: [PATCH 1/4] new helper: drm_gem_prime_handle_to_dmabuf()

2024-08-23 Thread Al Viro
On Thu, Aug 22, 2024 at 04:41:59PM +0200, Thomas Zimmermann wrote: > Hi > > Am 12.08.24 um 08:59 schrieb Al Viro: > > Once something had been put into descriptor table, the only thing you > > can do with it is returning descriptor to userland - you can't withdraw > &g

Re: [PATCH 1/4] new helper: drm_gem_prime_handle_to_dmabuf()

2024-08-23 Thread Al Viro
in amdgpu ---- Al Viro (4): new helper: drm_gem_prime_handle_to_dmabuf() amdgpu: fix a race in kfd_mem_export_dmabuf() amdkfd CRIU fixes amdgpu: get rid of bogus includes of fdtable.h .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_a

Re: [PATCH 2/2][RFC] amdkfd CRIU fixes

2024-06-05 Thread Al Viro
On Tue, Jun 04, 2024 at 02:16:00PM -0400, Felix Kuehling wrote: > > On 2024-06-03 22:14, Al Viro wrote: > > Instead of trying to use close_fd() on failure exits, just have > > criu_get_prime_handle() store the file reference without inserting > > it into descriptor table.

Re: [PATCH 1/2][RFC] amdgpu: fix a race in kfd_mem_export_dmabuf()

2024-06-05 Thread Al Viro
On Tue, Jun 04, 2024 at 02:08:30PM -0400, Felix Kuehling wrote: > > +int drm_gem_prime_handle_to_fd(struct drm_device *dev, > > + struct drm_file *file_priv, uint32_t handle, > > + uint32_t flags, > > + int *prime_fd) > > +{

[PATCH v2 1/2][RFC] amdgpu: fix a race in kfd_mem_export_dmabuf()

2024-06-05 Thread Al Viro
ould simply use that new helper and leave the descriptor table alone. Signed-off-by: Al Viro --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index 8975cf41a91a..793780bb819c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkf

[PATCH 3/4] amdkfd CRIU fixes

2024-08-12 Thread Al Viro
of descriptor table, or drop all those file references and free the unused descriptors. Reviewed-by: Felix Kuehling Signed-off-by: Al Viro --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 64 +--- 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm

[PATCHES] [drm] file descriptor fixes

2024-08-12 Thread Al Viro
switching kfd_mem_export_dmabuf() to that. Branch in git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git #for-drm, individual patches in followups. Please, review; IMO that ought to go through drm and amd-gfx trees. Shortlog: Al Viro (4): new helper

[PATCH 4/4] amdgpu: get rid of bogus includes of fdtable.h

2024-08-12 Thread Al Viro
Signed-off-by: Al Viro --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c b/drivers/gpu/drm/amd/amdgpu

[PATCH 2/4] amdgpu: fix a race in kfd_mem_export_dmabuf()

2024-08-12 Thread Al Viro
ng through that song and dance. Switch kfd_mem_export_dmabuf() to using drm_gem_prime_handle_to_dmabuf() and leave the descriptor table alone... Signed-off-by: Al Viro --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git

[PATCH 1/4] new helper: drm_gem_prime_handle_to_dmabuf()

2024-08-12 Thread Al Viro
rm_gem_prime_handle_to_fd() becomes a wrapper for it. Other users will be introduced in the next commit. Signed-off-by: Al Viro --- drivers/gpu/drm/drm_prime.c | 84 +++-- include/drm/drm_prime.h | 3 ++ 2 files changed, 46 insertions(+), 41 deletions(-) dif

[PATCH 1/2][RFC] amdgpu: fix a race in kfd_mem_export_dmabuf()

2024-06-04 Thread Al Viro
Signed-off-by: Al Viro --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index 8975cf41a91a..793780bb819c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

[PATCHES][RFC][CFT] close_fd() misuses in amdgpu

2024-06-04 Thread Al Viro
Use of close_fd() in cleanup on failure exits is wrong; descriptor table is a shared data structure, and as soon as you've inserted a file reference there it is entirely possible for another thread to have move it around, replace it or remove it. Fortunately, not many places are us

[PATCH 2/2][RFC] amdkfd CRIU fixes

2024-06-04 Thread Al Viro
of descriptor table, or drop all those file references and free the unused descriptors. Signed-off-by: Al Viro --- diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index fdf171ad4a3c..3f129e1c0daa 100644 --- a/drivers/gpu/drm/amd/amdkfd

Re: [PATCH RFC PKS/PMEM 33/58] fs/cramfs: Utilize new kmap_thread()

2020-10-13 Thread Al Viro
On Tue, Oct 13, 2020 at 08:36:43PM +0100, Matthew Wilcox wrote: > static inline void copy_to_highpage(struct page *to, void *vfrom, unsigned > int size) > { > char *vto = kmap_atomic(to); > > memcpy(vto, vfrom, size); > kunmap_atomic(vto); > } > > in linux/highmem.h ? You mea

Re: [PATCH v3 12/26] compat_ioctl: move more drivers to compat_ptr_ioctl

2019-04-25 Thread Al Viro
On Thu, Apr 25, 2019 at 12:21:53PM -0300, Mauro Carvalho Chehab wrote: > If I understand your patch description well, using compat_ptr_ioctl > only works if the driver is not for s390, right? No; s390 is where "oh, just set ->compat_ioctl same as ->unlocked_ioctl and be done with that; compat_ptr

Re: [PATCH v3 12/26] compat_ioctl: move more drivers to compat_ptr_ioctl

2019-04-25 Thread Al Viro
On Thu, Apr 25, 2019 at 05:55:23PM +0200, Arnd Bergmann wrote: > On Thu, Apr 25, 2019 at 5:35 PM Al Viro wrote: > > > > On Thu, Apr 25, 2019 at 12:21:53PM -0300, Mauro Carvalho Chehab wrote: > > > > > If I understand your patch description well, using compat_ptr

Re: [PATCH v2 05/17] compat_ioctl: move more drivers to generic_compat_ioctl_ptrarg

2018-09-17 Thread Al Viro
On Fri, Sep 14, 2018 at 01:35:06PM -0700, Darren Hart wrote: > Acked-by: Darren Hart (VMware) > > As for a longer term solution, would it be possible to init fops in such > a way that the compat_ioctl call defaults to generic_compat_ioctl_ptrarg > so we don't have to duplicate this boilerplate