On 10/5/22 9:57 AM, Jason Gunthorpe wrote: > On Wed, Oct 05, 2022 at 09:46:45AM -0400, Matthew Rosato wrote: > > >> (again, with the follow-up applied) Besides the panic above I just >> noticed there is also this warning that immediately precedes and is >> perhaps more useful. Re: what triggers the WARN, both group->owner >> and group->owner_cnt are already 0 > > And this is after the 2nd try that fixes the locking? Maybe I missed that email? I've only seen one version, happy to try another. Please resend? > > This shows that vfio_group_detach_container() is called twice (which > was my guess), hoever this looks to be impossible as both calls are > protected by 'if (group->container)' and the function NULL's > group->container and it is all under the proper lock. > > My guess was that missing locking caused the two cases to race and > trigger WARN, but the locking should fix that. > > So I'm at a loss, can you investigate a bit? > > Jason