On 11/12/20(Fri) 19:17, Scott Cheloha wrote: > Here's another sleep that doesn't need lbolt. > > The idea here is to call apm_periodic_check() once a second. > We can do that without lbolt. > > Is there some other address that would be more appropriate for this > thread to sleep on? It doesn't look like any apm(4) code calls > wakeup(9) on lbolt so I've just replaced with with a local channel.
Note sure we want to grow the stack just for that. Any member of `sc', or even `sc' itself if this doesn't conflict, could be used as wait channel. > ok? > > Index: apm.c > =================================================================== > RCS file: /cvs/src/sys/arch/i386/i386/apm.c,v > retrieving revision 1.125 > diff -u -p -r1.125 apm.c > --- apm.c 24 Jun 2020 22:03:40 -0000 1.125 > +++ apm.c 12 Dec 2020 01:17:38 -0000 > @@ -50,6 +50,7 @@ > #include <sys/buf.h> > #include <sys/reboot.h> > #include <sys/event.h> > +#include <sys/time.h> > > #include <machine/conf.h> > #include <machine/cpu.h> > @@ -904,12 +905,13 @@ void > apm_thread(void *v) > { > struct apm_softc *sc = v; > + int chan; > > for (;;) { > rw_enter_write(&sc->sc_lock); > (void) apm_periodic_check(sc); > rw_exit_write(&sc->sc_lock); > - tsleep_nsec(&lbolt, PWAIT, "apmev", INFSLP); > + tsleep_nsec(&chan, PWAIT, "apmev", SEC_TO_NSEC(1)); > } > } > >