public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Chao Gao <chao.gao@intel.com>
To: <kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<jon@nutanix.com>, <kevin.tian@intel.com>, <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>, <x86@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH v3] KVM: x86/vmx: Suppress posted interrupt notification when CPU is in host
Date: Thu, 29 Sep 2022 13:59:07 +0800	[thread overview]
Message-ID: <YzU0KyTx2SPRadTm@gao-cwp> (raw)
In-Reply-To: <20220928111604.180284-1-chao.gao@intel.com>

On Wed, Sep 28, 2022 at 07:16:03PM +0800, Chao Gao wrote:
>@@ -10538,6 +10547,17 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
> 
> 	vcpu->mode = OUTSIDE_GUEST_MODE;
> 	smp_wmb();
>+	/*
>+	 * Suppress notification when CPU is OUTSIDE_GUEST_MODE to avoid
>+	 * wasting time on handling interrupts. A notification to host/kvm
>+	 * just indicates some interrupts are posted for a vCPU. Since KVM
>+	 * always syncs pending interrupts in PIR to vAPIC IRR before guest
>+	 * entry (in ->sync_pir_to_irr()), notification isn't needed.
>+	 *
>+	 * Do this even if apicv is disabled for simplicity.
>+	 */
>+	if (kvm_lapic_enabled(vcpu))
>+		static_call_cond(kvm_x86_pi_suppress_notification)(vcpu, true);

I missed the other kvm's setting vcpu->mode to OUTSIDE_GUEST_MODE in
this function (a few lines above). Will fix it in v4.

> 
> 	/*
> 	 * Sync xfd before calling handle_exit_irqoff() which may
>
>base-commit: 372d07084593dc7a399bf9bee815711b1fb1bcf2
>-- 
>2.25.1
>

      reply	other threads:[~2022-09-29  5:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 11:16 [PATCH v3] KVM: x86/vmx: Suppress posted interrupt notification when CPU is in host Chao Gao
2022-09-29  5:59 ` Chao Gao [this message]

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=YzU0KyTx2SPRadTm@gao-cwp \
    --to=chao.gao@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jon@nutanix.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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