Skip to content

Commit cea05c1

Browse files
committed
Merge tag 'perf-urgent-2020-08-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 perf fix from Thomas Gleixner: "A single update for perf on x86 which has support for the broken down bandwith counters" * tag 'perf-urgent-2020-08-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/x86/intel/uncore: Add BW counters for GT, IA and IO breakdown
2 parents 10c091b + 24633d9 commit cea05c1

File tree

1 file changed

+49
-3
lines changed

1 file changed

+49
-3
lines changed

arch/x86/events/intel/uncore_snb.c

+49-3
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,18 @@ static struct uncore_event_desc snb_uncore_imc_events[] = {
390390
INTEL_UNCORE_EVENT_DESC(data_writes.scale, "6.103515625e-5"),
391391
INTEL_UNCORE_EVENT_DESC(data_writes.unit, "MiB"),
392392

393+
INTEL_UNCORE_EVENT_DESC(gt_requests, "event=0x03"),
394+
INTEL_UNCORE_EVENT_DESC(gt_requests.scale, "6.103515625e-5"),
395+
INTEL_UNCORE_EVENT_DESC(gt_requests.unit, "MiB"),
396+
397+
INTEL_UNCORE_EVENT_DESC(ia_requests, "event=0x04"),
398+
INTEL_UNCORE_EVENT_DESC(ia_requests.scale, "6.103515625e-5"),
399+
INTEL_UNCORE_EVENT_DESC(ia_requests.unit, "MiB"),
400+
401+
INTEL_UNCORE_EVENT_DESC(io_requests, "event=0x05"),
402+
INTEL_UNCORE_EVENT_DESC(io_requests.scale, "6.103515625e-5"),
403+
INTEL_UNCORE_EVENT_DESC(io_requests.unit, "MiB"),
404+
393405
{ /* end: all zeroes */ },
394406
};
395407

@@ -405,13 +417,35 @@ static struct uncore_event_desc snb_uncore_imc_events[] = {
405417
#define SNB_UNCORE_PCI_IMC_DATA_WRITES_BASE 0x5054
406418
#define SNB_UNCORE_PCI_IMC_CTR_BASE SNB_UNCORE_PCI_IMC_DATA_READS_BASE
407419

420+
/* BW break down- legacy counters */
421+
#define SNB_UNCORE_PCI_IMC_GT_REQUESTS 0x3
422+
#define SNB_UNCORE_PCI_IMC_GT_REQUESTS_BASE 0x5040
423+
#define SNB_UNCORE_PCI_IMC_IA_REQUESTS 0x4
424+
#define SNB_UNCORE_PCI_IMC_IA_REQUESTS_BASE 0x5044
425+
#define SNB_UNCORE_PCI_IMC_IO_REQUESTS 0x5
426+
#define SNB_UNCORE_PCI_IMC_IO_REQUESTS_BASE 0x5048
427+
408428
enum perf_snb_uncore_imc_freerunning_types {
409-
SNB_PCI_UNCORE_IMC_DATA = 0,
429+
SNB_PCI_UNCORE_IMC_DATA_READS = 0,
430+
SNB_PCI_UNCORE_IMC_DATA_WRITES,
431+
SNB_PCI_UNCORE_IMC_GT_REQUESTS,
432+
SNB_PCI_UNCORE_IMC_IA_REQUESTS,
433+
SNB_PCI_UNCORE_IMC_IO_REQUESTS,
434+
410435
SNB_PCI_UNCORE_IMC_FREERUNNING_TYPE_MAX,
411436
};
412437

413438
static struct freerunning_counters snb_uncore_imc_freerunning[] = {
414-
[SNB_PCI_UNCORE_IMC_DATA] = { SNB_UNCORE_PCI_IMC_DATA_READS_BASE, 0x4, 0x0, 2, 32 },
439+
[SNB_PCI_UNCORE_IMC_DATA_READS] = { SNB_UNCORE_PCI_IMC_DATA_READS_BASE,
440+
0x0, 0x0, 1, 32 },
441+
[SNB_PCI_UNCORE_IMC_DATA_READS] = { SNB_UNCORE_PCI_IMC_DATA_WRITES_BASE,
442+
0x0, 0x0, 1, 32 },
443+
[SNB_PCI_UNCORE_IMC_GT_REQUESTS] = { SNB_UNCORE_PCI_IMC_GT_REQUESTS_BASE,
444+
0x0, 0x0, 1, 32 },
445+
[SNB_PCI_UNCORE_IMC_IA_REQUESTS] = { SNB_UNCORE_PCI_IMC_IA_REQUESTS_BASE,
446+
0x0, 0x0, 1, 32 },
447+
[SNB_PCI_UNCORE_IMC_IO_REQUESTS] = { SNB_UNCORE_PCI_IMC_IO_REQUESTS_BASE,
448+
0x0, 0x0, 1, 32 },
415449
};
416450

417451
static struct attribute *snb_uncore_imc_formats_attr[] = {
@@ -525,6 +559,18 @@ static int snb_uncore_imc_event_init(struct perf_event *event)
525559
base = SNB_UNCORE_PCI_IMC_DATA_WRITES_BASE;
526560
idx = UNCORE_PMC_IDX_FREERUNNING;
527561
break;
562+
case SNB_UNCORE_PCI_IMC_GT_REQUESTS:
563+
base = SNB_UNCORE_PCI_IMC_GT_REQUESTS_BASE;
564+
idx = UNCORE_PMC_IDX_FREERUNNING;
565+
break;
566+
case SNB_UNCORE_PCI_IMC_IA_REQUESTS:
567+
base = SNB_UNCORE_PCI_IMC_IA_REQUESTS_BASE;
568+
idx = UNCORE_PMC_IDX_FREERUNNING;
569+
break;
570+
case SNB_UNCORE_PCI_IMC_IO_REQUESTS:
571+
base = SNB_UNCORE_PCI_IMC_IO_REQUESTS_BASE;
572+
idx = UNCORE_PMC_IDX_FREERUNNING;
573+
break;
528574
default:
529575
return -EINVAL;
530576
}
@@ -598,7 +644,7 @@ static struct intel_uncore_ops snb_uncore_imc_ops = {
598644

599645
static struct intel_uncore_type snb_uncore_imc = {
600646
.name = "imc",
601-
.num_counters = 2,
647+
.num_counters = 5,
602648
.num_boxes = 1,
603649
.num_freerunning_types = SNB_PCI_UNCORE_IMC_FREERUNNING_TYPE_MAX,
604650
.mmio_map_size = SNB_UNCORE_PCI_IMC_MAP_SIZE,

0 commit comments

Comments
 (0)