Up to [local] / src / sys / kern
Request diff between arbitrary revisions
Default branch: MAIN
Revision 1.18 / (download) - annotate - [select for diffs], Tue May 28 09:40:40 2024 UTC (5 days, 8 hours ago) by kettenis
Branch: MAIN
CVS Tags: HEAD
Changes since 1.17: +1 -5 lines
Diff to previous 1.17 (colored)
Garbage collect sleep_abort(); it doesn't do anything useful anymore. ok deraadt@, mlarkin@
Revision 1.17 / (download) - annotate - [select for diffs], Sun May 26 13:37:32 2024 UTC (7 days, 4 hours ago) by kettenis
Branch: MAIN
Changes since 1.16: +3 -1 lines
Diff to previous 1.16 (colored)
Implement wakeup interrupts on amd64. Provide a dummy implementation for i386 such that we can call the necessary hooks in the suspend/resume code without adding #ifdefs. Tweak the arm64 implementation such that we can call the hooks earlier as this is necessary to mask MSI and MSI-X interrupts on arm64. ok deraadt@, mlarkin@
Revision 1.16 / (download) - annotate - [select for diffs], Wed Jul 12 18:40:06 2023 UTC (10 months, 3 weeks ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE,
OPENBSD_7_5,
OPENBSD_7_4_BASE,
OPENBSD_7_4
Changes since 1.15: +18 -1 lines
Diff to previous 1.15 (colored)
GPROF: sleep_state: disable _mcount() across suspend/resume Something in the amd64 resume path doesn't agree with _mcount(), so suspend/resume always fails if gmoninit is non-zero. It would be nice if GPROF kernels didn't crash during resume. In sleep_state(), (1) clear gmoninit after sched_stop_secondary_cpus() so the primary CPU isn't racing sysctl(2) on another CPU, and (2) restore gmoninit just after resume_mp() so the secondary CPUs are out of cpu_hatch() and away from whatever is causing the crash before _mcount() is reenabled. Lots of input from claudio@, deraadt@, and kettenis@. Thread 1: https://marc.info/?l=openbsd-tech&m=168721453821801&w=2 Thread 2: https://marc.info/?l=openbsd-tech&m=168892518722935&w=2 ok kettenis@ deraadt@
Revision 1.15 / (download) - annotate - [select for diffs], Sun Jul 2 19:02:27 2023 UTC (11 months ago) by cheloha
Branch: MAIN
Changes since 1.14: +2 -3 lines
Diff to previous 1.14 (colored)
all platforms, kernel: remove __HAVE_CLOCKINTR symbol Every platform made the clockintr switch at least six months ago. The __HAVE_CLOCKINTR symbol is now redundant. Remove it. Prompted by claudio@. Link: https://marc.info/?l=openbsd-tech&m=168826181015032&w=2 "makes sense" mlarkin@
Revision 1.14 / (download) - annotate - [select for diffs], Thu Nov 10 10:37:40 2022 UTC (18 months, 3 weeks ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE,
OPENBSD_7_3
Changes since 1.13: +4 -1 lines
Diff to previous 1.13 (colored)
Put CPUs in the lowest P-state just before the final suspend step. The firmware probably does this for us on ACPI systems with proper S3 support, but this doesn't happen on systems where we park CPUs in a low-power idle state ourselves. ok deraadt@
Revision 1.13 / (download) - annotate - [select for diffs], Sat Nov 5 19:29:46 2022 UTC (18 months, 3 weeks ago) by cheloha
Branch: MAIN
Changes since 1.12: +6 -1 lines
Diff to previous 1.12 (colored)
clockintr(9): initial commit clockintr(9) is a machine-independent clock interrupt scheduler. It emulates most of what the machine-dependent clock interrupt code is doing on every platform. Every CPU has a work schedule based on the system uptime clock. For now, every CPU has a hardclock(9) and a statclock(). If schedhz is set, every CPU has a schedclock(), too. This commit only contains the MI pieces. All code is conditionally compiled with __HAVE_CLOCKINTR. This commit changes no behavior yet. At a high level, clockintr(9) is configured and used as follows: 1. During boot, the primary CPU calls clockintr_init(9). Global state is initialized. 2. Primary CPU calls clockintr_cpu_init(9). Local, per-CPU state is initialized. An "intrclock" struct may be installed, too. 3. Secondary CPUs call clockintr_cpu_init(9) to initialize their local state. 4. All CPUs repeatedly call clockintr_dispatch(9) from the MD clock interrupt handler. The CPUs complete work and rearm their local interrupt clock, if any, during the dispatch. 5. Repeat step (4) until the system shuts down, suspends, or hibernates. 6. During resume, the primary CPU calls inittodr(9) and advances the system uptime. 7. Go to step (2). This time around, clockintr_cpu_init(9) also advances the work schedule on the calling CPU to skip events that expired during suspend. This prevents a "thundering herd" of useless work during the first clock interrupt. In the long term, we need an MI clock interrupt scheduler in order to (1) provide control over the clock interrupt to MI subsystems like timeout(9) and dt(4) to improve their accuracy, (2) provide drivers like acpicpu(4) a means for slowing or stopping the clock interrupt on idle CPUs to conserve power, and (3) reduce the amount of duplicated code in the MD clock interrupt code. Before we can do any of that, though, we need to switch every platform over to using clockintr(9) and do some cleanup. Prompted by "the vmm(4) time bug," among other problems, and a discussion at a2k19 on the subject. Lots of design input from kettenis@. Early versions reviewed by kettenis@ and mlarkin@. Platform-specific help and testing from kettenis@, gkoehler@, mlarkin@, miod@, aoyama@, visa@, and dv@. Babysitting and spiritual guidance from mlarkin@ and kettenis@. Link: https://marc.info/?l=openbsd-tech&m=166697497302283&w=2 ok kettenis@ mlarkin@
Revision 1.12 / (download) - annotate - [select for diffs], Sat Sep 3 18:05:10 2022 UTC (20 months, 4 weeks ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE,
OPENBSD_7_2
Changes since 1.11: +13 -1 lines
Diff to previous 1.11 (colored)
Make sure we don't suspend if we have no way to wake up the machine. The idea is that device drivers that can wake up the machine register themselves by calling device_register_wakeup(). To prevent regressions on amd64, we let acpi(4) register itself as a wakeup device if the AML for the machine defines wakeup devices. This may be refined in the future. This diff will prevent people from suspending their arm64 SBCs without having a way to wake them up. For now the only driver that registers itself is axppmic(4), which means that at this moment only SBCs with an allwinner A64 or H5 SoC will actually support suspend/resume. ok mlarkin@, deraadt@
Revision 1.11 / (download) - annotate - [select for diffs], Sun Aug 14 01:58:28 2022 UTC (21 months, 2 weeks ago) by jsg
Branch: MAIN
Changes since 1.10: +1 -4 lines
Diff to previous 1.10 (colored)
remove unneeded includes in sys/kern ok mpi@ miod@
Revision 1.10 / (download) - annotate - [select for diffs], Wed Feb 16 16:44:17 2022 UTC (2 years, 3 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE,
OPENBSD_7_1
Changes since 1.9: +8 -20 lines
Diff to previous 1.9 (colored)
return unique errors (I chose some errno values.. ) for the various failure modes. Also, pack the code a little bit, easier to read.
Revision 1.9 / (download) - annotate - [select for diffs], Wed Feb 16 06:47:28 2022 UTC (2 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.8: +11 -6 lines
Diff to previous 1.8 (colored)
If the lid is closed, suspend_finish() now returns EAGAIN, so go to the top and restart the suspend all over again. This was previously done by issuing a task to the acpi thread, but this is simpler. (I want to try to duplicate these tests earlier in the resume path...)
Revision 1.8 / (download) - annotate - [select for diffs], Wed Feb 16 06:41:27 2022 UTC (2 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)
change MD gosleep() and sleep_finish() to return int, the MI code will be able to react to this suitably.
Revision 1.7 / (download) - annotate - [select for diffs], Tue Feb 15 21:17:12 2022 UTC (2 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.6: +8 -4 lines
Diff to previous 1.6 (colored)
Since acpitoshiba brightness button processing no longer plays games with AML parsing outside the acpi thread, the locking-release dance around wsdisplay_{suspend,resume} can be removed ok kettenis
Revision 1.6 / (download) - annotate - [select for diffs], Tue Feb 15 16:54:48 2022 UTC (2 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.5: +11 -4 lines
Diff to previous 1.5 (colored)
when the MI suspend code encounters problems, we need a way to reset the MD state before bailing out. New MD function sleep_abort() does that.
Revision 1.5 / (download) - annotate - [select for diffs], Tue Feb 15 02:38:18 2022 UTC (2 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.4: +1 -3 lines
Diff to previous 1.4 (colored)
MI disable_lid_wakeups() is not needed, x86 systems can do this in sleep_resume(), which seems sensible for other future systems also
Revision 1.4 / (download) - annotate - [select for diffs], Sun Feb 13 15:56:55 2022 UTC (2 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.3: +4 -1 lines
Diff to previous 1.3 (colored)
Move some MI pieces out of suspend_mp/resume_mp ok kettenis
Revision 1.3 / (download) - annotate - [select for diffs], Fri Feb 11 01:55:12 2022 UTC (2 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +1 -2 lines
Diff to previous 1.2 (colored)
the sleep_clocks() hook is not needed because the architectures which need to do this can do it a few moments later in a different hook
Revision 1.2 / (download) - annotate - [select for diffs], Thu Feb 10 16:41:53 2022 UTC (2 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +13 -1 lines
Diff to previous 1.1 (colored)
Duplicate "park disk" code, so that the SUSPEND case can be MI, it is only HIBERNATE that needs to be in MD code. ok gkoehler
Revision 1.1 / (download) - annotate - [select for diffs], Tue Feb 8 17:25:12 2022 UTC (2 years, 3 months ago) by deraadt
Branch: MAIN
The suspend/resume code is a sticky mess of MI, MD, and ACPI sequencing. This splits out the MI sequencing, backing it with per-architecture helper functions. Further steps will be neccesary because ACPI and MD are too tightly coupled, but soon we'll be able to use this code for more architectures (which depends on figuring out the lowest-level cpu sleeping method) ok kettenis