LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
To: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org
Cc: nfont@linux.vnet.ibm.com, naveen.n.rao@linux.vnet.ibm.com,
	aravinda@linux.vnet.ibm.com
Subject: [PATCH] powerpc/pseries: Export VPA related data
Date: Tue, 04 Sep 2018 15:00:55 +0530	[thread overview]
Message-ID: <153605345531.16879.5116444181129068578.stgit@aravinda> (raw)

This patch exports VPA related data such as stolen and
donated CPU cycles through /proc/powerpc/lparcfg file.

Signed-off-by: Aravinda Prasad <aravinda@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;
 }

                 reply	other threads:[~2018-09-04  9:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=153605345531.16879.5116444181129068578.stgit@aravinda \
    --to=aravinda@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=nfont@linux.vnet.ibm.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