From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>
Cc: "Christian Borntraeger" <borntraeger@de.ibm.com>,
LKML <linux-kernel@vger.kernel.org>, kvm <kvm@vger.kernel.org>,
"Radim Krčmář" <rkrcmar@redhat.com>
Subject: Re: [PATCH RESEND] KVM: Boosting vCPUs that are delivering interrupts
Date: Thu, 18 Jul 2019 11:07:03 +0200 [thread overview]
Message-ID: <bc210153-fbae-25d4-bf6b-e31ceef36aa5@redhat.com> (raw)
In-Reply-To: <CANRm+Cw43DKqD17U+7-OPX3BmeNBThSe9-uWP2Atob+A0ApzLA@mail.gmail.com>
On 18/07/19 10:43, Wanpeng Li wrote:
>>> Isnt that done by the sched_in handler?
>>
>> I am a bit confused because, if it is done by the sched_in later, I
>> don't understand why the sched_out handler hasn't set vcpu->preempted
>> already.
>>
>> The s390 commit message is not very clear, but it talks about "a former
>> sleeping cpu" that "gave up the cpu voluntarily". Does "voluntarily"
>> that mean it is in kvm_vcpu_block? But then at least for x86 it would
>
> 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.
Ok, I was totally blind to that "if" around vcpu->preempted = true, it's
obvious now.
I think we need two flags then, for example vcpu->preempted and vcpu->ready:
- kvm_sched_out sets both of them to true iff current->state == TASK_RUNNING
- kvm_vcpu_kick sets vcpu->ready to true
- kvm_sched_in clears both of them
This way, vmx_vcpu_pi_load can keep looking at preempted only (it
handles voluntary preemption in pi_pre_block/pi_post_block).
Also, kvm_s390_vcpu_wakeup can be changed to use kvm_vcpu_wake_up, which
is nice.
Paolo
next prev parent reply other threads:[~2019-07-18 9:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-12 7:15 [PATCH RESEND] KVM: Boosting vCPUs that are delivering interrupts Wanpeng Li
2019-07-12 7:25 ` Wanpeng Li
2019-07-18 6:09 ` Wanpeng Li
2019-07-18 7:59 ` Paolo Bonzini
2019-07-18 8:15 ` Christian Borntraeger
2019-07-18 8:34 ` Paolo Bonzini
2019-07-18 8:43 ` Wanpeng Li
2019-07-18 9:07 ` Paolo Bonzini [this message]
2019-07-18 9:29 ` Wanpeng Li
2019-07-18 9:39 ` Paolo Bonzini
2019-07-18 11:40 ` 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=bc210153-fbae-25d4-bf6b-e31ceef36aa5@redhat.com \
--to=pbonzini@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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