On Sun, May 20, 2018 at 11:28:14AM +0200, Mark Kettenis wrote: > > Date: Sun, 20 May 2018 10:44:49 +0200 > > From: Martin Pieuchot <m...@openbsd.org> > > > > On 19/05/18(Sat) 21:39, Mark Kettenis wrote: > > > Without the wakeup, the event doesn't get scheduled until some other > > > event wakes up the acpi thread. On one of my machines the gpio event > > > reads a status byte over i2c in repsonse of a gpio event. Without the > > > wakeup that status byte has often been cleared/overwritten by the time > > > the event gets scheduled. > > > > > > ok? > > > > ok mpi@ > > > > Then why not make acpi_addtask() call acpi_wakeup() if it could enqueue > > a task? This is how task_add(9) work. Most of the code paths already > > use the pattern your suggesting. > > I was thinking the same thing. It seems acpi_interrupt() schedules a > couple of tasks and does a single wakeup. There are also some > scheduling sleep-related tasks that don't have an acpi_wakeup() > associated with them. I don't see a fundamental reason why we can't > do this though. But maybe I'm missing something? >
Whatever direction you decide, ok mlarkin on either. > > > Index: acpi.c > > > =================================================================== > > > RCS file: /cvs/src/sys/dev/acpi/acpi.c,v > > > retrieving revision 1.343 > > > diff -u -p -r1.343 acpi.c > > > --- acpi.c 17 May 2018 20:46:45 -0000 1.343 > > > +++ acpi.c 19 May 2018 19:35:59 -0000 > > > @@ -861,6 +861,7 @@ acpi_gpio_event(void *arg) > > > struct acpi_gpio_event *ev = arg; > > > > > > acpi_addtask(acpi_softc, acpi_gpio_event_task, ev->node, ev->pin); > > > + acpi_wakeup(acpi_softc); > > > return 1; > > > } > > > > > > > > >