In the arm platform, we do not have the "CPU family" as X86.
In the linux kernel, it is hardcode to set the "CPU architecuture:8"
which should be changed for arm v9 in future.
This patch adds "bios_family" field, which we can get from the DMI table.
In the ampere Altra platform, we can get the new lscpu output:
----------------------------------------------------------------
Architecture: aarch64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 160
On-line CPU(s) list: 0-159
Vendor ID: ARM
BIOS Vendor ID: Ampere(R)
Model name: Neoverse-N1
BIOS Model name: Ampere(R) Altra(R) Processor Q00-00 CPU @ 3.0GHz
BIOS CPU family: 257
Model: 1
Thread(s) per core: 1
----------------------------------------------------------------
[kzak@redhat.com: - s/sprintf/snprintf/]
Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
The patch :367c85c47286 ("lscpu: use SMBIOS tables on ARM for lscpu")
relies on the existence of "/sys/firmware/dmi/entries/4-0/raw",
which may not exist in standard linux kernel.
But "/sys/firmware/dmi/tables/DMI" should exist and can provide the required
processor information.
This patch uses "/sys/firmware/dmi/tables/DMI"
to get the processor information:
Before this patch, in Ampere Altra platform, the lscpu output is:
---------------------------------------------
Architecture: aarch64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 160
On-line CPU(s) list: 0-159
Vendor ID: ARM
Model name: Neoverse-N1
Model: 1
Thread(s) per core: 1
Core(s) per socket: 80
Socket(s): 2
........................................
---------------------------------------------
After this patch, we can use get the lscpu output
in Ampere Altra platform:
---------------------------------------------
Architecture: aarch64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 160
On-line CPU(s) list: 0-159
Vendor ID: ARM
BIOS Vendor ID: Ampere(R)
Model name: Neoverse-N1
BIOS Model name: Ampere(R) Altra(R) Processor Q00-00 CPU @ 3.0GHz
Model: 1
Thread(s) per core: 1
Core(s) per socket: 80
Socket(s): 2
........................................
---------------------------------------------
[kzak@redhat.com: - s/sprintf/snprintf/]
Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Using mount flag `nosuid` also affects SELinux domain transitions but
this has not been documented well.
Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
Double-semicolon at the end of the option line results in description
being indented extra tab to the right. Replacing them with double-colons
allows all options to be displayed at the same indent level.
* 'lscpu-json-types' of https://github.com/t-8ch/util-linux:
lscpu: use optional json values
libsmartcols: add support for optional boolean values
lscpu: use json types
* next: (26 commits)
build-sys: add script to compare config.h from meson and autotools
meson: add missing header files check
docs: update TODO
tests: update lscpu outputs
lscpu: read MHZ from /sys/.../cpufreq/scaling_cur_freq
lscpu: use locale-independent strtod() when read from kernel
lib/c_strtod; add locale independent strtod()
tests: update lscpu output
lscpu: use MHZ as number to be locale sensitive
lscpu: add SCALMHZ% and "CPU scaling MHz:"
sulogin: fix whitespace error
sulogin: ignore none-existing console devices
lsns: fix old error message
lsns: fix copy & past in man page
lsns: fill UID and USER columns for interpolated namespaces
fixup! lsns: interpolate missing namespaces for converting forests to a tree
lsns: interpolate missing namespaces for converting forests to a tree
lsns: reorganize members specifying other namespaces in lsns_namespace
lsns: make namespace having no process printable
libblkid: support zone reset for wipefs
...
This is more portable and provides more stable results than
/proc/cpuinfo.
Fixes: https://github.com/karelzak/util-linux/pull/1317
Co-Author: Thomas Weißschuh
Signed-off-by: Karel Zak <kzak@redhat.com>
The tree of *parent* and *owner* could be forests because *lsns*
cannot track a namespace having no process.
This change tries interpolating the missing namespaces by calling
ioctl(NS_GET_PARENT) and ioctl(NS_GET_USERNS) recursively.
The original output for -Tparent:
# ./lsns -Tparent
NS TYPE NPROCS PID USER COMMAND
4026531837 user 404 1 root /usr/lib/systemd/sy
├─4026532508 user 1 29376 yamato /usr/lib64/firefox/
...
└─4026533513 user 1 24245 yamato /usr/lib64/firefox/
...
4026533733 user 1 30839 yamato /opt/google/chrome-
4026533734 user 15 10076 yamato /opt/google/chrome-
user namespaces 4026533733 and 4026533734 are orphans.
lsns could not find their parents.
With this change:
# ./lsns-with-changes -Tparent
NS TYPE NPROCS PID USER COMMAND
4026531837 user 404 1 root /usr/lib/systemd/
├─4026532508 user 1 29376 yamato /usr/lib64/firefo
...
├─4026532639 user 0
│ ├─4026532637 user 0
│ │ └─4026533733 user 1 30839 yamato /opt/google/chrom
│ └─4026533734 user 14 10076 yamato /opt/google/chrom
Now user namespaces 4026533733 and 4026533734 are integrated to the
tree. lsns interpolates the missing namespace 4026532639 and
4026532637 for the integration.
The original output for -Towner:
# ./lsns -Towner
NS TYPE NPROCS PID USER COMMAND
4026531837 user 405 1 root /usr/lib/systemd/s
├─4026531835 cgroup 431 1 root /usr/lib/systemd/s
...
4026532638 pid 1 30839 yamato /opt/google/chrome
4026532640 pid 2 30837 yamato /opt/google/chrome
...
pid namespaces 4026532638 and 4026532640 are orphans.
lsns could not find their owners.
With this change:
# ./lsns-with-changes -Towner
NS TYPE NPROCS PID USER COMMAND
4026531837 user 403 1 root /usr/lib/systemd
├─4026531835 cgroup 429 1 root /usr/lib/systemd
...
├─4026532639 user 0
...
│ ├─4026532637 user 0
│ │ ├─4026532638 pid 1 30839 yamato /opt/google/chro
│ │ ├─4026533638 net 1 30839 yamato /opt/google/chro
│ │ └─4026533733 user 1 30839 yamato /opt/google/chro
│ ├─4026532640 pid 2 30837 yamato /opt/google/chro
Now pid namespaces 4026532638 and 4026532640 are integrated to the
tree. lsns interpolates the missing namespace 4026532639 and
4026532637 for the integration.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
This is a preparation change for planed "tree interpolation" patch.
parentid, ownerid, parentns, and ownerns were members of
lsns_namespace struct. When interpolating missing namespaces
for building a unified name space tree, duplicated functions
are needed; one is for parentid and parentns members, and
another is for ownerid and ownerns members. To avoid the
duplication, this change unifies the members as following:
parentid and ownerid => related_id [2]
parentns and ownerns => related_ns [2]
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
* make --tree=process default for 'lsns' and 'lsns <ns>'
* remove 'list' from struct lsns
* update man page
Addresses: https://github.com/karelzak/util-linux/pull/1281
Signed-off-by: Karel Zak <kzak@redhat.com>
Suggested by Karel Zak.
`--tree` option is introduced as replacement for `--nstree`.
In addition to `parent` and `owner`, `--tree` take `process` as the
option argument.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Introduce new option -T[parent|owner]|--nstree[=parent|=owner].
With this change, lsns prints parent/child relationship tree if
"-T parent" is given and owner/owned relationship tree if "-T owner is given.
Passing only "-T" is same as passing "-Towner."
Example sessions:
# ./lsns -Tparent -ons,type,pns| head -20
NS TYPE PNS
4026531837 user 0
├─4026532508 user 4026531837
├─4026532609 user 4026531837
├─4026532610 user 4026531837
├─4026532629 user 4026531837
├─4026532705 user 4026531837
├─4026532901 user 4026531837
├─4026533090 user 4026531837
├─4026533185 user 4026531837
├─4026533280 user 4026531837
└─4026533468 user 4026531837
4026531835 cgroup 0
4026531836 pid 0
└─4026533038 pid 4026531836
├─4026532934 pid 4026533038
├─4026533715 pid 4026533038
├─4026533716 pid 4026533038
...
# ./lsns -Towner -ons,type,ons| head -20
NS TYPE ONS
4026531837 user 0
├─4026531835 cgroup 4026531837
├─4026531836 pid 4026531837
├─4026531838 uts 4026531837
├─4026531839 ipc 4026531837
├─4026531840 mnt 4026531837
├─4026531861 mnt 4026531837
├─4026532001 net 4026531837
├─4026532219 mnt 4026531837
├─4026532357 mnt 4026531837
├─4026532383 net 4026531837
├─4026532475 mnt 4026531837
├─4026532476 mnt 4026531837
├─4026532504 mnt 4026531837
├─4026532508 user 4026531837
│ ├─4026532509 ipc 4026532508
│ └─4026532511 net 4026532508
├─4026532573 mnt 4026531837
├─4026532574 mnt 4026531837
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
I'm working on building initramfs images directly from normal
packages, which means that the pristine system rpms should behave
correctly as much as possible also in the initrd. There usually isn't
enough time for the timer to actually fire, but starting it gives a
line on the console and generally looks confusing and sloppy. So let's
skip the timer if it ever ends up being enabled in the initrd.
Checking for /etc/initrd-release is the standard condition that
systemd's initrd units use.
The command-line option --force is defined as "disable all checks",
but the current code does not follow this idea. We need a way how to
disable read from the device (for example for dm-integrity devices).
Fixes: https://github.com/karelzak/util-linux/issues/1308
Signed-off-by: Karel Zak <kzak@redhat.com>
The mount() command associated with this error message is not about
unmounting the proc fs, but rather about changing the propagation
of mount events for the proc fs. Rewrite the error message to
reflect this.
* `RFKILL_EVENT_SIZE_V1` is defined as sizeof(struct rfkill_event), so let's use %zu
* cast `len` to size_t to make it usable with %zu
Signed-off-by: Karel Zak <kzak@redhat.com>