From 8f93d79d0536fb19b3e3894d8c888fb3084e9aab Mon Sep 17 00:00:00 2001 From: Jeff Roberson <jeff@FreeBSD.org> Date: Mon, 10 Mar 2008 03:16:51 +0000 Subject: [PATCH] - Handle kdb switch panics outside of mi_switch() to remove some instructions from the common path and make the code more clear. Whether this has any impact on performance may depend on optimization levels. Sponsored by: Nokia --- sys/kern/kern_synch.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index ad13c2b47461..983d5a6347a9 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -365,6 +365,15 @@ wakeup_one(ident) sleepq_release(ident); } +static void +kdb_switch(void) +{ + thread_unlock(curthread); + kdb_backtrace(); + kdb_reenter(); + panic("%s: did not reenter debugger", __func__); +} + /* * The machine independent parts of context switching. */ @@ -394,12 +403,8 @@ mi_switch(int flags, struct thread *newtd) /* * Don't perform context switches from the debugger. */ - if (kdb_active) { - thread_unlock(td); - kdb_backtrace(); - kdb_reenter(); - panic("%s: did not reenter debugger", __func__); - } + if (kdb_active) + kdb_switch(); if (flags & SW_VOL) td->td_ru.ru_nvcsw++; else