From: Paul Mackerras Date: Thu, 23 May 2019 08:31:39 +0000 Subject: Re: [PATCH 0/4] KVM: PPC: Book3S: Fix potential deadlocks Message-Id: <20190523083139.GB27043@blackberry> List-Id: References: <20190523063424.GB19655@blackberry> <3d159268-3645-bbf0-8f99-306c9ca68611@ozlabs.ru> In-Reply-To: <3d159268-3645-bbf0-8f99-306c9ca68611@ozlabs.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Alexey Kardashevskiy Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, =?iso-8859-1?Q?C=E9dric?= Le Goater On Thu, May 23, 2019 at 05:21:00PM +1000, Alexey Kardashevskiy wrote: > > > On 23/05/2019 16:34, Paul Mackerras wrote: > > Recent reports of lockdep splats in the HV KVM code revealed that it > > was taking the kvm->lock mutex in several contexts where a vcpu mutex > > was already held. Lockdep has only started warning since I added code > > to take the vcpu mutexes in the XIVE device release functions, but > > since Documentation/virtual/kvm/locking.txt specifies that the vcpu > > mutexes nest inside kvm->lock, it seems that the new code is correct > > and it is most of the old uses of kvm->lock that are wrong. > > > > This series should fix the problems, by adding new mutexes that nest > > inside the vcpu mutexes and using them instead of kvm->lock. > > > I applied these 4, compiled, installed, rebooted, tried running a guest > (which failed because I also updated QEMU and its cli has changed), got > this. So VM was created and then destroyed without executing a single > instruction, if that matters. Looks like I need to remove the lockdep_assert_held(&kvm->arch.rtas_token_lock); in kvmppc_rtas_tokens_free(). We don't have the rtas_token_lock, but it doesn't matter because we are destroying the VM and nothing else has a reference to it by now. Paul.