Permalink
Browse files

arm-common: account for SMC exits

Statistics on ARM currently has some imbalances: the total number of
exits doesn't equal the sum of the fine granular exit counters: we
aren't accounting for SMCCC exits.

Fix this by adding a new statistic counter for SMCCC.

PSCI exits are already accounted inside psci_dispatch(), move SMCCC
accounting to the dispatcher routine handle_smc().

Fixes: 7688e96 ("arm-common: Rework handling of SMC")
Signed-off-by: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
  • Loading branch information...
rralf authored and jan-kiszka committed Oct 18, 2018
1 parent a977f90 commit 0ef181543fcc3ff47f5f6f502ff88d351304feca
@@ -148,6 +148,7 @@ JAILHOUSE_CPU_STATS_ATTR(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);
JAILHOUSE_CPU_STATS_ATTR(vmexits_psci, JAILHOUSE_CPU_STAT_VMEXITS_PSCI);
JAILHOUSE_CPU_STATS_ATTR(vmexits_smccc, JAILHOUSE_CPU_STAT_VMEXITS_SMCCC);
#ifdef CONFIG_ARM
JAILHOUSE_CPU_STATS_ATTR(vmexits_cp15, JAILHOUSE_CPU_STAT_VMEXITS_CP15);
#endif
@@ -172,6 +173,7 @@ static struct attribute *cell_stats_attrs[] = {
&vmexits_virt_irq_cell_attr.kattr.attr,
&vmexits_virt_sgi_cell_attr.kattr.attr,
&vmexits_psci_cell_attr.kattr.attr,
&vmexits_smccc_cell_attr.kattr.attr,
#ifdef CONFIG_ARM
&vmexits_cp15_cell_attr.kattr.attr,
#endif
@@ -203,6 +205,7 @@ static struct attribute *cpu_stats_attrs[] = {
&vmexits_virt_irq_cpu_attr.kattr.attr,
&vmexits_virt_sgi_cpu_attr.kattr.attr,
&vmexits_psci_cpu_attr.kattr.attr,
&vmexits_smccc_cpu_attr.kattr.attr,
#ifdef CONFIG_ARM
&vmexits_cp15_cpu_attr.kattr.attr,
#endif
@@ -33,13 +33,16 @@ static long handle_arch(struct trap_context *ctx)
int handle_smc(struct trap_context *ctx)
{
unsigned long *regs = ctx->regs;
u32 *stats = this_cpu_public()->stats;
switch (SMCCC_GET_OWNER(regs[0])) {
case ARM_SMCCC_OWNER_ARCH:
stats[JAILHOUSE_CPU_STAT_VMEXITS_SMCCC]++;
regs[0] = handle_arch(ctx);
break;
case ARM_SMCCC_OWNER_SIP:
stats[JAILHOUSE_CPU_STAT_VMEXITS_SMCCC]++;
regs[0] = ARM_SMCCC_NOT_SUPPORTED;
break;
@@ -51,8 +51,9 @@
#define JAILHOUSE_CPU_STAT_VMEXITS_VIRQ JAILHOUSE_GENERIC_CPU_STATS + 1
#define JAILHOUSE_CPU_STAT_VMEXITS_VSGI JAILHOUSE_GENERIC_CPU_STATS + 2
#define JAILHOUSE_CPU_STAT_VMEXITS_PSCI JAILHOUSE_GENERIC_CPU_STATS + 3
#define JAILHOUSE_CPU_STAT_VMEXITS_CP15 JAILHOUSE_GENERIC_CPU_STATS + 4
#define JAILHOUSE_NUM_CPU_STATS JAILHOUSE_GENERIC_CPU_STATS + 5
#define JAILHOUSE_CPU_STAT_VMEXITS_SMCCC JAILHOUSE_GENERIC_CPU_STATS + 4
#define JAILHOUSE_CPU_STAT_VMEXITS_CP15 JAILHOUSE_GENERIC_CPU_STATS + 5
#define JAILHOUSE_NUM_CPU_STATS JAILHOUSE_GENERIC_CPU_STATS + 6
#ifndef __ASSEMBLY__
@@ -50,7 +50,8 @@
#define JAILHOUSE_CPU_STAT_VMEXITS_VIRQ JAILHOUSE_GENERIC_CPU_STATS + 1
#define JAILHOUSE_CPU_STAT_VMEXITS_VSGI JAILHOUSE_GENERIC_CPU_STATS + 2
#define JAILHOUSE_CPU_STAT_VMEXITS_PSCI JAILHOUSE_GENERIC_CPU_STATS + 3
#define JAILHOUSE_NUM_CPU_STATS JAILHOUSE_GENERIC_CPU_STATS + 4
#define JAILHOUSE_CPU_STAT_VMEXITS_SMCCC JAILHOUSE_GENERIC_CPU_STATS + 4
#define JAILHOUSE_NUM_CPU_STATS JAILHOUSE_GENERIC_CPU_STATS + 5
#ifndef __ASSEMBLY__

0 comments on commit 0ef1815

Please sign in to comment.