Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/cqm: Share PQR_ASSOC related data between CQM and CAT

PQR_ASSOC MSR contains the RMID used for preformance monitoring of cache
occupancy and memory bandwidth. The upper 32bit of this MSR contain the
CLOSID for cache allocation. So we need to share the information between
the two facilities.

Move the rdt data structure declaration into the shared header file and
make the per cpu data structure containing the MSR values global.

Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Cc: "Ravi V Shankar" <ravi.v.shankar@intel.com>
Cc: "Tony Luck" <tony.luck@intel.com>
Cc: "David Carrillo-Cisneros" <davidcc@google.com>
Cc: "Sai Prakhya" <sai.praneeth.prakhya@intel.com>
Cc: "Peter Zijlstra" <peterz@infradead.org>
Cc: "Stephane Eranian" <eranian@google.com>
Cc: "Dave Hansen" <dave.hansen@intel.com>
Cc: "Shaohua Li" <shli@fb.com>
Cc: "Nilay Vaish" <nilayvaish@gmail.com>
Cc: "Vikas Shivappa" <vikas.shivappa@linux.intel.com>
Cc: "Ingo Molnar" <mingo@elte.hu>
Cc: "Borislav Petkov" <bp@suse.de>
Cc: "H. Peter Anvin" <h.peter.anvin@intel.com>
Link: http://lkml.kernel.org/r/1477142405-32078-10-git-send-email-fenghua.yu@intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Fenghua Yu and committed by
Thomas Gleixner
6b281569 c1c7c3f9

+22 -20
+1 -20
arch/x86/events/intel/cqm.c
··· 24 24 static bool cqm_enabled, mbm_enabled; 25 25 unsigned int mbm_socket_max; 26 26 27 - /** 28 - * struct intel_pqr_state - State cache for the PQR MSR 29 - * @rmid: The cached Resource Monitoring ID 30 - * @closid: The cached Class Of Service ID 31 - * @rmid_usecnt: The usage counter for rmid 32 - * 33 - * The upper 32 bits of MSR_IA32_PQR_ASSOC contain closid and the 34 - * lower 10 bits rmid. The update to MSR_IA32_PQR_ASSOC always 35 - * contains both parts, so we need to cache them. 36 - * 37 - * The cache also helps to avoid pointless updates if the value does 38 - * not change. 39 - */ 40 - struct intel_pqr_state { 41 - u32 rmid; 42 - u32 closid; 43 - int rmid_usecnt; 44 - }; 45 - 46 27 /* 47 28 * The cached intel_pqr_state is strictly per CPU and can never be 48 29 * updated from a remote CPU. Both functions which modify the state 49 30 * (intel_cqm_event_start and intel_cqm_event_stop) are called with 50 31 * interrupts disabled, which is sufficient for the protection. 51 32 */ 52 - static DEFINE_PER_CPU(struct intel_pqr_state, pqr_state); 33 + DEFINE_PER_CPU(struct intel_pqr_state, pqr_state); 53 34 static struct hrtimer *mbm_timers; 54 35 /** 55 36 * struct sample - mbm event's (local or total) data
+21
arch/x86/include/asm/intel_rdt_common.h
··· 3 3 4 4 #define MSR_IA32_PQR_ASSOC 0x0c8f 5 5 6 + /** 7 + * struct intel_pqr_state - State cache for the PQR MSR 8 + * @rmid: The cached Resource Monitoring ID 9 + * @closid: The cached Class Of Service ID 10 + * @rmid_usecnt: The usage counter for rmid 11 + * 12 + * The upper 32 bits of MSR_IA32_PQR_ASSOC contain closid and the 13 + * lower 10 bits rmid. The update to MSR_IA32_PQR_ASSOC always 14 + * contains both parts, so we need to cache them. 15 + * 16 + * The cache also helps to avoid pointless updates if the value does 17 + * not change. 18 + */ 19 + struct intel_pqr_state { 20 + u32 rmid; 21 + u32 closid; 22 + int rmid_usecnt; 23 + }; 24 + 25 + DECLARE_PER_CPU(struct intel_pqr_state, pqr_state); 26 + 6 27 #endif /* _ASM_X86_INTEL_RDT_COMMON_H */