Commit 4ecea694 authored by Pu Wen's avatar Pu Wen
Browse files

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 26559114
("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: 26559114 ("perf/x86/uncore: Add L3 PMU support for Hygon family 18h model 6h")
Signed-off-by: default avatarPu Wen <puwen@hygon.cn>
parent e33d399c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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 ?