Skip to content

Commit 0f25f2c

Browse files
committed
Merge branch 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 kgdb fixlet from Ingo Molnar: "A single debugging related commit: compress the memory usage of a kgdb data structure" * 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/kgdb: Replace bool_int_array[NR_CPUS] with bitmap
2 parents f323c49 + 0d44975 commit 0f25f2c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

arch/x86/kernel/kgdb.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,26 +511,31 @@ single_step_cont(struct pt_regs *regs, struct die_args *args)
511511
return NOTIFY_STOP;
512512
}
513513

514-
static int was_in_debug_nmi[NR_CPUS];
514+
static DECLARE_BITMAP(was_in_debug_nmi, NR_CPUS);
515515

516516
static int kgdb_nmi_handler(unsigned int cmd, struct pt_regs *regs)
517517
{
518+
int cpu;
519+
518520
switch (cmd) {
519521
case NMI_LOCAL:
520522
if (atomic_read(&kgdb_active) != -1) {
521523
/* KGDB CPU roundup */
522-
kgdb_nmicallback(raw_smp_processor_id(), regs);
523-
was_in_debug_nmi[raw_smp_processor_id()] = 1;
524+
cpu = raw_smp_processor_id();
525+
kgdb_nmicallback(cpu, regs);
526+
set_bit(cpu, was_in_debug_nmi);
524527
touch_nmi_watchdog();
528+
525529
return NMI_HANDLED;
526530
}
527531
break;
528532

529533
case NMI_UNKNOWN:
530-
if (was_in_debug_nmi[raw_smp_processor_id()]) {
531-
was_in_debug_nmi[raw_smp_processor_id()] = 0;
534+
cpu = raw_smp_processor_id();
535+
536+
if (__test_and_clear_bit(cpu, was_in_debug_nmi))
532537
return NMI_HANDLED;
533-
}
538+
534539
break;
535540
default:
536541
/* do nothing */

0 commit comments

Comments
 (0)