* [PATCH] x86/nospec: Fixup array_index_nospec_mask() asm constraint
@ 2018-02-07 1:33 Dan Williams
2018-02-07 1:50 ` Linus Torvalds
0 siblings, 1 reply; 3+ messages in thread
From: Dan Williams @ 2018-02-07 1:33 UTC (permalink / raw)
To: mingo
Cc: x86, linux-kernel, Andy Lutomirski, H. Peter Anvin,
Thomas Gleixner, Linus Torvalds
Allow the compiler to handle @size as an immediate value rather than
allocating a register.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
arch/x86/include/asm/barrier.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h
index 30d406146016..9e9d6f27825a 100644
--- a/arch/x86/include/asm/barrier.h
+++ b/arch/x86/include/asm/barrier.h
@@ -40,7 +40,7 @@ static inline unsigned long array_index_mask_nospec(unsigned long index,
asm ("cmp %1,%2; sbb %0,%0;"
:"=r" (mask)
- :"r"(size),"r" (index)
+ :"ir"(size),"r" (index)
:"cc");
return mask;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/nospec: Fixup array_index_nospec_mask() asm constraint
2018-02-07 1:33 [PATCH] x86/nospec: Fixup array_index_nospec_mask() asm constraint Dan Williams
@ 2018-02-07 1:50 ` Linus Torvalds
2018-02-07 1:55 ` Dan Williams
0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2018-02-07 1:50 UTC (permalink / raw)
To: Dan Williams
Cc: Ingo Molnar, the arch/x86 maintainers, Linux Kernel Mailing List,
Andy Lutomirski, H. Peter Anvin, Thomas Gleixner
On Tue, Feb 6, 2018 at 5:33 PM, Dan Williams <dan.j.williams@intel.com> wrote:
> Allow the compiler to handle @size as an immediate value rather than
> allocating a register.
Actually, maybe that "ir" should be "g".
Because it's fine if it's a memory location too. "cmp" takes pretty
much anything, as long as the thing we compare _to_ is a register.
Linus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/nospec: Fixup array_index_nospec_mask() asm constraint
2018-02-07 1:50 ` Linus Torvalds
@ 2018-02-07 1:55 ` Dan Williams
0 siblings, 0 replies; 3+ messages in thread
From: Dan Williams @ 2018-02-07 1:55 UTC (permalink / raw)
To: Linus Torvalds
Cc: Ingo Molnar, the arch/x86 maintainers, Linux Kernel Mailing List,
Andy Lutomirski, H. Peter Anvin, Thomas Gleixner
On Tue, Feb 6, 2018 at 5:50 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Tue, Feb 6, 2018 at 5:33 PM, Dan Williams <dan.j.williams@intel.com> wrote:
>> Allow the compiler to handle @size as an immediate value rather than
>> allocating a register.
>
> Actually, maybe that "ir" should be "g".
>
> Because it's fine if it's a memory location too. "cmp" takes pretty
> much anything, as long as the thing we compare _to_ is a register.
Ok, no worries I'll do a v2. In fact you suggested 'g' in your initial
version and I lost that along the way while wrestling with why the
compiler miscompiled it until I put it in a static inline rather than
a macro.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-02-07 1:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-07 1:33 [PATCH] x86/nospec: Fixup array_index_nospec_mask() asm constraint Dan Williams
2018-02-07 1:50 ` Linus Torvalds
2018-02-07 1:55 ` Dan Williams
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.