提交 e4e69222 编写于 作者: K Kim Phillips 提交者: Caspar Zhang

perf/amd/uncore: Make L3 thread mask code more readable

fix #29035100

commit 9689dbbeaea884d19e3085439c6a247ef986b2af upstream

Convert the l3_thread_slice_mask() function to use the more readable
topology_* helper functions, more intuitive variable names like shift
and thread_mask, and BIT_ULL().

No functional changes.
Signed-off-by: NKim Phillips <kim.phillips@amd.com>
Signed-off-by: NBorislav Petkov <bp@suse.de>
Acked-by: NPeter Zijlstra <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200313231024.17601-2-kim.phillips@amd.comSigned-off-by: NPeng Wang <rocking@linux.alibaba.com>
Reviewed-by: NArtie Ding <artie.ding@linux.alibaba.com>
上级 4c6a1c15
......@@ -188,13 +188,16 @@ static void amd_uncore_del(struct perf_event *event, int flags)
*/
static u64 l3_thread_slice_mask(int cpu)
{
int thread = 2 * (cpu_data(cpu).cpu_core_id % 4);
u64 thread_mask, core = topology_core_id(cpu);
unsigned int shift, thread = 0;
if (smp_num_siblings > 1)
thread += cpu_data(cpu).apicid & 1;
if (topology_smt_supported() && !topology_is_primary_thread(cpu))
thread = 1;
return (1ULL << (AMD64_L3_THREAD_SHIFT + thread) &
AMD64_L3_THREAD_MASK) | AMD64_L3_SLICE_MASK;
shift = AMD64_L3_THREAD_SHIFT + 2 * (core % 4) + thread;
thread_mask = BIT_ULL(shift);
return AMD64_L3_SLICE_MASK | thread_mask;
}
static int amd_uncore_event_init(struct perf_event *event)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册