From: Joao Martins <joao.m.martins@oracle.com>
To: Wanpeng Li <kernellwp@gmail.com>
Cc: kvm <kvm@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Sean Christopherson" <sean.j.christopherson@intel.com>,
"Vitaly Kuznetsov" <vkuznets@redhat.com>,
"Wanpeng Li" <wanpengli@tencent.com>,
"Jim Mattson" <jmattson@google.com>,
"Joerg Roedel" <joro@8bytes.org>,
"Liran Alon" <liran.alon@oracle.com>,
"Jag Raman" <jag.raman@oracle.com>
Subject: Re: [PATCH v2 2/3] KVM: VMX: Do not change PID.NDST when loading a blocked vCPU
Date: Tue, 19 Nov 2019 14:44:27 +0000 [thread overview]
Message-ID: <6b6acdee-f080-241f-8a6e-89708f746944@oracle.com> (raw)
In-Reply-To: <CANRm+CyrbiJ068zLRH8ZMttqjnEG38qb1W1SMND+H-D=8N8tVw@mail.gmail.com>
On 11/19/19 11:36 AM, Wanpeng Li wrote:
> On Tue, 12 Nov 2019 at 01:23, Joao Martins <joao.m.martins@oracle.com> wrote:
>>
>> While vCPU is blocked (in kvm_vcpu_block()), it may be preempted which
>> will cause vmx_vcpu_pi_put() to set PID.SN. If later the vCPU will be
>
> How can this happen? See the prepare_to_swait_exlusive() in
> kvm_vcpu_block(), the task will be set in TASK_INTERRUPTIBLE state,
> kvm_sched_out will set vcpu->preempted to true iff current->state ==
> TASK_RUNNING.
You're right.
But preemption (thus setting PID.SN) can still happen before vcpu_block(), or
otherwise scheduled out if we are already in vcpu_block() (with task in
TASK_INTERRUPTIBLE). The right term we should have written in that sentence
above would have been 'scheduled out' and drop the vcpu_block mention and it
would encompass both cases. A better sentence would perhaps be:
"While vCPU is blocked (or about to block) it may be scheduled out which will
cause vmx_vcpu_pi_put() to be called."
But setting or not preempted/PID.SN doesn't change the rest and was mentioned
for completeness.
Joao
next prev parent reply other threads:[~2019-11-19 14:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-11 17:20 [PATCH v2 0/3] KVM: VMX: Posted Interrupts fixes Joao Martins
2019-11-11 17:20 ` [PATCH v2 1/3] KVM: VMX: Consider PID.PIR to determine if vCPU has pending interrupts Joao Martins
2019-11-11 17:20 ` [PATCH v2 2/3] KVM: VMX: Do not change PID.NDST when loading a blocked vCPU Joao Martins
2019-11-19 11:36 ` Wanpeng Li
2019-11-19 14:44 ` Joao Martins [this message]
2019-11-11 17:20 ` [PATCH v2 3/3] KVM: VMX: Introduce pi_is_pir_empty() helper Joao Martins
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=6b6acdee-f080-241f-8a6e-89708f746944@oracle.com \
--to=joao.m.martins@oracle.com \
--cc=jag.raman@oracle.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=liran.alon@oracle.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=sean.j.christopherson@intel.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;
as well as URLs for NNTP newsgroup(s).