PERFORCE change 61256 for review
John Baldwin
jhb at FreeBSD.org
Thu Sep 9 12:02:38 PDT 2004
http://perforce.freebsd.org/chv.cgi?CH=61256
Change 61256 by jhb at jhb_slimer on 2004/09/09 19:01:42
Fix compile and add a new double fault inducing test.
Affected files ...
.. //depot/projects/smpng/sys/modules/crash/crash.c#12 edit
Differences ...
==== //depot/projects/smpng/sys/modules/crash/crash.c#12 (text+ko) ====
@@ -41,6 +41,7 @@
#include <sys/param.h>
#include <sys/condvar.h>
#include <sys/errno.h>
+#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/lock.h>
@@ -52,7 +53,7 @@
#include <sys/sysctl.h>
#include <sys/systm.h>
-#define MAX_EVENT 19
+#define MAX_EVENT 20
static struct sx foo, bar, bar2;
static struct cv event_cv;
@@ -80,6 +81,7 @@
"use test1 and test2 mutexes to test witness removal",
"try lock tests including recursion test",
"test witness_defineorder and witness_checkorder",
+ "blow the kernel stack on purpose",
};
static int mod_event(struct module *module, int cmd, void *arg);
@@ -111,6 +113,15 @@
SYSCTL_PROC(_debug_crash, OID_AUTO, test, CTLTYPE_INT | CTLFLAG_RW, 0, 0,
sysctl_debug_crash_test, "I", "");
+static int
+blow_stack(void)
+{
+ char dummy[512];
+
+ dummy[0] += blow_stack();
+ return (dummy[0]);
+}
+
static void
crash_thread(void *arg)
{
@@ -196,9 +207,9 @@
sx_xunlock(&foo);
break;
case 13:
- Debugger("about to init again");
+ kdb_enter("about to init again");
mtx_init(&test_mtx, "test", NULL, MTX_DEF);
- Debugger("if we haven't panic'd by now, ouch. :(");
+ kdb_enter("if we haven't panic'd by now, ouch. :(");
mtx_destroy(&test_mtx);
break;
case 14:
@@ -220,18 +231,18 @@
bzero(&test2_mtx, sizeof(test2_mtx));
mtx_init(&test1_mtx, "test1", NULL, MTX_DEF);
mtx_init(&test2_mtx, "test2", NULL, MTX_DEF);
- Debugger("no order yet");
+ kdb_enter("no order yet");
mtx_lock(&Giant);
mtx_lock(&test1_mtx);
mtx_lock(&test2_mtx);
mtx_unlock(&test2_mtx);
mtx_unlock(&test1_mtx);
mtx_unlock(&Giant);
- Debugger("test1 and test2 should be ordered");
+ kdb_enter("test1 and test2 should be ordered");
mtx_destroy(&test1_mtx);
- Debugger("test1 should be gone, test2 should be after Giant");
+ kdb_enter("test1 should be gone, test2 should be after Giant");
mtx_destroy(&test2_mtx);
- Debugger("test1 and test2 should be gone");
+ kdb_enter("test1 and test2 should be gone");
break;
case 18:
bzero(&test1_mtx, sizeof(test1_mtx));
@@ -263,11 +274,11 @@
bzero(&test2_mtx, sizeof(test2_mtx));
mtx_init(&test1_mtx, "test1", NULL, MTX_DEF);
mtx_init(&test2_mtx, "test2", NULL, MTX_DEF);
- Debugger("no order yet");
+ kdb_enter("no order yet");
status = WITNESS_DEFINEORDER(&test1_mtx, &test2_mtx);
printf("Status of test1 -> test2 set order should be 0: %d\n",
status);
- Debugger("order should be test1 then test2");
+ kdb_enter("order should be test1 then test2");
printf("Check order of test1 -> test2 should succeed.\n");
mtx_lock(&test1_mtx);
witness_check_mutex(&test2_mtx);
@@ -291,6 +302,9 @@
mtx_destroy(&test1_mtx);
mtx_destroy(&test2_mtx);
break;
+ case 20:
+ (void)blow_stack();
+ break;
default:
panic("event %d is bogus\n", event);
}
@@ -318,7 +332,7 @@
mtx_lock_spin(&sched_lock);
td->td_priority = PRI_MIN_IDLE;
TD_SET_CAN_RUN(td);
- setrunqueue(td);
+ setrunqueue(td, SRQ_BORING);
mtx_unlock_spin(&sched_lock);
kthread = p;
return (0);
More information about the p4-projects
mailing list