diff options
author | Tony Luck <tony.luck@intel.com> | 2017-07-26 00:14:45 +0300 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2017-08-01 23:41:28 +0300 |
commit | 9f52425ba303d91c8370719e91d7e578bfdf309f (patch) | |
tree | cfd5e19f66e8da55111ce8b390a5beac2d7924a7 /arch/x86/kernel/cpu/intel_rdt_monitor.c | |
parent | 895c663ecef16c8138e20a7d5c052e0fcc400241 (diff) | |
download | linux-9f52425ba303d91c8370719e91d7e578bfdf309f.tar.xz |
x86/intel_rdt/mbm: Basic counting of MBM events (total and local)
Check CPUID bits for whether each of the MBM events is supported.
Allocate space for each RMID for each counter in each domain to save
previous MSR counter value and running total of data.
Create files in each of the monitor directories.
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Vikas Shivappa <vikas.shivappa@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: ravi.v.shankar@intel.com
Cc: fenghua.yu@intel.com
Cc: peterz@infradead.org
Cc: eranian@google.com
Cc: vikas.shivappa@intel.com
Cc: ak@linux.intel.com
Cc: davidcc@google.com
Cc: reinette.chatre@intel.com
Link: http://lkml.kernel.org/r/1501017287-28083-27-git-send-email-vikas.shivappa@linux.intel.com
Diffstat (limited to 'arch/x86/kernel/cpu/intel_rdt_monitor.c')
-rw-r--r-- | arch/x86/kernel/cpu/intel_rdt_monitor.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/intel_rdt_monitor.c b/arch/x86/kernel/cpu/intel_rdt_monitor.c index 6ae5cf58e50a..ef0358b59102 100644 --- a/arch/x86/kernel/cpu/intel_rdt_monitor.c +++ b/arch/x86/kernel/cpu/intel_rdt_monitor.c @@ -296,7 +296,8 @@ void free_rmid(u32 rmid) static int __mon_event_count(u32 rmid, struct rmid_read *rr) { - u64 tval; + u64 chunks, shift, tval; + struct mbm_state *m; tval = __rmid_read(rmid, rr->evtid); if (tval & (RMID_VAL_ERROR | RMID_VAL_UNAVAIL)) { @@ -307,6 +308,12 @@ static int __mon_event_count(u32 rmid, struct rmid_read *rr) case QOS_L3_OCCUP_EVENT_ID: rr->val += tval; return 0; + case QOS_L3_MBM_TOTAL_EVENT_ID: + m = &rr->d->mbm_total[rmid]; + break; + case QOS_L3_MBM_LOCAL_EVENT_ID: + m = &rr->d->mbm_local[rmid]; + break; default: /* * Code would never reach here because @@ -314,6 +321,14 @@ static int __mon_event_count(u32 rmid, struct rmid_read *rr) */ return -EINVAL; } + shift = 64 - MBM_CNTR_WIDTH; + chunks = (tval << shift) - (m->prev_msr << shift); + chunks >>= shift; + m->chunks += chunks; + m->prev_msr = tval; + + rr->val += m->chunks; + return 0; } /* @@ -377,6 +392,16 @@ static struct mon_evt llc_occupancy_event = { .evtid = QOS_L3_OCCUP_EVENT_ID, }; +static struct mon_evt mbm_total_event = { + .name = "mbm_total_bytes", + .evtid = QOS_L3_MBM_TOTAL_EVENT_ID, +}; + +static struct mon_evt mbm_local_event = { + .name = "mbm_local_bytes", + .evtid = QOS_L3_MBM_LOCAL_EVENT_ID, +}; + /* * Initialize the event list for the resource. * @@ -390,6 +415,10 @@ static void l3_mon_evt_init(struct rdt_resource *r) if (is_llc_occupancy_enabled()) list_add_tail(&llc_occupancy_event.list, &r->evt_list); + if (is_mbm_total_enabled()) + list_add_tail(&mbm_total_event.list, &r->evt_list); + if (is_mbm_local_enabled()) + list_add_tail(&mbm_local_event.list, &r->evt_list); } int rdt_get_mon_l3_config(struct rdt_resource *r) |