lkml.org 
[lkml]   [2020]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] x86/asm: Replace __force_order with memory clobber
On Wed, Sep 02, 2020 at 08:19:25PM +0200, Miguel Ojeda wrote:
> On Wed, Sep 2, 2020 at 5:33 PM Arvind Sankar <nivedita@alum.mit.edu> wrote:
> >
> > + * The compiler should not reorder volatile asm, however older versions of GCC
> > + * had a bug (which was fixed in 8.1, 7.3 and 6.5) where they could sometimes
> > + * reorder volatile asm. The write functions are not a problem since they have
> > + * memory clobbers preventing reordering. To prevent reads from being reordered
> > + * with respect to writes, use a dummy memory operand.
>
> I see you added the information to the commit message, but I'd still
> reword this to something like:

Ah sorry, I forgot to change the comment in the source as well.

>
> "The compiler should not reorder volatile asm, however GCC 4.9.x and
> 5.x have a bug where they could sometimes reorder volatile asm. The
> bug was fixed in 8.1, 7.3 and 6.5. The write functions are not a
> problem since they have memory clobbers preventing reordering. To
> prevent reads from being reordered with respect to writes, use a dummy
> memory operand."
>
> The important point is that 4.9.x and 5.x *have* the bug and that is
> the reason for having the hack. In the old wording it seems like the
> bug is no more. Then one wonders why the hack is still there (i.e.
> perhaps because we don't trust it, perhaps to support the rest of the
> minor versions which are newer, perhaps to avoid regressions, perhaps
> only the comment was updated, etc.).
>
> Cheers,
> Miguel

\
 
 \ /
  Last update: 2020-09-02 20:25    [W:0.110 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site