This patch exports VPA related data such as stolen and donated CPU cycles through /proc/powerpc/lparcfg file.
Signed-off-by: Aravinda Prasad <aravi...@linux.vnet.ibm.com> --- arch/powerpc/include/asm/lppaca.h | 10 ++++++- arch/powerpc/platforms/pseries/lparcfg.c | 45 ++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/lppaca.h b/arch/powerpc/include/asm/lppaca.h index 7c23ce8..87e22f6 100644 --- a/arch/powerpc/include/asm/lppaca.h +++ b/arch/powerpc/include/asm/lppaca.h @@ -94,7 +94,15 @@ struct lppaca { volatile __be32 dispersion_count; /* dispatch changed physical cpu */ volatile __be64 cmo_faults; /* CMO page fault count */ volatile __be64 cmo_fault_time; /* CMO page fault time */ - u8 reserved10[104]; + volatile __be64 idle_stolen_purr; + volatile __be64 idle_stolen_spurr; + volatile __be64 busy_stolen_purr; + volatile __be64 busy_stolen_spurr; + volatile __be64 idle_donated_purr; + volatile __be64 idle_donated_spurr; + volatile __be64 busy_donated_purr; + volatile __be64 busy_donated_spurr; + u8 reserved10[40]; /* cacheline 4-5 */ diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c index 7c872dc..b986551 100644 --- a/arch/powerpc/platforms/pseries/lparcfg.c +++ b/arch/powerpc/platforms/pseries/lparcfg.c @@ -433,6 +433,50 @@ static void parse_em_data(struct seq_file *m) seq_printf(m, "power_mode_data=%016lx\n", retbuf[0]); } +static void pseries_vpa_data(struct seq_file *m) +{ + int cpu; + unsigned long idle_stolen_purr = 0; + unsigned long idle_stolen_spurr = 0; + unsigned long busy_stolen_purr = 0; + unsigned long busy_stolen_spurr = 0; + unsigned long idle_donated_purr = 0; + unsigned long idle_donated_spurr = 0; + unsigned long busy_donated_purr = 0; + unsigned long busy_donated_spurr = 0; + + if (!firmware_has_feature(FW_FEATURE_SPLPAR)) + return; + + for_each_possible_cpu(cpu) { + idle_stolen_purr += + be64_to_cpu(lppaca_of(cpu).idle_stolen_purr); + idle_stolen_spurr += + be64_to_cpu(lppaca_of(cpu).idle_stolen_spurr); + busy_stolen_purr += + be64_to_cpu(lppaca_of(cpu).busy_stolen_purr); + busy_stolen_spurr += + be64_to_cpu(lppaca_of(cpu).busy_stolen_spurr); + idle_donated_purr += + be64_to_cpu(lppaca_of(cpu).idle_donated_purr); + idle_donated_spurr += + be64_to_cpu(lppaca_of(cpu).idle_donated_spurr); + busy_donated_purr += + be64_to_cpu(lppaca_of(cpu).busy_donated_purr); + busy_donated_spurr += + be64_to_cpu(lppaca_of(cpu).busy_donated_spurr); + } + + seq_printf(m, "idle_stolen_purr=%lu\n", idle_stolen_purr); + seq_printf(m, "idle_stolen_spurr=%lu\n", idle_stolen_spurr); + seq_printf(m, "busy_stolen_purr=%lu\n", busy_stolen_purr); + seq_printf(m, "busy_stolen_spurr=%lu\n", busy_stolen_spurr); + seq_printf(m, "idle_donated_purr=%lu\n", idle_donated_purr); + seq_printf(m, "idle_donated_spurr=%lu\n", idle_donated_spurr); + seq_printf(m, "busy_donated_purr=%lu\n", busy_donated_purr); + seq_printf(m, "busy_donated_spurr=%lu\n", busy_donated_spurr); +} + static int pseries_lparcfg_data(struct seq_file *m, void *v) { int partition_potential_processors; @@ -491,6 +535,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v) seq_printf(m, "slb_size=%d\n", mmu_slb_size); #endif parse_em_data(m); + pseries_vpa_data(m); return 0; }