Until debugging threaded programs in NetBSD is fixed, supply the

cpp option RUMP_WITHOUT_THREADS as a workaround.  If defined, it
makes rump itself operate single-threaded and prevents kthread_create()
from working.
This commit is contained in:
pooka 2008-01-22 09:23:39 +00:00
parent cd0b25a26a
commit 2310c71b91
4 changed files with 22 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: emul.c,v 1.22 2008/01/20 18:09:13 joerg Exp $ */
/* $NetBSD: emul.c,v 1.23 2008/01/22 09:23:39 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -347,6 +347,10 @@ kthread_create(pri_t pri, int flags, struct cpu_info *ci,
struct lwp *l;
int rv;
#ifdef RUMP_WITHOUT_THREADS
panic("threads not available, undef RUMP_WITHOUT_THREADS");
#endif
KASSERT(fmt != NULL);
if (ci != NULL)
panic("%s: bounded threads not supported", __func__);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rump.c,v 1.28 2008/01/03 02:48:03 pooka Exp $ */
/* $NetBSD: rump.c,v 1.29 2008/01/22 09:23:39 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -63,6 +63,7 @@ struct fakeblk {
static LIST_HEAD(, fakeblk) fakeblks = LIST_HEAD_INITIALIZER(fakeblks);
#ifndef RUMP_WITHOUT_THREADS
static void
rump_aiodone_worker(struct work *wk, void *dummy)
{
@ -71,6 +72,7 @@ rump_aiodone_worker(struct work *wk, void *dummy)
KASSERT(&bp->b_work == wk);
bp->b_iodone(bp);
}
#endif /* RUMP_WITHOUT_THREADS */
int rump_inited;
@ -120,10 +122,12 @@ rump_init()
rumpuser_mutex_recursive_init(&rump_giantlock.kmtx_mtx);
#ifndef RUMP_WITHOUT_THREADS
/* aieeeedondest */
if (workqueue_create(&uvm.aiodone_queue, "aiodoned",
rump_aiodone_worker, NULL, 0, 0, 0))
panic("aiodoned");
#endif /* RUMP_WITHOUT_THREADS */
rumpuser_gethostname(hostname, MAXHOSTNAMELEN, &error);
hostnamelen = strlen(hostname);

View File

@ -1,4 +1,4 @@
/* $NetBSD: specfs.c,v 1.17 2008/01/21 03:40:59 pooka Exp $ */
/* $NetBSD: specfs.c,v 1.18 2008/01/22 09:23:39 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -240,6 +240,9 @@ rump_specstrategy(void *v)
* avoid unnecessary scheduling with the I/O thread.
*/
if (bp->b_flags & B_ASYNC) {
#ifdef RUMP_WITHOUT_THREADS
goto syncfallback;
#else
struct rumpuser_aio *rua;
rua = kmem_alloc(sizeof(struct rumpuser_aio), KM_SLEEP);
@ -272,6 +275,7 @@ rump_specstrategy(void *v)
rua_head = (rua_head+1) % (N_AIOS-1);
rumpuser_cv_signal(&rua_cv);
rumpuser_mutex_exit(&rua_mtx);
#endif /* !RUMP_WITHOUT_THREADS */
} else {
syncfallback:
if (bp->b_flags & B_READ) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: rumpuser_pth.c,v 1.9 2008/01/18 14:12:19 reinoud Exp $ */
/* $NetBSD: rumpuser_pth.c,v 1.10 2008/01/22 09:23:40 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -63,6 +63,7 @@ struct rumpuser_aio *rua_aios[N_AIOS];
struct rumpuser_rw rumpspl;
#ifndef RUMP_WITHOUT_THREADS
static void *
iothread(void *arg)
{
@ -90,11 +91,14 @@ iothread(void *arg)
NOFAIL(pthread_mutex_lock(&rua_mtx.pthmtx) == 0);
}
}
#endif /* RUMP_WITHOUT_THREADS */
int
rumpuser_thrinit()
{
#ifndef RUMP_WITHOUT_THREADS
pthread_t iothr;
#endif
pthread_mutex_init(&rua_mtx.pthmtx, NULL);
pthread_cond_init(&rua_cv.pthcv, NULL);
@ -103,7 +107,9 @@ rumpuser_thrinit()
pthread_key_create(&curlwpkey, NULL);
pthread_key_create(&isintr, NULL);
#ifndef RUMP_WITHOUT_THREADS
pthread_create(&iothr, NULL, iothread, NULL);
#endif
return 0;
}