From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH] KVM: avoid using rcu_dereference_protected Date: Wed, 2 Aug 2017 22:16:33 +0200 Message-ID: <20170802201633.GA32403@flask> References: <1501689354-18699-1-git-send-email-pbonzini@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, borntraeger@de.ibm.com To: Paolo Bonzini Return-path: Content-Disposition: inline In-Reply-To: <1501689354-18699-1-git-send-email-pbonzini@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 2017-08-02 17:55+0200, Paolo Bonzini: > During teardown, accesses to memslots and buses are using > rcu_dereference_protected with an always-true condition because > these accesses are done outside the usual mutexes. This > is because the last reference is gone and there cannot be any > concurrent modifications, but rcu_dereference_protected is > ugly and unobvious. > > Instead, check the refcount in kvm_get_bus and __kvm_memslots. > > Signed-off-by: Paolo Bonzini > --- Probably looks nicer than temporarily taking the slots_lock. Queued for 4.13, thanks.