x86, MCE, AMD: Make error_count read only
authorBorislav Petkov <borislav.petkov@amd.com>
Fri, 27 Apr 2012 13:37:25 +0000 (15:37 +0200)
committerBorislav Petkov <borislav.petkov@amd.com>
Thu, 7 Jun 2012 10:43:47 +0000 (12:43 +0200)
Until now, writing to error count caused the code to reset the
thresholding bank to the current thresholding limit and start counting
errors from the beginning.

This is misleading and unclear, and can be accomplished by writing the
old thresholding limit into ->threshold_limit.

Make error_count read-only with the functionality to show the current
error count.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
arch/x86/kernel/cpu/mcheck/mce_amd.c

index a7204ef37223a875a43127ee7cf1158f6b9b73c4..e5ed2c7cb4de6f046e31df4708a7f57b51e25353 100644 (file)
@@ -369,14 +369,10 @@ static ssize_t show_error_count(struct threshold_block *b, char *buf)
                                     (THRESHOLD_MAX - b->threshold_limit)));
 }
 
-static ssize_t store_error_count(struct threshold_block *b,
-                                const char *buf, size_t count)
-{
-       struct thresh_restart tr = { .b = b, .reset = 1, .old_limit = 0 };
-
-       smp_call_function_single(b->cpu, threshold_restart_bank, &tr, 1);
-       return 1;
-}
+static struct threshold_attr error_count = {
+       .attr = {.name = __stringify(error_count), .mode = 0444 },
+       .show = show_error_count,
+};
 
 #define RW_ATTR(val)                                                   \
 static struct threshold_attr val = {                                   \
@@ -387,7 +383,6 @@ static struct threshold_attr val = {                                        \
 
 RW_ATTR(interrupt_enable);
 RW_ATTR(threshold_limit);
-RW_ATTR(error_count);
 
 static struct attribute *default_attrs[] = {
        &threshold_limit.attr,