mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] KVM: x86: Drop @vcpu parameter from kvm_x86_ops.hwapic_isr_update()
Date: Wed, 15 Jun 2022 15:15:56 +0200	[thread overview]
Message-ID: <c7f07be6-3674-4553-0ae9-548886ba9b6f@redhat.com> (raw)
In-Reply-To: <20220614230548.3852141-3-seanjc@google.com>

On 6/15/22 01:05, Sean Christopherson wrote:
> Drop the unused @vcpu parameter from hwapic_isr_update().  AMD/AVIC is
> unlikely to implement the helper, and VMX/APICv doesn't need the vCPU as
> it operates on the current VMCS.  The result is somewhat odd, but allows
> for a decent amount of (future) cleanup in the APIC code.
> 
> No functional change intended.

Yeah, that's a bit odd; what it saves is essentially the apic->vcpu 
dereference.  I don't really like it, so if you want to have a v2 that 
passes the struct kvm_lapic* instead (which is free and keeps irr/isr 
functions consistent), I'll gladly switch.  But I _have_ queued the 
series in the meanwhile, so that's a good reason to ignore me.

Paolo

> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
>   arch/x86/include/asm/kvm_host.h | 2 +-
>   arch/x86/kvm/lapic.c            | 8 ++++----
>   arch/x86/kvm/vmx/vmx.c          | 2 +-
>   3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 7e98b2876380..16acc54d49a7 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -1517,7 +1517,7 @@ struct kvm_x86_ops {
>   	bool (*check_apicv_inhibit_reasons)(enum kvm_apicv_inhibit reason);
>   	void (*refresh_apicv_exec_ctrl)(struct kvm_vcpu *vcpu);
>   	void (*hwapic_irr_update)(struct kvm_vcpu *vcpu, int max_irr);
> -	void (*hwapic_isr_update)(struct kvm_vcpu *vcpu, int isr);
> +	void (*hwapic_isr_update)(int isr);
>   	bool (*guest_apic_has_interrupt)(struct kvm_vcpu *vcpu);
>   	void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap);
>   	void (*set_virtual_apic_mode)(struct kvm_vcpu *vcpu);
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index a413a1d8df4c..cc0da5671eb9 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -556,7 +556,7 @@ static inline void apic_set_isr(int vec, struct kvm_lapic *apic)
>   	 * just set SVI.
>   	 */
>   	if (unlikely(vcpu->arch.apicv_active))
> -		static_call_cond(kvm_x86_hwapic_isr_update)(vcpu, vec);
> +		static_call_cond(kvm_x86_hwapic_isr_update)(vec);
>   	else {
>   		++apic->isr_count;
>   		BUG_ON(apic->isr_count > MAX_APIC_VECTOR);
> @@ -604,7 +604,7 @@ static inline void apic_clear_isr(int vec, struct kvm_lapic *apic)
>   	 * and must be left alone.
>   	 */
>   	if (unlikely(vcpu->arch.apicv_active))
> -		static_call_cond(kvm_x86_hwapic_isr_update)(vcpu, apic_find_highest_isr(apic));
> +		static_call_cond(kvm_x86_hwapic_isr_update)(apic_find_highest_isr(apic));
>   	else {
>   		--apic->isr_count;
>   		BUG_ON(apic->isr_count < 0);
> @@ -2457,7 +2457,7 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu, bool init_event)
>   	if (vcpu->arch.apicv_active) {
>   		static_call_cond(kvm_x86_apicv_post_state_restore)(vcpu);
>   		static_call_cond(kvm_x86_hwapic_irr_update)(vcpu, -1);
> -		static_call_cond(kvm_x86_hwapic_isr_update)(vcpu, -1);
> +		static_call_cond(kvm_x86_hwapic_isr_update)(-1);
>   	}
>   
>   	vcpu->arch.apic_arb_prio = 0;
> @@ -2737,7 +2737,7 @@ int kvm_apic_set_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s)
>   	if (vcpu->arch.apicv_active) {
>   		static_call_cond(kvm_x86_apicv_post_state_restore)(vcpu);
>   		static_call_cond(kvm_x86_hwapic_irr_update)(vcpu, apic_find_highest_irr(apic));
> -		static_call_cond(kvm_x86_hwapic_isr_update)(vcpu, apic_find_highest_isr(apic));
> +		static_call_cond(kvm_x86_hwapic_isr_update)(apic_find_highest_isr(apic));
>   	}
>   	kvm_make_request(KVM_REQ_EVENT, vcpu);
>   	if (ioapic_in_kernel(vcpu->kvm))
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 5e14e4c40007..42f8924a90f4 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -6556,7 +6556,7 @@ static void vmx_set_apic_access_page_addr(struct kvm_vcpu *vcpu)
>   	put_page(page);
>   }
>   
> -static void vmx_hwapic_isr_update(struct kvm_vcpu *vcpu, int max_isr)
> +static void vmx_hwapic_isr_update(int max_isr)
>   {
>   	u16 status;
>   	u8 old;


  reply	other threads:[~2022-06-15 13:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 23:05 [PATCH 0/5] KVM: x86: Move apicv_active into kvm_lapic Sean Christopherson
2022-06-14 23:05 ` [PATCH 1/5] KVM: SVM: Drop unused AVIC / kvm_x86_ops declarations Sean Christopherson
2022-06-14 23:05 ` [PATCH 2/5] KVM: x86: Drop @vcpu parameter from kvm_x86_ops.hwapic_isr_update() Sean Christopherson
2022-06-15 13:15   ` Paolo Bonzini [this message]
2022-06-15 13:55     ` Sean Christopherson
2022-06-14 23:05 ` [PATCH 3/5] KVM: x86: Check for in-kernel xAPIC when querying APICv for directed yield Sean Christopherson
2022-06-14 23:05 ` [PATCH 4/5] KVM: x86: Move "apicv_active" into "struct kvm_lapic" Sean Christopherson
2022-06-14 23:05 ` [PATCH 5/5] KVM: x86: Use lapic_in_kernel() to query in-kernel APIC in APICv helper Sean Christopherson

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=c7f07be6-3674-4553-0ae9-548886ba9b6f@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seanjc@google.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

all inboxes | Powered by JetHome®