tech-kern archive

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

Re: racy acccess in kern_runq.c



> Compilers have became much more aggressive over the years.  But they
> are allowed to be so by the C standard.  Specifically, in addition to
> code-level re-ordering, plain accesses (loads/stores) are subject to
> load/store fusing, tearing as well as invented loads/stores.

Then, honestly, it sounds to me as though "the latest revision of C" is
no longer an appropriate language for writing kernels.  I see no reason
to twist the kernel code into a pretzel to work around latitude a new
language gives to its compilers - and that's what C11 is, a new
language, albeit one closely related to various previous languages.

One of the prime considerations when choosing a language and/or
compiler for building a kernel is that it produce relatively
predictable code, for exactly this kind of reason.  If the latest C and
the latest gcc no longer do that, then IMO they are no longer
appropriate for writing/compiling kernels.

> While these primitives might be slightly verbose, they are in C11,
> they fix real bugs, they definitely make code less error-prone and
> they have other merits too (e.g. they accommodate static analysers
> which find some real bugs).

How many of those "real bugs" exist only because C11 gave compilers new
latitude to produce unexpected code?

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index