Re: user-mode port 0.44-2.4.7

Chris Friesen (cfriesen@nortelnetworks.com)
Mon, 23 Jul 2001 16:44:06 -0400


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".

If I understand correctly, xtime is updated asynchronously. If it isn't, then
ignore this message totally. However, if it is, then *not* specifying it as
volatile could easily cause problems in technically correct but poorly written
code.

Suppose I loop against xtime reaching a particular value. While this is
definately not good practice, if xtime is not specified as volatile then since I
never modify it within the loop the compiler is free to move the initial load
out of the loop when optimizing. In this example the case where it is marked as
volatile will run (though inefficiently), but the non-volatile case can hang
totally.

Do we want to get ourselves into something like this?

Chris

-- 
Chris Friesen                    | MailStop: 043/33/F10  
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: cfriesen@nortelnetworks.com
-
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/