Re: [PATCH 01/18] asm-generic/barrier: add generic nospec helpers

From
Mark Rutland <mark.rutland@arm.com>
Date
2018-01-06 17:09:08
Also in
linux-arch, lkml
Reply to
Dan Williams, 2018-01-06
On Fri, Jan 05, 2018 at 09:23:06PM -0800, Dan Williams wrote:
On Fri, Jan 5, 2018 at 6:55 PM, Linus Torvalds
[off-list ref] wrote:
quoted
On Fri, Jan 5, 2018 at 5:09 PM, Dan Williams [off-list ref] wrote:
quoted
+#ifndef nospec_ptr
+#define nospec_ptr(ptr, lo, hi)                                                \
Do we actually want this horrible interface?

It just causes the compiler - or inline asm - to generate worse code,
because it needs to compare against both high and low limits.

Basically all users are arrays that are zero-based, and where a
comparison against the high _index_ limit would be sufficient.

But the way this is all designed, it's literally designed for bad code
generation for the unusual case, and the usual array case is written
in the form of the unusual and wrong non-array case. That really seems
excessively stupid.
Yes, it appears we can kill nospec_ptr() and move nospec_array_ptr()
to assume 0 based arrays rather than use nospec_ptr.
Sounds good to me; I can respin the arm/arm64 implementations accordingly.

We can always revisit that if we have non-array cases that need to be covered.

Thanks,
Mark.
Thread (136 messages) 136 messages, 29 authors, last reply 2018-01-12
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help