Module Name:    src
Committed By:   bouyer
Date:           Mon Jan 13 20:15:01 UTC 2020

Modified Files:
        src/sys/arch/xen/x86: cpu.c

Log Message:
Don't call cpu_switchto() before idle_loop(), it should not be needed any more.
While there, assume (and KASSERT) that curlwp == ci->ci_data.cpu_idlelwp,
this saves a lwp_getpcb() call.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/xen/x86/cpu.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/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.131 src/sys/arch/xen/x86/cpu.c:1.132
--- src/sys/arch/xen/x86/cpu.c:1.131	Sat Nov 23 19:40:38 2019
+++ src/sys/arch/xen/x86/cpu.c	Mon Jan 13 20:15:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.131 2019/11/23 19:40:38 ad Exp $	*/
+/*	$NetBSD: cpu.c,v 1.132 2020/01/13 20:15:01 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.131 2019/11/23 19:40:38 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.132 2020/01/13 20:15:01 bouyer Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -716,9 +716,10 @@ cpu_hatch(void *v)
 
 	KASSERT((ci->ci_flags & CPUF_RUNNING) == 0);
 
+	KASSERT(ci->ci_curlwp == ci->ci_data.cpu_idlelwp);
+	KASSERT(curlwp == ci->ci_data.cpu_idlelwp);
 	pcb = lwp_getpcb(curlwp);
 	pcb->pcb_cr3 = pmap_pdirpa(pmap_kernel(), 0);
-	pcb = lwp_getpcb(ci->ci_data.cpu_idlelwp);
 
 	xen_ipi_init();
 
@@ -739,8 +740,7 @@ cpu_hatch(void *v)
 
 	aprint_debug_dev(ci->ci_dev, "running\n");
 
-	cpu_switchto(NULL, ci->ci_data.cpu_idlelwp, true);
-
+	KASSERT(ci->ci_curlwp == ci->ci_data.cpu_idlelwp);
 	idle_loop(NULL);
 	KASSERT(false);
 }

Reply via email to