Commit Graph

37 Commits

Author SHA1 Message Date
Thomas Richter
886476a207 cpumf/chcpumf.c: Print proper error message on non-root invocation
chcpumf must be executed as root. A non-root user sees this error
message:

[tester@t35lp46 ~]$ chcpumf -m 1000
Error: /sys/module/kernel/parameters/cpum_sfb_size: Permission denied
[tester@t35lp46 ~]$

Enhance the error message and be clear about the root cause:
[tester@t35lp46 ~]$ chcpumf-new  -m 1000
Error: Must run as root
[tester@t35lp46 ~]$

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-11-18 11:28:35 +01:00
Thomas Richter
86685f001d cpumf/lscpumf.c: Check for help and version options first
Check command line arguments for help text and version
string first, before doing any action. This ensures this
information is always printed, even when invoked as non-root
user.

Fixes: https://github.com/ibm-s390-tools/s390-tools/issues/97
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-11-18 11:28:35 +01:00
Dan Horák
3b402a0630 lscpumf: add z15 Model T02
Closes: https://github.com/ibm-s390-tools/s390-tools/pull/87
Signed-off-by: Dan Horák <dan@danny.cz>
Reviewed-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-11-11 14:25:46 +01:00
Thomas Richter
ea10995f4d cpumf/chcpumf.c: Fix version and help printout when CPUMF not installed.
chcpumf does not print out version (option -v) or help text
(option -h) when the CPU Measurement Sampling facility is not
installed. This was different up to and including release 4.10.
Fix this and hounour option -v and option -h even when
the sampling facility is not installed.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-10-12 13:12:55 +02:00
Thomas Richter
644432ba23 cpumf/man/lscpumf.1: Fix invocation list in man page
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-10-12 13:12:55 +02:00
Jan Höppner
ed52031821 cpumf: Remove TESTS from Makefile
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-08-21 09:12:29 +02:00
Thomas Richter
34cfca722c cpumf/lscpumf.c: Add support for counter number 265
Set the counter name for z15 counter numbered 265. It is either named
DFLT_CCERROR or DFLT_CCFINISH, depending on the linux version. The
counter was renamed from CCERROR to CCFINISH in linux version 5.8.
Check for existence of file /sys/devices/cpum_cf/events/DLFT_CCERROR.
f this file exists the counter is named DFLT_CCERROR else
DFLT_CCFINISH (only for z15), other machines do not have this counter.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-07-24 13:01:09 +02:00
Thomas Richter
20b05e1f82 cpumf/chcpumf.8: Add description for option verbose
Add description for option verbose.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-05-29 15:18:31 +02:00
Thomas Richter
ce02dd7167 cpumf/chcpumf.c: Print verbose message on success
Print verbose message on success only.

Reviewed-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-05-29 15:18:31 +02:00
Thomas Richter
d2fc700b73 man/lscpumf.1: Fix wording and typos
Linux in upper case L.

Reviewed-by: Horst Weber <hweber@linux.ibm.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-05-29 15:18:31 +02:00
Thomas Richter
199b030580 cpumf: Rewrite chcpumf and lscpumf in C
Rewrite lscpumf and chcpumf in C. The previous version
habe been written in perl which require a lot of instructure.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-05-29 15:18:31 +02:00
Thomas Richter
2c106425e8 cpumf_helper: Avoid perl warning from pod2usage function
The pod2usage function from module Pod::Usage always emits this warning
when the module is loaded, even if the funtion is not invoked at all:

The script_run feature is experimental in regex;
            marked by <-- HERE in m/(*script_run: <-- HERE  ^ .* $ )/
            at (eval 14) line 2.

To avoid this warning every time the cpumf_helper script is invoked,
do not use function pod2usage. The use of this function has no
benefit. cpumf_helper is invoked under the covers from lscpumf and
chcpumf, so it is sufficient to print the help text in case a wrong
parameter has been supplied.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-03-16 13:39:10 +01:00
Thomas Richter
1086548607 cpumf: Add IBM z15 extended counter defintion file
Add IBM Z15 extended counter definition file to Makefile
DATA_FILES list.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-03-16 13:39:10 +01:00
Thomas Richter
5d2871d626 cpumf/data: Add new deflate counters for IBM z15
Add support for new deflate counters:
- Counter 247: cycles CPU spent obtaining access to Deflate unit
- Counter 252: cycles CPU is using Deflate unit
- Counter 264: Increments by one for every DEFLATE CONVERSION CALL
    instruction executed.
- Counter 265: Increments by one for every DEFLATE CONVERSION CALL
    instruction executed that ended in Condition Codes
    0, 1 or 2.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-03-16 13:39:10 +01:00
Thomas Richter
21de913a5e cpumf/bin/cpumf_helper.in: Add IBM z15 machine name
Add IBM z15 as official machine name to lscpumf command
output.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-09-18 12:55:17 +02:00
Thomas Richter
f110a77b68 cpumf: Add support for CPU-Measurement Facility counters SVN 6
Add support for CPU-Measurement facility counter second version
number 6. This adds some more counters to the crypto counter set.
Extended counter set is the same as for z14.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-07-15 16:06:53 +02:00
Hendrik Brueckner
299144264d cpumf/cpumf_helper: always return list reference for --sfb-size
Running lscpumf -i as regular user causes a warning when trying to
disply sampling buffer sizes.  The root cause is in the cpumf_helper
that returns "0,0" instead of a list reference "[0,0]".

This happened when running as regular user because the sampling buffer
size sysfs attribute is not readable for them.

Remove the shortcut and always return a list reference.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-02-11 12:33:56 +01:00
Thomas Richter
f642019bcc cpumf: Add IBM z14 ZR1 to the CPU Measurement Facility model list
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
aab339d3e3 cpumf: Make short descriptions common for extended counter sets
The short descriptions for a counter in the extender counter
set should be identical for all models.
This patch fixes minor differences.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
1f459af568 cpumf: Add short description for crypto counter set
Add short description to the crypto counter set definition
file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
46f09a0adc cpumf: Add short description for diag counter set
Add a short description to the diagnosis counter set
definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
f65003a14e cpumf: Add short description for zEC12 extended counter set
Add a short description to the zEC12 extended counter set
definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
e092b4024a cpumf: Add short description for z196 extended counter set
Add a short description to the z196 extended counter set
definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
9d7bab18a4 cpumf: Add short description for z14 extended counter set
Add a short description to the z14 extended counter set
definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
8688d47e3d cpumf: Add short description for z13 extended counter set
Add a short description to the z13 extended counter set
definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
04bb72c0dc cpumf: Add short description for z10 extended counter set
Add a short description to the z10 extended counter set
definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
1c065082d2 cpumf: Add short description for basic counters level 3
Add a short description to the basic counter first
version number 3 definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
38642e6905 cpumf: Add short description for basic counters level 1
Add a short description to the basic counter first
version number 1 definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
ebdf888a2f cpumf: Fix typo in counter 135
Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Hendrik Brueckner
9745e4678a cpumf: correct counter name for z13 and z14
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
edb75870b5 cpumf_helper.in: Fix output of shortdesc
The cpumf_helper.in is called to parse counter definition
files stored in /usr/share/s390-tools/cpumf directory and
returns perl references to be examined by other perl tools
such as lsctrdef.

cpumf_helper.in expects several keywords in the counter
definition files, one is 'shortdesc' which contains
a short description of the purpose of the counter.

However this short description not is stored in the hash
field shortdesc keyed by counter number 'ctr' because the
wrong key is used.

Output before:
{
  '64' => {
            'desc' => 'Total number of the PRNG functions issued by the CPU',
            'name' => 'PRNG_FUNCTIONS',
            'set' => 8
          },
  '65' => {
            'desc' => 'Total number of CPU cycles when the DEA/AES coprocessor is busy performing PRNG functions issued by the CPU',
            'name' => 'PRNG_CYCLES',
            'set' => 8
          },
  ....
  'ctr' => {   <-------- WRONG
             'shortdesc' => 'AES Blocked Cycles'
           }
}

Output with this patch:
{
  '64' => {
            'desc' => 'Total number of the PRNG functions issued by the CPU',
            'name' => 'PRNG_FUNCTIONS',
            'set' => 8,
            'shortdesc' => 'PRNG Functions'
          },
  '65' => {
            'desc' => 'Total number of CPU cycles when the DEA/AES coprocessor is busy performing PRNG functions issued by the CPU',
            'name' => 'PRNG_CYCLES',
            'set' => 8,
            'shortdesc' => 'PRNG Cycles'
          },
  ...
}

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
a3c746846d cpumf: add missing Description: tag for z13/z14/ctr:128
Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Hendrik Brueckner
144bddbf5b cpumf: correct z14 counter number
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
2018-01-30 15:37:19 +01:00
Hendrik Brueckner
1064e5b9cc cpumf/cpumf_helper: read split counter sets (part 2/2)
Update the cpumf helper program to read the split counter set
definition files.  Changes to higher-level program like lscpumf
are not necessary.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
2018-01-30 15:36:23 +01:00
Hendrik Brueckner
d121ffa3f0 cpumf/z14: split counter sets according to CFVN/CSVN (part 1/2)
With z14, the counters in the problem-state are reduced resulting
in an increased first version number of the CPUM CF.  To adapt to
this change, split the counter sets according to their counter
first and second version number.  The second version number controls
the crypto-activity and extended counter set.  Treat the crypto-activity
counter set as generic, as the extended counter set is already handled
based on hardware models.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
2018-01-30 15:35:39 +01:00
Martin Schwidefsky
57f18c5f59 cpumf: Add extended counter defintion files for IBM z14
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
[brueckner: Prefer plural for counter names]
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
2018-01-30 15:35:18 +01:00
Michael Holzheu
b627b8d8e1 Initial s390-tools-2.0.0 import
This commit is based on the s390-tools-1.39.0 version.

Changes on top of s390-tools-1.39.0:

 - Add MIT license to all source files
 - Add LICENSE file
 - Transform REAMDE to README.md (markdown)
 - Add AUTHORS.md file
 - Add CONTRIBUTING.md file
 - Move changelog from README to CHANGELOG.md file

Reviewed-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
2017-08-21 10:55:40 +02:00