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
Karel Zak [Tue, 17 Mar 2020 12:12:12 +0000 (13:12 +0100)]
lscpu: add very basic cputype code
The current lscpu assumes that all CPUs in the system are the same.
Unfortunately this is not true. We need to split all internal CPUs
descriptions to CPU-type and CPU.
This patch add lscpu-cputype.c where will be CPU-type description --
mostly based on /proc/cpuinfo.
Pali Rohár [Thu, 5 Nov 2020 18:23:23 +0000 (19:23 +0100)]
libblkid: udf: add support for multisession via session_offset hint
To read multisession UDF disc it is required to probe VSD and AVDP from the
selected session (specified by session_offset) and then read other volume
descriptors from absolute location specified in AVDP, which is in most
cases in previous session.
So it is required for udf detector to be able to read data from any
location of disc and therefore blkid's --offset argument cannot be used to
access multisession optical disc.
Only blkid's --hint session_offset argument can be used to instruct blkid
to read multisession optical disc or disc images correctly.
Pali Rohár [Thu, 5 Nov 2020 18:22:58 +0000 (19:22 +0100)]
libblkid: iso9660: add support for multisession via session_offset hint
The only required change is to read disc from offset specified by
session_offset instead of beginning of disc (offset 0).
So either blkid's --offset or --hint session_offset argument would work for
correct detection of multisession ISO9660 optical disc or disc image.
Although the ISO9660 specification allows also non-2kB sector sizes,
current blkid implementation has hardcoded ISO9660 sector size to 2kB.
Therefore there is check that session_offset is multiple of 2048.
Pali Rohár [Thu, 5 Nov 2020 18:21:15 +0000 (19:21 +0100)]
libblkid: detect session_offset hint for optical discs
When offset and session_offset hint are not specified then sets
session_offset hint from CDROMMULTISESSION ioctl which returns start
position of the last session of multisession optical disc.
It is expected that session_offset hint contains position offset in bytes
where starts session of multisession optical disc which should be read.
Filesystems designed for optical discs are expected to use this value when
dealing with multisession optical disc to know where they should start
reading optical disc or image of optical disc.
Pali Rohár [Thu, 5 Nov 2020 18:16:27 +0000 (19:16 +0100)]
libblkid: detect CD/DVD discs in packet writing mode
Packet writing mode for CD and DVD discs is provided by kernel module
pktcdvd.ko which exports block devices /dev/pktcdvd/pktcdvd*.
These block devices do not accept CDROM_DRIVE_STATUS ioctl, therefore
current blkid code does not detect them as BLKID_FL_CDROM_DEV and also
does not do necessary size correction.
Extend detection of CD/DVD discs by additional CDROM_LAST_WRITTEN ioctl
which is accepted also by pktcdvd.ko.