All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Juergen Gross <jgross@suse.com>, Anup Patel <anup.patel@wdc.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	kvm@vger.kernel.org,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Marc Zyngier <maz@kernel.org>,
	Huacai Chen <chenhuacai@kernel.org>,
	David Hildenbrand <david@redhat.com>,
	linux-mips@vger.kernel.org, Nicholas Piggin <npiggin@gmail.com>,
	Atish Patra <atish.patra@wdc.com>,
	Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	kernel-team@android.com,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH 4/5] KVM: x86: Use kvm_get_vcpu() instead of open-coded access
Date: Tue, 16 Nov 2021 16:07:47 +0000	[thread overview]
Message-ID: <YZPXU3eBT8j0fUPs@google.com> (raw)
In-Reply-To: <330eb780-1963-ac1f-aaad-908346112f28@redhat.com>

On Tue, Nov 16, 2021, Paolo Bonzini wrote:
> On 11/5/21 21:03, Sean Christopherson wrote:
> > But I think even that is flawed, as APICv can be dynamically deactivated and
> > re-activated while the VM is running, and I don't see a path that re-updates
> > the IRTE when APICv is re-activated.  So I think a more conservative check is
> > needed, e.g.
> > 
> > diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c
> > index 5f81ef092bd4..6cf5b2e86118 100644
> > --- a/arch/x86/kvm/vmx/posted_intr.c
> > +++ b/arch/x86/kvm/vmx/posted_intr.c
> > @@ -272,7 +272,7 @@ int pi_update_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_irq,
> > 
> >          if (!kvm_arch_has_assigned_device(kvm) ||
> >              !irq_remapping_cap(IRQ_POSTING_CAP) ||
> > -           !kvm_vcpu_apicv_active(kvm->vcpus[0]))
> > +           !irqchip_in_kernel(kvm) || !enable_apicv)
> >                  return 0;
> > 
> >          idx = srcu_read_lock(&kvm->irq_srcu);
> 
> What happens then if pi_pre_block is called and the IRTE denotes a posted
> interrupt?
> 
> I might be wrong, but it seems to me that you have to change all of the
> occurrences this way.  As soon as enable_apicv is set, you need to go
> through the POSTED_INTR_WAKEUP_VECTOR just in case.

Sorry, I didn't grok that at all.  All occurences of what?
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

WARNING: multiple messages have this Message-ID (diff)
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Marc Zyngier <maz@kernel.org>,
	kvm@vger.kernel.org, linux-mips@vger.kernel.org,
	kvmarm@lists.cs.columbia.edu, linuxppc-dev@lists.ozlabs.org,
	Huacai Chen <chenhuacai@kernel.org>,
	Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>,
	Anup Patel <anup.patel@wdc.com>,
	Atish Patra <atish.patra@wdc.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	David Hildenbrand <david@redhat.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Juergen Gross <jgross@suse.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	James Morse <james.morse@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	kernel-team@android.com
Subject: Re: [PATCH 4/5] KVM: x86: Use kvm_get_vcpu() instead of open-coded access
Date: Tue, 16 Nov 2021 16:07:47 +0000	[thread overview]
Message-ID: <YZPXU3eBT8j0fUPs@google.com> (raw)
In-Reply-To: <330eb780-1963-ac1f-aaad-908346112f28@redhat.com>

On Tue, Nov 16, 2021, Paolo Bonzini wrote:
> On 11/5/21 21:03, Sean Christopherson wrote:
> > But I think even that is flawed, as APICv can be dynamically deactivated and
> > re-activated while the VM is running, and I don't see a path that re-updates
> > the IRTE when APICv is re-activated.  So I think a more conservative check is
> > needed, e.g.
> > 
> > diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c
> > index 5f81ef092bd4..6cf5b2e86118 100644
> > --- a/arch/x86/kvm/vmx/posted_intr.c
> > +++ b/arch/x86/kvm/vmx/posted_intr.c
> > @@ -272,7 +272,7 @@ int pi_update_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_irq,
> > 
> >          if (!kvm_arch_has_assigned_device(kvm) ||
> >              !irq_remapping_cap(IRQ_POSTING_CAP) ||
> > -           !kvm_vcpu_apicv_active(kvm->vcpus[0]))
> > +           !irqchip_in_kernel(kvm) || !enable_apicv)
> >                  return 0;
> > 
> >          idx = srcu_read_lock(&kvm->irq_srcu);
> 
> What happens then if pi_pre_block is called and the IRTE denotes a posted
> interrupt?
> 
> I might be wrong, but it seems to me that you have to change all of the
> occurrences this way.  As soon as enable_apicv is set, you need to go
> through the POSTED_INTR_WAKEUP_VECTOR just in case.

Sorry, I didn't grok that at all.  All occurences of what?

WARNING: multiple messages have this Message-ID (diff)
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Juergen Gross <jgross@suse.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	Anup Patel <anup.patel@wdc.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	kvm@vger.kernel.org,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Marc Zyngier <maz@kernel.org>,
	Huacai Chen <chenhuacai@kernel.org>,
	David Hildenbrand <david@redhat.com>,
	linux-mips@vger.kernel.org, Nicholas Piggin <npiggin@gmail.com>,
	Atish Patra <atish.patra@wdc.com>,
	Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>,
	Paul Mackerras <paulus@samba.org>,
	James Morse <james.morse@arm.com>,
	kernel-team@android.com,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, kvmarm@lists.cs.columbia.edu,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Subject: Re: [PATCH 4/5] KVM: x86: Use kvm_get_vcpu() instead of open-coded access
Date: Tue, 16 Nov 2021 16:07:47 +0000	[thread overview]
Message-ID: <YZPXU3eBT8j0fUPs@google.com> (raw)
In-Reply-To: <330eb780-1963-ac1f-aaad-908346112f28@redhat.com>

On Tue, Nov 16, 2021, Paolo Bonzini wrote:
> On 11/5/21 21:03, Sean Christopherson wrote:
> > But I think even that is flawed, as APICv can be dynamically deactivated and
> > re-activated while the VM is running, and I don't see a path that re-updates
> > the IRTE when APICv is re-activated.  So I think a more conservative check is
> > needed, e.g.
> > 
> > diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c
> > index 5f81ef092bd4..6cf5b2e86118 100644
> > --- a/arch/x86/kvm/vmx/posted_intr.c
> > +++ b/arch/x86/kvm/vmx/posted_intr.c
> > @@ -272,7 +272,7 @@ int pi_update_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_irq,
> > 
> >          if (!kvm_arch_has_assigned_device(kvm) ||
> >              !irq_remapping_cap(IRQ_POSTING_CAP) ||
> > -           !kvm_vcpu_apicv_active(kvm->vcpus[0]))
> > +           !irqchip_in_kernel(kvm) || !enable_apicv)
> >                  return 0;
> > 
> >          idx = srcu_read_lock(&kvm->irq_srcu);
> 
> What happens then if pi_pre_block is called and the IRTE denotes a posted
> interrupt?
> 
> I might be wrong, but it seems to me that you have to change all of the
> occurrences this way.  As soon as enable_apicv is set, you need to go
> through the POSTED_INTR_WAKEUP_VECTOR just in case.

Sorry, I didn't grok that at all.  All occurences of what?

  reply	other threads:[~2021-11-16 16:08 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 19:20 [PATCH 0/5] KVM: Turn the vcpu array into an xarray Marc Zyngier
2021-11-05 19:20 ` Marc Zyngier
2021-11-05 19:20 ` Marc Zyngier
2021-11-05 19:20 ` [PATCH 1/5] KVM: Move wiping of the kvm->vcpus array to common code Marc Zyngier
2021-11-05 19:20   ` Marc Zyngier
2021-11-05 19:20   ` Marc Zyngier
2021-11-05 20:12   ` Sean Christopherson
2021-11-05 20:12     ` Sean Christopherson
2021-11-05 20:12     ` Sean Christopherson
2021-11-06 11:17     ` Marc Zyngier
2021-11-06 11:17       ` Marc Zyngier
2021-11-06 11:17       ` Marc Zyngier
2021-11-16 13:49       ` Paolo Bonzini
2021-11-16 13:49         ` Paolo Bonzini
2021-11-16 13:49         ` Paolo Bonzini
2021-11-08 12:12   ` Claudio Imbrenda
2021-11-08 12:12     ` Claudio Imbrenda
2021-11-08 12:12     ` Claudio Imbrenda
2021-11-05 19:20 ` [PATCH 2/5] KVM: mips: Use kvm_get_vcpu() instead of open-coded access Marc Zyngier
2021-11-05 19:20   ` Marc Zyngier
2021-11-05 19:20   ` Marc Zyngier
2021-11-06 15:56   ` Philippe Mathieu-Daudé
2021-11-06 15:56     ` Philippe Mathieu-Daudé
2021-11-06 15:56     ` Philippe Mathieu-Daudé
2021-11-05 19:20 ` [PATCH 3/5] KVM: s390: " Marc Zyngier
2021-11-05 19:20   ` Marc Zyngier
2021-11-05 19:20   ` Marc Zyngier
2021-11-08 12:13   ` Claudio Imbrenda
2021-11-08 12:13     ` Claudio Imbrenda
2021-11-08 12:13     ` Claudio Imbrenda
2021-11-05 19:21 ` [PATCH 4/5] KVM: x86: " Marc Zyngier
2021-11-05 19:21   ` Marc Zyngier
2021-11-05 19:21   ` Marc Zyngier
2021-11-05 20:03   ` Sean Christopherson
2021-11-05 20:03     ` Sean Christopherson
2021-11-05 20:03     ` Sean Christopherson
2021-11-16 14:04     ` Paolo Bonzini
2021-11-16 14:04       ` Paolo Bonzini
2021-11-16 14:04       ` Paolo Bonzini
2021-11-16 16:07       ` Sean Christopherson [this message]
2021-11-16 16:07         ` Sean Christopherson
2021-11-16 16:07         ` Sean Christopherson
2021-11-16 16:48         ` Paolo Bonzini
2021-11-16 16:48           ` Paolo Bonzini
2021-11-16 16:48           ` Paolo Bonzini
2021-11-05 19:21 ` [PATCH 5/5] KVM: Convert the kvm->vcpus array to a xarray Marc Zyngier
2021-11-05 19:21   ` Marc Zyngier
2021-11-05 19:21   ` Marc Zyngier
2021-11-05 20:21   ` Sean Christopherson
2021-11-05 20:21     ` Sean Christopherson
2021-11-05 20:21     ` Sean Christopherson
2021-11-06 11:48     ` Marc Zyngier
2021-11-06 11:48       ` Marc Zyngier
2021-11-06 11:48       ` Marc Zyngier
2021-11-08  8:23       ` Marc Zyngier
2021-11-08  8:23         ` Marc Zyngier
2021-11-08  8:23         ` Marc Zyngier
2021-11-16 14:13 ` [PATCH 0/5] KVM: Turn the vcpu array into an xarray Juergen Gross
2021-11-16 14:13   ` Juergen Gross
2021-11-16 14:13   ` Juergen Gross
2021-11-16 14:21   ` Paolo Bonzini
2021-11-16 14:21     ` Paolo Bonzini
2021-11-16 14:21     ` Paolo Bonzini
2021-11-16 14:54     ` Juergen Gross
2021-11-16 14:54       ` Juergen Gross
2021-11-16 14:54       ` Juergen Gross
2021-11-16 15:03 ` Paolo Bonzini
2021-11-16 15:03   ` Paolo Bonzini
2021-11-16 15:03   ` Paolo Bonzini
2021-11-16 15:40   ` Marc Zyngier
2021-11-16 15:40     ` Marc Zyngier
2021-11-16 15:40     ` Marc Zyngier

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=YZPXU3eBT8j0fUPs@google.com \
    --to=seanjc@google.com \
    --cc=aleksandar.qemu.devel@gmail.com \
    --cc=anup.patel@wdc.com \
    --cc=atish.patra@wdc.com \
    --cc=borntraeger@de.ibm.com \
    --cc=chenhuacai@kernel.org \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=jgross@suse.com \
    --cc=kernel-team@android.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-mips@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maz@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=paulus@samba.org \
    --cc=pbonzini@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.