Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fcf01044 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull kgdb updates from Daniel Thompson:
 "Mostly clean ups although while Doug's was chasing down a odd lockdep
  warning he also did some work to improved debugger resilience when
  some CPUs fail to respond to the round up request.

  The main changes are:

   - Fixing a lockdep warning on architectures that cannot use an NMI
     for the round up plus related changes to make CPU round up and all
     CPU backtrace more resilient.

   - Constify the arch ops tables

   - A couple of other small clean ups

  Two of the three patchsets here include changes that spill over into
  arch/. Changes in the arch space are relatively narrow in scope (and
  directly related to kgdb). Didn't get comprehensive acks but all
  impacted maintainers were Cc:ed in good time"

* tag 'kgdb-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/danielt/linux:
  kgdb/treewide: constify struct kgdb_arch arch_kgdb_ops
  mips/kgdb: prepare arch_kgdb_ops for constness
  kdb: use bool for binary state indicators
  kdb: Don't back trace on a cpu that didn't round up
  kgdb: Don't round up a CPU that failed rounding up before
  kgdb: Fix kgdb_roundup_cpus() for arches who used smp_call_function()
  kgdb: Remove irq flags from roundup
parents fbea8c7c cc028297
Loading
Loading
Loading
Loading
+3 −9
Original line number Original line Diff line number Diff line
@@ -192,19 +192,13 @@ void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip)
	instruction_pointer(regs) = ip;
	instruction_pointer(regs) = ip;
}
}


static void kgdb_call_nmi_hook(void *ignored)
void kgdb_call_nmi_hook(void *ignored)
{
{
	/* Default implementation passes get_irq_regs() but we don't */
	kgdb_nmicallback(raw_smp_processor_id(), NULL);
	kgdb_nmicallback(raw_smp_processor_id(), NULL);
}
}


void kgdb_roundup_cpus(unsigned long flags)
const struct kgdb_arch arch_kgdb_ops = {
{
	local_irq_enable();
	smp_call_function(kgdb_call_nmi_hook, NULL, 0);
	local_irq_disable();
}

struct kgdb_arch arch_kgdb_ops = {
	/* breakpoint instruction: TRAP_S 0x3 */
	/* breakpoint instruction: TRAP_S 0x3 */
#ifdef CONFIG_CPU_BIG_ENDIAN
#ifdef CONFIG_CPU_BIG_ENDIAN
	.gdb_bpt_instr		= {0x78, 0x7e},
	.gdb_bpt_instr		= {0x78, 0x7e},
+1 −13
Original line number Original line Diff line number Diff line
@@ -170,18 +170,6 @@ static struct undef_hook kgdb_compiled_brkpt_hook = {
	.fn			= kgdb_compiled_brk_fn
	.fn			= kgdb_compiled_brk_fn
};
};


static void kgdb_call_nmi_hook(void *ignored)
{
       kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs());
}

void kgdb_roundup_cpus(unsigned long flags)
{
       local_irq_enable();
       smp_call_function(kgdb_call_nmi_hook, NULL, 0);
       local_irq_disable();
}

static int __kgdb_notify(struct die_args *args, unsigned long cmd)
static int __kgdb_notify(struct die_args *args, unsigned long cmd)
{
{
	struct pt_regs *regs = args->regs;
	struct pt_regs *regs = args->regs;
@@ -274,7 +262,7 @@ int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt)
 * and we handle the normal undef case within the do_undefinstr
 * and we handle the normal undef case within the do_undefinstr
 * handler.
 * handler.
 */
 */
struct kgdb_arch arch_kgdb_ops = {
const struct kgdb_arch arch_kgdb_ops = {
#ifndef __ARMEB__
#ifndef __ARMEB__
	.gdb_bpt_instr		= {0xfe, 0xde, 0xff, 0xe7}
	.gdb_bpt_instr		= {0xfe, 0xde, 0xff, 0xe7}
#else /* ! __ARMEB__ */
#else /* ! __ARMEB__ */
+1 −13
Original line number Original line Diff line number Diff line
@@ -284,18 +284,6 @@ static struct step_hook kgdb_step_hook = {
	.fn		= kgdb_step_brk_fn
	.fn		= kgdb_step_brk_fn
};
};


static void kgdb_call_nmi_hook(void *ignored)
{
	kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs());
}

void kgdb_roundup_cpus(unsigned long flags)
{
	local_irq_enable();
	smp_call_function(kgdb_call_nmi_hook, NULL, 0);
	local_irq_disable();
}

static int __kgdb_notify(struct die_args *args, unsigned long cmd)
static int __kgdb_notify(struct die_args *args, unsigned long cmd)
{
{
	struct pt_regs *regs = args->regs;
	struct pt_regs *regs = args->regs;
@@ -357,7 +345,7 @@ void kgdb_arch_exit(void)
	unregister_die_notifier(&kgdb_notifier);
	unregister_die_notifier(&kgdb_notifier);
}
}


struct kgdb_arch arch_kgdb_ops;
const struct kgdb_arch arch_kgdb_ops;


int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt)
int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt)
{
{
+1 −1
Original line number Original line Diff line number Diff line
@@ -129,7 +129,7 @@ void kgdb_arch_exit(void)
	/* Nothing to do */
	/* Nothing to do */
}
}


struct kgdb_arch arch_kgdb_ops = {
const struct kgdb_arch arch_kgdb_ops = {
	/* Breakpoint instruction: trapa #2 */
	/* Breakpoint instruction: trapa #2 */
	.gdb_bpt_instr = { 0x57, 0x20 },
	.gdb_bpt_instr = { 0x57, 0x20 },
};
};
+1 −33
Original line number Original line Diff line number Diff line
@@ -83,7 +83,7 @@ struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = {
	{ "syscall_nr", GDB_SIZEOF_REG, offsetof(struct pt_regs, syscall_nr)},
	{ "syscall_nr", GDB_SIZEOF_REG, offsetof(struct pt_regs, syscall_nr)},
};
};


struct kgdb_arch arch_kgdb_ops = {
const struct kgdb_arch arch_kgdb_ops = {
	/* trap0(#0xDB) 0x0cdb0054 */
	/* trap0(#0xDB) 0x0cdb0054 */
	.gdb_bpt_instr = {0x54, 0x00, 0xdb, 0x0c},
	.gdb_bpt_instr = {0x54, 0x00, 0xdb, 0x0c},
};
};
@@ -115,38 +115,6 @@ void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
	instruction_pointer(regs) = pc;
	instruction_pointer(regs) = pc;
}
}


#ifdef CONFIG_SMP

/**
 * kgdb_roundup_cpus - Get other CPUs into a holding pattern
 * @flags: Current IRQ state
 *
 * On SMP systems, we need to get the attention of the other CPUs
 * and get them be in a known state.  This should do what is needed
 * to get the other CPUs to call kgdb_wait(). Note that on some arches,
 * the NMI approach is not used for rounding up all the CPUs. For example,
 * in case of MIPS, smp_call_function() is used to roundup CPUs. In
 * this case, we have to make sure that interrupts are enabled before
 * calling smp_call_function(). The argument to this function is
 * the flags that will be used when restoring the interrupts. There is
 * local_irq_save() call before kgdb_roundup_cpus().
 *
 * On non-SMP systems, this is not called.
 */

static void hexagon_kgdb_nmi_hook(void *ignored)
{
	kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs());
}

void kgdb_roundup_cpus(unsigned long flags)
{
	local_irq_enable();
	smp_call_function(hexagon_kgdb_nmi_hook, NULL, 0);
	local_irq_disable();
}
#endif



/*  Not yet working  */
/*  Not yet working  */
void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs,
void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs,
Loading