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/octeon | |
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/octeon')
-rw-r--r-- | sys/arch/octeon/octeon/machdep.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c index 0adc6f84e47..3c781e5dbd0 100644 --- a/sys/arch/octeon/octeon/machdep.c +++ b/sys/arch/octeon/octeon/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.136 2023/02/04 19:19:36 cheloha Exp $ */ +/* $OpenBSD: machdep.c,v 1.137 2023/10/24 13:20:10 claudio Exp $ */ /* * Copyright (c) 2009, 2010 Miodrag Vallat. @@ -1302,8 +1302,6 @@ hw_cpu_boot_secondary(struct cpu_info *ci) void hw_cpu_hatch(struct cpu_info *ci) { - int s; - /* * Set curcpu address on this processor. */ @@ -1341,7 +1339,6 @@ hw_cpu_hatch(struct cpu_info *ci) spl0(); (void)updateimask(0); - SCHED_LOCK(s); - cpu_switchto(NULL, sched_chooseproc()); + sched_toidle(); } #endif /* MULTIPROCESSOR */ |