History log of /openbsd-src/sys/kern/subr_suspend.c (Results 1 – 18 of 18)
Revision Date Author Comments
# 9a6a36e2 28-May-2024 kettenis <kettenis@openbsd.org>

Garbage collect sleep_abort(); it doesn't do anything useful anymore.

ok deraadt@, mlarkin@


# fc30b644 26-May-2024 kettenis <kettenis@openbsd.org>

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 implementa

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@

show more ...


# 3772e814 12-Jul-2023 cheloha <cheloha@openbsd.org>

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

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@

show more ...


# b2653891 02-Jul-2023 cheloha <cheloha@openbsd.org>

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

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@

show more ...


# b396fb91 10-Nov-2022 kettenis <kettenis@openbsd.org>

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 CPU

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@

show more ...


# 329e3480 05-Nov-2022 cheloha <cheloha@openbsd.org>

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

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@

show more ...


# 17b371d9 03-Sep-2022 kettenis <kettenis@openbsd.org>

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

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@

show more ...


# 0d280c5f 14-Aug-2022 jsg <jsg@openbsd.org>

remove unneeded includes in sys/kern
ok mpi@ miod@


# f134d78d 16-Feb-2022 deraadt <deraadt@openbsd.org>

return unique errors (I chose some errno values.. ) for the various
failure modes. Also, pack the code a little bit, easier to read.


# fd33afa7 16-Feb-2022 deraadt <deraadt@openbsd.org>

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

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...)

show more ...


# 4a9a38d5 16-Feb-2022 deraadt <deraadt@openbsd.org>

change MD gosleep() and sleep_finish() to return int, the MI code will be
able to react to this suitably.


# cb9e2b65 15-Feb-2022 deraadt <deraadt@openbsd.org>

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


# 1f9ba6f4 15-Feb-2022 deraadt <deraadt@openbsd.org>

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.


# 1d28c7e6 15-Feb-2022 deraadt <deraadt@openbsd.org>

MI disable_lid_wakeups() is not needed, x86 systems can do this
in sleep_resume(), which seems sensible for other future systems also


# 0a23802a 13-Feb-2022 deraadt <deraadt@openbsd.org>

Move some MI pieces out of suspend_mp/resume_mp
ok kettenis


# a9d89b3a 11-Feb-2022 deraadt <deraadt@openbsd.org>

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


# 7f8722a4 10-Feb-2022 deraadt <deraadt@openbsd.org>

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


# ad814436 08-Feb-2022 deraadt <deraadt@openbsd.org>

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

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

show more ...