]> git.baikalelectronics.ru Git - kernel.git/commit
perf/x86/intel: Fix a warning on x86_pmu_stop() with large PEBS
authorNamhyung Kim <namhyung@kernel.org>
Thu, 26 Nov 2020 11:09:21 +0000 (20:09 +0900)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 3 Dec 2020 09:00:26 +0000 (10:00 +0100)
commit58d56158e950e76aa6c25d9fba5bd89d73f85be7
tree1674af225c34ef9546a56901175e260eafcf69c3
parentbe2650cbbfc89e9b7f08111f1d6d14b474b6499e
perf/x86/intel: Fix a warning on x86_pmu_stop() with large PEBS

The commit f2c7eb61b473 ("x86/perf/amd: Remove need to check "running"
bit in NMI handler") introduced this.  It seems x86_pmu_stop can be
called recursively (like when it losts some samples) like below:

  x86_pmu_stop
    intel_pmu_disable_event  (x86_pmu_disable)
      intel_pmu_pebs_disable
        intel_pmu_drain_pebs_nhm  (x86_pmu_drain_pebs_buffer)
          x86_pmu_stop

While commit 32e2214a0cd0 ("perf/x86/intel/ds: Fix x86_pmu_stop
warning for large PEBS") fixed it for the normal cases, there's
another path to call x86_pmu_stop() recursively when a PEBS error was
detected (like two or more counters overflowed at the same time).

Like in the Kan's previous fix, we can skip the interrupt accounting
for large PEBS, so check the iregs which is set for PMI only.

Fixes: f2c7eb61b473 ("x86/perf/amd: Remove need to check "running" bit in NMI handler")
Reported-by: John Sperbeck <jsperbeck@google.com>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20201126110922.317681-1-namhyung@kernel.org
arch/x86/events/intel/ds.c