Skip to content

Commit 4336877

Browse files
ldu4tyreld
authored andcommitted
Introducing lparnumascore
This command is computing the LPAR NUMA score for CPU and memory. After a LPM, resources like CPU and memory could be reassigned to a different NUMA node. But the Linux kernel is not able to replicate these changes and since the kernel commit bb7c3d36e3b1 ("powerpc/pseries: remove prrn special case from DT update path"), PRRN event are only updating the device tree, but not the resource's assignement the kernel is managing. This new command detects CPU and memory resources the kernel keep binded to the NUMA node topology of the departure node. It computes a ratio, and print it to the standard output. The ratio is between 0 (worst) and 100 (best). For instance when half of the CPUs have been reassigned to a new NUMA node, the score would be 50. If all the CPUs are on the right node, the score would be 100. The command can compute the CPU and memory score or only one if specified through the -c option. Example of output: $ ./lparnumascore -h Usage: lparnumascore [-d detail_level] [-c {mem | cpu}] $ ./lparnumascore CPU score: 80 MEM score: 45 $ ./lparnumascore -c mem MEM score: 45 $ ./lparnumascore -c cpu CPU score: 80 The command is not locking /var/lock/dr_config_lock so user should ensure that there is not ongoing command impacting the computed scores. This allows the command to be run without special privileges. Signed-off-by: Laurent Dufour <[email protected]> Signed-off-by: Tyrel Datwyler <[email protected]>
1 parent fb5feb0 commit 4336877

File tree

7 files changed

+370
-4
lines changed

7 files changed

+370
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ GTAGS
8888
/src/activate_firmware
8989
/src/drmgr/drmgr
9090
/src/drmgr/lsslot
91+
/src/drmgr/lparnumascore
9192
/src/lparstat
9293
/src/lsprop
9394
/src/nvram

Makefile.am

+15-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ man_MANS = \
4747
man/errinjct.8 \
4848
man/vcpustat.8 \
4949
man/rtas_dbg.8 \
50-
man/drmgr.8
50+
man/drmgr.8 \
51+
man/lparnumascore.8
5152

5253
EXTRA_DIST += $(bin_SCRIPTS) $(sbin_SCRIPTS) $(man_MANS)
5354

@@ -147,7 +148,7 @@ src_rtas_dbg_SOURCES = src/rtas_dbg.c $(pseries_platform_SOURCES)
147148

148149
src_rtas_dbg_LDADD = -lrtas
149150

150-
sbin_PROGRAMS += src/drmgr/drmgr src/drmgr/lsslot
151+
sbin_PROGRAMS += src/drmgr/drmgr src/drmgr/lsslot src/drmgr/lparnumascore
151152
endif
152153

153154
src_drmgr_drmgr_SOURCES = \
@@ -198,6 +199,18 @@ noinst_HEADERS += \
198199

199200
src_drmgr_lsslot_LDADD = -lrtas
200201

202+
src_drmgr_lparnumascore_SOURCES = \
203+
src/drmgr/lparnumascore.c \
204+
src/drmgr/common.c \
205+
src/drmgr/common_ofdt.c \
206+
src/drmgr/common_numa.c \
207+
src/drmgr/common_cpu.c \
208+
src/drmgr/rtas_calls.c \
209+
src/drmgr/drslot_chrp_mem.c \
210+
$(pseries_platform_SOURCES)
211+
212+
src_drmgr_lparnumascore_LDADD = -lnuma
213+
201214
install-exec-hook:
202215
cd $(DESTDIR)${sbindir} && \
203216
ln -sf hcnmgr hcncfgdrc && \

README

+6
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ lsslot:
5151
Tool used to determine dyanmic reconfiguration capable slots/cpus/memory
5252
on a partition.
5353

54+
lparnumascore:
55+
------
56+
Tool used to compute the NUMA affinity score reflecting the difference
57+
between NUMA topology exposed by the hypervisor and the one the linux
58+
kernel has taken in account.
59+
5460
ppc64_cpu:
5561
---------
5662
This allows users to set the smt state and other settings on ppc64 processors.

addon/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ PPU_ADDONS_NAME = powerpc-utils-sles10-addons
44
VERSION = 1.0.2
55

66
SCRIPTS = ../scripts/lsdevinfo ../scripts/ls-vdev ../scripts/ls-veth ../scripts/ls-vscsi
7-
UTILS = ../src/drmgr/drmgr ../src/drmgr/lsslot
7+
UTILS = ../src/drmgr/drmgr ../src/drmgr/lsslot ../src/drmgr/lparnumascore
88
DOCS = ../COPYRIGHT README
99

1010
INSTALL = /usr/bin/install

man/lparnumascore.8

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.\"
2+
.\" Copyright (C) 2021 International Business Machines
3+
.\" Laurent Dufour <[email protected]>
4+
.\"
5+
.TH LPARNUMASCORE 8 2021-04-14 Linux "Linux on Power Service Tools"
6+
.SH NAME
7+
lparnumascore \- display the NUMA affinity score for the running LPAR
8+
.SH SYNOPSIS
9+
.BI "lparnumascore [-c | -d ]"
10+
.SH DESCRIPTION
11+
The
12+
.B lparnumascore
13+
command can be used to display the NUMA affinity score for the running
14+
LPAR. Each score reflect the amount of resources the Linux kernel is seeing as
15+
bound to a node while the hypervisor has moved that resource to another node.
16+
17+
The score is a number between 0 and 100. A score of 100 means that all the
18+
resources are seen correctly, while a score of 0 means that all the resources
19+
have been moved to different nodes. There is a dedicated score for
20+
each resource type.
21+
.SH OPTIONS
22+
.TP
23+
.B \-c <resource type>
24+
Display the score for this type of resources. The valid resource types are
25+
"mem" for memory, and "cpu" for cpu's. By default, the score for each of
26+
supported resources is reported.
27+
.TP
28+
.B \-d <detail level>
29+
Enable debugging output. When displaying memory information this flag will
30+
also enable printing information about LMBs not currently owned by the system.
31+
.SH AUTHOR
32+
Laurent Dufour <[email protected]>

powerpc-utils.spec.in

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Group: System Environment
1111
Source: powerpc-utils-%{version}.tar.gz
1212
BuildRoot: /tmp/%{name}-buildroot/
1313
Vendor: IBM Corp.
14-
Requires: /bin/bash, /bin/sh, /bin/sed, /usr/bin/perl, librtas >= 1.4.0, zlib
14+
Requires: /bin/bash, /bin/sh, /bin/sed, /usr/bin/perl, librtas >= 1.4.0, zlib, numactl-libs
1515
Requires: coreutils
1616
Requires: findutils
1717
Requires: gawk
@@ -54,6 +54,7 @@ Utilities for maintaining and servicing PowerPC systems.
5454
/usr/sbin/sys_ident
5555
/usr/sbin/drmgr
5656
/usr/sbin/lsslot
57+
/usr/sbin/lparnumascore
5758
/usr/sbin/lsprop
5859
/usr/sbin/nvram
5960
/usr/sbin/nvsetenv
@@ -110,6 +111,7 @@ Utilities for maintaining and servicing PowerPC systems.
110111
/usr/share/man/man8/rtas_dbg.8.gz
111112
/usr/share/man/man8/vcpustat.8.gz
112113
/usr/share/man/man8/drmgr.8.gz
114+
/usr/share/man/man8/lparnumascore.8.gz
113115

114116
%post
115117
# Post-install script -----------------------------------------------
@@ -151,6 +153,8 @@ systemctl daemon-reload
151153
%endif
152154

153155
%changelog
156+
* Wed Apr 14 2021 Laurent Dufour <[email protected]>
157+
- Added lparnumascore
154158
* Fri Mar 06 2020 Naveen N. Rao <[email protected]>
155159
- Added vcpustat utility
156160
* Wed Dec 7 2011 Brian King <[email protected]>

0 commit comments

Comments
 (0)