File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -1442,15 +1442,20 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
1442
1442
1443
1443
int mce_threshold_remove_device (unsigned int cpu )
1444
1444
{
1445
+ struct threshold_bank * * bp = this_cpu_read (threshold_banks );
1445
1446
unsigned int bank ;
1446
1447
1448
+ if (!bp )
1449
+ return 0 ;
1450
+
1447
1451
for (bank = 0 ; bank < per_cpu (mce_num_banks , cpu ); ++ bank ) {
1448
1452
if (!(per_cpu (bank_map , cpu ) & (1 << bank )))
1449
1453
continue ;
1450
1454
threshold_remove_bank (cpu , bank );
1451
1455
}
1452
- kfree (per_cpu (threshold_banks , cpu ));
1453
- per_cpu (threshold_banks , cpu ) = NULL ;
1456
+ /* Clear the pointer before freeing the memory */
1457
+ this_cpu_write (threshold_banks , NULL );
1458
+ kfree (bp );
1454
1459
return 0 ;
1455
1460
}
1456
1461
@@ -1461,6 +1466,9 @@ int mce_threshold_create_device(unsigned int cpu)
1461
1466
struct threshold_bank * * bp ;
1462
1467
int err = 0 ;
1463
1468
1469
+ if (!mce_flags .amd_threshold )
1470
+ return 0 ;
1471
+
1464
1472
bp = per_cpu (threshold_banks , cpu );
1465
1473
if (bp )
1466
1474
return 0 ;
Original file line number Diff line number Diff line change @@ -1756,6 +1756,7 @@ static void __mcheck_cpu_init_early(struct cpuinfo_x86 *c)
1756
1756
mce_flags .overflow_recov = !!cpu_has (c , X86_FEATURE_OVERFLOW_RECOV );
1757
1757
mce_flags .succor = !!cpu_has (c , X86_FEATURE_SUCCOR );
1758
1758
mce_flags .smca = !!cpu_has (c , X86_FEATURE_SMCA );
1759
+ mce_flags .amd_threshold = 1 ;
1759
1760
1760
1761
if (mce_flags .smca ) {
1761
1762
msr_ops .ctl = smca_ctl_reg ;
Original file line number Diff line number Diff line change @@ -148,17 +148,20 @@ struct mce_vendor_flags {
148
148
* Recovery. It indicates support for data poisoning in HW and deferred
149
149
* error interrupts.
150
150
*/
151
- succor : 1 ,
151
+ succor : 1 ,
152
152
153
153
/*
154
154
* (AMD) SMCA: This bit indicates support for Scalable MCA which expands
155
155
* the register space for each MCA bank and also increases number of
156
156
* banks. Also, to accommodate the new banks and registers, the MCA
157
157
* register space is moved to a new MSR range.
158
158
*/
159
- smca : 1 ,
159
+ smca : 1 ,
160
160
161
- __reserved_0 : 61 ;
161
+ /* AMD-style error thresholding banks present. */
162
+ amd_threshold : 1 ,
163
+
164
+ __reserved_0 : 60 ;
162
165
};
163
166
164
167
extern struct mce_vendor_flags mce_flags ;
You can’t perform that action at this time.
0 commit comments