beautification of debugger_active usage
Subsystems (2)
PATCH 1/1 beautification of debugger_active usage
Just a beautification of using debugger_active for checking the debugger state.
Signed-off-by Jan Kiszka <[email protected]>
--- arch/x86/kernel/kgdb.c | 6 +++--- include/linux/kgdb.h | 7 ++++++- kernel/kgdb.c | 8 ++++---- kernel/sched.c | 7 +------ 4 files changed, 14 insertions(+), 14 deletions(-)
arch/x86/kernel/kgdb.c +3 -3
@@ -442,14 +442,14 @@ static int kgdb_notify(struct notifier_bswitch (cmd) {case DIE_NMI : -if (atomic_read (&debugger_active)) { +if (kgdb_active ()) {/* KGDB CPU roundup */ kgdb_nmihook (raw_smp_processor_id (), regs);return NOTIFY_STOP ; }return NOTIFY_DONE ;case DIE_NMI_IPI : -if (atomic_read (&debugger_active)) { +if (kgdb_active ()) {/* KGDB CPU roundup */ if (kgdb_nmihook (raw_smp_processor_id (), regs))return NOTIFY_DONE ;
@@ -457,7 +457,7 @@ static int kgdb_notify(struct notifier_b }return NOTIFY_DONE ;case DIE_NMIWATCHDOG : -if (atomic_read (&debugger_active)) { +if (kgdb_active ()) {/* KGDB CPU roundup */ kgdb_nmihook (raw_smp_processor_id (), regs);return NOTIFY_STOP ;
include/linux/kgdb.h +6 -1
@@ -285,8 +285,13 @@ int kgdb_nmihook(int cpu, void *regs);extern int debugger_step;extern atomic_t debugger_active; +static inline int kgdb_active (void ) +{ +return (atomic_read (&debugger_active) !=0 ); +} +#else /* !CONFIG_KGDB */ -static const atomic_t debugger_active =ATOMIC_INIT (0 ); +#define kgdb_active () 0#endif /* !CONFIG_KGDB */ #endif /* _KGDB_H_ */
kernel/kgdb.c +4 -4
@@ -774,7 +774,7 @@ static void kgdb_wait(struct pt_regs *re* gaurd in case the master CPU had not been selected if * this was an entry via nmi. */ -while (!atomic_read (&debugger_active)) +while (!kgdb_active ())cpu_relax ();/* Wait till master CPU goes completely into the debugger. */
@@ -1901,7 +1901,7 @@ int kgdb_nmihook(int cpu, void *regs)static int kgdb_panic_notify (struct notifier_block *self,unsigned long cmd,void *ptr) { -if (atomic_read (&debugger_active) !=0 ) { +if (kgdb_active ()) {printk (KERN_ERR "KGDB: Cannot handle panic while" "debugger active\n" );dump_stack ();
@@ -1923,7 +1923,7 @@ void kgdb_console_write(struct console */* If we're debugging, or KGDB has not connected, don't try * and print. */ -if (!kgdb_connected ||atomic_read (&debugger_active) !=0 ) +if (!kgdb_connected ||kgdb_active ())return ;local_irq_save (flags);
@@ -2104,7 +2104,7 @@ kgdb_notify_reboot(struct notifier_block* If we're debugging, or KGDB has not connected, don't try * and print: */ -if (!kgdb_connected ||atomic_read (&debugger_active) !=0 ) +if (!kgdb_connected ||kgdb_active ())return 0 ;if (code ==SYS_RESTART || code ==SYS_HALT || code ==SYS_POWER_OFF ) {
kernel/sched.c +1 -6
@@ -7264,12 +7264,7 @@ void __might_sleep(char *file, int line)#ifdef in_atomicstatic unsigned long prev_jiffy;/* ratelimiting */ -#ifdef CONFIG_KGDB -if (atomic_read (&debugger_active)) -return ; -#endif - -if ((in_atomic () ||irqs_disabled ()) && +if ((in_atomic () ||irqs_disabled ()) && !kgdb_active () && system_state ==SYSTEM_RUNNING && !oops_in_progress) {if (time_before (jiffies, prev_jiffy +HZ ) && prev_jiffy)return ;
Jason Wessel
maintainerQuoted 13 lines · Jan Kiszka
Just a beautification of using
debugger_activefor checking the debugger state.Signed-off-by Jan Kiszka <[email protected]>--- arch/x86/kernel/kgdb.c | 6 +++--- include/linux/kgdb.h | 7 ++++++- kernel/kgdb.c | 8 ++++---- kernel/sched.c | 7 +------ 4 files changed, 14 insertions(+), 14 deletions(-)
committed to:
http://git.kernel.org/?p=linux/kernel/git/jwessel/linux-2.6-kgdb.git;a=shortlog;h=kgdb_2.6.25
Jason.