linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: "Mika Penttilä" <mika.penttila@nextfour.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>, kvm <kvm@vger.kernel.org>
Cc: Anup Patel <anup.patel@wdc.com>,
	"wanpengli @ tencent . com" <wanpengli@tencent.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Joao Martins <joao.m.martins@oracle.com>,
	Will Deacon <will@kernel.org>,
	kvmarm@lists.cs.columbia.edu, linux-s390@vger.kernel.org,
	"joro @ 8bytes . org" <joro@8bytes.org>,
	Huacai Chen <chenhuacai@kernel.org>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>,
	karahmed@amazon.com, Suzuki K Poulose <suzuki.poulose@arm.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	"jmattson @ google . com" <jmattson@google.com>,
	"seanjc @ google . com" <seanjc@google.com>,
	"mtosatti @ redhat . com" <mtosatti@redhat.com>,
	linux-mips@vger.kernel.org, James Morse <james.morse@arm.com>,
	kvm-riscv@lists.infradead.org, Marc Zyngier <maz@kernel.org>,
	"vkuznets @ redhat . com" <vkuznets@redhat.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v4 11/11] KVM: x86: First attempt at converting nested virtual APIC page to gpc
Date: Sat, 20 Nov 2021 17:02:03 +0000	[thread overview]
Message-ID: <df87f7e828f403013f30c2c8d77ea2694b49292e.camel@infradead.org> (raw)
In-Reply-To: <b806de35-167a-4c7c-f143-cff3ec279491@nextfour.com>

[-- Attachment #1: Type: text/plain, Size: 1738 bytes --]

On Sat, 2021-11-20 at 18:30 +0200, Mika Penttilä wrote:
> 
> On 20.11.2021 18.21, David Woodhouse wrote:
> > On Sat, 2021-11-20 at 17:48 +0200, Mika Penttilä wrote:
> > > > @@ -9785,6 +9787,14 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
> > > >         local_irq_disable();
> > > >         vcpu->mode = IN_GUEST_MODE;
> > > >     
> > > > +     /*
> > > > +      * If the guest requires direct access to mapped L1 pages, check
> > > > +      * the caches are valid. Will raise KVM_REQ_GET_NESTED_STATE_PAGES
> > > > +      * to go and revalidate them, if necessary.
> > > > +      */
> > > > +     if (is_guest_mode(vcpu) && kvm_x86_ops.nested_ops->check_guest_maps)
> > > > +             kvm_x86_ops.nested_ops->check_guest_maps(vcpu);
> > >
> > > But KVM_REQ_GET_NESTED_STATE_PAGES is not check until next
> > > vcpu_enter_guest() entry ?
> >
> > Sure, but that's why this call to ->check_guest_maps() comes just a few
> > lines *before* the 'if (kvm_cpu_exit_request(vcpu))' that will bounce
> > us back out so that we go through vcpu_enter_guest() from the start
> > again?
>
> Yes, I had forgotten that...=

Having said that, I think Paolo was rightly trying to persuade me that
we don't need the check there at all anyway. Because the *invalidation*
will raise KVM_REQ_GPC_INVALIDATE, and that's sufficient to bounce us
out of IN_GUEST_MODE without us having to check the GPC explicitly.

We do need to ensure that we are up to date with memslots changes, but
that's a bit simpler, and we have kvm_arch_memslots_changed() waking us
for that too.

So yeah, with sufficient thought I think we can be entirely event-
driven instead of having to have an explicit *check* on entry.




[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5174 bytes --]

  reply	other threads:[~2021-11-20 17:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-20 10:27 PATCH v4 00/11] KVM: x86/xen: Add in-kernel Xen event channel delivery David Woodhouse
2021-11-20 10:28 ` [PATCH v4 01/11] KVM: Introduce CONFIG_HAVE_KVM_DIRTY_RING David Woodhouse
2021-11-20 10:28 ` [PATCH v4 02/11] KVM: Add Makefile.kvm for common files, use it for x86 David Woodhouse
2021-11-20 10:28 ` [PATCH v4 03/11] KVM: s390: Use Makefile.kvm for common files David Woodhouse
2021-11-20 10:28 ` [PATCH v4 04/11] KVM: mips: " David Woodhouse
2021-11-20 10:28 ` [PATCH v4 05/11] KVM: RISC-V: " David Woodhouse
2021-11-20 10:28 ` [PATCH v4 06/11] KVM: powerpc: " David Woodhouse
2021-11-20 10:28 ` [PATCH v4 07/11] KVM: arm64: " David Woodhouse
2021-11-20 10:28 ` [PATCH v4 08/11] KVM: Reinstate gfn_to_pfn_cache with invalidation support David Woodhouse
2021-11-20 10:28 ` [PATCH v4 09/11] KVM: x86/xen: Maintain valid mapping of Xen shared_info page David Woodhouse
2021-11-20 10:28 ` [PATCH v4 10/11] KVM: x86/xen: Add KVM_IRQ_ROUTING_XEN_EVTCHN and event channel delivery David Woodhouse
2021-11-20 10:28 ` [PATCH v4 11/11] KVM: x86: First attempt at converting nested virtual APIC page to gpc David Woodhouse
2021-11-20 15:48   ` Mika Penttilä
2021-11-20 16:21     ` David Woodhouse
2021-11-20 16:30       ` Mika Penttilä
2021-11-20 17:02         ` David Woodhouse [this message]
2021-11-20 18:20 ` [PATCH v4 12/11] KVM: x86: Fix wall clock writes in Xen shared_info not to mark page dirty David Woodhouse

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=df87f7e828f403013f30c2c8d77ea2694b49292e.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=aleksandar.qemu.devel@gmail.com \
    --cc=alexandru.elisei@arm.com \
    --cc=anup.patel@wdc.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=borntraeger@de.ibm.com \
    --cc=catalin.marinas@arm.com \
    --cc=chenhuacai@kernel.org \
    --cc=james.morse@arm.com \
    --cc=jmattson@google.com \
    --cc=joao.m.martins@oracle.com \
    --cc=joro@8bytes.org \
    --cc=karahmed@amazon.com \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maz@kernel.org \
    --cc=mika.penttila@nextfour.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=suzuki.poulose@arm.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=will@kernel.org \
    /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).