Help with 4.3 mod to kill uninteruptable procs.

der Mouse mouse at thunder.mcrcim.mcgill.edu
Wed Feb 27 21:54:36 AEST 1991


In article <5583 at awdprime.UUCP>, tif at doorstop.austin.ibm.com (Paul Chamberlain) writes:
> In article <5558 at awdprime.UUCP> jfh at greenber.austin.ibm.com (John F Haugh II) writes:
>> A typical sleep loop looks something like

>>	while (some_status & some_busy_flag)
>>		sleep (&some_status, PRI_O_MINE);
>>	some_status |= some_busy_flag;

> John, perhaps it obvious, but I've seen several places that neglect
> to do this right, and I don't want it to become anymore widespread.
> Unless you like drivers that hang sometimes, this is the way it
> should be:

> 	DISABLE_INTERRUPTS;
> 	while (some_status & some_busy_flag)
> 		sleep (&some_status, PRI_O_MINE);
> 	ENABLE_INTERRUPTS;
> 	some_status |= some_busy_flag;

I would tend to move the enable after the bit set.  I think at present
it doesn't make any difference, but only because kernel code can't be
preempted, except in a limited way by interrupts, and the interrupt
handler never sets or clears the busy bit.  If either of these changes,
you'll be glad you have the enable after the setting of the busy bit!

					der Mouse

			old: mcgill-vision!mouse
			new: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.unix.internals mailing list