Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/x86 Don't call cpu_switchto() before idle_loop(...



details:   https://anonhg.NetBSD.org/src/rev/9d4a72e77f5f
branches:  trunk
changeset: 848004:9d4a72e77f5f
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Mon Jan 13 20:15:01 2020 +0000

description:
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.

diffstat:

 sys/arch/xen/x86/cpu.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (40 lines):

diff -r 54c27ac2fbab -r 9d4a72e77f5f sys/arch/xen/x86/cpu.c
--- a/sys/arch/xen/x86/cpu.c    Mon Jan 13 19:14:37 2020 +0000
+++ b/sys/arch/xen/x86/cpu.c    Mon Jan 13 20:15:01 2020 +0000
@@ -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 @@
 
        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 @@
 
        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);
 }



Home | Main Index | Thread Index | Old Index