Title: [8999] trunk/kernel/kgdb.c: [!no_src_qa!]Fix bug[#6044] sync 2 cores when switching.
- Revision
- 8999
- Author
- sonicz
- Date
- 2010-07-21 06:55:07 -0400 (Wed, 21 Jul 2010)
Log Message
[!no_src_qa!]Fix bug[#6044] sync 2 cores when switching.
Also avoid doing real switch to current core.
Modified Paths
Diff
Modified: trunk/kernel/kgdb.c (8998 => 8999)
--- trunk/kernel/kgdb.c 2010-07-21 09:23:13 UTC (rev 8998)
+++ trunk/kernel/kgdb.c 2010-07-21 10:55:07 UTC (rev 8999)
@@ -1068,7 +1068,8 @@
#ifdef CONFIG_SMP
/* switch cpu only when it is not a thread query request */
if ((arch_kgdb_ops.flags & KGDB_THR_PROC_SWAP) &&
- !ks->thr_query && ks->kgdb_usethreadid < -1) {
+ !ks->thr_query && ks->kgdb_usethreadid < -1 &&
+ (-ks->kgdb_usethreadid - 2) != raw_smp_processor_id()) {
kgdb_roundup_cpu(raw_smp_processor_id(), 0);
kgdb_contthread = kgdb_usethread;
return 1;
@@ -1520,23 +1521,18 @@
atomic_dec(&cpu_in_kgdb[ks->cpu]);
- if (!kgdb_single_step) {
- /* wake up next master cpu when do real cpu switch */
- if ((arch_kgdb_ops.flags & KGDB_THR_PROC_SWAP) &&
- kgdb_contthread) {
- i = -(ks->kgdb_usethreadid + 2);
+ if (!kgdb_single_step &&
+ !((arch_kgdb_ops.flags & KGDB_THR_PROC_SWAP) &&
+ kgdb_contthread)) {
+ for (i = NR_CPUS-1; i >= 0; i--)
atomic_dec(&passive_cpu_wait[i]);
- } else {
- for (i = NR_CPUS-1; i >= 0; i--)
- atomic_dec(&passive_cpu_wait[i]);
- /*
- * Wait till all the CPUs have quit
- * from the debugger.
- */
- for_each_online_cpu(i) {
- while (atomic_read(&cpu_in_kgdb[i]))
- cpu_relax();
- }
+ /*
+ * Wait till all the CPUs have quit
+ * from the debugger.
+ */
+ for_each_online_cpu(i) {
+ while (atomic_read(&cpu_in_kgdb[i]))
+ cpu_relax();
}
}
@@ -1552,6 +1548,14 @@
tracing_on();
/* Free kgdb_active */
atomic_set(&kgdb_active, -1);
+ /* wake up next master cpu when do real cpu switch */
+ if ((arch_kgdb_ops.flags & KGDB_THR_PROC_SWAP) &&
+ kgdb_contthread) {
+ i = -(ks->kgdb_usethreadid + 2);
+ atomic_dec(&passive_cpu_wait[i]);
+ while (atomic_read(&kgdb_active) == -1)
+ cpu_relax();
+ }
touch_softlockup_watchdog_sync();
clocksource_touch_watchdog();
local_irq_restore(flags);
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits