N Naveen N. Rao #
Hi Michael, Naveen N. Rao wrote:
Add debugfs interface to retrieve associativity information for lpar vcpus (debugfs/vphn/lpar) and the hypervisor cpus (debugfs/vphn/hyp). This information is useful to derive various metrics, including the vcpu dispatch statistics in a SPLPAR environment.
Any thoughts on this approach vs. adding a tracepoint? Thanks, Naveen
quoted hunk
Signed-off-by: Naveen N. Rao <redacted> --- arch/powerpc/mm/numa.c | 105 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+)diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 6677a578f18d..f0b0e87016e6 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c@@ -40,6 +40,7 @@ #include <asm/setup.h> #include <asm/vdso.h> #include <asm/drmem.h> +#include <asm/debugfs.h> static int numa_enabled = 1;@@ -1089,6 +1090,107 @@ static long hcall_vphn(unsigned long cpu, u64 flags, __be32 *associativity) return rc; } +#ifdef CONFIG_DEBUG_FS +static ssize_t vphn_lpar_cpu_file_read(struct file *filp, char __user *buf, + size_t len, loff_t *pos) +{ + int cpu = (long)filp->private_data; + __be32 associativity[VPHN_ASSOC_BUFSIZE] = {0}; + int hwcpu = get_hard_smp_processor_id(cpu); + long int rc; + + if (len != sizeof(associativity)) + return -EINVAL; + + rc = hcall_vphn(hwcpu, 1, associativity); + if (rc) + return -EFAULT; + + rc = copy_to_user(buf, &associativity, sizeof(associativity)); + if (rc)