subr_kdb.c (139804) | subr_kdb.c (145727) |
---|---|
1/*- 2 * Copyright (c) 2004 The FreeBSD Project 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2004 The FreeBSD Project 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/kern/subr_kdb.c 139804 2005-01-06 23:35:40Z imp $"); | 28__FBSDID("$FreeBSD: head/sys/kern/subr_kdb.c 145727 2005-04-30 20:01:00Z dwhite $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kdb.h> 33#include <sys/kernel.h> 34#include <sys/malloc.h> 35#include <sys/pcpu.h> 36#include <sys/proc.h> 37#include <sys/smp.h> 38#include <sys/sysctl.h> 39 40#include <machine/kdb.h> 41#include <machine/pcb.h> 42 | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kdb.h> 33#include <sys/kernel.h> 34#include <sys/malloc.h> 35#include <sys/pcpu.h> 36#include <sys/proc.h> 37#include <sys/smp.h> 38#include <sys/sysctl.h> 39 40#include <machine/kdb.h> 41#include <machine/pcb.h> 42 |
43#ifdef KDB_STOP_NMI 44#include <machine/smp.h> 45#endif 46 47/* 48 * KDB_STOP_NMI requires SMP to pick up the right dependencies 49 * (And isn't useful on UP anyway) 50 */ 51#if defined(KDB_STOP_NMI) && !defined(SMP) 52#error "options KDB_STOP_NMI" requires "options SMP" 53#endif 54 |
|
43int kdb_active = 0; 44void *kdb_jmpbufp = NULL; 45struct kdb_dbbe *kdb_dbbe = NULL; 46struct pcb kdb_pcb; 47struct pcb *kdb_thrctx = NULL; 48struct thread *kdb_thread = NULL; 49struct trapframe *kdb_frame = NULL; 50 --- 21 unchanged lines hidden (view full) --- 72 * stop_cpus() waits for the other cpus to stop, so we allow it to be 73 * disabled. 74 */ 75#ifdef SMP 76static int kdb_stop_cpus = 1; 77SYSCTL_INT(_debug_kdb, OID_AUTO, stop_cpus, CTLTYPE_INT | CTLFLAG_RW, 78 &kdb_stop_cpus, 0, ""); 79TUNABLE_INT("debug.kdb.stop_cpus", &kdb_stop_cpus); | 55int kdb_active = 0; 56void *kdb_jmpbufp = NULL; 57struct kdb_dbbe *kdb_dbbe = NULL; 58struct pcb kdb_pcb; 59struct pcb *kdb_thrctx = NULL; 60struct thread *kdb_thread = NULL; 61struct trapframe *kdb_frame = NULL; 62 --- 21 unchanged lines hidden (view full) --- 84 * stop_cpus() waits for the other cpus to stop, so we allow it to be 85 * disabled. 86 */ 87#ifdef SMP 88static int kdb_stop_cpus = 1; 89SYSCTL_INT(_debug_kdb, OID_AUTO, stop_cpus, CTLTYPE_INT | CTLFLAG_RW, 90 &kdb_stop_cpus, 0, ""); 91TUNABLE_INT("debug.kdb.stop_cpus", &kdb_stop_cpus); |
92 93#ifdef KDB_STOP_NMI 94/* 95 * Provide an alternate method of stopping other CPUs. If another CPU has 96 * disabled interrupts the conventional STOP IPI will be blocked. This 97 * NMI-based stop should get through in that case. 98 */ 99static int kdb_stop_cpus_with_nmi = 0; 100SYSCTL_INT(_debug_kdb, OID_AUTO, stop_cpus_with_nmi, CTLTYPE_INT | CTLFLAG_RW, 101 &kdb_stop_cpus_with_nmi, 0, ""); 102TUNABLE_INT("debug.kdb.stop_cpus_with_nmi", &kdb_stop_cpus_with_nmi); 103#endif /* KDB_STOP_NMI */ 104 |
|
80#endif 81 82static int 83kdb_sysctl_available(SYSCTL_HANDLER_ARGS) 84{ 85 struct kdb_dbbe *be, **iter; 86 char *avail, *p; 87 ssize_t len, sz; --- 215 unchanged lines hidden (view full) --- 303} 304 305/* 306 * Thread related support functions. 307 */ 308 309struct pcb * 310kdb_thr_ctx(struct thread *thr) | 105#endif 106 107static int 108kdb_sysctl_available(SYSCTL_HANDLER_ARGS) 109{ 110 struct kdb_dbbe *be, **iter; 111 char *avail, *p; 112 ssize_t len, sz; --- 215 unchanged lines hidden (view full) --- 328} 329 330/* 331 * Thread related support functions. 332 */ 333 334struct pcb * 335kdb_thr_ctx(struct thread *thr) |
336#ifdef KDB_STOP_NMI 337{ 338 u_int cpuid; 339 struct pcpu *pc; 340 341 if (thr == curthread) 342 return &kdb_pcb; 343 344 SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { 345 cpuid = pc->pc_cpuid; 346 if (pc->pc_curthread == thr && (atomic_load_acq_int(&stopped_cpus) & (1 << cpuid))) 347 return &stoppcbs[cpuid]; 348 } 349 350 return thr->td_pcb; 351} 352#else |
|
311{ 312 return ((thr == curthread) ? &kdb_pcb : thr->td_pcb); 313} | 353{ 354 return ((thr == curthread) ? &kdb_pcb : thr->td_pcb); 355} |
356#endif /* KDB_STOP_NMI */ |
|
314 315struct thread * 316kdb_thr_first(void) 317{ 318 struct proc *p; 319 struct thread *thr; 320 321 p = LIST_FIRST(&allproc); --- 80 unchanged lines hidden (view full) --- 402 return (0); 403 404 critical_enter(); 405 406 kdb_active++; 407 408#ifdef SMP 409 if ((did_stop_cpus = kdb_stop_cpus) != 0) | 357 358struct thread * 359kdb_thr_first(void) 360{ 361 struct proc *p; 362 struct thread *thr; 363 364 p = LIST_FIRST(&allproc); --- 80 unchanged lines hidden (view full) --- 445 return (0); 446 447 critical_enter(); 448 449 kdb_active++; 450 451#ifdef SMP 452 if ((did_stop_cpus = kdb_stop_cpus) != 0) |
453 { 454#ifdef KDB_STOP_NMI 455 if(kdb_stop_cpus_with_nmi) 456 stop_cpus_nmi(PCPU_GET(other_cpus)); 457 else 458#endif /* KDB_STOP_NMI */ |
|
410 stop_cpus(PCPU_GET(other_cpus)); | 459 stop_cpus(PCPU_GET(other_cpus)); |
460 } |
|
411#endif 412 413 kdb_frame = tf; 414 415 /* Let MD code do its thing first... */ 416 kdb_cpu_trap(type, code); 417 418 makectx(tf, &kdb_pcb); --- 15 unchanged lines hidden --- | 461#endif 462 463 kdb_frame = tf; 464 465 /* Let MD code do its thing first... */ 466 kdb_cpu_trap(type, code); 467 468 makectx(tf, &kdb_pcb); --- 15 unchanged lines hidden --- |