Patch "perf/x86/intel/uncore: Fix multi-domain PCI CHA enumeration bug on Skylake servers" has been added to the 4.9-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
perf/x86/intel/uncore: Fix multi-domain PCI CHA enumeration bug on Skylake servers
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
perf-x86-intel-uncore-fix-multi-domain-pci-cha-enumeration-bug-on-skylake-servers.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
320b0651f32b830add6497fcdcfdcb6ae8c7b8a0Mon Sep 17 00:00:00 2001
From: Kan Liang <[email protected]>
Date: Tue, 13 Mar 2018 11:51:34 -0700
Subject: perf/x86/intel/uncore: Fix multi-domain PCI CHA enumeration bug on Skylake servers
From: Kan Liang <[email protected]>
commit 320b0651f32b830add6497fcdcfdcb6ae8c7b8a0 upstream.
The number of CHAs is miscalculated on multi-domain PCI Skylake server systems, resulting in an uncore driver initialization error.
Gary Kroening explains:
"For systems with a single PCI segment, it is sufficient to look for the
bus number to change in order to determine that all of the CHa's have been counted for a single socket.
However, for multi PCI segment systems, each socket is given a new segment and the bus number does NOT change. So looking only for the bus number to change ends up counting all of the CHa's on all sockets in the system. This leads to writing CPU MSRs beyond a valid range and causes an error in ivbep_uncore_msr_init_box()."
To fix this bug, query the number of CHAs from the CAPID6 register:
it should read bits 27:0 in the CAPID6 register located at Device 30, Function 3, Offset 0x9C. These 28 bits form a bit vector of available LLC slices and the CHAs that manage those slices.
--- arch/x86/events/intel/uncore_snbep.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-)
arch/x86/events/intel/uncore_snbep.c +17 -14
@@ -3522,24 +3522,27 @@ static struct intel_uncore_type *skx_msr NULL, }; +/* +* To determine the number of CHAs, it should read bits 27:0 in the CAPID6 +* register which located at Device 30, Function 3, Offset 0x9C. PCI ID 0x2083. +*/ +#define SKX_CAPID6 0x9c +#define SKX_CHA_BIT_MASK GENMASK(27, 0) +static int skx_count_chabox (void ) { -struct pci_dev *chabox_dev =NULL ; -int bus, count =0 ; +struct pci_dev *dev =NULL ; +u32 val =0 ; -while (1 ) { - chabox_dev =pci_get_device (PCI_VENDOR_ID_INTEL ,0x208d , chabox_dev); -if (!chabox_dev) -break ; -if (count ==0 ) - bus = chabox_dev->bus->number; -if (bus != chabox_dev->bus->number) -break ; - count++; - } + dev =pci_get_device (PCI_VENDOR_ID_INTEL ,0x2083 , dev); +if (!dev) + goto out; -pci_dev_put (chabox_dev); -return count; +pci_read_config_dword (dev,SKX_CAPID6 , &val); + val &=SKX_CHA_BIT_MASK ; +out: +pci_dev_put (dev); +return hweight32 (val); }void skx_uncore_cpu_init (void )
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/perf-x86-intel-uncore-fix-skylake-upi-event-format.patch queue-4.9/perf-x86-intel-uncore-fix-multi-domain-pci-cha-enumeration-bug-on-skylake-servers.patch queue-4.9/perf-x86-intel-don-t-accidentally-clear-high-bits-in-bdw_limit_period.patch