@@ -386,6 +386,10 @@ static void threshold_restart_bank(void *_tr)
386
386
struct thresh_restart * tr = _tr ;
387
387
u32 hi , lo ;
388
388
389
+ /* sysfs write might race against an offline operation */
390
+ if (this_cpu_read (threshold_banks ))
391
+ return ;
392
+
389
393
rdmsr (tr -> b -> address , lo , hi );
390
394
391
395
if (tr -> b -> threshold_limit < (hi & THRESHOLD_MAX ))
@@ -1085,7 +1089,8 @@ store_interrupt_enable(struct threshold_block *b, const char *buf, size_t size)
1085
1089
memset (& tr , 0 , sizeof (tr ));
1086
1090
tr .b = b ;
1087
1091
1088
- smp_call_function_single (b -> cpu , threshold_restart_bank , & tr , 1 );
1092
+ if (smp_call_function_single (b -> cpu , threshold_restart_bank , & tr , 1 ))
1093
+ return - ENODEV ;
1089
1094
1090
1095
return size ;
1091
1096
}
@@ -1109,7 +1114,8 @@ store_threshold_limit(struct threshold_block *b, const char *buf, size_t size)
1109
1114
b -> threshold_limit = new ;
1110
1115
tr .b = b ;
1111
1116
1112
- smp_call_function_single (b -> cpu , threshold_restart_bank , & tr , 1 );
1117
+ if (smp_call_function_single (b -> cpu , threshold_restart_bank , & tr , 1 ))
1118
+ return - ENODEV ;
1113
1119
1114
1120
return size ;
1115
1121
}
@@ -1118,7 +1124,9 @@ static ssize_t show_error_count(struct threshold_block *b, char *buf)
1118
1124
{
1119
1125
u32 lo , hi ;
1120
1126
1121
- rdmsr_on_cpu (b -> cpu , b -> address , & lo , & hi );
1127
+ /* CPU might be offline by now */
1128
+ if (rdmsr_on_cpu (b -> cpu , b -> address , & lo , & hi ))
1129
+ return - ENODEV ;
1122
1130
1123
1131
return sprintf (buf , "%u\n" , ((hi & THRESHOLD_MAX ) -
1124
1132
(THRESHOLD_MAX - b -> threshold_limit )));
0 commit comments