Re: user-mode port 0.44-2.4.7

From: Jonathan Lundell (jlundell@pobox.com)
Date: Mon Jul 23 2001 - 15:15:31 EST


At 1:00 PM -0700 2001-07-23, Linus Torvalds wrote:
>On Mon, 23 Jul 2001, Andrea Arcangeli wrote:
>>
>> gcc can assume 'state' stays constant in memory not just during the
>> 'case'.
>
>The point is that if the kernel has _any_ algorithm where it cares, it's a
>kernel bug. With volatile or without.
>
>SHOW ME THE CASE WHERE IT CARES. Let's fix it. Let's not just hide it with
>"volatile".

in arch/i386/kernel/io_apic.c:

>static int __init timer_irq_works(void)
>{
> unsigned int t1 = jiffies;
>
> sti();
> /* Let ten ticks pass... */
> mdelay((10 * 1000) / HZ);
>
> /*
> * Expect a few ticks at least, to be sure some possible
> * glue logic does not lock up after one or two first
> * ticks in a non-ExtINT mode. Also the local APIC
> * might have cached one ExtINT interrupt. Finally, at
> * least one tick may be lost due to delays.
> */
> if (jiffies - t1 > 4)
> return 1;
>
> return 0;
>}

If jiffies were not volatile, this initializing assignment and the
test at the end could be optimized away, leaving an unconditional
"return 0". A lock is of no help.

-- 
/Jonathan Lundell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 23 2001 - 21:00:17 EST