diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2009-03-17 20:10:25 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-18 02:03:12 -0400 |
commit | a6b6a14e0c60561f2902b078bd28d0e61defad70 (patch) | |
tree | 6f16edcaeb0c5dfc9f9cf768baac75124f7912c5 /arch/x86 | |
parent | 514ec49a5f5146a6c0ade1a688787acf13617868 (diff) |
x86: use smp_call_function_single() in arch/x86/kernel/cpu/mcheck/mce_amd_64.c
Attempting to rid us of the problematic work_on_cpu(). Just use
smp_call_function_single() here.
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
LKML-Reference: <20090318042217.EF3F1DDF39@ozlabs.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce_amd_64.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c index c5a32f92d07e..7d01be868870 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c | |||
@@ -92,7 +92,8 @@ struct thresh_restart { | |||
92 | }; | 92 | }; |
93 | 93 | ||
94 | /* must be called with correct cpu affinity */ | 94 | /* must be called with correct cpu affinity */ |
95 | static long threshold_restart_bank(void *_tr) | 95 | /* Called via smp_call_function_single() */ |
96 | static void threshold_restart_bank(void *_tr) | ||
96 | { | 97 | { |
97 | struct thresh_restart *tr = _tr; | 98 | struct thresh_restart *tr = _tr; |
98 | u32 mci_misc_hi, mci_misc_lo; | 99 | u32 mci_misc_hi, mci_misc_lo; |
@@ -119,7 +120,6 @@ static long threshold_restart_bank(void *_tr) | |||
119 | 120 | ||
120 | mci_misc_hi |= MASK_COUNT_EN_HI; | 121 | mci_misc_hi |= MASK_COUNT_EN_HI; |
121 | wrmsr(tr->b->address, mci_misc_lo, mci_misc_hi); | 122 | wrmsr(tr->b->address, mci_misc_lo, mci_misc_hi); |
122 | return 0; | ||
123 | } | 123 | } |
124 | 124 | ||
125 | /* cpu init entry point, called from mce.c with preempt off */ | 125 | /* cpu init entry point, called from mce.c with preempt off */ |
@@ -279,7 +279,7 @@ static ssize_t store_interrupt_enable(struct threshold_block *b, | |||
279 | tr.b = b; | 279 | tr.b = b; |
280 | tr.reset = 0; | 280 | tr.reset = 0; |
281 | tr.old_limit = 0; | 281 | tr.old_limit = 0; |
282 | work_on_cpu(b->cpu, threshold_restart_bank, &tr); | 282 | smp_call_function_single(b->cpu, threshold_restart_bank, &tr, 1); |
283 | 283 | ||
284 | return end - buf; | 284 | return end - buf; |
285 | } | 285 | } |
@@ -301,23 +301,32 @@ static ssize_t store_threshold_limit(struct threshold_block *b, | |||
301 | tr.b = b; | 301 | tr.b = b; |
302 | tr.reset = 0; | 302 | tr.reset = 0; |
303 | 303 | ||
304 | work_on_cpu(b->cpu, threshold_restart_bank, &tr); | 304 | smp_call_function_single(b->cpu, threshold_restart_bank, &tr, 1); |
305 | 305 | ||
306 | return end - buf; | 306 | return end - buf; |
307 | } | 307 | } |
308 | 308 | ||
309 | static long local_error_count(void *_b) | 309 | struct threshold_block_cross_cpu { |
310 | struct threshold_block *tb; | ||
311 | long retval; | ||
312 | }; | ||
313 | |||
314 | static void local_error_count_handler(void *_tbcc) | ||
310 | { | 315 | { |
311 | struct threshold_block *b = _b; | 316 | struct threshold_block_cross_cpu *tbcc = _tbcc; |
317 | struct threshold_block *b = tbcc->tb; | ||
312 | u32 low, high; | 318 | u32 low, high; |
313 | 319 | ||
314 | rdmsr(b->address, low, high); | 320 | rdmsr(b->address, low, high); |
315 | return (high & 0xFFF) - (THRESHOLD_MAX - b->threshold_limit); | 321 | tbcc->retval = (high & 0xFFF) - (THRESHOLD_MAX - b->threshold_limit); |
316 | } | 322 | } |
317 | 323 | ||
318 | static ssize_t show_error_count(struct threshold_block *b, char *buf) | 324 | static ssize_t show_error_count(struct threshold_block *b, char *buf) |
319 | { | 325 | { |
320 | return sprintf(buf, "%lx\n", work_on_cpu(b->cpu, local_error_count, b)); | 326 | struct threshold_block_cross_cpu tbcc = { .tb = b, }; |
327 | |||
328 | smp_call_function_single(b->cpu, local_error_count_handler, &tbcc, 1); | ||
329 | return sprintf(buf, "%lx\n", tbcc.retval); | ||
321 | } | 330 | } |
322 | 331 | ||
323 | static ssize_t store_error_count(struct threshold_block *b, | 332 | static ssize_t store_error_count(struct threshold_block *b, |
@@ -325,7 +334,7 @@ static ssize_t store_error_count(struct threshold_block *b, | |||
325 | { | 334 | { |
326 | struct thresh_restart tr = { .b = b, .reset = 1, .old_limit = 0 }; | 335 | struct thresh_restart tr = { .b = b, .reset = 1, .old_limit = 0 }; |
327 | 336 | ||
328 | work_on_cpu(b->cpu, threshold_restart_bank, &tr); | 337 | smp_call_function_single(b->cpu, threshold_restart_bank, &tr, 1); |
329 | return 1; | 338 | return 1; |
330 | } | 339 | } |
331 | 340 | ||
@@ -394,7 +403,7 @@ static __cpuinit int allocate_threshold_blocks(unsigned int cpu, | |||
394 | if ((bank >= NR_BANKS) || (block >= NR_BLOCKS)) | 403 | if ((bank >= NR_BANKS) || (block >= NR_BLOCKS)) |
395 | return 0; | 404 | return 0; |
396 | 405 | ||
397 | if (rdmsr_safe(address, &low, &high)) | 406 | if (rdmsr_safe_on_cpu(cpu, address, &low, &high)) |
398 | return 0; | 407 | return 0; |
399 | 408 | ||
400 | if (!(high & MASK_VALID_HI)) { | 409 | if (!(high & MASK_VALID_HI)) { |
@@ -458,12 +467,11 @@ out_free: | |||
458 | return err; | 467 | return err; |
459 | } | 468 | } |
460 | 469 | ||
461 | static __cpuinit long local_allocate_threshold_blocks(void *_bank) | 470 | static __cpuinit long |
471 | local_allocate_threshold_blocks(int cpu, unsigned int bank) | ||
462 | { | 472 | { |
463 | unsigned int *bank = _bank; | 473 | return allocate_threshold_blocks(cpu, bank, 0, |
464 | 474 | MSR_IA32_MC0_MISC + bank * 4); | |
465 | return allocate_threshold_blocks(smp_processor_id(), *bank, 0, | ||
466 | MSR_IA32_MC0_MISC + *bank * 4); | ||
467 | } | 475 | } |
468 | 476 | ||
469 | /* symlinks sibling shared banks to first core. first core owns dir/files. */ | 477 | /* symlinks sibling shared banks to first core. first core owns dir/files. */ |
@@ -526,7 +534,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) | |||
526 | 534 | ||
527 | per_cpu(threshold_banks, cpu)[bank] = b; | 535 | per_cpu(threshold_banks, cpu)[bank] = b; |
528 | 536 | ||
529 | err = work_on_cpu(cpu, local_allocate_threshold_blocks, &bank); | 537 | err = local_allocate_threshold_blocks(cpu, bank); |
530 | if (err) | 538 | if (err) |
531 | goto out_free; | 539 | goto out_free; |
532 | 540 | ||