Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/usermode/dev Disable kernel preemption in the criti...



details:   https://anonhg.NetBSD.org/src/rev/6e9f5bef5c15
branches:  trunk
changeset: 769274:6e9f5bef5c15
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Mon Sep 05 12:22:19 2011 +0000

description:
Disable kernel preemption in the critical section of cpu_switchto()

diffstat:

 sys/arch/usermode/dev/cpu.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r f3366ad570e1 -r 6e9f5bef5c15 sys/arch/usermode/dev/cpu.c
--- a/sys/arch/usermode/dev/cpu.c       Mon Sep 05 12:19:12 2011 +0000
+++ b/sys/arch/usermode/dev/cpu.c       Mon Sep 05 12:22:19 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.29 2011/09/04 21:01:39 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.30 2011/09/05 12:22:19 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_cpu.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.29 2011/09/04 21:01:39 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.30 2011/09/05 12:22:19 reinoud Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -184,6 +184,8 @@
        }
 #endif /* !CPU_DEBUG */
 
+       kpreempt_disable();
+
        ci->ci_stash = oldlwp;
        curlwp = newlwp;
 
@@ -197,6 +199,8 @@
        }
        thunk_seterrno(newpcb->pcb_errno);
 
+       kpreempt_enable();
+
 #ifdef CPU_DEBUG
        printf("cpu_switchto: returning %p (was %p)\n", ci->ci_stash, oldlwp);
 #endif



Home | Main Index | Thread Index | Old Index