linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Cristian Marussi <cristian.marussi@arm.com>
To: Oliver Upton <oliver.upton@linux.dev>
Cc: Jeremy Linton <jeremy.linton@arm.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	David Woodhouse <dwmw@amazon.co.uk>,
	Marc Zyngier <marc.zyngier@arm.com>
Subject: Re: Circular lockdep in kvm_reset_vcpu() ?
Date: Mon, 13 Mar 2023 10:09:55 +0000	[thread overview]
Message-ID: <ZA72c+TT9epTcvX4@e120937-lin> (raw)
In-Reply-To: <Y+bnybGEkMpZzm/y@linux.dev>

On Sat, Feb 11, 2023 at 12:56:41AM +0000, Oliver Upton wrote:
> Hi Jeremy,
> 

Hi,

> On Fri, Feb 10, 2023 at 11:46:36AM -0600, Jeremy Linton wrote:
> > Hi,
> > 
> > I saw this pop yesterday:
> 
> You and me both actually! Shame on me, I spoke off-list about this with
> Marc in passing. Thanks for sending along the report.
> 
> > [   78.333360] ======================================================
> > [   78.339541] WARNING: possible circular locking dependency detected
> > [   78.345721] 6.2.0-rc7+ #19 Not tainted
> > [   78.349470] ------------------------------------------------------
> > [   78.355647] qemu-system-aar/859 is trying to acquire lock:
> > [   78.361130] ffff5aa69269eba0 (&host_kvm->lock){+.+.}-{3:3}, at:
> > kvm_reset_vcpu+0x34/0x274
> > [   78.369344]
> > [   78.369344] but task is already holding lock:
> > [   78.375182] ffff5aa68768c0b8 (&vcpu->mutex){+.+.}-{3:3}, at:
> > kvm_vcpu_ioctl+0x8c/0xba0
> 
> [...]
> 
> > It appears to be triggered by the new commit 42a90008f890a ('KVM: Ensure
> > lockdep knows about kvm->lock vs. vcpu->mutex ordering rule') which is
> > detecting the vcpu lock grabbed by kvm_vcpu_ioctl() and then the kvm mutext
> > grabbed by kvm_reset_vcpu().
> 
> Right, this commit gave lockdep what it needed to smack us on the head
> for getting the locking wrong in the arm64 side.
> 
> As gross as it might be, the right direction is likely to have our own
> lock in kvm_arch that we can acquire while holding the vcpu mutex. I'll
> throw a patch at the list once I get done testing it.
> 

I just hit this using a v6.3-rc2 and a mainline kvmtool.

In my case, though, the guest does not even boot if I use more than 1 vcpu, which
I suppose triggers effectively the reported possible deadlock, i.e.:

root/lkvm_master run -c 4 -m 4096 -k /root/Image_guest -d /root/disk_debian_buster_guest.img -p "loglevel=8"
  # lkvm run -k /root/Image_guest -m 4096 -c 4 --name guest-288
....<HANGS FOREVER>

Thanks,
Cristian


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-03-13 10:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10 17:46 Circular lockdep in kvm_reset_vcpu() ? Jeremy Linton
2023-02-11  0:56 ` Oliver Upton
2023-03-13 10:09   ` Cristian Marussi [this message]
2023-03-13 14:09     ` Marc Zyngier
2023-03-13 18:20       ` Cristian Marussi
     [not found]         ` <82978ec75c0b34203dd1df693e7adf83@kernel.org>
2023-03-14 11:04           ` Cristian Marussi
2023-03-14 11:42             ` Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZA72c+TT9epTcvX4@e120937-lin \
    --to=cristian.marussi@arm.com \
    --cc=dwmw@amazon.co.uk \
    --cc=jeremy.linton@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=oliver.upton@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).