From: Vasant Hegde <vasant.hegde@amd.com>
To: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>, kvm@vger.kernel.org
Cc: seanjc@google.com, pbonzini@redhat.com,
linux-kernel@vger.kernel.org, suravee.suthikulpanit@amd.com,
vashegde@amd.com, mlevitsk@redhat.com, joao.m.martins@oracle.com,
boris.ostrovsky@oracle.com, mark.kanda@oracle.com
Subject: Re: [PATCH 3/4] KVM: x86: Add a VM stat exposing when KVM PIT is set to reinject mode
Date: Fri, 31 May 2024 14:53:27 +0530 [thread overview]
Message-ID: <ddd2f4a3-9d44-4f98-aee2-0a4b5553004f@amd.com> (raw)
In-Reply-To: <20240429155738.990025-4-alejandro.j.jimenez@oracle.com>
On 4/29/2024 9:27 PM, Alejandro Jimenez wrote:
> Add a stat to query when PIT is in reinject mode, which can have a large
> performance impact due to disabling SVM AVIC.
> When using in-kernel irqchip, QEMU and KVM default to creating a PIT in
> reinject mode, since this is necessary for old guest operating systems that
> use the PIT for timing. Unfortunately, reinject mode relies on EOI
> interception and so SVM AVIC must be inhibited when the PIT is set up using
> this mode.
>
> Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
-Vasant
> ---
> arch/x86/include/asm/kvm_host.h | 1 +
> arch/x86/kvm/i8254.c | 2 ++
> arch/x86/kvm/x86.c | 3 ++-
> 3 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index f3b40cfebec4..e7e3213cefae 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -1535,6 +1535,7 @@ struct kvm_vm_stat {
> u64 max_mmu_page_hash_collisions;
> u64 max_mmu_rmap_size;
> u64 synic_auto_eoi_used;
> + u64 pit_reinject_mode;
> };
>
> struct kvm_vcpu_stat {
> diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
> index cd57a517d04a..44e593e909a1 100644
> --- a/arch/x86/kvm/i8254.c
> +++ b/arch/x86/kvm/i8254.c
> @@ -316,6 +316,8 @@ void kvm_pit_set_reinject(struct kvm_pit *pit, bool reinject)
> kvm_unregister_irq_mask_notifier(kvm, 0, &pit->mask_notifier);
> }
>
> + kvm->stat.pit_reinject_mode = reinject;
> +
> atomic_set(&ps->reinject, reinject);
> }
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 27e339133068..03cb933920cb 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -257,7 +257,8 @@ const struct _kvm_stats_desc kvm_vm_stats_desc[] = {
> STATS_DESC_ICOUNTER(VM, nx_lpage_splits),
> STATS_DESC_PCOUNTER(VM, max_mmu_rmap_size),
> STATS_DESC_PCOUNTER(VM, max_mmu_page_hash_collisions),
> - STATS_DESC_IBOOLEAN(VM, synic_auto_eoi_used)
> + STATS_DESC_IBOOLEAN(VM, synic_auto_eoi_used),
> + STATS_DESC_IBOOLEAN(VM, pit_reinject_mode)
> };
>
> const struct kvm_stats_header kvm_vm_stats_header = {
next prev parent reply other threads:[~2024-05-31 9:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-29 15:57 [PATCH 0/4] Export APICv-related state via binary stats interface Alejandro Jimenez
2024-04-29 15:57 ` [PATCH 1/4] KVM: x86: Expose per-vCPU APICv status Alejandro Jimenez
2024-05-31 9:27 ` Vasant Hegde
2024-06-04 0:16 ` Sean Christopherson
2024-04-29 15:57 ` [PATCH 2/4] KVM: x86: Add a VM stat exposing when SynIC AutoEOI is in use Alejandro Jimenez
2024-04-29 15:57 ` [PATCH 3/4] KVM: x86: Add a VM stat exposing when KVM PIT is set to reinject mode Alejandro Jimenez
2024-05-31 9:23 ` Vasant Hegde [this message]
2024-04-29 15:57 ` [PATCH 4/4] KVM: x86: Add vCPU stat for APICv interrupt injections causing #VMEXIT Alejandro Jimenez
2024-05-31 9:22 ` Vasant Hegde
2024-06-04 0:14 ` Sean Christopherson
2024-06-06 21:09 ` Alejandro Jimenez
2024-06-07 15:11 ` Sean Christopherson
2024-05-23 18:49 ` [PATCH 0/4] Export APICv-related state via binary stats interface Alejandro Jimenez
2024-05-31 9:19 ` Vasant Hegde
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=ddd2f4a3-9d44-4f98-aee2-0a4b5553004f@amd.com \
--to=vasant.hegde@amd.com \
--cc=alejandro.j.jimenez@oracle.com \
--cc=boris.ostrovsky@oracle.com \
--cc=joao.m.martins@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.kanda@oracle.com \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=vashegde@amd.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®