All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoffer Dall <cdall@linaro.org>
To: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: marc.zyngier@arm.com, pbonzini@redhat.com,
	kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org
Subject: Re: [PATCH v2 2/9] KVM: Add documentation for VCPU requests
Date: Wed, 5 Apr 2017 19:45:38 +0200	[thread overview]
Message-ID: <20170405174538.GB27123@cbox> (raw)
In-Reply-To: <20170405141139.GA13944@potion>

On Wed, Apr 05, 2017 at 04:11:40PM +0200, Radim Krčmář wrote:
> 2017-04-04 19:23+0200, Christoffer Dall:
> > On Tue, Apr 04, 2017 at 07:06:00PM +0200, Andrew Jones wrote:
> >> On Tue, Apr 04, 2017 at 05:24:03PM +0200, Christoffer Dall wrote:
> >> > On Fri, Mar 31, 2017 at 06:06:51PM +0200, Andrew Jones wrote:
> >> > > +and will definitely see the request, or is outside guest mode, but has yet
> >> > > +to do its final request check, and therefore when it does, it will see the
> >> > > +request, then things will work.  However, the transition from outside to
> >> > > +inside guest mode, after the last request check has been made, opens a
> >> > > +window where a request could be made, but the VCPU would not see until it
> >> > > +exits guest mode some time later.  See the table below.
> >> > 
> >> > This text, and the table below, only deals with the details of entering
> >> > the guest.  Should we talk about kvm_vcpu_exiting_guest_mode() and
> >> > anything related to exiting the guest?
> >> 
> >> I think all !IN_GUEST_MODE should behave the same, so I was avoiding
> >> the use of EXITING_GUEST_MODE and OUTSIDE_GUEST_MODE, which wouldn't be
> >> hard to address, but then I'd also have to address
> >> READING_SHADOW_PAGE_TABLES, which may complicate the document more than
> >> necessary.  I'm not sure we need to address a VCPU exiting guest mode,
> >> other than making sure it's clear that a VCPU that exits must check
> >> requests before it enters again.
> > 
> > But the problem is that kvm_make_all_cpus_request() only sends IPIs to
> > CPUs where the mode was different from OUTSIDE_GUEST_MODE, so there it's
> > about !OUTSIDE_GUEST_MODE rather than !IN_GUEST_MODE, so there's some
> > subtlety here which I feel like it's dangerous to paper over.
> 
> Right, that needs fixing in the code.

Really?  I thought Paolo said that this is the intended behavior and
semantics; non-urgent requests that should just be serviced before the
next guest entry.

Now I'm confused again.  What did I miss?

> 
> guest_mode is just an optimization that allows us to skip sending the
> IPI when the VCPU is known to handle the request as soon as possible.
> 
>   IN_GUEST_MODE: we must force VM exit or the request could never be
>     handled
>   EXITING_GUEST_MODE: another request already forces the VM exit and
>     we're just waiting for the VCPU to notice our request
>   OUTSIDE_GUEST_MODE: KVM is going to notice our request without any
>     intervention
>   READING_SHADOW_PAGE_TABLES: same as OUTSIDE_GUEST_MODE -- rename to
>     unwieldly OUTSIDE_GUEST_MODE_READING_SHADOW_PAGE_TABLES?

Again, I thought Paolo was arguing that EXITING_GUEST_MODE makes the
whole thing work because you check that after checking requests?

> 
> The kick is needed only in IN_GUEST_MODE and a wake up is needed in case
> where the guest is halted OUTSIDE_GUEST_MODE ...

> Hm, maybe we should add a halt state too?

Wouldn't that be swait_active(&vcpu->wq) ?   You could add a wrapper
though.

What I think you need is a way to distinguish the semantics of calling
kvm_make_all_cpus_request(), perhaps by adding a 'bool wake_up'
parameter.

I also feel like it would be more reliable or easier to understand if
kvm_make_all_cpus_request() called kvm_vcpu_kick() somehow, but there
may be such an established and understood use of the differences between
the two by other architectures that it's worse to introduce the churn of
changing it.  I don't know.

Thanks,
-Christoffer
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

  reply	other threads:[~2017-04-05 17:45 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 16:06 [PATCH v2 0/9] KVM: arm/arm64: race fixes and vcpu requests Andrew Jones
2017-03-31 16:06 ` [PATCH v2 1/9] KVM: add kvm_request_pending Andrew Jones
2017-04-04 15:30   ` Christoffer Dall
2017-04-04 16:41     ` Andrew Jones
2017-04-05 13:10       ` Radim Krčmář
2017-04-05 17:39         ` Christoffer Dall
2017-04-05 18:30           ` Paolo Bonzini
2017-04-05 20:20           ` Radim Krčmář
2017-04-06 12:02             ` Andrew Jones
2017-04-06 14:37               ` Christoffer Dall
2017-04-06 15:08                 ` Andrew Jones
2017-04-07 15:33                   ` Paolo Bonzini
2017-04-08 18:19                     ` Christoffer Dall
2017-04-06 14:25             ` Christoffer Dall
2017-04-07 13:15               ` Radim Krčmář
2017-04-08 18:23                 ` Christoffer Dall
2017-04-08 19:32                   ` Paolo Bonzini
2017-04-11 21:06                     ` Radim Krčmář
2017-03-31 16:06 ` [PATCH v2 2/9] KVM: Add documentation for VCPU requests Andrew Jones
2017-04-04 15:24   ` Christoffer Dall
2017-04-04 17:06     ` Andrew Jones
2017-04-04 17:23       ` Christoffer Dall
2017-04-04 17:36         ` Paolo Bonzini
2017-04-05 14:11         ` Radim Krčmář
2017-04-05 17:45           ` Christoffer Dall [this message]
2017-04-05 18:29             ` Paolo Bonzini
2017-04-05 20:46               ` Radim Krčmář
2017-04-06 14:29                 ` Christoffer Dall
2017-04-07 11:44                   ` Paolo Bonzini
2017-04-06 14:27               ` Christoffer Dall
2017-04-06 10:18   ` Christian Borntraeger
2017-04-06 12:08     ` Andrew Jones
2017-04-06 12:29     ` Radim Krčmář
2017-03-31 16:06 ` [PATCH v2 3/9] KVM: arm/arm64: prepare to use vcpu requests Andrew Jones
2017-04-04 15:34   ` Christoffer Dall
2017-04-04 17:06     ` Andrew Jones
2017-03-31 16:06 ` [PATCH v2 4/9] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu request Andrew Jones
2017-04-04 13:39   ` Marc Zyngier
2017-04-04 14:47     ` Andrew Jones
2017-04-04 14:51       ` Paolo Bonzini
2017-04-04 15:05         ` Marc Zyngier
2017-04-04 17:07         ` Andrew Jones
2017-04-04 16:04   ` Christoffer Dall
2017-04-04 16:24     ` Paolo Bonzini
2017-04-04 17:19       ` Christoffer Dall
2017-04-04 17:35         ` Paolo Bonzini
2017-04-04 17:57           ` Christoffer Dall
2017-04-04 18:15             ` Paolo Bonzini
2017-04-04 18:38               ` Christoffer Dall
2017-04-04 18:18           ` Andrew Jones
2017-04-04 18:59             ` Paolo Bonzini
2017-04-04 17:57     ` Andrew Jones
2017-04-04 19:04       ` Christoffer Dall
2017-04-04 20:10         ` Paolo Bonzini
2017-04-05  7:09           ` Christoffer Dall
2017-04-05 11:37             ` Paolo Bonzini
2017-04-06 14:14               ` Christoffer Dall
2017-04-07 11:47                 ` Paolo Bonzini
2017-04-08  8:35                   ` Christoffer Dall
2017-03-31 16:06 ` [PATCH v2 5/9] KVM: arm/arm64: replace vcpu->arch.power_off " Andrew Jones
2017-04-04 17:37   ` Christoffer Dall
2017-03-31 16:06 ` [PATCH v2 6/9] KVM: arm/arm64: use a vcpu request on irq injection Andrew Jones
2017-04-04 17:42   ` Christoffer Dall
2017-04-04 18:27     ` Andrew Jones
2017-04-04 18:59     ` Paolo Bonzini
2017-04-04 18:51   ` Paolo Bonzini
2017-03-31 16:06 ` [PATCH v2 7/9] KVM: arm/arm64: PMU: remove request-less vcpu kick Andrew Jones
2017-04-04 17:46   ` Christoffer Dall
2017-04-04 18:29     ` Andrew Jones
2017-04-04 19:35       ` Christoffer Dall
2017-03-31 16:06 ` [PATCH v2 8/9] KVM: arm/arm64: fix race in kvm_psci_vcpu_on Andrew Jones
2017-04-04 19:42   ` Christoffer Dall
2017-04-05  8:35     ` Andrew Jones
2017-04-05  8:50       ` Christoffer Dall
2017-04-05  9:12         ` Andrew Jones
2017-04-05  9:30           ` Christoffer Dall
2017-03-31 16:06 ` [PATCH v2 9/9] KVM: arm/arm64: avoid race by caching MPIDR Andrew Jones
2017-04-04 19:44   ` Christoffer Dall
2017-04-05  8:50     ` Andrew Jones
2017-04-05 11:03       ` Christoffer Dall
2017-04-05 11:14         ` Andrew Jones
2017-04-03 15:28 ` [PATCH v2 0/9] KVM: arm/arm64: race fixes and vcpu requests Christoffer Dall
2017-04-03 17:11   ` Paolo Bonzini
2017-04-04  7:27   ` Andrew Jones
2017-04-04 16:05     ` Christoffer Dall

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=20170405174538.GB27123@cbox \
    --to=cdall@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=marc.zyngier@arm.com \
    --cc=pbonzini@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.