Re: [PATCH 2/3] drm/amdkfd: handle VMA remove race

2021-11-18 Thread Felix Kuehling
Am 2021-11-18 um 10:55 a.m. schrieb philip yang: > > > On 2021-11-18 10:07 a.m., Felix Kuehling wrote: >> Am 2021-11-18 um 10:00 a.m. schrieb philip yang: >>> On 2021-11-17 7:10 p.m., Felix Kuehling wrote: On 2021-11-16 10:43 p.m., Philip Yang wrote: > VMA may be removed before unmap

Re: [PATCH 2/3] drm/amdkfd: handle VMA remove race

2021-11-18 Thread philip yang
On 2021-11-18 10:07 a.m., Felix Kuehling wrote: Am 2021-11-18 um 10:00 a.m. schrieb philip yang: On 2021-11-17 7:10 p.m., Felix Kuehling wrote: On 2021-11-16 10:43 p.m., Philip Yang wrote: VMA may

Re: [PATCH 2/3] drm/amdkfd: handle VMA remove race

2021-11-18 Thread Felix Kuehling
Am 2021-11-18 um 10:00 a.m. schrieb philip yang: > > > On 2021-11-17 7:10 p.m., Felix Kuehling wrote: >> On 2021-11-16 10:43 p.m., Philip Yang wrote: >>> VMA may be removed before unmap notifier callback, restore pages take >>> mmap write lock to lookup VMA to avoid race, >> >> The old code looked

Re: [PATCH 2/3] drm/amdkfd: handle VMA remove race

2021-11-18 Thread philip yang
On 2021-11-17 7:10 p.m., Felix Kuehling wrote: On 2021-11-16 10:43 p.m., Philip Yang wrote: VMA may be removed before unmap notifier callback, restore pages take mmap write lock to lookup VMA to avoid race,

Re: [PATCH 2/3] drm/amdkfd: handle VMA remove race

2021-11-17 Thread Felix Kuehling
On 2021-11-16 10:43 p.m., Philip Yang wrote: VMA may be removed before unmap notifier callback, restore pages take mmap write lock to lookup VMA to avoid race, The old code looked up the VMA after taking the mmap lock (either read or write) and kept holding the lock afterwards. I think even

[PATCH 2/3] drm/amdkfd: handle VMA remove race

2021-11-16 Thread Philip Yang
VMA may be removed before unmap notifier callback, restore pages take mmap write lock to lookup VMA to avoid race, and then create unregister new range and check VMA access permission, then downgrade to take mmap read lock to recover fault. Refactor code to avoid duplicate VMA lookup.