Commit Graph

9 Commits

Author SHA1 Message Date
Juergen Christ
c6207db8fc cpacfstats: Typos and Explanation
Correct wrong counter name.
Clarify counting of KMA.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2022-07-21 15:57:17 +02:00
Juergen Christ
fcb1f7efd1 cpacfstats: Add PAI and hotplug support
Add virtual counters pai_user and pai_kernel to detail all Processor Activity
 Instrumentation (PAI) counters in user resp. kernel space.  Once activated,
they will show all counters for the corresponding set.  Add option -n to limit
the display to only non-zero counter values.

Add support for cpu hotplug events based on libudev.  CPU hotplug events are
used to either detach from a vanishing CPU or (re-)attach to a (re-)appearing
CPU.  In that case, a "hotplug detected" virtual counter is set to a non-zero
value to indicate possible loss of counters which happens when CPACF is used
on the CPU before cpacfstatsd could attach to it.  The hotplug indication is
cleared once all counters are deactivated.

Add support for JSON output.  The JSON document is an array of JSON objects
representing the counters and their values.  Every object has a name (property
"counter") and a value (property "value").  For PAI counters, the counters
also have a space (property "space") determining the counter set pai_user or
pai_kernel, and a numeric id (property "counterid") that can be used to filter
the JSON document.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
Reviewed-By: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2022-06-29 14:07:34 +02:00
Juergen Christ
72b5e8b313 cpacfstats: Handle CPU hotplug
cpacfstatsd now correctly handles offline cpus and dynamically attaches to
cpus once they get online.  If events are enabled when a hotplug event
occurs, cpacfstatsd uses a pseudo-counter to notify user applications about
the occurence of this event and a potential data inaccuracy.

cpacfstats shows if a hotplug event has been detected since at least one
counter was activated.  As soon as all counters are deactivated, the
hotplug detection state is reset.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
Reviewed-By: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2022-06-29 14:07:31 +02:00
Juergen Christ
225964875c cpacfstats: Use timed operations in daemon.
The cpacfstats daemon is susceptible to dos attacks from malicious clients
that connect but either do not send a query or receive an answer fast
enough.  The latter currently is impossible but might occur once we
introduce further counters.

Solve both problems by exploiting a timed read/write operation in the
daemon and close the connection on timeout.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
Reviewed-By: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2022-06-29 14:06:35 +02:00
Juergen Christ
fd174cb952 cpacfstats: Bugfix to remove libpfm from cpacfstats
libpfm does not yet include counters introduced with z15 in a release.
cpacfstatsd now implements its own counter logic to become independent
of the slow release cycles of libpfm.

Reviewd-By: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewd-By: Harald Freudenberger <freude@de.ibm.com>
Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-07-27 17:34:24 +02:00
Juergen Christ
e08e07baa9 cpacfstats: Add ECC counters to cpacfstats
z15 architecture supports counters for ECC operations.  We now add and evaluate
these counters on supported architectures.  If ECC counters are not supported,
we simply print "unsupported" for ECC counter values.

Manpages adapted accordingly.

Signed-off-by: Juergen Christ <juergen.christ@ibm.com>
Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2020-06-16 10:32:19 +02:00
Dan Horák
847f16f632 Switch to using /run directory instead of the legacy /var/run
Closes: https://github.com/ibm-s390-tools/s390-tools/pull/53
Signed-off-by: Dan Horák <dan@danny.cz>
Acked-by: Sa Liu <saliu@de.ibm.com>
Acked-by: Harald Freudenberger <freude@linux.ibm.com>
Acked-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2019-02-11 12:33:56 +01:00
Harald Freudenberger
93d91679c3 cpacfstats: Add size setting to perf event
The newer perf_event_open syscall needs a struct
perf_event_attr with the size field set correctly. Older
versions did not even provide this field. However, this
field is now set to the correct size value.

Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
2017-09-06 13:04:19 +02: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