[tip:perf/urgent] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code

2017-01-11 Thread tip-bot for Prarit Bhargava
Commit-ID:  6d6daa20945f3f598e56e18d1f926c08754f5801
Gitweb: http://git.kernel.org/tip/6d6daa20945f3f598e56e18d1f926c08754f5801
Author: Prarit Bhargava 
AuthorDate: Thu, 5 Jan 2017 10:09:25 -0500
Committer:  Thomas Gleixner 
CommitDate: Wed, 11 Jan 2017 12:13:21 +0100

perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init 
code

hswep_uncore_cpu_init() uses a hardcoded physical package id 0 for the boot
cpu. This works as long as the boot CPU is actually on the physical package
0, which is normaly the case after power on / reboot.

But it fails with a NULL pointer dereference when a kdump kernel is started
on a secondary socket which has a different physical package id because the
locigal package translation for physical package 0 does not exist.

Use the logical package id of the boot cpu instead of hard coded 0.

[ tglx: Rewrote changelog once more ]

Fixes: cf6d445f6897 ("perf/x86/uncore: Track packages, not per CPU data")
Signed-off-by: Prarit Bhargava 
Cc: Alexander Shishkin 
Cc: Arnaldo Carvalho de Melo 
Cc: Borislav Petkov 
Cc: H. Peter Anvin 
Cc: Harish Chegondi 
Cc: Jiri Olsa 
Cc: Kan Liang 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: Vince Weaver 
Cc: sta...@vger.kernel.org
Link: 
http://lkml.kernel.org/r/1483628965-2890-1-git-send-email-pra...@redhat.com
Signed-off-by: Ingo Molnar 
Signed-off-by: Thomas Gleixner 
---
 arch/x86/events/intel/uncore_snbep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/uncore_snbep.c 
b/arch/x86/events/intel/uncore_snbep.c
index e6832be..dae2fed 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -2686,7 +2686,7 @@ static struct intel_uncore_type *hswep_msr_uncores[] = {
 
 void hswep_uncore_cpu_init(void)
 {
-   int pkg = topology_phys_to_logical_pkg(0);
+   int pkg = boot_cpu_data.logical_proc_id;
 
if (hswep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
hswep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;


[tip:perf/urgent] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code

2017-01-11 Thread tip-bot for Prarit Bhargava
Commit-ID:  6d6daa20945f3f598e56e18d1f926c08754f5801
Gitweb: http://git.kernel.org/tip/6d6daa20945f3f598e56e18d1f926c08754f5801
Author: Prarit Bhargava 
AuthorDate: Thu, 5 Jan 2017 10:09:25 -0500
Committer:  Thomas Gleixner 
CommitDate: Wed, 11 Jan 2017 12:13:21 +0100

perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init 
code

hswep_uncore_cpu_init() uses a hardcoded physical package id 0 for the boot
cpu. This works as long as the boot CPU is actually on the physical package
0, which is normaly the case after power on / reboot.

But it fails with a NULL pointer dereference when a kdump kernel is started
on a secondary socket which has a different physical package id because the
locigal package translation for physical package 0 does not exist.

Use the logical package id of the boot cpu instead of hard coded 0.

[ tglx: Rewrote changelog once more ]

Fixes: cf6d445f6897 ("perf/x86/uncore: Track packages, not per CPU data")
Signed-off-by: Prarit Bhargava 
Cc: Alexander Shishkin 
Cc: Arnaldo Carvalho de Melo 
Cc: Borislav Petkov 
Cc: H. Peter Anvin 
Cc: Harish Chegondi 
Cc: Jiri Olsa 
Cc: Kan Liang 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: Vince Weaver 
Cc: sta...@vger.kernel.org
Link: 
http://lkml.kernel.org/r/1483628965-2890-1-git-send-email-pra...@redhat.com
Signed-off-by: Ingo Molnar 
Signed-off-by: Thomas Gleixner 
---
 arch/x86/events/intel/uncore_snbep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/uncore_snbep.c 
b/arch/x86/events/intel/uncore_snbep.c
index e6832be..dae2fed 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -2686,7 +2686,7 @@ static struct intel_uncore_type *hswep_msr_uncores[] = {
 
 void hswep_uncore_cpu_init(void)
 {
-   int pkg = topology_phys_to_logical_pkg(0);
+   int pkg = boot_cpu_data.logical_proc_id;
 
if (hswep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
hswep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;


[tip:perf/urgent] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code

2017-01-08 Thread tip-bot for Prarit Bhargava
Commit-ID:  fa37361e291bfe528872b9aef5c8644a3fc7ff20
Gitweb: http://git.kernel.org/tip/fa37361e291bfe528872b9aef5c8644a3fc7ff20
Author: Prarit Bhargava 
AuthorDate: Thu, 5 Jan 2017 10:09:25 -0500
Committer:  Ingo Molnar 
CommitDate: Sat, 7 Jan 2017 08:54:38 +0100

perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init 
code

On multi-socket Intel v3 processor systems (aka Haswell), kdump can crash
in hswep_uncore_cpu_init():

  BUG: unable to handle kernel paging request at 006563a1
  IP: [] hswep_uncore_cpu_init+0x52/0xa0

The crash was introduced by the following commit:

  9d85eb9119f4 ("x86/smpboot: Make logical package management more robust")

... which patch corrected the physical ID to logical ID mapping of the
threads if the kdumped panic occurs on any socket other than socket 0.

But hswep_uncore_cpu_init() is hard coded for physical socket 0 and if the
system is kdump'ing on any other socket the logical package value will be
incorrect - crashing the kdump kernel.

The code should not use 0 as the physical ID, and should use the boot
CPU's logical package ID in this calculation.

Signed-off-by: Prarit Bhargava 
Cc: Alexander Shishkin 
Cc: Arnaldo Carvalho de Melo 
Cc: Borislav Petkov 
Cc: H. Peter Anvin 
Cc: Harish Chegondi 
Cc: Jiri Olsa 
Cc: Kan Liang 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: Vince Weaver 
Link: 
http://lkml.kernel.org/r/1483628965-2890-1-git-send-email-pra...@redhat.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/events/intel/uncore_snbep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/uncore_snbep.c 
b/arch/x86/events/intel/uncore_snbep.c
index e6832be..dae2fed 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -2686,7 +2686,7 @@ static struct intel_uncore_type *hswep_msr_uncores[] = {
 
 void hswep_uncore_cpu_init(void)
 {
-   int pkg = topology_phys_to_logical_pkg(0);
+   int pkg = boot_cpu_data.logical_proc_id;
 
if (hswep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
hswep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;


[tip:perf/urgent] perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code

2017-01-08 Thread tip-bot for Prarit Bhargava
Commit-ID:  fa37361e291bfe528872b9aef5c8644a3fc7ff20
Gitweb: http://git.kernel.org/tip/fa37361e291bfe528872b9aef5c8644a3fc7ff20
Author: Prarit Bhargava 
AuthorDate: Thu, 5 Jan 2017 10:09:25 -0500
Committer:  Ingo Molnar 
CommitDate: Sat, 7 Jan 2017 08:54:38 +0100

perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init 
code

On multi-socket Intel v3 processor systems (aka Haswell), kdump can crash
in hswep_uncore_cpu_init():

  BUG: unable to handle kernel paging request at 006563a1
  IP: [] hswep_uncore_cpu_init+0x52/0xa0

The crash was introduced by the following commit:

  9d85eb9119f4 ("x86/smpboot: Make logical package management more robust")

... which patch corrected the physical ID to logical ID mapping of the
threads if the kdumped panic occurs on any socket other than socket 0.

But hswep_uncore_cpu_init() is hard coded for physical socket 0 and if the
system is kdump'ing on any other socket the logical package value will be
incorrect - crashing the kdump kernel.

The code should not use 0 as the physical ID, and should use the boot
CPU's logical package ID in this calculation.

Signed-off-by: Prarit Bhargava 
Cc: Alexander Shishkin 
Cc: Arnaldo Carvalho de Melo 
Cc: Borislav Petkov 
Cc: H. Peter Anvin 
Cc: Harish Chegondi 
Cc: Jiri Olsa 
Cc: Kan Liang 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: Vince Weaver 
Link: 
http://lkml.kernel.org/r/1483628965-2890-1-git-send-email-pra...@redhat.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/events/intel/uncore_snbep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/uncore_snbep.c 
b/arch/x86/events/intel/uncore_snbep.c
index e6832be..dae2fed 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -2686,7 +2686,7 @@ static struct intel_uncore_type *hswep_msr_uncores[] = {
 
 void hswep_uncore_cpu_init(void)
 {
-   int pkg = topology_phys_to_logical_pkg(0);
+   int pkg = boot_cpu_data.logical_proc_id;
 
if (hswep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
hswep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;