lkml.org 
[lkml]   [2006]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [patch] spinlocks: remove 'volatile'
    Linus Torvalds writes:

    > AND I POINTED OUT THAT EVEN IN YOUR TRIVIAL EXAMPLE, VOLATILE WAS
    > ACTUALLY THE WRONG THING TO DO.
    >
    > And that's _exactly_ because the language environment (in this case
    > the CPU itself) has evolved past the point it was 30 years ago.

    Key thing being "language environment", meaning gcc.

    By the language spec, volatile is a low-performance way to
    get the job done. Following the language spec is damn hard
    these days, considering some of the evil things PCI does in
    the name of performance. The compiler probably should offer
    an option to call a function for read/write to volatile mem.
    Such a function could take a lock, determine if a PCI read
    is required to enforce ordering, perform the operation, and
    then release the lock.

    That's all theoretical though. Today, gcc's volatile does
    not follow the C standard on modern hardware. Bummer.
    It'd be low-performance anyway though.
    -
    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/

    \
     
     \ /
      Last update: 2006-07-08 05:57    [W:0.040 / U:0.140 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site