> From: Liu, Yi L <yi.l.liu@xxxxxxxxx> > Sent: Friday, January 20, 2023 11:10 PM > > > From: Jason Gunthorpe <jgg@xxxxxxxxxx> > > Sent: Friday, January 20, 2023 10:34 PM > > > > On Fri, Jan 20, 2023 at 02:00:26PM +0000, Liu, Yi L wrote: > > > Say in the same time, we have thread B closes device, it will hold > > > group_lock first and then calls kvm_put_kvm() which is the last > > > reference, then it would loop the kvm-device list. Currently, it is > > > not holding kvm_lock. But it also manipulating the kvm-device list, > > > should it hold kvm_lock? > > > > No. When using refcounts if the refcount is 0 it guarantees there are > > no other threads that can possibly touch this memory, so any locks > > internal to the memory are not required. > > Ok. The patch has been sent out standalone. > > https://lore.kernel.org/kvm/20230114000351.115444-1- > mjrosato@xxxxxxxxxxxxx/T/#u Wrong link. Below is the correct one. 😊 https://lore.kernel.org/kvm/20230120150528.471752-1-yi.l.liu@xxxxxxxxx/T/#u Regards, Yi Liu