aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKan Liang <kan.liang@intel.com>2018-05-03 14:25:11 -0400
committerIngo Molnar <mingo@kernel.org>2018-05-31 06:36:28 -0400
commit0f519f0352e37e7d71bdce5559517c74a35f6e33 (patch)
tree140f651dbd2e06e04eab4383dccbfe8010f4f4fc
parent0e0162dfcd1fbe4c711ee86f24f966c318999603 (diff)
perf/x86/intel/uncore: Support IIO free-running counters on SKX
As of Skylake Server, there are a number of free running counters in each IIO Box that collect counts of per-box IO clocks and per-port Input/Output x BW/Utilization. The free running counters cannot be part of the existing IIO BOX, because, quoting from Peter Zijlstra: "This will result in some (probably) unexpected scheduling artifacts. Probably the only way to really cure that is to have the free running counters in their own PMU and not share with the GP counters of this box." So let's add a new PMU for the free running counters, as suggested. The free-running counter is read-only and always active. Counting will be suspended only when the IIO Box is powered down. There are three types of IIO free-running counters on Skylake server, IO CLOCKS counter, BANDWIDTH counters and UTILIZATION counters. IO CLOCKS counter is a clock of IIO box. BANDWIDTH counters are to count inbound(PCIe->CPU)/outbound(CPU->PCIe) bandwidth. UTILIZATION counters are to count input/output utilization. The bit width of the free-running counters is 36-bits. Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Kan Liang <kan.liang@intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: acme@kernel.org Cc: eranian@google.com Link: http://lkml.kernel.org/r/1525371913-10597-6-git-send-email-kan.liang@intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/events/intel/uncore_snbep.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 77076a102e34..87dc0263a2e1 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -3522,6 +3522,87 @@ static struct intel_uncore_type skx_uncore_iio = {
3522 .format_group = &skx_uncore_iio_format_group, 3522 .format_group = &skx_uncore_iio_format_group,
3523}; 3523};
3524 3524
3525enum perf_uncore_iio_freerunning_type_id {
3526 SKX_IIO_MSR_IOCLK = 0,
3527 SKX_IIO_MSR_BW = 1,
3528 SKX_IIO_MSR_UTIL = 2,
3529
3530 SKX_IIO_FREERUNNING_TYPE_MAX,
3531};
3532
3533
3534static struct freerunning_counters skx_iio_freerunning[] = {
3535 [SKX_IIO_MSR_IOCLK] = { 0xa45, 0x1, 0x20, 1, 36 },
3536 [SKX_IIO_MSR_BW] = { 0xb00, 0x1, 0x10, 8, 36 },
3537 [SKX_IIO_MSR_UTIL] = { 0xb08, 0x1, 0x10, 8, 36 },
3538};
3539
3540static struct uncore_event_desc skx_uncore_iio_freerunning_events[] = {
3541 /* Free-Running IO CLOCKS Counter */
3542 INTEL_UNCORE_EVENT_DESC(ioclk, "event=0xff,umask=0x10"),
3543 /* Free-Running IIO BANDWIDTH Counters */
3544 INTEL_UNCORE_EVENT_DESC(bw_in_port0, "event=0xff,umask=0x20"),
3545 INTEL_UNCORE_EVENT_DESC(bw_in_port0.scale, "3.814697266e-6"),
3546 INTEL_UNCORE_EVENT_DESC(bw_in_port0.unit, "MiB"),
3547 INTEL_UNCORE_EVENT_DESC(bw_in_port1, "event=0xff,umask=0x21"),
3548 INTEL_UNCORE_EVENT_DESC(bw_in_port1.scale, "3.814697266e-6"),
3549 INTEL_UNCORE_EVENT_DESC(bw_in_port1.unit, "MiB"),
3550 INTEL_UNCORE_EVENT_DESC(bw_in_port2, "event=0xff,umask=0x22"),
3551 INTEL_UNCORE_EVENT_DESC(bw_in_port2.scale, "3.814697266e-6"),
3552 INTEL_UNCORE_EVENT_DESC(bw_in_port2.unit, "MiB"),
3553 INTEL_UNCORE_EVENT_DESC(bw_in_port3, "event=0xff,umask=0x23"),
3554 INTEL_UNCORE_EVENT_DESC(bw_in_port3.scale, "3.814697266e-6"),
3555 INTEL_UNCORE_EVENT_DESC(bw_in_port3.unit, "MiB"),
3556 INTEL_UNCORE_EVENT_DESC(bw_out_port0, "event=0xff,umask=0x24"),
3557 INTEL_UNCORE_EVENT_DESC(bw_out_port0.scale, "3.814697266e-6"),
3558 INTEL_UNCORE_EVENT_DESC(bw_out_port0.unit, "MiB"),
3559 INTEL_UNCORE_EVENT_DESC(bw_out_port1, "event=0xff,umask=0x25"),
3560 INTEL_UNCORE_EVENT_DESC(bw_out_port1.scale, "3.814697266e-6"),
3561 INTEL_UNCORE_EVENT_DESC(bw_out_port1.unit, "MiB"),
3562 INTEL_UNCORE_EVENT_DESC(bw_out_port2, "event=0xff,umask=0x26"),
3563 INTEL_UNCORE_EVENT_DESC(bw_out_port2.scale, "3.814697266e-6"),
3564 INTEL_UNCORE_EVENT_DESC(bw_out_port2.unit, "MiB"),
3565 INTEL_UNCORE_EVENT_DESC(bw_out_port3, "event=0xff,umask=0x27"),
3566 INTEL_UNCORE_EVENT_DESC(bw_out_port3.scale, "3.814697266e-6"),
3567 INTEL_UNCORE_EVENT_DESC(bw_out_port3.unit, "MiB"),
3568 /* Free-running IIO UTILIZATION Counters */
3569 INTEL_UNCORE_EVENT_DESC(util_in_port0, "event=0xff,umask=0x30"),
3570 INTEL_UNCORE_EVENT_DESC(util_out_port0, "event=0xff,umask=0x31"),
3571 INTEL_UNCORE_EVENT_DESC(util_in_port1, "event=0xff,umask=0x32"),
3572 INTEL_UNCORE_EVENT_DESC(util_out_port1, "event=0xff,umask=0x33"),
3573 INTEL_UNCORE_EVENT_DESC(util_in_port2, "event=0xff,umask=0x34"),
3574 INTEL_UNCORE_EVENT_DESC(util_out_port2, "event=0xff,umask=0x35"),
3575 INTEL_UNCORE_EVENT_DESC(util_in_port3, "event=0xff,umask=0x36"),
3576 INTEL_UNCORE_EVENT_DESC(util_out_port3, "event=0xff,umask=0x37"),
3577 { /* end: all zeroes */ },
3578};
3579
3580static struct intel_uncore_ops skx_uncore_iio_freerunning_ops = {
3581 .read_counter = uncore_msr_read_counter,
3582};
3583
3584static struct attribute *skx_uncore_iio_freerunning_formats_attr[] = {
3585 &format_attr_event.attr,
3586 &format_attr_umask.attr,
3587 NULL,
3588};
3589
3590static const struct attribute_group skx_uncore_iio_freerunning_format_group = {
3591 .name = "format",
3592 .attrs = skx_uncore_iio_freerunning_formats_attr,
3593};
3594
3595static struct intel_uncore_type skx_uncore_iio_free_running = {
3596 .name = "iio_free_running",
3597 .num_counters = 17,
3598 .num_boxes = 6,
3599 .num_freerunning_types = SKX_IIO_FREERUNNING_TYPE_MAX,
3600 .freerunning = skx_iio_freerunning,
3601 .ops = &skx_uncore_iio_freerunning_ops,
3602 .event_descs = skx_uncore_iio_freerunning_events,
3603 .format_group = &skx_uncore_iio_freerunning_format_group,
3604};
3605
3525static struct attribute *skx_uncore_formats_attr[] = { 3606static struct attribute *skx_uncore_formats_attr[] = {
3526 &format_attr_event.attr, 3607 &format_attr_event.attr,
3527 &format_attr_umask.attr, 3608 &format_attr_umask.attr,
@@ -3595,6 +3676,7 @@ static struct intel_uncore_type *skx_msr_uncores[] = {
3595 &skx_uncore_ubox, 3676 &skx_uncore_ubox,
3596 &skx_uncore_chabox, 3677 &skx_uncore_chabox,
3597 &skx_uncore_iio, 3678 &skx_uncore_iio,
3679 &skx_uncore_iio_free_running,
3598 &skx_uncore_irp, 3680 &skx_uncore_irp,
3599 &skx_uncore_pcu, 3681 &skx_uncore_pcu,
3600 NULL, 3682 NULL,