lkml.org 
[lkml]   [2018]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] x86/platform/x86: Fix count of CHas on multi-pci-segment arches
Date
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().

The fix is to check for either the bus number or segment number to change.

Signed-off-by: Gary Kroening <gary.kroening@hpe.com>
Signed-off-by: Mike Travis <mike.travis@hpe.com>
Reviewed-by: Dimitri Sivanich <dimitri.sivanich@hpe.com>
---
arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

--- linux-4.4.orig/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
+++ linux-4.4/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
@@ -3525,15 +3525,19 @@ static struct intel_uncore_type *skx_msr
static int skx_count_chabox(void)
{
struct pci_dev *chabox_dev = NULL;
- int bus, count = 0;
+ int bus, seg, count = 0;

while (1) {
chabox_dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x208d, chabox_dev);
if (!chabox_dev)
break;
- if (count == 0)
+ if (count == 0) {
bus = chabox_dev->bus->number;
- if (bus != chabox_dev->bus->number)
+ seg = pci_domain_nr(chabox_dev->bus);
+ }
+ /* check for change in both bus and domain/segment */
+ if (bus != chabox_dev->bus->number ||
+ seg != pci_domain_nr(chabox_dev->bus))
break;
count++;
}
\
 
 \ /
  Last update: 2018-03-07 21:35    [W:0.109 / U:1.668 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site