Re: [GIT PULL] x86/asm changes for v5.6

From: Ingo Molnar
Date: Tue Jan 28 2020 - 15:14:22 EST



* Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Tue, Jan 28, 2020 at 11:51 AM Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > ALTERNATIVE_2 \
> > "cmp $680, %rdx ; jb 3f ; cmpb %dil, %sil; je 4f", \
> > "movq %rdx, %rcx ; rep movsb; retq", X86_FEATURE_FSRM, \
> > "cmp $0x20, %rdx; jb 1f; movq %rdx, %rcx; rep movsb; retq", X86_FEATURE_ERMS
>
> Note the UNTESTED part.
>
> In particular, I didn't check what the priority for the alternatives
> is. Since FSRM being set always implies ERMS being set too, it may be
> that the ERMS case is always picked with the above code.
>
> So maybe the FSRM and ERMS lines need to be switched around, and
> somebody should add a comment to the ALTERNATIVE_2 macro about the
> priority rules for feature1 vs feature2 when both are set..
>
> IOW, testing most definitely required for that patch suggestion of mine..

Understood, thanks!

Ingo