]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
perf/x86/intel/uncore: Remove uncore extra PCI dev HSWEP_PCI_PCU_3
authorKan Liang <kan.liang@linux.intel.com>
Thu, 15 Apr 2021 21:22:43 +0000 (14:22 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 7 May 2021 07:54:11 +0000 (09:54 +0200)
commit657fb5f3758d15e8eb400a4deb40522203548db1
treee65245d690402ba0e6e7533efceca42c46f86aec
parent70bd6fa1254a32278708f96ccd7bbcc853fcefc1
perf/x86/intel/uncore: Remove uncore extra PCI dev HSWEP_PCI_PCU_3

BugLink: https://bugs.launchpad.net/bugs/1927535
[ Upstream commit 9d480158ee86ad606d3a8baaf81e6b71acbfd7d5 ]

There may be a kernel panic on the Haswell server and the Broadwell
server, if the snbep_pci2phy_map_init() return error.

The uncore_extra_pci_dev[HSWEP_PCI_PCU_3] is used in the cpu_init() to
detect the existence of the SBOX, which is a MSR type of PMON unit.
The uncore_extra_pci_dev is allocated in the uncore_pci_init(). If the
snbep_pci2phy_map_init() returns error, perf doesn't initialize the
PCI type of the PMON units, so the uncore_extra_pci_dev will not be
allocated. But perf may continue initializing the MSR type of PMON
units. A null dereference kernel panic will be triggered.

The sockets in a Haswell server or a Broadwell server are identical.
Only need to detect the existence of the SBOX once.
Current perf probes all available PCU devices and stores them into the
uncore_extra_pci_dev. It's unnecessary.
Use the pci_get_device() to replace the uncore_extra_pci_dev. Only
detect the existence of the SBOX on the first available PCU device once.

Factor out hswep_has_limit_sbox(), since the Haswell server and the
Broadwell server uses the same way to detect the existence of the SBOX.

Add some macros to replace the magic number.

Fixes: 5306c31c5733 ("perf/x86/uncore/hsw-ep: Handle systems with only two SBOXes")
Reported-by: Steve Wahl <steve.wahl@hpe.com>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Steve Wahl <steve.wahl@hpe.com>
Link: https://lkml.kernel.org/r/1618521764-100923-1-git-send-email-kan.liang@linux.intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
arch/x86/events/intel/uncore_snbep.c