diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2023-10-24 13:20:12 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2023-10-24 13:20:12 +0000 |
commit | eab399b544910d35d946debb3061295e80005445 (patch) | |
tree | 5a1bd93af430b91413ddda13e9430c33e300c0cf /sys/arch/hppa | |
parent | 1a4745dcea2fa3ae554b1cb454a7292e44577a30 (diff) |
Normally context switches happen in mi_switch() but there are 3 cases
where a switch happens outside. Cleanup these code paths and make the
machine independent.
- when a process forks (fork, tfork, kthread), the new proc needs to
somehow be scheduled for the first time. This is done by proc_trampoline.
Since proc_trampoline is machine dependent assembler code change
the MP specific proc_trampoline_mp() to proc_trampoline_mi() and make
sure it is now always called.
- cpu_hatch: when booting APs the code needs to jump to the first proc
running on that CPU. This should be the idle thread for that CPU.
- sched_exit: when a proc exits it needs to switch away from itself and
then instruct the reaper to clean up the rest. This is done by switching
to the idle loop.
Since the last two cases require a context switch to the idle proc factor
out the common code to sched_toidle() and use it in those places.
Tested by many on all archs.
OK miod@ mpi@ cheloha@
Diffstat (limited to 'sys/arch/hppa')
-rw-r--r-- | sys/arch/hppa/dev/cpu.c | 10 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/locore.S | 8 |
2 files changed, 4 insertions, 14 deletions
diff --git a/sys/arch/hppa/dev/cpu.c b/sys/arch/hppa/dev/cpu.c index 777bbd44587..35801a4b8c2 100644 --- a/sys/arch/hppa/dev/cpu.c +++ b/sys/arch/hppa/dev/cpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.c,v 1.46 2023/08/29 16:19:34 claudio Exp $ */ +/* $OpenBSD: cpu.c,v 1.47 2023/10/24 13:20:09 claudio Exp $ */ /* * Copyright (c) 1998-2003 Michael Shalayeff @@ -243,7 +243,6 @@ void cpu_hatch(void) { struct cpu_info *ci = curcpu(); - int s; /* Initialise IPIs. */ hppa_ipi_init(ci); @@ -263,12 +262,7 @@ cpu_hatch(void) while (!start_secondary_cpu) ; - s = splhigh(); - nanouptime(&ci->ci_schedstate.spc_runtime); - splx(s); - - SCHED_LOCK(s); - cpu_switchto(NULL, sched_chooseproc()); + sched_toidle(); } void diff --git a/sys/arch/hppa/hppa/locore.S b/sys/arch/hppa/hppa/locore.S index a9963b380ee..068440760e1 100644 --- a/sys/arch/hppa/hppa/locore.S +++ b/sys/arch/hppa/hppa/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.204 2022/10/25 15:15:38 guenther Exp $ */ +/* $OpenBSD: locore.S,v 1.205 2023/10/24 13:20:10 claudio Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -2697,16 +2697,12 @@ EXIT(cpu_idle_leave) ENTRY(proc_trampoline,0) copy r0, r3 -#ifdef MULTIPROCESSOR copy t4, r5 copy arg0, r4 - bl proc_trampoline_mp, rp + bl proc_trampoline_mi, rp nop copy r4, arg0 copy r5, t4 -#endif - mfctl cr29, t1 - stw r0, CI_CPL(t1) .call blr r0, rp bv,n r0(t4) |