Commit Graph

357 Commits

Author SHA1 Message Date
Karel Zak 50c6ee4cb4 lscpu: gettextize two columns
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-27 12:26:02 +02:00
Heiko Carstens e43fc13e76 lscpu: s/Y/Yes/ s/N/No/
However I'd like to see one change if you don't object: printing just "N" or
"Y" instead of "No" and "Yes" in the human readable output looks a bit ugly to
me.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-12 12:39:30 +02:00
Heiko Carstens 59fb133a02 chcpu,cpuset: reduce code duplication for cpu list parsing
Reduce code duplication and print better error message if an
unsupported cpu number was passed.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-10 00:00:35 +02:00
Heiko Carstens 10829cd73c lscpu: add Hypervisor to output
Some vendors have several hypervisors. Therefore it makes sense to not only
print out the hypervisor vendor but also the name of the hypervisor.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:54:01 +02:00
Karel Zak 23e9e95ac3 lscpu: add --online option
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:50:41 +02:00
Heiko Carstens 0ad29ff6b0 lscpu: add --all option
The parsable output includes only lines of online CPUs. To also include
lines for all offline CPUs the "--all" option can be specified.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 23:50:01 +02:00
Heiko Carstens a7e5300c97 lscpu: add online state to output
lscpu only prints lines for online CPUs. At least for the human readable
list the offline CPUs are of interest as well. In order to distinguish
between online and offline CPUs introduce the "Online" column.
By default the human readable output now displays online and offline CPUs.
The parsable output is not changed. It will print only lines for online
CPUs as it used to do.

[kzak@redhat.com: - minor changes]

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:49:22 +02:00
Heiko Carstens d231eea114 lscpu: add configured state to output
CPUs may be in a configured or deconfigured state depending if the CPU resource
may be used by the guest.  If a CPU is in configured state the guest may use it
(i.e. set it online). It it is in deconfigured state it cannot use it before
changing its state to configured.  Display this CPU attribute as well.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 23:41:25 +02:00
Karel Zak ba45d8c1ea lscpu: add human readable extended cpu table output
Based on patch from Heiko Carstens <heiko.carstens@de.ibm.com>:

lscpu currently only supports a parsable output which contains a row for
each cpu and its attributes. This output contains only comas as separators
and is hard to read for humans.

Therefore add a new option "-e | --extended" which outputs the rows in a
much more readable (and non-parsable) form. Just like for the -p option a
list of columns can be specified that shall be included in the output.

By default this option will print all columns that contain data.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:41:01 +02:00
Karel Zak e3b3a2f3f8 lscpu: use buffer for data and headers
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:40:28 +02:00
Karel Zak e9d659ea85 lscpu: use function to search in cpu masks arrays
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:27:40 +02:00
Karel Zak 8005924a89 lscpu: cleanup output modes
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 07:25:21 +02:00
Heiko Carstens 44de912cdf lscpu: add --version option
Add a --version option like most other tools have it.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 06:34:43 +02:00
Heiko Carstens dcdead4271 lscpu: allow read_cache() to be called for offline cpus
First check path before accessing files to be sure they actually exist. This is
necessary when also informations for offline CPUs will be printed.  Since we do
not necessarily know if "cpu is offline" means the same as "path does not
exist" just check for it.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 06:30:06 +02:00
Heiko Carstens f6512068b2 lscpu: simplify cache column output function
Simplify the logic to "always print a ',' for each cache except if it is the
last one.  This is also a preparation patch for printing the cache column for
offline CPUs where it would print one colon too much because of the current
logic.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 06:24:26 +02:00
Heiko Carstens 08cd09415a lscpu: fix cache output for extended parsable output
The extended parsable output prints a colon instead of comma between each
item. The case where a CPU doesn't belong to any cache was not converted.
Just fix this.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 06:24:14 +02:00
Heiko Carstens c403ae6a1a lscpu: remove comma operator
Fix typo where the comma operator has been introduced.
Use a semicolon instead so we end up with simple assignment expressions.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 06:24:12 +02:00
Karel Zak c672220f1c dmesg: add --file option
This new option is mostly for testing (to test raw logs from another
boxes/kernels).

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-08 19:40:34 +02:00
Karel Zak 31c9099a81 dmesg: remove extra space only after time stamp
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-02 14:42:04 +02:00
Karel Zak 22f6982577 dmesg: fix for non-CONFIG_PRINTK_TIME kernels
* dmesg(1) incorrectly assumes that lines like "<6>\n"
   are broken.

 * it's more robust to assume the end of the record is "\n<"

 * print \n for empty lines

Reported-by: "Gabor Z. Papp" <gzp@papp.hu>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-31 12:36:02 +02:00
Karel Zak b82c15bd19 Merge branch 'chcpu' of git://git.kernel.org/pub/scm/linux/kernel/git/heiko/util-linux
* 'chcpu' of git://git.kernel.org/pub/scm/linux/kernel/git/heiko/util-linux:
  chcpu: new tool
  cpuset: add option to allow cpulist_parse() to fail
2011-08-31 11:49:27 +02:00
Karel Zak fa25f2289c Merge branch 'docs-dir' of https://github.com/kerolasa/lelux-utiliteetit
* 'docs-dir' of https://github.com/kerolasa/lelux-utiliteetit:
  docs: remove duplicated text
  docs: require kernel support before accepting use of it
  docs: note about independent super block structs
  docs: add libmount & libblkid debug instructions
  Documentation: add debugging doc
  arch: start using arch as a usage() example
  docs: new file Documentation/release-schedule.txt
  docs: move setuid information from reame to hwclock.8
  docs: clean up old readme files
  docs: copy contributors from legacy files to AUTHORS
  docs: new file Documentation/howto-man-page.txt
  docs: new file Documentation/source-code-management.txt
  docs: new file Documentation/howto-contribute.txt
  docs: new file Documentation/howto-compilation.txt
  docs: tell what the Documentation/ is about
  docs: add usage() howto for contributors
  docs: Documentation directory added
  docs: remove README.clear
2011-08-31 11:04:15 +02:00
Karel Zak e8a728df31 Merge branch 'lscpu' of git://git.kernel.org/pub/scm/linux/kernel/git/heiko/util-linux
* 'lscpu' of git://git.kernel.org/pub/scm/linux/kernel/git/heiko/util-linux:
  lscpu: add physical cpu address to parseable output
  lscpu: add cpu polarization to parseable output
  lscpu: show dispatching mode
  lscpu: use hypervisor generated topology information
  lscpu: detect IBM hypervisor
  lscpu: fix fallback nthreads calculation
  lscpu: fix cpu map array sizes
  lscpu: fix s390 bogomips detection coding style
2011-08-30 12:05:05 +02:00
Benno Schulenberg 62246430f3 docs: also uniformize headers and footers of troff-formatted man pages
Add two spaces as the required third argument of the date line to make
the specified date get used instead of today's date.  Incorporate the
section number into the page title, then use an empty section number,
so that specifying an explicit section/volume name will work.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-29 11:24:39 +02:00
Ben Hutchings 70eebc40e2 setarch: add --uname-2.6 option for personality flag UNAME26
[kzak@redhat.com: - minor change in usage()]

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-29 11:16:25 +02:00
Karel Zak 36908f176f flock: fix example in man page
Reported-by: Pierre Gaston <pierre.gaston@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-29 11:05:41 +02:00
Sami Kerola cd7accd446 arch: start using arch as a usage() example
The arch command is hijacked to be example of howto write usage
as defined in Documentation/howto-usage-function.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-08-28 10:50:36 +02:00
Heiko Carstens 0b57c6c229 chcpu: new tool
chcpu can modify the logical state of CPUs. It can enable and disable CPUs,
scan for new CPUs, change the CPU dispatching mode of the underlying
hypervisor and request (configure) or give logical CPUs back (deconfigure)
to the the underlying hypervisor.

This is quite useful if you work a lot with virtual servers, since doing all
the configuration stuff directly via sysfs becomes a pain.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-08-22 13:56:31 +02:00
Benno Schulenberg 232dc924c4 docs: uniformize the header and footer lines in man pages
Use dates without the day, use the full month name, put "util-linux" in
the lower left corner, and "User Commands" or "System Administration"
at the top center.

Also improve here and there the one-line program description.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-08-22 10:39:21 +02:00
Karel Zak fe931e05bc ipcmk: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:34:42 +02:00
Karel Zak 5ff204235d ldattach: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:30:26 +02:00
Karel Zak 7f1ec5e8d4 lscpu: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:28:02 +02:00
Karel Zak 4f92adb61a mountpoint: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:25:28 +02:00
Karel Zak 704c770555 rtcwake: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:23:30 +02:00
Karel Zak ae1ae49e78 renice: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:20:54 +02:00
Karel Zak 3cf01b94d4 unshare: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:16:40 +02:00
Karel Zak 2daae86205 fstrim: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:14:02 +02:00
Karel Zak a2aef6d928 fsfreeze: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:12:08 +02:00
Karel Zak 2e49d90f34 flock: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:07:30 +02:00
Karel Zak 130bf041ba fallocate: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:04:08 +02:00
Karel Zak dcd16b0fb0 dmesg: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:02:00 +02:00
Petr Uzel 5920295058 dmesg: avoid mess at the end of dmesg output
Since util-linux commit a7ee94f220,
dmesg incorrectly calculates number of bytes that are remaining in the
buffer in get_next_record(). This could, under specific circumstances,
cause printing mess at the end of dmesg output:

> dmesg | tail
[ 1191.478725] Adding 285488k swap on /root/swapfile.  Priority:-2 extents:15 across:1186612k
[ 1205.588331] Adding 285488k swap on /root/swapfile.  Priority:-2 extents:15 across:1186612k
\xffffffba\xffffffba

Reported-by: Glenn Doig <doiggl@velocitynet.com.au>
Addresses: https://bugzilla.novell.com/show_bug.cgi?id=710417

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-08-15 14:28:21 +02:00
Heiko Carstens b16f615afb cpuset: add option to allow cpulist_parse() to fail
This is a preparation patch for chcpu. If a cpu should be added to
a cpu_set where the cpu doesn't fit into the cpu_set this got silently
ignored.
Since the cpu-list is user space provided it should be checked if cpus
are specified that are completely out of range of the system.
In order to do that add a parameter which specifies if cpulist_parse()
should fail if it parses a cpu-list with "impossible" cpus.
The current callers have been converted so they behave like before.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-08-15 07:52:44 +02:00
Heiko Carstens 596b884510 lscpu: add physical cpu address to parseable output
Print also the physical cpu address for each logical cpu in parsable
output if selected and present via sysfs.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-08-14 17:34:39 +02:00
Heiko Carstens 2b8fcb8138 lscpu: add cpu polarization to parseable output
When running in different dispatching mode the virtual cpus may
have different polarizations.
E.g. in "vertical" mode cpus may have a polarization of "vertical:high"
which means the virtual cpu has dedicated physical cpu assigned.
Print this information in the parsable output.

Note that this breaks the current rule that
a) the parseable output contains only numbers
b) these numbers are equal or increased in each line

Since however this new item must be selected with the "list" argument
this shouldn't be a problem.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-08-14 17:34:34 +02:00
Heiko Carstens a0fff77e93 lscpu: show dispatching mode
A virtual guest my run in either "horiziontal" or "vertical" mode
which is the mode in which the underlying hypervisor schedules the
guest cpu.
Since this is of interest print this in the readable output.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-08-14 17:34:30 +02:00
Heiko Carstens 8648ca961f lscpu: use hypervisor generated topology information
The readable output prints also informations like cores per socket etc.
On newer kernel versions on s390 this information is available via
/proc/sysinfo. However it does not contain the layout of the guest but
the layout of the real machine.
Nevertheless this is better than random guessing with completely broken
numbers like we have it now on s390. If the information is not available
we fall back to old mechanism with more or less random numbers.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-08-14 17:34:26 +02:00
Heiko Carstens b8ec7bdfeb lscpu: detect IBM hypervisor
Detect if the hypervisor on s390 is from KVM or IBM.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-08-14 17:34:21 +02:00
Heiko Carstens 32a46618bc lscpu: fix fallback nthreads calculation
The fallback calculation of nthreads did not consider books.
In order to avoid division/multiply by/with zero make sure each number
used is at least "1".

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-08-14 17:34:17 +02:00
Heiko Carstens 9d1a3a18f3 lscpu: fix cpu map array sizes
Completely virtualized architectures like s390 may have multiple
virtual sockets and/or cores where each of them has a different
number of cores and cpus.
So the general assumption within the allocation scheme that e.g.
each socket contains the same number of cores is not necessarily
true. To make sure the arrays are always large enough we simply
allocate enough memory so that each array could hold cpu masks
for all present cpus.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-08-14 17:34:12 +02:00