tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: racy acccess in kern_runq.c



On Dec 6,  5:22pm, Don Lee wrote:
}
} Writing Kernel code *requires* knowledge of what code is generated
} sometimes.  In my experience, there have been standard techniques,
} like pragmas and insertions of assembly code to suppress this
} sort of undesirable optimization.
} 
} Don't those techniques exist any more?  My compiler friends used
} to put them in for just this purpose, and they tried to make them
} as portable as possible.  Surely GCC does this.  No?

   Pragmas and assembly code, of course, still exist, but they are
extremely unportable.  It is my understanding that Clang emulates
many of GCCs pragmas, but there is no guarantee as pragmas are very
much a compiler dependent feature.  Writing short bits of assembly
code is going to have dependence on the compiler and the CPU.  Even
within a particular CPU architecture, there are often significantly
varying feature sets.  Both of these options are best avoided in
portable code.  Newer versions of the C standard provide ways to
annotate your code to tell the compiler what you want, which is
what one should be using.

}-- End of excerpt from Don Lee


Home | Main Index | Thread Index | Old Index