From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Wanpeng Li <wanpengli@tencent.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Sasha Levin <sashal@kernel.org>,
kvm@vger.kernel.org
Subject: [PATCH AUTOSEL 5.10 02/14] KVM: Fix lockdep false negative during host resume
Date: Tue, 1 Mar 2022 15:18:14 -0500 [thread overview]
Message-ID: <20220301201833.18841-2-sashal@kernel.org> (raw)
In-Reply-To: <20220301201833.18841-1-sashal@kernel.org>
From: Wanpeng Li <wanpengli@tencent.com>
[ Upstream commit 4cb9a998b1ce25fad74a82f5a5c45a4ef40de337 ]
I saw the below splatting after the host suspended and resumed.
WARNING: CPU: 0 PID: 2943 at kvm/arch/x86/kvm/../../../virt/kvm/kvm_main.c:5531 kvm_resume+0x2c/0x30 [kvm]
CPU: 0 PID: 2943 Comm: step_after_susp Tainted: G W IOE 5.17.0-rc3+ #4
RIP: 0010:kvm_resume+0x2c/0x30 [kvm]
Call Trace:
<TASK>
syscore_resume+0x90/0x340
suspend_devices_and_enter+0xaee/0xe90
pm_suspend.cold+0x36b/0x3c2
state_store+0x82/0xf0
kernfs_fop_write_iter+0x1b6/0x260
new_sync_write+0x258/0x370
vfs_write+0x33f/0x510
ksys_write+0xc9/0x160
do_syscall_64+0x3b/0xc0
entry_SYSCALL_64_after_hwframe+0x44/0xae
lockdep_is_held() can return -1 when lockdep is disabled which triggers
this warning. Let's use lockdep_assert_not_held() which can detect
incorrect calls while holding a lock and it also avoids false negatives
when lockdep is disabled.
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
Message-Id: <1644920142-81249-1-git-send-email-wanpengli@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
virt/kvm/kvm_main.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index d22de43925076..06367f2d55000 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -4758,9 +4758,7 @@ static int kvm_suspend(void)
static void kvm_resume(void)
{
if (kvm_usage_count) {
-#ifdef CONFIG_LOCKDEP
- WARN_ON(lockdep_is_held(&kvm_count_lock));
-#endif
+ lockdep_assert_not_held(&kvm_count_lock);
hardware_enable_nolock(NULL);
}
}
--
2.34.1
next prev parent reply other threads:[~2022-03-01 20:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-01 20:18 [PATCH AUTOSEL 5.10 01/14] selftests/bpf: Add test for bpf_timer overwriting crash Sasha Levin
2022-03-01 20:18 ` Sasha Levin [this message]
2022-03-01 20:19 ` [PATCH AUTOSEL 5.10 02/14] KVM: Fix lockdep false negative during host resume Paolo Bonzini
2022-03-01 20:18 ` [PATCH AUTOSEL 5.10 03/14] spi: rockchip: Fix error in getting num-cs property Sasha Levin
2022-03-01 20:18 ` [PATCH AUTOSEL 5.10 04/14] spi: rockchip: terminate dma transmission when slave abort Sasha Levin
2022-03-01 20:18 ` [PATCH AUTOSEL 5.10 05/14] net-sysfs: add check for netdevice being present to speed_show Sasha Levin
2022-03-01 20:18 ` [PATCH AUTOSEL 5.10 06/14] sr9700: sanity check for packet length Sasha Levin
2022-03-01 20:18 ` [PATCH AUTOSEL 5.10 07/14] hwmon: (pmbus) Clear pmbus fault/warning bits after read Sasha Levin
2022-03-01 20:18 ` [PATCH AUTOSEL 5.10 08/14] gpio: Return EPROBE_DEFER if gc->to_irq is NULL Sasha Levin
2022-03-01 20:18 ` [PATCH AUTOSEL 5.10 09/14] Revert "xen-netback: remove 'hotplug-status' once it has served its purpose" Sasha Levin
2022-03-01 20:18 ` [PATCH AUTOSEL 5.10 10/14] Revert "xen-netback: Check for hotplug-status existence before watching" Sasha Levin
2022-03-01 20:18 ` [PATCH AUTOSEL 5.10 11/14] ipv6: prevent a possible race condition with lifetimes Sasha Levin
2022-03-01 20:18 ` [PATCH AUTOSEL 5.10 12/14] tracing: Ensure trace buffer is at least 4096 bytes large Sasha Levin
2022-03-01 20:18 ` [PATCH AUTOSEL 5.10 13/14] selftest/vm: fix map_fixed_noreplace test failure Sasha Levin
2022-03-01 20:18 ` [PATCH AUTOSEL 5.10 14/14] selftests/memfd: clean up mapping in mfd_fail_write Sasha Levin
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=20220301201833.18841-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=stable@vger.kernel.org \
--cc=wanpengli@tencent.com \
/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
Powered by JetHome