]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
arm: exit statistics
authorJean-Philippe Brucker <jean-philippe.brucker@arm.com>
Fri, 4 Jul 2014 11:15:04 +0000 (12:15 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 19 Dec 2014 10:04:08 +0000 (11:04 +0100)
This patch implements the counters that report the number VM exits,
accessible by the driver. It also adds three statistics for the ARM
side: the number of IRQs injected, the number of IPIs injected, and the
number of GIC maintenance IRQs received.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
driver.c
hypervisor/arch/arm/control.c
hypervisor/arch/arm/gic-common.c
hypervisor/arch/arm/include/asm/jailhouse_hypercall.h
hypervisor/arch/arm/mmio.c

index ec2d619d9787ff314aaf8b236f9a3d903608dc34..9948959eec4fc98b5039fc93f182bb84c531c45f 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -238,6 +238,10 @@ JAILHOUSE_CPU_STATS_ATTR(vmexits_cr, JAILHOUSE_CPU_STAT_VMEXITS_CR);
 JAILHOUSE_CPU_STATS_ATTR(vmexits_msr, JAILHOUSE_CPU_STAT_VMEXITS_MSR);
 JAILHOUSE_CPU_STATS_ATTR(vmexits_cpuid, JAILHOUSE_CPU_STAT_VMEXITS_CPUID);
 JAILHOUSE_CPU_STATS_ATTR(vmexits_xsetbv, JAILHOUSE_CPU_STAT_VMEXITS_XSETBV);
+#elif defined(CONFIG_ARM)
+JAILHOUSE_CPU_STATS_ATTR(vmexits_maintenance, JAILHOUSE_CPU_STAT_VMEXITS_MAINTENANCE);
+JAILHOUSE_CPU_STATS_ATTR(vmexits_virt_irq, JAILHOUSE_CPU_STAT_VMEXITS_VIRQ);
+JAILHOUSE_CPU_STATS_ATTR(vmexits_virt_sgi, JAILHOUSE_CPU_STAT_VMEXITS_VSGI);
 #endif
 
 static struct attribute *no_attrs[] = {
@@ -252,6 +256,10 @@ static struct attribute *no_attrs[] = {
        &vmexits_msr_attr.kattr.attr,
        &vmexits_cpuid_attr.kattr.attr,
        &vmexits_xsetbv_attr.kattr.attr,
+#elif defined(CONFIG_ARM)
+       &vmexits_maintenance_attr.kattr.attr,
+       &vmexits_virt_irq_attr.kattr.attr,
+       &vmexits_virt_sgi_attr.kattr.attr,
 #endif
        NULL
 };
index 6562862d15e52cda04cfe5a9087ac89bc097329a..5a685f468410e78df8b1382ca82ecbda1d6ec9d9 100644 (file)
@@ -177,6 +177,8 @@ static void arch_dump_abt(bool is_data)
 struct registers* arch_handle_exit(struct per_cpu *cpu_data,
                                   struct registers *regs)
 {
+       cpu_data->stats[JAILHOUSE_CPU_STAT_VMEXITS_TOTAL]++;
+
        switch (regs->exit_reason) {
        case EXIT_REASON_IRQ:
                irqchip_handle_irq(cpu_data);
@@ -268,6 +270,8 @@ void arch_suspend_cpu(unsigned int cpu_id)
 
 void arch_handle_sgi(struct per_cpu *cpu_data, u32 irqn)
 {
+       cpu_data->stats[JAILHOUSE_CPU_STAT_VMEXITS_MANAGEMENT]++;
+
        switch (irqn) {
        case SGI_INJECT:
                irqchip_inject_pending(cpu_data);
@@ -299,10 +303,14 @@ unsigned int arm_cpu_virt2phys(struct cell *cell, unsigned int virt_id)
 bool arch_handle_phys_irq(struct per_cpu *cpu_data, u32 irqn)
 {
        if (irqn == MAINTENANCE_IRQ) {
+               cpu_data->stats[JAILHOUSE_CPU_STAT_VMEXITS_MAINTENANCE]++;
+
                irqchip_inject_pending(cpu_data);
                return true;
        }
 
+       cpu_data->stats[JAILHOUSE_CPU_STAT_VMEXITS_VIRQ]++;
+
        irqchip_set_pending(cpu_data, irqn, true);
 
        return false;
index 447dabb8c58fd57189fe7de29b64f55722d55ecf..6fc1d27a7df3300529f5c8121b6b907f7f8fd0fc 100644 (file)
@@ -270,6 +270,8 @@ int gic_handle_sgir_write(struct per_cpu *cpu_data, struct sgi *sgi,
        struct cell *cell = cpu_data->cell;
        bool is_target = false;
 
+       cpu_data->stats[JAILHOUSE_CPU_STAT_VMEXITS_VSGI]++;
+
        targets = sgi->targets;
        sgi->targets = 0;
 
index 196713893e98bff7cd6b0142376bd2b02099a43b..918791e91ad4f6bf6938ea92f9c6c3ad1863c18b 100644 (file)
 #define JAILHOUSE_CALL_ARG2            "r2"
 
 /* CPU statistics */
-#define JAILHOUSE_NUM_CPU_STATS                        JAILHOUSE_GENERIC_CPU_STATS
+#define JAILHOUSE_CPU_STAT_VMEXITS_MAINTENANCE JAILHOUSE_GENERIC_CPU_STATS
+#define JAILHOUSE_CPU_STAT_VMEXITS_VIRQ                JAILHOUSE_GENERIC_CPU_STATS + 1
+#define JAILHOUSE_CPU_STAT_VMEXITS_VSGI                JAILHOUSE_GENERIC_CPU_STATS + 2
+#define JAILHOUSE_NUM_CPU_STATS                        JAILHOUSE_GENERIC_CPU_STATS + 3
 
 #ifndef __asmeq
 #define __asmeq(x, y)  ".ifnc " x "," y " ; .err ; .endif\n\t"
index a0f3b134ff2995c10fd6b73c869cf1026ba071e6..5d7fdf51a726e063bb053c3055491456fffe4d00 100644 (file)
@@ -115,6 +115,8 @@ int arch_handle_dabt(struct per_cpu *cpu_data, struct trap_context *ctx)
        access.addr = hpfar << 8;
        access.addr |= hdfar & 0xfff;
 
+       cpu_data->stats[JAILHOUSE_CPU_STAT_VMEXITS_MMIO]++;
+
        /*
         * Invalid instruction syndrome means multiple access or writeback, there
         * is nothing we can do.