diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2010-04-02 15:58:18 -0400 |
---|---|---|
committer | Jason Wessel <jason.wessel@windriver.com> | 2010-04-02 15:58:18 -0400 |
commit | ae6bf53e0255c8ab04b6fe31806e318432570e3c (patch) | |
tree | d4726e48bfe5e0dd6ce4061551af3d0518efbe83 | |
parent | 62fae312197a8fbcd3727261d59f5a6bd0dbf158 (diff) |
kgdb: use atomic_inc and atomic_dec instead of atomic_set
Memory barriers should be used for the kgdb cpu synchronization. The
atomic_set() does not imply a memory barrier.
Reported-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
-rw-r--r-- | kernel/kgdb.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/kernel/kgdb.c b/kernel/kgdb.c index 6882c047452d..2f7f454605c2 100644 --- a/kernel/kgdb.c +++ b/kernel/kgdb.c | |||
@@ -1379,8 +1379,7 @@ acquirelock: | |||
1379 | * Make sure the above info reaches the primary CPU before | 1379 | * Make sure the above info reaches the primary CPU before |
1380 | * our cpu_in_kgdb[] flag setting does: | 1380 | * our cpu_in_kgdb[] flag setting does: |
1381 | */ | 1381 | */ |
1382 | smp_wmb(); | 1382 | atomic_inc(&cpu_in_kgdb[cpu]); |
1383 | atomic_set(&cpu_in_kgdb[cpu], 1); | ||
1384 | 1383 | ||
1385 | /* | 1384 | /* |
1386 | * CPU will loop if it is a slave or request to become a kgdb | 1385 | * CPU will loop if it is a slave or request to become a kgdb |
@@ -1400,7 +1399,7 @@ return_normal: | |||
1400 | */ | 1399 | */ |
1401 | if (arch_kgdb_ops.correct_hw_break) | 1400 | if (arch_kgdb_ops.correct_hw_break) |
1402 | arch_kgdb_ops.correct_hw_break(); | 1401 | arch_kgdb_ops.correct_hw_break(); |
1403 | atomic_set(&cpu_in_kgdb[cpu], 0); | 1402 | atomic_dec(&cpu_in_kgdb[cpu]); |
1404 | touch_softlockup_watchdog_sync(); | 1403 | touch_softlockup_watchdog_sync(); |
1405 | clocksource_touch_watchdog(); | 1404 | clocksource_touch_watchdog(); |
1406 | local_irq_restore(flags); | 1405 | local_irq_restore(flags); |
@@ -1449,7 +1448,7 @@ return_normal: | |||
1449 | */ | 1448 | */ |
1450 | if (!kgdb_single_step) { | 1449 | if (!kgdb_single_step) { |
1451 | for (i = 0; i < NR_CPUS; i++) | 1450 | for (i = 0; i < NR_CPUS; i++) |
1452 | atomic_set(&passive_cpu_wait[i], 1); | 1451 | atomic_inc(&passive_cpu_wait[i]); |
1453 | } | 1452 | } |
1454 | 1453 | ||
1455 | #ifdef CONFIG_SMP | 1454 | #ifdef CONFIG_SMP |
@@ -1483,11 +1482,11 @@ return_normal: | |||
1483 | if (kgdb_io_ops->post_exception) | 1482 | if (kgdb_io_ops->post_exception) |
1484 | kgdb_io_ops->post_exception(); | 1483 | kgdb_io_ops->post_exception(); |
1485 | 1484 | ||
1486 | atomic_set(&cpu_in_kgdb[ks->cpu], 0); | 1485 | atomic_dec(&cpu_in_kgdb[ks->cpu]); |
1487 | 1486 | ||
1488 | if (!kgdb_single_step) { | 1487 | if (!kgdb_single_step) { |
1489 | for (i = NR_CPUS-1; i >= 0; i--) | 1488 | for (i = NR_CPUS-1; i >= 0; i--) |
1490 | atomic_set(&passive_cpu_wait[i], 0); | 1489 | atomic_dec(&passive_cpu_wait[i]); |
1491 | /* | 1490 | /* |
1492 | * Wait till all the CPUs have quit | 1491 | * Wait till all the CPUs have quit |
1493 | * from the debugger. | 1492 | * from the debugger. |
@@ -1736,11 +1735,11 @@ EXPORT_SYMBOL_GPL(kgdb_unregister_io_module); | |||
1736 | */ | 1735 | */ |
1737 | void kgdb_breakpoint(void) | 1736 | void kgdb_breakpoint(void) |
1738 | { | 1737 | { |
1739 | atomic_set(&kgdb_setting_breakpoint, 1); | 1738 | atomic_inc(&kgdb_setting_breakpoint); |
1740 | wmb(); /* Sync point before breakpoint */ | 1739 | wmb(); /* Sync point before breakpoint */ |
1741 | arch_kgdb_breakpoint(); | 1740 | arch_kgdb_breakpoint(); |
1742 | wmb(); /* Sync point after breakpoint */ | 1741 | wmb(); /* Sync point after breakpoint */ |
1743 | atomic_set(&kgdb_setting_breakpoint, 0); | 1742 | atomic_dec(&kgdb_setting_breakpoint); |
1744 | } | 1743 | } |
1745 | EXPORT_SYMBOL_GPL(kgdb_breakpoint); | 1744 | EXPORT_SYMBOL_GPL(kgdb_breakpoint); |
1746 | 1745 | ||