From 4ecea6948835edd490f853d65ef452f1d43b1788 Mon Sep 17 00:00:00 2001 From: Pu Wen Date: Mon, 13 May 2024 14:38:16 +0800 Subject: [PATCH] perf/x86/uncore: Create L3 event strictly to the CPU vendor hygon inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I9OYEP CVE: NA --------------------------- In function amd_uncore_l3_ctx_init(), there is already a family check existed before the part Hygon added in commit 26559114c45e ("perf/x86/uncore: Add L3 PMU support for Hygon family 18h model 6h"), and it will take effect for Hygon which is not expected, otherwise the following process will produce error messages as follow: "amd uncore: 4 HYGON amd df counters detected" "sysfs: cannot create duplicate filename '/devices/amd 13/format/event'" So restrict the family check to the specific CPU vendor. Fixes: 26559114c45e ("perf/x86/uncore: Add L3 PMU support for Hygon family 18h model 6h") Signed-off-by: Pu Wen --- arch/x86/events/amd/uncore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index 20ac3ad69764..39e7a63fd6b9 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c @@ -846,7 +846,8 @@ int amd_uncore_l3_ctx_init(struct amd_uncore *uncore, unsigned int cpu) pmu->rdpmc_base = RDPMC_BASE_LLC; pmu->group = amd_uncore_ctx_gid(uncore, cpu); - if (boot_cpu_data.x86 >= 0x17) { + if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD && + boot_cpu_data.x86 >= 0x17) { *l3_attr++ = &format_attr_event8.attr; *l3_attr++ = &format_attr_umask8.attr; *l3_attr++ = boot_cpu_data.x86 >= 0x19 ? -- Gitee