From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: Sean Christopherson <seanjc@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>
Subject: Re: [PATCH v3 3/3] KVM: vCPU kick tax cut for running vCPU
Date: Tue, 19 Oct 2021 18:59:43 +0200 [thread overview]
Message-ID: <24e67e43-c50c-7e0f-305a-c7f6129f8d70@redhat.com> (raw)
In-Reply-To: <1634631160-67276-3-git-send-email-wanpengli@tencent.com>
On 19/10/21 10:12, Wanpeng Li wrote:
> - if (kvm_vcpu_wake_up(vcpu))
> - return;
> + me = get_cpu();
> +
> + if (rcuwait_active(kvm_arch_vcpu_get_wait(vcpu)) && kvm_vcpu_wake_up(vcpu))
> + goto out;
This is racy. You are basically doing the same check that
rcuwait_wake_up does, but without the memory barrier before.
Also here:
> + if (vcpu == __this_cpu_read(kvm_running_vcpu)) {
> + WARN_ON_ONCE(vcpu->mode == IN_GUEST_MODE);
it's better to do
if (vcpu == ... && !WARN_ON_ONCE(vcpu->mode == IN_GUEST_MODE))
goto out;
so that if the bug happens you do get a smp_send_reschedule() and fail
safely.
Paolo
> + goto out;
> + }
next prev parent reply other threads:[~2021-10-19 16:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 8:12 [PATCH v3 1/3] KVM: emulate: Don't inject #GP when emulating RDMPC if CR0.PE=0 Wanpeng Li
2021-10-19 8:12 ` [PATCH v3 2/3] KVM: vPMU: Fill get_msr MSR_CORE_PERF_GLOBAL_OVF_CTRL w/ 0 Wanpeng Li
2021-10-19 16:59 ` Paolo Bonzini
2021-10-19 8:12 ` [PATCH v3 3/3] KVM: vCPU kick tax cut for running vCPU Wanpeng Li
2021-10-19 16:59 ` Paolo Bonzini [this message]
2021-10-19 17:34 ` Sean Christopherson
2021-10-20 2:49 ` Wanpeng Li
2021-10-20 6:47 ` Paolo Bonzini
2021-10-20 10:02 ` Wanpeng Li
2021-10-20 10:37 ` Paolo Bonzini
2021-10-20 10:33 ` Paolo Bonzini
2021-10-19 17:00 ` [PATCH v3 1/3] KVM: emulate: Don't inject #GP when emulating RDMPC if CR0.PE=0 Paolo Bonzini
2021-10-20 1:56 ` 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=24e67e43-c50c-7e0f-305a-c7f6129f8d70@redhat.com \
--to=pbonzini@redhat.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=seanjc@google.com \
--cc=vkuznets@redhat.com \
--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
all inboxes | Powered by JetHome®