Skip to content

Commit 9d48c7a

Browse files
Thomas RichterVasily Gorbik
authored andcommitted
s390/cpumf: cpum_cf PMU displays invalid value after hotplug remove
When a CPU is hotplugged while the perf stat -e cycles command is running, a wrong (very large) value is displayed immediately after the CPU removal: Check the values, shouldn't be too high as in time counts unit events 1.001101919 29261846 cycles 2.002454499 17523405 cycles 3.003659292 24361161 cycles 4.004816983 18446744073638406144 cycles 5.005671647 <not counted> cycles ... The CPU hotplug off took place after 3 seconds. The issue is the read of the event count value after 4 seconds when the CPU is not available and the read of the counter returns an error. This is treated as a counter value of zero. This results in a very large value (0 - previous_value). Fix this by detecting the hotplugged off CPU and report 0 instead of a very large number. Cc: [email protected] Fixes: a029a4e ("s390/cpumf: Allow concurrent access for CPU Measurement Counter Facility") Reported-by: Sumanth Korikkar <[email protected]> Signed-off-by: Thomas Richter <[email protected]> Reviewed-by: Sumanth Korikkar <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent 213fca9 commit 9d48c7a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/s390/kernel/perf_cpum_cf.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,8 +687,10 @@ static void cpumf_pmu_stop(struct perf_event *event, int flags)
687687
false);
688688
if (cfdiag_diffctr(cpuhw, event->hw.config_base))
689689
cfdiag_push_sample(event, cpuhw);
690-
} else
690+
} else if (cpuhw->flags & PMU_F_RESERVED) {
691+
/* Only update when PMU not hotplugged off */
691692
hw_perf_event_update(event);
693+
}
692694
hwc->state |= PERF_HES_UPTODATE;
693695
}
694696
}

0 commit comments

Comments
 (0)