Module Name:    src
Committed By:   pooka
Date:           Sun Jun 22 20:09:19 UTC 2014

Modified Files:
        src/sys/rump/librump/rumpkern: intr.c

Log Message:
Initialize cpu_softcpu before creating softint threads.  Fixes things
with rump kernel hypervisors which wrap the thread creation hypercall.

pointed out by Justin Cormack


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/rump/librump/rumpkern/intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/librump/rumpkern/intr.c
diff -u src/sys/rump/librump/rumpkern/intr.c:1.45 src/sys/rump/librump/rumpkern/intr.c:1.46
--- src/sys/rump/librump/rumpkern/intr.c:1.45	Mon Jun  9 13:03:16 2014
+++ src/sys/rump/librump/rumpkern/intr.c	Sun Jun 22 20:09:19 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.45 2014/06/09 13:03:16 rmind Exp $	*/
+/*	$NetBSD: intr.c,v 1.46 2014/06/22 20:09:19 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008-2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.45 2014/06/09 13:03:16 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.46 2014/06/22 20:09:19 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -242,7 +242,15 @@ softint_init(struct cpu_info *ci)
 	if (!rump_threads)
 		return;
 
+	slev = kmem_alloc(sizeof(struct softint_lev) * SOFTINT_COUNT, KM_SLEEP);
+	for (i = 0; i < SOFTINT_COUNT; i++) {
+		rumpuser_cv_init(&slev[i].si_cv);
+		LIST_INIT(&slev[i].si_pending);
+	}
+	cd->cpu_softcpu = slev;
+
 	/* overloaded global init ... */
+	/* XXX: should be done the last time we are called */
 	if (ci->ci_index == 0) {
 		int sithr_swap;
 
@@ -261,13 +269,6 @@ softint_init(struct cpu_info *ci)
 		}
 	}
 
-	slev = kmem_alloc(sizeof(struct softint_lev) * SOFTINT_COUNT, KM_SLEEP);
-	for (i = 0; i < SOFTINT_COUNT; i++) {
-		rumpuser_cv_init(&slev[i].si_cv);
-		LIST_INIT(&slev[i].si_pending);
-	}
-	cd->cpu_softcpu = slev;
-
 	/* well, not really a "soft" interrupt ... */
 	if ((rv = kthread_create(PRI_NONE, KTHREAD_MPSAFE,
 	    ci, doclock, NULL, NULL, "rumpclk%d", ci->ci_index)) != 0)

Reply via email to