From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
"Paul E . McKenney" <paulmck@linux.ibm.com>
Subject: Re: [PATCH 3/4] KVM: Fix spinlock taken warning during host resume
Date: Mon, 20 May 2019 12:36:30 +0200 [thread overview]
Message-ID: <7cce6762-006a-a21c-6400-6c0166428cf1@redhat.com> (raw)
In-Reply-To: <1558082990-7822-3-git-send-email-wanpengli@tencent.com>
On 17/05/19 10:49, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@tencent.com>
>
> WARNING: CPU: 0 PID: 13554 at kvm/arch/x86/kvm//../../../virt/kvm/kvm_main.c:4183 kvm_resume+0x3c/0x40 [kvm]
> CPU: 0 PID: 13554 Comm: step_after_susp Tainted: G OE 5.1.0-rc4+ #1
> RIP: 0010:kvm_resume+0x3c/0x40 [kvm]
> Call Trace:
> syscore_resume+0x63/0x2d0
> suspend_devices_and_enter+0x9d1/0xa40
> pm_suspend+0x33a/0x3b0
> state_store+0x82/0xf0
> kobj_attr_store+0x12/0x20
> sysfs_kf_write+0x4b/0x60
> kernfs_fop_write+0x120/0x1a0
> __vfs_write+0x1b/0x40
> vfs_write+0xcd/0x1d0
> ksys_write+0x5f/0xe0
> __x64_sys_write+0x1a/0x20
> do_syscall_64+0x6f/0x6c0
> entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> Commit ca84d1a24 (KVM: x86: Add clock sync request to hardware enable) mentioned
> that "we always hold kvm_lock when hardware_enable is called. The one place that
> doesn't need to worry about it is resume, as resuming a frozen CPU, the spinlock
> won't be taken." However, commit 6706dae9 (virt/kvm: Replace spin_is_locked() with
> lockdep) introduces a bug, it asserts when the lock is not held which is contrary
> to the original goal.
>
> This patch fixes it by WARN_ON when the lock is held.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> Cc: Paul E. McKenney <paulmck@linux.ibm.com>
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
> ---
> virt/kvm/kvm_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 5fb0f16..c7eab5f 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -4096,7 +4096,7 @@ static int kvm_suspend(void)
> static void kvm_resume(void)
> {
> if (kvm_usage_count) {
> - lockdep_assert_held(&kvm_count_lock);
> + WARN_ON(lockdep_is_held(&kvm_count_lock));
> hardware_enable_nolock(NULL);
> }
> }
>
Queued, thanks.
Paolo
next prev parent reply other threads:[~2019-05-20 10:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-17 8:49 [PATCH 1/4] KVM: x86: Disable intercept for CORE cstate read Wanpeng Li
2019-05-17 8:49 ` [PATCH RESEND 2/4] KVM: X86: Emulate MSR_IA32_MISC_ENABLE MWAIT bit Wanpeng Li
2019-05-20 10:34 ` Paolo Bonzini
2019-05-20 11:39 ` Wanpeng Li
2019-05-17 8:49 ` [PATCH 3/4] KVM: Fix spinlock taken warning during host resume Wanpeng Li
2019-05-20 10:36 ` Paolo Bonzini [this message]
2019-05-17 8:49 ` [PATCH 4/4] KVM: nVMX: Fix using __this_cpu_read() in preemptible context Wanpeng Li
2019-05-17 20:12 ` Sean Christopherson
2019-05-20 10:36 ` Paolo Bonzini
2019-05-20 10:30 ` [PATCH 1/4] KVM: x86: Disable intercept for CORE cstate read Paolo Bonzini
2019-05-20 11:29 ` Wanpeng Li
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=7cce6762-006a-a21c-6400-6c0166428cf1@redhat.com \
--to=pbonzini@redhat.com \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.ibm.com \
--cc=rkrcmar@redhat.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;
as well as URLs for NNTP newsgroup(s).