File s390-tools-sles15sp2-lscpumf-change-dflt-ccerror-counter-name.patch of Package s390-tools.18357
Subject: [PATCH] [BZ 188009] cpumf/lscpumf.c: Add support for counter number 265
From: Thomas Richter <tmricht@linux.ibm.com>
Description: s390-tools: lscpumf change DFLT_CCERROR counter name
Symptom: lscpumf displays counter number 265 as DFLT_CCERROR.
This is wrong and differs from the counter name as
defined in the Linux kernel version 5.8 and later.
Note: This patch required kernel 5.8 and later.
Problem: Linux Kernel commit 3d3af181d37006 renames this counter
from DFLT_CCERROR to DFLT_CCFINISH. This new name
better reflects the purpose of this counter.
Solution: Rename the counter 265 in the corresponding z15 data
file.
Reproduction: Run command lscpumf -c | fgrep DFLT_
Upstream-ID: 34cfca722c1a36ae04b9fb6e50930fef30f75518
Problem-ID: 188009
Upstream-Description:
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 Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
cpumf/bin/lscpumf.in | 16 ++++++++++++++--
cpumf/data/cpum-cf-extended-z15.ctr | 2 +-
2 files changed, 15 insertions(+), 3 deletions(-)
--- a/cpumf/bin/lscpumf.in
+++ b/cpumf/bin/lscpumf.in
@@ -101,7 +101,7 @@ sub show_version()
{
print <<'EoVersion';
CPU-measurement facility utilities, version @S390_TOOLS_RELEASE@
-Copyright IBM Corp. 2014, 2017
+Copyright IBM Corp. 2014, 2020
EoVersion
exit 0;
@@ -258,6 +258,14 @@ out:
return 0;
}
+sub find_ctr265name()
+{
+ if (-e "/sys/devices/cpum_cf/events/DFLT_CCERROR") {
+ return "DFLT_CCERROR";
+ }
+ return "DFLT_CCFINISH";
+}
+
sub print_counters($$)
{
my ($ctrdef, $header) = @_;
@@ -282,7 +290,11 @@ $ctr_perf, $name
foreach my $ctr (sort { $a <=> $b } keys %$ctrdef) {
$ctr_perf = sprintf "%x", $ctr;
$ctr_num = $ctr < (1 << 16) ? $ctr : "";
- $name = $ctrdef->{$ctr}->{name};
+ if ($ctr == 265) {
+ $name = find_ctr265name();
+ } else {
+ $name = $ctrdef->{$ctr}->{name};
+ }
$desc = $ctrdef->{$ctr}->{shortdesc} ?
$ctrdef->{$ctr}->{shortdesc}
: $ctrdef->{$ctr}->{desc};
--- a/cpumf/data/cpum-cf-extended-z15.ctr
+++ b/cpumf/data/cpum-cf-extended-z15.ctr
@@ -356,7 +356,7 @@ Short-Description:Increments by one for
Description:
Increments by one for every DEFLATE CONVERSION CALL instruction executed
.
-Counter:265 Name:DFLT_CCERROR
+Counter:265 Name:DFLT_CCFINISH
Short-Description:Increments by one for every DEFLATE CONVERSION CALL instruction executed that ended in Condition Codes 0, 1 or 2
Description:
Increments by one for every DEFLATE CONVERSION CALL instruction executed that ended in Condition Codes 0, 1 or 2