Re: cvs commit: src/sys/compat/ndis kern_ndis.c src/sys/dev/acpica/Osd OsdSchedule.c src/sys/dev/ata ata-all.c atapi-cd.c atapi-tape.c src/sys/dev/ppc ppc.c

From: John Baldwin <jhb_at_freebsd.org>
Date: Fri, 23 Feb 2007 17:05:05 -0500
On Friday 23 February 2007 15:37, John E Hein wrote:
> John Baldwin wrote at 16:25 +0000 on Feb 23, 2007:
>  > jhb         2007-02-23 16:25:08 UTC
>  > 
>  >   FreeBSD src repository
>  > 
>  >   Modified files:
>  >     sys/compat/ndis      kern_ndis.c 
>  >     sys/dev/acpica/Osd   OsdSchedule.c 
>  >     sys/dev/ata          ata-all.c atapi-cd.c atapi-tape.c 
>  >     sys/dev/ppc          ppc.c 
>  >   Log:
>  >   Use 'pause' in several places rather than trying to tsleep() on NULL 
(which
>  >   triggers a KASSERT) or local variables.  In the case of kern_ndis, the
>  >   tsleep() actually used a common sleep address (curproc) making it
>  >   susceptible to a premature wakeup.
> 
> Nice.  Maybe you should pass in priority so pause(9) users don't
> always wake up at PRI_MIN.

Right now they wakeup at whatever they were when they weng to sleep
(passing 0 to tsleep() results in no priority change).  This way,
pause() doesn't affect your priority at all.

> If not, PZERO might be a more sensible default perhaps.
> 
> PCATCH complicates this slightly since pause(9) currently returns
> nothing, but I could see cases where users might want PCATCH.

If people want to catch signals they can use tsleep() directly, but
this intended for saying "I want to wait 100ms for the hardware to
settle, but don't want to hog the CPU while I do it", and those
places don't use PCATCH now.

-- 
John Baldwin
Received on Fri Feb 23 2007 - 22:04:38 UTC