debug_trap_cpu_in_kdl(): If the CPU running the kernel debugger exited and
re-entered it fast enough, we wouldn't leave the loop and thus cause a deadlock, since we wouldn't process the ICI message telling us to halt. We do now call smp_intercpu_int_handler() in the loop and guard the function from being re-entered. This also has the advantage that we can execute code on all CPUs in the kernel debugger, if we have to. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30208 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <arch/debug_console.h>
|
||||
#include <arch/debug.h>
|
||||
#include <util/AutoLock.h>
|
||||
#include <util/ring_buffer.h>
|
||||
|
||||
#include <syslog_daemon.h>
|
||||
@@ -102,6 +103,8 @@ static vint32 sInDebugger = 0;
|
||||
static bool sPreviousDprintfState;
|
||||
static volatile bool sHandOverKDL = false;
|
||||
static vint32 sHandOverKDLToCPU = -1;
|
||||
static bool sCPUTrapped[B_MAX_CPU_COUNT];
|
||||
|
||||
|
||||
#define distance(a, b) ((a) < (b) ? (b) - (a) : (a) - (b))
|
||||
|
||||
@@ -1307,19 +1310,28 @@ debug_get_page_fault_info()
|
||||
void
|
||||
debug_trap_cpu_in_kdl(bool returnIfHandedOver)
|
||||
{
|
||||
cpu_status state = disable_interrupts();
|
||||
InterruptsLocker locker;
|
||||
|
||||
int cpu = smp_get_current_cpu();
|
||||
|
||||
// return, if we've been called recursively (we call
|
||||
// smp_intercpu_int_handler() below)
|
||||
if (sCPUTrapped[cpu])
|
||||
return;
|
||||
|
||||
sCPUTrapped[cpu] = true;
|
||||
|
||||
while (sInDebugger != 0) {
|
||||
if (sHandOverKDL && sHandOverKDLToCPU == smp_get_current_cpu()) {
|
||||
if (sHandOverKDL && sHandOverKDLToCPU == cpu) {
|
||||
if (returnIfHandedOver)
|
||||
return;
|
||||
break;
|
||||
|
||||
kernel_debugger(NULL);
|
||||
} else
|
||||
PAUSE();
|
||||
smp_intercpu_int_handler();
|
||||
}
|
||||
|
||||
restore_interrupts(state);
|
||||
sCPUTrapped[cpu] = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user