Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-17 Thread Christian König
Am 17.01.22 um 15:50 schrieb Marek Olšák: I don't think fork() would work with userspace where all buffers are shared. It certainly doesn't work now. The driver needs to be notified that a buffer or texture is shared to ensure data coherency between processes, and the driver must execute

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-17 Thread Marek Olšák
I don't think fork() would work with userspace where all buffers are shared. It certainly doesn't work now. The driver needs to be notified that a buffer or texture is shared to ensure data coherency between processes, and the driver must execute decompression and other render passes when a buffer

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-17 Thread Felix Kuehling
Am 2022-01-17 um 9:21 a.m. schrieb Christian König: > Am 17.01.22 um 15:17 schrieb Felix Kuehling: >> Am 2022-01-17 um 6:44 a.m. schrieb Christian König: >>> Am 14.01.22 um 18:40 schrieb Felix Kuehling: Am 2022-01-14 um 12:26 p.m. schrieb Christian König: > Am 14.01.22 um 17:44 schrieb

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-17 Thread Christian König
Am 17.01.22 um 15:17 schrieb Felix Kuehling: Am 2022-01-17 um 6:44 a.m. schrieb Christian König: Am 14.01.22 um 18:40 schrieb Felix Kuehling: Am 2022-01-14 um 12:26 p.m. schrieb Christian König: Am 14.01.22 um 17:44 schrieb Daniel Vetter: Top post because I tried to catch up on the entire

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-17 Thread Felix Kuehling
Am 2022-01-17 um 6:44 a.m. schrieb Christian König: > Am 14.01.22 um 18:40 schrieb Felix Kuehling: >> Am 2022-01-14 um 12:26 p.m. schrieb Christian König: >>> Am 14.01.22 um 17:44 schrieb Daniel Vetter: Top post because I tried to catch up on the entire discussion here. So

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-17 Thread Christian König
Am 14.01.22 um 18:40 schrieb Felix Kuehling: Am 2022-01-14 um 12:26 p.m. schrieb Christian König: Am 14.01.22 um 17:44 schrieb Daniel Vetter: Top post because I tried to catch up on the entire discussion here. So fundamentally I'm not opposed to just close this fork() hole once and for all.

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-14 Thread Felix Kuehling
Am 2022-01-14 um 12:26 p.m. schrieb Christian König: > Am 14.01.22 um 17:44 schrieb Daniel Vetter: >> Top post because I tried to catch up on the entire discussion here. >> >> So fundamentally I'm not opposed to just close this fork() hole once and >> for all. The thing that worries me from a

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-14 Thread Christian König
Am 14.01.22 um 17:44 schrieb Daniel Vetter: Top post because I tried to catch up on the entire discussion here. So fundamentally I'm not opposed to just close this fork() hole once and for all. The thing that worries me from a upstream/platform pov is really only if we don't do it consistently

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-14 Thread Daniel Vetter
Top post because I tried to catch up on the entire discussion here. So fundamentally I'm not opposed to just close this fork() hole once and for all. The thing that worries me from a upstream/platform pov is really only if we don't do it consistently across all drivers. So maybe as an idea: - Do

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-10 Thread Bhardwaj, Rajneesh
Hi Christian I have reverted the change from the amd-staging-drm-next as per the discussion.  Thank you. Regards Rajneesh On 1/4/2022 1:08 PM, Felix Kuehling wrote: [+Adrian] Am 2021-12-23 um 2:05 a.m. schrieb Christian König: Am 22.12.21 um 21:53 schrieb Daniel Vetter: On Mon, Dec

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-07 Thread Felix Kuehling
Am 2022-01-07 um 3:56 a.m. schrieb Christian König: > Am 06.01.22 um 17:51 schrieb Felix Kuehling: >> Am 2022-01-06 um 11:48 a.m. schrieb Christian König: >>> Am 06.01.22 um 17:45 schrieb Felix Kuehling: Am 2022-01-06 um 4:05 a.m. schrieb Christian König: [SNIP] Also, why does your

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-07 Thread Christian König
Am 06.01.22 um 17:51 schrieb Felix Kuehling: Am 2022-01-06 um 11:48 a.m. schrieb Christian König: Am 06.01.22 um 17:45 schrieb Felix Kuehling: Am 2022-01-06 um 4:05 a.m. schrieb Christian König: [SNIP] Also, why does your ACK or NAK depend on this at all. If it's the right thing to do, it's

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-06 Thread Felix Kuehling
Am 2022-01-06 um 4:05 a.m. schrieb Christian König: > Am 05.01.22 um 17:16 schrieb Felix Kuehling: >> [SNIP] But KFD doesn't know anything about the inherited BOs from the parent process. >>> Ok, why that? When the KFD is reinitializing it's context why >>> shouldn't it cleanup those

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-06 Thread Felix Kuehling
Am 2022-01-06 um 11:48 a.m. schrieb Christian König: > Am 06.01.22 um 17:45 schrieb Felix Kuehling: >> Am 2022-01-06 um 4:05 a.m. schrieb Christian König: >>> Am 05.01.22 um 17:16 schrieb Felix Kuehling: [SNIP] >> But KFD doesn't know anything about the inherited BOs >> from the

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-06 Thread Christian König
Am 06.01.22 um 17:45 schrieb Felix Kuehling: Am 2022-01-06 um 4:05 a.m. schrieb Christian König: Am 05.01.22 um 17:16 schrieb Felix Kuehling: [SNIP] But KFD doesn't know anything about the inherited BOs from the parent process. Ok, why that? When the KFD is reinitializing it's context why

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-06 Thread Christian König
Am 05.01.22 um 17:16 schrieb Felix Kuehling: [SNIP] But KFD doesn't know anything about the inherited BOs from the parent process. Ok, why that? When the KFD is reinitializing it's context why shouldn't it cleanup those VMAs? That cleanup has to be initiated by user mode. Basically closing

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-05 Thread Felix Kuehling
Am 2022-01-05 um 11:16 a.m. schrieb Felix Kuehling: >> I was already wondering which mmaps through the KFD node we have left >> which cause problems here. > We still use the KFD FD for mapping doorbells and HDP flushing. These > are both SG BOs, so they cannot be CPU-mapped through render nodes.

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-05 Thread Felix Kuehling
Am 2022-01-05 um 3:08 a.m. schrieb Christian König: > Am 04.01.22 um 19:08 schrieb Felix Kuehling: >> [+Adrian] >> >> Am 2021-12-23 um 2:05 a.m. schrieb Christian König: >> >>> Am 22.12.21 um 21:53 schrieb Daniel Vetter: On Mon, Dec 20, 2021 at 01:12:51PM -0500, Bhardwaj, Rajneesh wrote:

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-05 Thread Christian König
Am 04.01.22 um 19:08 schrieb Felix Kuehling: [+Adrian] Am 2021-12-23 um 2:05 a.m. schrieb Christian König: Am 22.12.21 um 21:53 schrieb Daniel Vetter: On Mon, Dec 20, 2021 at 01:12:51PM -0500, Bhardwaj, Rajneesh wrote: [SNIP] Still sounds funky. I think minimally we should have an ack from

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2022-01-04 Thread Felix Kuehling
[+Adrian] Am 2021-12-23 um 2:05 a.m. schrieb Christian König: > Am 22.12.21 um 21:53 schrieb Daniel Vetter: >> On Mon, Dec 20, 2021 at 01:12:51PM -0500, Bhardwaj, Rajneesh wrote: >> >> [SNIP] >> Still sounds funky. I think minimally we should have an ack from CRIU >> developers that this is

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2021-12-22 Thread Christian König
Am 22.12.21 um 21:53 schrieb Daniel Vetter: On Mon, Dec 20, 2021 at 01:12:51PM -0500, Bhardwaj, Rajneesh wrote: [SNIP] Still sounds funky. I think minimally we should have an ack from CRIU developers that this is officially the right way to solve this problem. I really don't want to have random

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2021-12-22 Thread Bhardwaj, Rajneesh
Sorry for the typo in my previous email. Please read Adrian Reber* On 12/22/2021 8:49 PM, Bhardwaj, Rajneesh wrote: Adding Adrian Rebel who is the CRIU maintainer and CRIU list On 12/22/2021 3:53 PM, Daniel Vetter wrote: On Mon, Dec 20, 2021 at 01:12:51PM -0500, Bhardwaj, Rajneesh wrote: On

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2021-12-22 Thread Bhardwaj, Rajneesh
Adding Adrian Rebel who is the CRIU maintainer and CRIU list On 12/22/2021 3:53 PM, Daniel Vetter wrote: On Mon, Dec 20, 2021 at 01:12:51PM -0500, Bhardwaj, Rajneesh wrote: On 12/20/2021 4:29 AM, Daniel Vetter wrote: On Fri, Dec 10, 2021 at 07:58:50AM +0100, Christian König wrote: Am

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2021-12-22 Thread Daniel Vetter
On Mon, Dec 20, 2021 at 01:12:51PM -0500, Bhardwaj, Rajneesh wrote: > > On 12/20/2021 4:29 AM, Daniel Vetter wrote: > > On Fri, Dec 10, 2021 at 07:58:50AM +0100, Christian König wrote: > > > Am 09.12.21 um 19:28 schrieb Felix Kuehling: > > > > Am 2021-12-09 um 10:30 a.m. schrieb Christian König:

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2021-12-20 Thread Bhardwaj, Rajneesh
On 12/20/2021 4:29 AM, Daniel Vetter wrote: On Fri, Dec 10, 2021 at 07:58:50AM +0100, Christian König wrote: Am 09.12.21 um 19:28 schrieb Felix Kuehling: Am 2021-12-09 um 10:30 a.m. schrieb Christian König: That still won't work. But I think we could do this change for the amdgpu mmap

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2021-12-20 Thread Daniel Vetter
On Fri, Dec 10, 2021 at 07:58:50AM +0100, Christian König wrote: > Am 09.12.21 um 19:28 schrieb Felix Kuehling: > > Am 2021-12-09 um 10:30 a.m. schrieb Christian König: > > > That still won't work. > > > > > > But I think we could do this change for the amdgpu mmap callback only. > > If graphics

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2021-12-09 Thread Christian König
Am 09.12.21 um 19:28 schrieb Felix Kuehling: Am 2021-12-09 um 10:30 a.m. schrieb Christian König: That still won't work. But I think we could do this change for the amdgpu mmap callback only. If graphics user mode has problems with it, we could even make this specific to KFD BOs in the

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2021-12-09 Thread Felix Kuehling
Am 2021-12-09 um 10:30 a.m. schrieb Christian König: > That still won't work. > > But I think we could do this change for the amdgpu mmap callback only. If graphics user mode has problems with it, we could even make this specific to KFD BOs in the amdgpu_gem_object_mmap callback. Regards,  

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2021-12-09 Thread Bhardwaj, Rajneesh
Sounds good. I will send a v2 with only ttm_bo_mmap_obj change. Thank you! On 12/9/2021 10:27 AM, Christian König wrote: Hi Rajneesh, yes, separating this from the drm_gem_mmap_obj() change is certainly a good idea. The child cannot access the BOs mapped by the parent anyway with access

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2021-12-09 Thread Christian König
That still won't work. But I think we could do this change for the amdgpu mmap callback only. Regards, Christian. Am 09.12.21 um 16:29 schrieb Bhardwaj, Rajneesh: Sounds good. I will send a v2 with only ttm_bo_mmap_obj change. Thank you! On 12/9/2021 10:27 AM, Christian König wrote: Hi

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2021-12-09 Thread Bhardwaj, Rajneesh
Thanks Christian. Would it make it less intrusive if I just use the flag for ttm bo mmap and remove the drm_gem_mmap_obj change from this patch? For our use case, just the ttm_bo_mmap_obj change should suffice and we don't want to put any more work arounds in the user space (thunk, in our

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2021-12-09 Thread Christian König
Hi Rajneesh, yes, separating this from the drm_gem_mmap_obj() change is certainly a good idea. The child cannot access the BOs mapped by the parent anyway with access restrictions applied exactly that is not correct. That behavior is actively used by some userspace stacks as far as I

Re: [PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2021-12-09 Thread Christian König
Am 08.12.21 um 21:53 schrieb Rajneesh Bhardwaj: When an application having open file access to a node forks, its shared mappings also get reflected in the address space of child process even though it cannot access them with the object permissions applied. With the existing permission checks on

[PATCH] drm/ttm: Don't inherit GEM object VMAs in child process

2021-12-08 Thread Rajneesh Bhardwaj
When an application having open file access to a node forks, its shared mappings also get reflected in the address space of child process even though it cannot access them with the object permissions applied. With the existing permission checks on the gem objects, it might be reasonable to also