The new drawer support did have a type in the summary output:
it reported Drawers(s) instead of Drawer(s). Fix this.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
The s390 architecture gained another cpu topology level called
"drawer" which is above the book level.
Add support for this to lscpu.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Fix various typos in error messages, warnings, debug strings,
comments and names of static functions.
Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
Nowadays, most Intel CPUs have "cpuid faulting" available which could trap
the execution of "cpuid" instruction when CPL>0 with GP fault. Thus,
"cpuid" instruction could trap to Xen hypervisor on the paravirtualized PV
guest on most servers today, except on old CPUs prior to 2011. On CPU after
2011, Xen will put "XenVMMXenVMM" on both HVM and PV guests, which could
have lscpu command erroneously classify the guest as type "full". The
current lscpu command, which is based on "cpuid" instruction, still assumes
that it will not cause the trap to Xen hypervisor on Xen PV guest and uses
/proc/xen to identify whether it's running on PV DomU or not. To identify
this kind of information under the help of
/sys/hypervisor/properties/features would be more accurate for the CPU
nowadays. The bit 5 (XENFEAT_mmu_pt_update_preserve_ad) of the features
will be set only when it's running on Xen PV domain. The combo of bit 3 and
8 (XENFEAT_supervisor_mode_kernel and XENFEAT_hvm_callback_vector) will be
set simultaneously only when it's running on Xen PVH domain.
[kzak@redhat.com: - add path_exist()]
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Now the first one of certain ambiguous tags wins. Alternatively to
this patch we could have called free() before xstrdup().
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Avoid ifdef which does not work with --sysroot. Our existing test
dumps produce even better output now for ppc and sparc.
The logic moved to the printing section.
CC: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This patch reverts 3ac03fe4d2 for
snapshots (--sysroot).
Yeah, poor-man solution. It would be really nice to have runtime
detection to support model overwriting also on snapshots.
Signed-off-by: Karel Zak <kzak@redhat.com>
On Power System, lspcu presently displays system model number instead of
processor model name. 'model' tag in cpuinfo contains system model name,
not processor model. Instead it uses 'cpu' tag for processor model name.
Also it uses 'revision' tag for processor model.
Fix lspcu so that it displays processor model number. Also display processor
model name.
cpuinfo output on Power System:
...
...
processor : 127
cpu : POWER8E (raw), altivec supported
clock : 4322.000000MHz
revision : 2.1 (pvr 004b 0201)
timebase : 512000000
platform : PowerNV
model : 8286-42A
machine : PowerNV 8286-42A
firmware : OPAL
Output without this patch:
Architecture: ppc64le
Byte Order: Little Endian
CPU(s): 128
On-line CPU(s) list: 0-127
Thread(s) per core: 8
Core(s) per socket: 4
Socket(s): 4
NUMA node(s): 4
Model: 8286-42A
...
...
Output with this patch:
Architecture: ppc64le
Byte Order: Little Endian
CPU(s): 128
On-line CPU(s) list: 0-127
Thread(s) per core: 8
Core(s) per socket: 4
Socket(s): 4
NUMA node(s): 4
Model: 2.1 (pvr 004b 0201)
Model name: POWER8E (raw), altivec supported
...
...
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
lscpu currently prints information for CPUs configured in the system.
In case of KVM or other virtualized guest operating systems, this
refers to the virtual system, and bears no relation to the physical
topology of the system.
It would be useful if lscpu could also display the physical topology
info when available:
$ ./lscpu
Architecture: ppc64le
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 16
NUMA node(s): 1
Model: IBM pSeries (emulated by qemu)
Hypervisor vendor: KVM
Virtualization type: para
L1d cache: 64K
L1i cache: 32K
NUMA node0 CPU(s): 0-15
Physical sockets: 2 <<< New
Physical chips: 4 <<< New
Physical cores/chip: 4 <<< New
For now, physical topology information is available on platforms that
support the following RTAS (Real time abstraction service) call provided
by librtas:
rtas_get_sysparm(PROCESSOR_MODULE_INFO).
Currently this call is available to the PowerVM (pHYP) guests on PowerPC.
With a patch propoosed to PowerKVM, this RTAS call would also be available
to PowerKVM guests.
Based on input from Nishanth Aravamudan and Karel Zak.
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
We care about /proc/device-tree/compatible content...
The patch also removes unnecessary path_exist(), it seems good enough
to call open() rather than access() + open().
Addresses: https://github.com/karelzak/util-linux/issues/218
Signed-off-by: Karel Zak <kzak@redhat.com>
Intel compiler complains about printf style function calls with trivial
format string and no other arguments. Like this one:
../sys-utils/ipcrm.c(117): warning #2279: printf/scanf format not a string literal and no format arguments
err(EXIT_FAILURE, iskey ? _("key failed") : _("id failed"));
This adds a concise description of a tool to its usage text.
A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
AddressSanitizer is identifying the __asm__ segment as suspicious.
==1215==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000
(pc 0x0000004ccffd bp 0x7fff9b7184f0 sp 0x7fff9b7184e0 T0)
#0 0x4ccffc in vmware_bdoor /home/src/util-linux/sys-utils/lscpu.c:660
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
there is a theoretical buffer overflow possible in the hypervisor
parsing code of lscpu. It would require a proc entry to return way more
than expected so it's no high priority. But better be safe than sorry.
At first I thought about switching to fgets but there is another
code file that adds a format specifier. The diff is less intrusive
that way, too.
Signed-off-by: Karel Zak <kzak@redhat.com>
CppCheck founds a few wrong arguments in format strings and a NULL
pointer dereference.
Amended version with fixed strcmp() usage.
Signed-off-by: Boris Egorov <egorov@linux.com>
This code is not PIC clean which means it fails to build on hardened
32bit x86 systems (i.e. building as PIE).
While here, optimize the existing cpuid logic slightly.
URL: https://bugs.gentoo.org/518936
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This patch comes from openSUSE / SLE. Original author was probably
Petr Uzel.
Internal SUSE references: fate310255, sr226509
VMmware backdoor assembler code has been fixed for old clang compiler
(travis), see
see http://llvm.org/bugs/show_bug.cgi?id=9379
CC: Stanislav Brabec <sbrabec@suse.cz>
CC: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This patch comes originally from openSUSE / SLE. Author was probably
Petr Uzel.
Internal SUSE references: fate310255, sr226509
In comparison to the original patch we have slightly corrected iSeries
and pSeries detection according to Alexander Graf's comments on
util-linux@vger.kernel.org. Maybe we would need to add some more code
to detect pSeries emulated by Qemu/KVM.
CC: Stanislav Brabec <sbrabec@suse.cz>
CC: Petr Uzel <petr.uzel@suse.cz>
CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
- add HYPER_VBOX
- improve HYPER_VMWARE
This patch comes from openSUSE / SLE. Original author was probably
Petr Uzel.
Internal SUSE references: fate310255, sr226509
CC: Stanislav Brabec <sbrabec@suse.cz>
CC: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* rename flags functions to scols_table_enable_*
* rename *_no_foo() functions to _nofoo()
* output formats are mutually exclusive, so don't use flags there
* don't assume symbols in scols_new_table(), use scols_table_set_symbols()
Signed-off-by: Karel Zak <kzak@redhat.com>
There are systems where the size file does not exist. Most badly even
lscpu -p would abort allthough it does not use the size:
$ lscpu -p
lscpu: error: cannot open
/sys/devices/system/cpu/cpu0/cache/index0/size: No such file or directory
This patch does not abort in this case and prints "unknown size" in
human-readable case. For examle on this qemu pcc test machine:
$ lscpu
Architecture: ppc
CPU op-mode(s): 32-bit
Byte Order: Big Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
Model: Power Macintosh
BogoMIPS: 33.25
L1d cache: unknown size
L1i cache: unknown size
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Not all file systems support the d_type field and simply checking for
d_type == DT_DIR in is_node_dirent would cause the test suite to fail
if run on (for example) XFS.
The simple fix is to check for DT_DIR or DT_UNKNOWN in is_node_dirent.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
lscpu fails to print proper NUMA node values in a system with
discontinuous nodes. This patch adds support by creating a nodeidx
array to map node numbers.
Based on patch from Madhavan Srinivasan <maddy@linux.vnet.ibm.com>.
Reported-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
lscpu don't work correctly on my system with:
$ cat /sys/devices/system/cpu/possible
0-1,4-5,8-9,12-13
[kzak@redhat.com: - coding style,
- add commit message
- add real_cpu_num() macro,
- fix functions where we need idx as well as CPU number]
Signed-off-by: Karel Zak <kzak@redhat.com>
The lscpu tool only shows the current and max CPU frequencies, however,
in many scenarios this is not enough. If there are energy saving situations
(like some CPUs being idle, or not fully used) the cpugov can lower this value.
Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>