|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 10/10] x86/SVM: Append AMD AVIC related data to IRQ keyhandler 'i'
From: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
Append AVIC related data when IRQ information is dumped with key 'i'.
Here is an example of per-domain statistics being dumped.
*********** SVM AVIC Statistics **************
>>> Domain 1 <<<
VCPU 0
* incomp_ipi = 3110
* noaccel = 236475
* post_intr = 116176
* doorbell = 715
VCPU 1
* incomp_ipi = 2565
* noaccel = 233061
* post_intr = 115765
* doorbell = 771
**************************************
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
Signed-off-by: Janakarajan Natarajan <Janakarajan.Natarajan@xxxxxxx>
---
xen/arch/x86/hvm/svm/avic.c | 54 +++++++++++++++++++++++++++++++++++++-
xen/arch/x86/irq.c | 2 ++
xen/include/asm-x86/hvm/svm/avic.h | 3 +++
xen/include/asm-x86/hvm/svm/vmcb.h | 6 +++++
4 files changed, 64 insertions(+), 1 deletion(-)
diff --git a/xen/arch/x86/hvm/svm/avic.c b/xen/arch/x86/hvm/svm/avic.c
index 19caaeda53..fd86c578db 100644
--- a/xen/arch/x86/hvm/svm/avic.c
+++ b/xen/arch/x86/hvm/svm/avic.c
@@ -48,6 +48,11 @@ bool svm_avic = false;
static const char __section(".bss.page_aligned.const") __aligned(PAGE_SIZE)
avic_backing_page[PAGE_SIZE];
+static inline const bool svm_is_avic_domain(struct domain *d)
+{
+ return d->arch.hvm_domain.svm.avic_physical_id_table != 0;
+}
+
static struct avic_physical_id_entry*
avic_get_physical_id_entry(struct svm_domain *d, unsigned int index)
{
@@ -252,6 +257,8 @@ void svm_avic_vmexit_do_incomp_ipi(struct cpu_user_regs
*regs)
u32 id = vmcb->exitinfo2 >> 32;
u32 index = vmcb->exitinfo2 && 0xFF;
+ curr->arch.hvm_svm.cnt_avic_incomp_ipi++;
+
switch ( id )
{
case AVIC_INCMP_IPI_ERR_INVALID_INT_TYPE:
@@ -494,6 +501,8 @@ void svm_avic_vmexit_do_noaccel(struct cpu_user_regs *regs)
u32 offset = vmcb->exitinfo1 & 0xFF0;
u32 rw = (vmcb->exitinfo1 >> 32) & 0x1;
+ curr->arch.hvm_svm.cnt_avic_noaccel++;
+
if ( avic_is_trap(offset) )
{
/* Handling AVIC Trap (intercept right after the access). */
@@ -541,14 +550,57 @@ void svm_avic_deliver_posted_intr(struct vcpu *v, u8 vec)
if ( vlapic_test_and_set_vector(vec, &vlapic->regs->data[APIC_IRR]) )
return;
+ v->arch.hvm_svm.cnt_avic_post_intr++;
/*
* If vcpu is running on another cpu, hit the doorbell to signal
* it to process interrupt. Otherwise, kick it.
*/
if ( v->is_running && (v != current) )
+ {
wrmsrl(MSR_AMD_AVIC_DOORBELL, cpu_data[v->processor].apicid);
- else
+ v->arch.hvm_svm.cnt_avic_doorbell++;
+ }
+ else {
vcpu_kick(v);
+ }
+}
+
+void dump_avic_info()
+{
+ struct domain *d;
+ struct vcpu *v;
+
+ if ( !svm_avic )
+ return;
+
+ printk("*********** SVM AVIC Statistics **************\n");
+
+ rcu_read_lock(&domlist_read_lock);
+
+ for_each_domain ( d )
+ {
+ if ( !svm_is_avic_domain(d) )
+ continue;
+
+ printk(">>> Domain %d <<<\n", d->domain_id);
+ for_each_vcpu ( d, v )
+ {
+ printk("\tVCPU %d\n", v->vcpu_id);
+ printk("\t* incomp_ipi = %u\n",
+ v->arch.hvm_svm.cnt_avic_incomp_ipi);
+ printk("\t* noaccel = %u\n",
+ v->arch.hvm_svm.cnt_avic_noaccel);
+ printk("\t* post_intr = %u\n",
+ v->arch.hvm_svm.cnt_avic_post_intr);
+ printk("\t* doorbell = %u\n",
+ v->arch.hvm_svm.cnt_avic_doorbell);
+ }
+ }
+
+ rcu_read_unlock(&domlist_read_lock);
+
+ printk("**************************************\n");
+
}
/*
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 87ef2e801f..62fe9c3177 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -23,6 +23,7 @@
#include <asm/msi.h>
#include <asm/current.h>
#include <asm/flushtlb.h>
+#include <asm/hvm/svm/avic.h>
#include <asm/mach-generic/mach_apic.h>
#include <public/physdev.h>
@@ -2351,6 +2352,7 @@ static void dump_irqs(unsigned char key)
printk(" %#02x -> %ps()\n", i, direct_apic_vector[i]);
dump_ioapic_irq_info();
+ dump_avic_info();
}
static int __init setup_dump_irqs(void)
diff --git a/xen/include/asm-x86/hvm/svm/avic.h
b/xen/include/asm-x86/hvm/svm/avic.h
index 8e8c4c9422..92326a77a3 100644
--- a/xen/include/asm-x86/hvm/svm/avic.h
+++ b/xen/include/asm-x86/hvm/svm/avic.h
@@ -40,4 +40,7 @@ void svm_avic_vmexit_do_incomp_ipi(struct cpu_user_regs
*regs);
void svm_avic_vmexit_do_noaccel(struct cpu_user_regs *regs);
void svm_avic_deliver_posted_intr(struct vcpu *v, u8 vector);
+
+void dump_avic_info(void);
+
#endif /* _SVM_AVIC_H_ */
diff --git a/xen/include/asm-x86/hvm/svm/vmcb.h
b/xen/include/asm-x86/hvm/svm/vmcb.h
index f27bdbd83d..e902d51b25 100644
--- a/xen/include/asm-x86/hvm/svm/vmcb.h
+++ b/xen/include/asm-x86/hvm/svm/vmcb.h
@@ -557,6 +557,12 @@ struct arch_svm_struct {
struct avic_physical_id_entry *avic_last_phy_id;
u32 avic_last_ldr;
+
+ /* AVIC Statistics */
+ u32 cnt_avic_incomp_ipi;
+ u32 cnt_avic_noaccel;
+ u32 cnt_avic_post_intr;
+ u32 cnt_avic_doorbell;
};
struct vmcb_struct *alloc_vmcb(void);
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |