Karel Zak [Fri, 20 Nov 2020 11:01:22 +0000 (12:01 +0100)]
Merge branch 'w45'
* w45:
fdformat: remove command from default build
more: improve error messaging when input file is directory
ul: make set_column() zero check more obvious
colrm: fix argument parsing
rfkill: stop execution when rfkill device cannot be opened
cifuzz: reindent yaml file
man: make tilde and caret characters to render correctly
Masayoshi Mizuma [Fri, 20 Nov 2020 05:06:08 +0000 (00:06 -0500)]
lscpu: add helper to get physical sockets
Add a helper function, get_number_of_physical_sockets_from_dmi(),
to get physical sockets from DMI table in case of the sysfs for
cpu topology doesn't have the physical socket information.
get_number_of_physical_sockets_from_dmi() parse the DMI table
and counts the number of SMBIOS Processor Information (Type04)
structure.
Masayoshi Mizuma [Fri, 20 Nov 2020 05:06:05 +0000 (00:06 -0500)]
lscpu: use cluster on aarch64 machine which doesn't have ACPI PPTT
lscpu may show the wrong number of sockets if the machine is aarch64 and
doesn't have ACPI PPTT.
That's because lscpu shows the number of sockets by using a sysfs entry
(cpu/cpuX/topology/core_siblings). The sysfs entry is set by MPIDR_EL1
register if the machine doesn't have ACPI PPTT. MPIDR_EL1 doesn't show
the physical socket information directly. It shows the affinity level.
According to linux/arch/arm64/kernel/topology.c:store_cpu_topology(),
the top level of affinity is called as 'Cluster'.
Use Cluster instead of Socket on the machine which doesn't have ACPI PPTT.
This patch is useful for aarch64 machine which is based on ARM
SBBR v1.0 and v1.1, the specs don't require ACPI PPTT. ARM SBBR v1.2
requires ACPI PPTT.
Karel Zak [Thu, 19 Nov 2020 11:04:08 +0000 (12:04 +0100)]
lib/signames: change license to public domain
The file is simple list of signal names and trivial function to search
in the list. We do not need any extra license here and as public
domain it will be more portable to other tools (GPL and BSD) in the
util-linux.
All previous contributors (Sami, Niklas and me) agree with this change.
Karel Zak [Thu, 19 Nov 2020 10:12:06 +0000 (11:12 +0100)]
umount: ignore --no-canonicalize,-c for non-root users
It seems better to ignore this option than drop-permissions and later
exit with EPERMs. This change makes umount(8) more compatible with
fuser user umounts by systemd where -c is used to reduce overhead etc.
Addresses: https://github.com/karelzak/util-linux/issues/1192 Signed-off-by: Karel Zak <kzak@redhat.com>
Érico Rolim [Sun, 15 Nov 2020 04:34:41 +0000 (01:34 -0300)]
lib/caputils: add fall back for last cap using prctl.
This allows the rest of the programs using cap_last_cap to trust the
value returned by it, since it will either be obtained from procfs
(straight from kernel) or with prctl.
Also checked if the file under /proc is actually mounted in a procfs.
Sami Kerola [Wed, 11 Nov 2020 21:10:32 +0000 (21:10 +0000)]
fdformat: remove command from default build
It should be safe assumption a command related to floppy disks does not
need to be part of default build. Notice that the reference commit removed
floppy driver from linux about year ago. Virtual floppies might exist they
should not need low-level formatting. But if someone really needs this
enabling the build in that case is better than pushing the binary by
default to many many systems that install util-linux.
Sami Kerola [Mon, 19 Oct 2020 20:57:04 +0000 (21:57 +0100)]
colrm: fix argument parsing
Short options had all sortss of characters listed, that were clearly copied
from col(1) command getopt_long() invocation. Luckily both -V and -h were
part of the short options, but lets get rid of the unnecessary ones.
Fixes: 1647d032a7bfcba36d3dabe627b858b372210d05 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Tue, 1 Sep 2020 19:23:36 +0000 (20:23 +0100)]
cifuzz: reindent yaml file
Fixex two yamllint indentation warning, the truthy is false positive.
util-linux $ yamllint ./.github/workflows/cifuzz.yml
6:1 warning truthy value should be one of [false, true] (truthy)
14:2 error wrong indentation: expected 2 but found 1 (indentation)
22:4 error wrong indentation: expected 5 but found 3 (indentation)
Reference: https://github.com/adrienverge/yamllint Signed-off-by: Sami Kerola <kerolasa@iki.fi>
That's because 367c85c47 changes to get the modelname from Processor
Version of SMBIOS.
To fix that, use the hard corded table to show the "Model name" and
add two new lines; "BIOS Vendor ID" and "BIOS Model name" to show the
SMBIOS information.
lscpu shows the SMBIOS information when root user runs it because
accessing the SMBIOS information requires root privilege.
[kzak@redhat.com: - port the patch to new lscpu code]
Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 3 Nov 2020 10:49:28 +0000 (11:49 +0100)]
lscpu: update tests
* cpu MHz is per-CPU value and not printed in summary anymore
* topology is reordered
* number of NUMA nodes is moved to NUMA section
* parsable output uses cache ID from kernel if avalable
Karel Zak [Tue, 3 Nov 2020 10:13:26 +0000 (11:13 +0100)]
lscpu: improve bogomips use
* keep global (cputype) bogomips
* add per-CPU bogomips
* use bogomips from the first CPU as global (for cputype) if /proc/cpuinfo does not provide global bogomips
* add BOGOMIPS column for to -e/-p output
Karel Zak [Tue, 3 Nov 2020 08:46:45 +0000 (09:46 +0100)]
lscpu: improve topology calculation
Let's make it more robust and readable. The sysinfo file on s390 may
contain zeros, so we need to check the values and fallback to data
from shared maps if necessary.
Karel Zak [Mon, 2 Nov 2020 09:11:46 +0000 (10:11 +0100)]
lscpu: generate cache ID if not available
The file /sys/devices/system/cpu/cpu*/cache/index*/id is not available
in old kernels. This patch add code to generate IDs according to cache
type and level.
Karel Zak [Fri, 4 Sep 2020 09:27:33 +0000 (11:27 +0200)]
lscpu: keep static/dynamic MHz in cputype struct
The Dynamic and Static MHz are /proc/cpuinfo s390 per-CPU fields, but
we display it as a single value according the first parsed CPU. For
this purpose we store the values from the first CPU in lscpu_cputype.
For -p and -e outputs we will print per CPU values.
Karel Zak [Thu, 20 Aug 2020 10:28:52 +0000 (12:28 +0200)]
lscpu: use cache ID, keep caches independent on CPU type
The cache is identified by Type, Level and ID, the ID is unique cache
instance identifier (of the type).
This changes forces lscpu allocate more lscpu_cache instances (than
old version), but now we're ready for arbitrary scenario where
different CPU types share caches and the same cache type uses
different size in different instances, etc.
Karel Zak [Wed, 19 Aug 2020 10:43:48 +0000 (12:43 +0200)]
lscpu: remove obsolete code
This is the first step in conversion from old lscpu to the new code.
The patch removes obsolete code from lscpu.c and lscpu.h. The old
output code in lscpu.c is temporary disabled by #ifdef due to
incompatibility between old and new internal APIs -- this will be
changed later by small steps to make all all the changes review-able.
Karel Zak [Thu, 16 Jul 2020 08:51:14 +0000 (10:51 +0200)]
lscpu: calculate threads number from type specific values
Don't use global CPU masks (like "online" or "present") to
calculate type specific number of threads due systems with
mixed CPU types.
It's also necessary to check all thread_siblings maps to get the
highest number, because some threads (CPUs) may be disables, for
example old lscpu calculates number of threads from the cpu0 and
if you disable cpu0's sibling (cpu4):
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2 <---
Core(s) per socket: 4
Socket(s): 1