lkml.org 
[lkml]   [2015]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: linux-next: build warnings after merge of the access_once tree
From
On Thu, Mar 26, 2015 at 9:15 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> Really. Just get rid of the checks - they were wrong. They were
> clearly very close to *introducing* a bug, rather than fixing anything
> at all.

Side note: we will continue to expect the compiler to do single-word
accesses as a single acccess, rather than splitting things up. And
that's fine. READ_ONCE() uses "volatile", and it means on a language
level that the actual access is "visible", so it's a reasonable
expectation to have.

So the proper patch looks something like this:

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 1b45e4a0519b..f36e1abf56ea 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -198,10 +198,6 @@ __compiletime_warning("data access exceeds
word size and won't be atomic")
#endif
;

-static __always_inline void data_access_exceeds_word_size(void)
-{
-}
-
static __always_inline void __read_once_size(const volatile void
*p, void *res, int size)
{
switch (size) {
@@ -214,7 +210,6 @@ static __always_inline void
__read_once_size(const volatile void *p, void *res,
default:
barrier();
__builtin_memcpy((void *)res, (const void *)p, size);
- data_access_exceeds_word_size();
barrier();
}
}
@@ -231,7 +226,6 @@ static __always_inline void
__write_once_size(volatile void *p, void *res, int s
default:
barrier();
__builtin_memcpy((void *)p, (const void *)res, size);
- data_access_exceeds_word_size();
barrier();
}
}
and let's just leave it at that.

Note again how the default case just guarantees that it is never
reloaded by the compiler. That's the primary issue this is all about.
The whole "we expect the compiler to not be shit" is secondary and
_may_ be an issue in some places, but is not what the main goal is.

Linus


\
 
 \ /
  Last update: 2015-03-26 18:01    [W:0.591 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site