From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E8F80C6FD19 for ; Mon, 13 Mar 2023 14:11:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:Cc:To:From :Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1/eqdv5/p9geFDtXTbRiQWK+1NQoPEk4Qn3L2eBkmuM=; b=lpefJiZgjHL4N8aeoCU0MOP+Ny AAsr+vfJIiv/5B9VCqwQEfQYM2T3buJWPMOd/qpbyNNirTsyeQZMCAqco+AcK5H4BjmFJRdeuzEHF 5crtTktmbX2pYSbUllFNHtTD/joAMB4kRAoQpZju/Xqye824j3Izzd+egyJ61ivtdifvFqVwwv2nV +hBmKh30mAP+wolCYXcqIApmhRq4P8emdRtguKky5alr1+HmlhuqQrTQmSVjB+0vdjPQpOPtgu50O Otra8rjDxYIo1nIXcus6TQgJ99Kl3eZydp+QF9Zv0K986wgshH4I2x8xgLbFbv4c3MmKi9vuY0tta vwdRDI5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbisP-0065wb-MZ; Mon, 13 Mar 2023 14:10:13 +0000 Received: from disco-boy.misterjones.org ([51.254.78.96]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbisM-0065vD-EZ for linux-arm-kernel@lists.infradead.org; Mon, 13 Mar 2023 14:10:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=misterjones.org; s=dkim20211231; h=Content-Transfer-Encoding:Content-Type: Message-ID:References:In-Reply-To:Subject:Cc:To:From:Date:MIME-Version:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Qr9EmARbpnWVBZVDOnt8Yn6YBbvuxLqxnG9mDigVdc4=; b=DTLP+2GXw5z/4G76KmEtd1Gja3 D5qgsxG3QaFv3ll2zrN/8ibitIq82Ue+1nuq1WNt3GD11m2/MW7qW1kiXf/JyWy43RRoIxHKz0xOA WsHxrOaM3ubxLJz5npfX6Z/GvyW+qIE4yYKlyaBdbM+P7PMjBUNuc9c9714gUgZnGy4BQpqLn3vhL Fcve9tCh3qL7SAAOB5vD/Prka0F/aDQH9WRR3+Q+O6TAJRpU0NPc7AYhzDOddQkFf7cGUJyZ5bTRK IDMwgKy/Jbsw5clKXTLuIorr7bDppYDquAJ+uCn7RG0e/tgPbMsLoeYzdtVwZLFcVpFMqeNS3ZmkV wMCP5x/w==; Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pbis8-00HGIo-9F; Mon, 13 Mar 2023 14:09:56 +0000 MIME-Version: 1.0 Date: Mon, 13 Mar 2023 14:09:55 +0000 From: Marc Zyngier To: Cristian Marussi Cc: Oliver Upton , Jeremy Linton , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, David Woodhouse , Marc Zyngier Subject: Re: Circular lockdep in kvm_reset_vcpu() ? In-Reply-To: References: User-Agent: Roundcube Webmail/1.4.13 Message-ID: <3496a6a10b2d8693825e733b871938f5@misterjones.org> X-Sender: maz@misterjones.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: cristian.marussi@arm.com, oliver.upton@linux.dev, jeremy.linton@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, dwmw@amazon.co.uk, marc.zyngier@arm.com X-SA-Exim-Mail-From: maz@misterjones.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230313_071010_836786_081CBFD4 X-CRM114-Status: GOOD ( 18.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2023-03-13 10:09, Cristian Marussi wrote: > 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 > .... Pass earlycon to the guest for a start. I seriously doubt someone has actually seen a deadlock, because the issue has been there for at least the past 7 years... And -rc2 works just fine here. M. -- Who you jivin' with that Cosmik Debris? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel