hpet vs suspend to ram
Andriy Gapon
avg at FreeBSD.org
Thu May 3 11:58:03 UTC 2018
On 03/05/2018 14:50, Andriy Gapon wrote:
> Thank you very much for the suggestion!
> It seems that doing that (and a little bit more[*]) helps indeed.
>
> However there seems to be another issue.
> hpet_suspend() is called too early. [Some] Other drivers require a working
> event timer for their suspend routines. So after HPET is stopped the suspend
> process gets stuck. Repeatedly pressing keyboard keys helps the process to
> finally reach the firmware suspend. Everything is okay after resume.
Got a patch for this issue as well.
The idea is to suspend children in the reverse order (comparing to their attach
order).
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -3772,15 +3772,16 @@ int
bus_generic_suspend(device_t dev)
{
int error;
- device_t child, child2;
+ device_t child;
- TAILQ_FOREACH(child, &dev->children, link) {
+ TAILQ_FOREACH_REVERSE(child, &dev->children, device_list, link) {
error = BUS_SUSPEND_CHILD(dev, child);
- if (error) {
- for (child2 = TAILQ_FIRST(&dev->children);
- child2 && child2 != child;
- child2 = TAILQ_NEXT(child2, link))
- BUS_RESUME_CHILD(dev, child2);
+ if (error != 0) {
+ child = TAILQ_NEXT(child, link);
+ if (child != NULL) {
+ TAILQ_FOREACH_FROM(child, &dev->children, link)
+ BUS_RESUME_CHILD(dev, child);
+ }
return (error);
}
}
--
Andriy Gapon
More information about the freebsd-hackers
mailing list