On 2019-06-18 1:37, Christoph Hellwig wrote: > On Mon, Jun 17, 2019 at 09:45:09PM -0300, Jason Gunthorpe wrote: >> Am I looking at the wrong thing? Looks like it calls it through a work >> queue should should be OK.. > Yes, it calls it through a work queue. I guess that is fine because > it needs to take the lock again. > >> Though very strange that amdgpu only destroys the mirror via release, >> that cannot be right. > As said the whole things looks rather odd to me. This code is derived from our old MMU notifier code. Before HMM we used to register a single MMU notifier per mm_struct and look up virtual address ranges that had been registered for mirroring via driver API calls. The idea was to reuse a single MMU notifier for the life time of the process. It would remain registered until we got a notifier_release. hmm_mirror took the place of that when we converted the code to HMM. I suppose we could destroy the mirror earlier, when we have no more registered virtual address ranges, and create a new one if needed later. Regards, Felix