From: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
To: kvm@vger.kernel.org
Cc: seanjc@google.com, pbonzini@redhat.com,
linux-kernel@vger.kernel.org, joao.m.martins@oracle.com,
boris.ostrovsky@oracle.com, mark.kanda@oracle.com,
suravee.suthikulpanit@amd.com, mlevitsk@redhat.com,
alejandro.j.jimenez@oracle.com
Subject: [RFC 3/3] x86: KVM: stats: Add a stat counter for GALog events
Date: Thu, 15 Feb 2024 16:01:36 +0000 [thread overview]
Message-ID: <20240215160136.1256084-4-alejandro.j.jimenez@oracle.com> (raw)
In-Reply-To: <20240215160136.1256084-1-alejandro.j.jimenez@oracle.com>
Export a per-vCPU binary stat counting GALog events received. Such events
are specific to IOMMU AVIC, and their presence can be used to confirm that
this capability is active. Also, exporting this statistic is useful to
assert that device interrupts are being sent to specific vCPUs, confirming
IRQ affinity settings.
Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
---
arch/x86/include/asm/kvm_host.h | 1 +
arch/x86/kvm/svm/avic.c | 4 +++-
arch/x86/kvm/x86.c | 1 +
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 b6f18084d504..74e08b57f2e0 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -1565,6 +1565,7 @@ struct kvm_vcpu_stat {
u64 guest_mode;
u64 notify_window_exits;
u64 apicv_accept_irq;
+ u64 ga_log_event;
};
struct x86_instruction_info;
diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index 4b74ea91f4e6..853cafe4a9af 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -165,8 +165,10 @@ int avic_ga_log_notifier(u32 ga_tag)
* bit in the vAPIC backing page. So, we just need to schedule
* in the vcpu.
*/
- if (vcpu)
+ if (vcpu) {
kvm_vcpu_wake_up(vcpu);
+ ++vcpu->stat.ga_log_event;
+ }
return 0;
}
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 2ad70cf6e52c..6a1df29ae650 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -305,6 +305,7 @@ const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = {
STATS_DESC_IBOOLEAN(VCPU, guest_mode),
STATS_DESC_COUNTER(VCPU, notify_window_exits),
STATS_DESC_COUNTER(VCPU, apicv_accept_irq),
+ STATS_DESC_COUNTER(VCPU, ga_log_event),
};
const struct kvm_stats_header kvm_vcpu_stats_header = {
--
2.39.3
next prev parent reply other threads:[~2024-02-15 16:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-15 16:01 [RFC 0/3] Export APICv-related state via binary stats interface Alejandro Jimenez
2024-02-15 16:01 ` [RFC 1/3] x86: KVM: stats: Add a stat to report status of APICv inhibition Alejandro Jimenez
2024-04-09 14:54 ` Suthikulpanit, Suravee
2024-04-16 18:19 ` Sean Christopherson
2024-04-16 19:53 ` Paolo Bonzini
2024-04-16 19:59 ` Alejandro Jimenez
2024-02-15 16:01 ` [RFC 2/3] x86: KVM: stats: Add stat counter for IRQs injected via APICv Alejandro Jimenez
2024-02-15 16:16 ` Dongli Zhang
2024-02-15 18:12 ` Alejandro Jimenez
2024-04-16 18:25 ` Sean Christopherson
2024-02-15 16:01 ` Alejandro Jimenez [this message]
2024-04-09 6:45 ` [RFC 3/3] x86: KVM: stats: Add a stat counter for GALog events Chao Gao
2024-04-10 1:31 ` Alejandro Jimenez
2024-04-12 10:45 ` Chao Gao
2024-04-16 18:35 ` Sean Christopherson
2024-04-24 0:50 ` Alejandro Jimenez
2024-04-09 5:09 ` [RFC 0/3] Export APICv-related state via binary stats interface Vasant Hegde
2024-04-10 1:36 ` Alejandro Jimenez
2024-04-16 18:08 ` Sean Christopherson
2024-04-16 19:51 ` Paolo Bonzini
2024-04-16 21:29 ` Alejandro Jimenez
2024-04-16 21:36 ` Paolo Bonzini
2024-04-16 22:34 ` Sean Christopherson
2024-04-17 9:48 ` Paolo Bonzini
2024-04-23 20:43 ` Alejandro Jimenez
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=20240215160136.1256084-4-alejandro.j.jimenez@oracle.com \
--to=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 \
/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®