Commit 9d48015
perf/x86/intel/uncore: Remove uncore extra PCI dev HSWEP_PCI_PCU_3
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: 5306c31 ("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.com1 parent bf05bf1 commit 9d48015
1 file changed
Lines changed: 26 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1159 | 1159 | | |
1160 | 1160 | | |
1161 | 1161 | | |
1162 | | - | |
1163 | 1162 | | |
1164 | 1163 | | |
1165 | 1164 | | |
| |||
2857 | 2856 | | |
2858 | 2857 | | |
2859 | 2858 | | |
2860 | | - | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
2861 | 2864 | | |
2862 | | - | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
2863 | 2874 | | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
2864 | 2880 | | |
2865 | 2881 | | |
2866 | 2882 | | |
2867 | 2883 | | |
2868 | | - | |
2869 | | - | |
2870 | | - | |
2871 | | - | |
2872 | | - | |
2873 | | - | |
2874 | | - | |
2875 | | - | |
| 2884 | + | |
| 2885 | + | |
2876 | 2886 | | |
2877 | 2887 | | |
2878 | 2888 | | |
| |||
3135 | 3145 | | |
3136 | 3146 | | |
3137 | 3147 | | |
3138 | | - | |
3139 | | - | |
3140 | | - | |
3141 | | - | |
3142 | | - | |
3143 | 3148 | | |
3144 | 3149 | | |
3145 | 3150 | | |
| |||
3231 | 3236 | | |
3232 | 3237 | | |
3233 | 3238 | | |
| 3239 | + | |
| 3240 | + | |
3234 | 3241 | | |
3235 | 3242 | | |
3236 | | - | |
3237 | | - | |
3238 | 3243 | | |
3239 | 3244 | | |
3240 | 3245 | | |
3241 | 3246 | | |
3242 | | - | |
3243 | | - | |
3244 | | - | |
3245 | 3247 | | |
3246 | | - | |
3247 | | - | |
3248 | | - | |
3249 | | - | |
3250 | | - | |
3251 | | - | |
3252 | | - | |
3253 | | - | |
3254 | | - | |
| 3248 | + | |
| 3249 | + | |
| 3250 | + | |
3255 | 3251 | | |
3256 | 3252 | | |
3257 | 3253 | | |
| |||
3472 | 3468 | | |
3473 | 3469 | | |
3474 | 3470 | | |
3475 | | - | |
3476 | | - | |
3477 | | - | |
3478 | | - | |
3479 | | - | |
3480 | 3471 | | |
3481 | 3472 | | |
3482 | 3473 | | |
| |||
0 commit comments