Skip to content

Commit 10e9e7b

Browse files
kliang2Ingo Molnar
authored andcommitted
perf/x86/intel/uncore: Fix uncore num_counters
Some uncore boxes' num_counters value for Haswell server and Broadwell server are not correct (too large, off by one). This issue was found by comparing the code with the document. Although there is no bug report from users yet, accessing non-existent counters is dangerous and the behavior is undefined: it may cause miscounting or even crashes. This patch makes them consistent with the uncore document. Reported-by: Lukasz Odzioba <lukasz.odzioba@intel.com> Signed-off-by: Kan Liang <kan.liang@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Cc: <stable@vger.kernel.org> Link: http://lkml.kernel.org/r/1470925820-59847-1-git-send-email-kan.liang@intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 6818787 commit 10e9e7b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

arch/x86/events/intel/uncore_snbep.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2626,7 +2626,7 @@ void hswep_uncore_cpu_init(void)
26262626

26272627
static struct intel_uncore_type hswep_uncore_ha = {
26282628
.name = "ha",
2629-
.num_counters = 5,
2629+
.num_counters = 4,
26302630
.num_boxes = 2,
26312631
.perf_ctr_bits = 48,
26322632
SNBEP_UNCORE_PCI_COMMON_INIT(),
@@ -2645,7 +2645,7 @@ static struct uncore_event_desc hswep_uncore_imc_events[] = {
26452645

26462646
static struct intel_uncore_type hswep_uncore_imc = {
26472647
.name = "imc",
2648-
.num_counters = 5,
2648+
.num_counters = 4,
26492649
.num_boxes = 8,
26502650
.perf_ctr_bits = 48,
26512651
.fixed_ctr_bits = 48,
@@ -2691,7 +2691,7 @@ static struct intel_uncore_type hswep_uncore_irp = {
26912691

26922692
static struct intel_uncore_type hswep_uncore_qpi = {
26932693
.name = "qpi",
2694-
.num_counters = 5,
2694+
.num_counters = 4,
26952695
.num_boxes = 3,
26962696
.perf_ctr_bits = 48,
26972697
.perf_ctr = SNBEP_PCI_PMON_CTR0,
@@ -2773,7 +2773,7 @@ static struct event_constraint hswep_uncore_r3qpi_constraints[] = {
27732773

27742774
static struct intel_uncore_type hswep_uncore_r3qpi = {
27752775
.name = "r3qpi",
2776-
.num_counters = 4,
2776+
.num_counters = 3,
27772777
.num_boxes = 3,
27782778
.perf_ctr_bits = 44,
27792779
.constraints = hswep_uncore_r3qpi_constraints,
@@ -2972,7 +2972,7 @@ static struct intel_uncore_type bdx_uncore_ha = {
29722972

29732973
static struct intel_uncore_type bdx_uncore_imc = {
29742974
.name = "imc",
2975-
.num_counters = 5,
2975+
.num_counters = 4,
29762976
.num_boxes = 8,
29772977
.perf_ctr_bits = 48,
29782978
.fixed_ctr_bits = 48,

0 commit comments

Comments
 (0)