Skip to content

Commit 7e60598

Browse files
palmer-dabbeltIngo Molnar
authored andcommitted
sched/wait: Change wait_on_bit*() to take an unsigned long *, not a void *
The implementations of wait_on_bit*() will only work with long-aligned memory on systems that don't support misaligned loads and stores. This patch changes the function prototypes to ensure that the compiler will enforce alignment. Running make defconfig make KFLAGS="-Werror" seems to indicate that, as of c56fb6564dcd ("Fix a misaligned load inside ptrace_attach()"), there are now no users of non-long-aligned calls to wait_on_bit*(). I additionally tried a few "make randconfig" attempts, none of which failed to compile for this reason. Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Chris Metcalf <cmetcalf@ezchip.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Borislav Petkov <bp@alien8.de> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: bobby.prani@gmail.com Cc: oleg@redhat.com Cc: paulmck@linux.vnet.ibm.com Cc: richard@nod.at Cc: vdavydov@parallels.com Link: http://lkml.kernel.org/r/1430453997-32459-3-git-send-email-palmer@dabbelt.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent b76808e commit 7e60598

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

include/linux/wait.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ extern int bit_wait_io_timeout(struct wait_bit_key *);
969969
* on that signal.
970970
*/
971971
static inline int
972-
wait_on_bit(void *word, int bit, unsigned mode)
972+
wait_on_bit(unsigned long *word, int bit, unsigned mode)
973973
{
974974
might_sleep();
975975
if (!test_bit(bit, word))
@@ -994,7 +994,7 @@ wait_on_bit(void *word, int bit, unsigned mode)
994994
* on that signal.
995995
*/
996996
static inline int
997-
wait_on_bit_io(void *word, int bit, unsigned mode)
997+
wait_on_bit_io(unsigned long *word, int bit, unsigned mode)
998998
{
999999
might_sleep();
10001000
if (!test_bit(bit, word))
@@ -1020,7 +1020,8 @@ wait_on_bit_io(void *word, int bit, unsigned mode)
10201020
* received a signal and the mode permitted wakeup on that signal.
10211021
*/
10221022
static inline int
1023-
wait_on_bit_timeout(void *word, int bit, unsigned mode, unsigned long timeout)
1023+
wait_on_bit_timeout(unsigned long *word, int bit, unsigned mode,
1024+
unsigned long timeout)
10241025
{
10251026
might_sleep();
10261027
if (!test_bit(bit, word))
@@ -1047,7 +1048,8 @@ wait_on_bit_timeout(void *word, int bit, unsigned mode, unsigned long timeout)
10471048
* on that signal.
10481049
*/
10491050
static inline int
1050-
wait_on_bit_action(void *word, int bit, wait_bit_action_f *action, unsigned mode)
1051+
wait_on_bit_action(unsigned long *word, int bit, wait_bit_action_f *action,
1052+
unsigned mode)
10511053
{
10521054
might_sleep();
10531055
if (!test_bit(bit, word))
@@ -1075,7 +1077,7 @@ wait_on_bit_action(void *word, int bit, wait_bit_action_f *action, unsigned mode
10751077
* the @mode allows that signal to wake the process.
10761078
*/
10771079
static inline int
1078-
wait_on_bit_lock(void *word, int bit, unsigned mode)
1080+
wait_on_bit_lock(unsigned long *word, int bit, unsigned mode)
10791081
{
10801082
might_sleep();
10811083
if (!test_and_set_bit(bit, word))
@@ -1099,7 +1101,7 @@ wait_on_bit_lock(void *word, int bit, unsigned mode)
10991101
* the @mode allows that signal to wake the process.
11001102
*/
11011103
static inline int
1102-
wait_on_bit_lock_io(void *word, int bit, unsigned mode)
1104+
wait_on_bit_lock_io(unsigned long *word, int bit, unsigned mode)
11031105
{
11041106
might_sleep();
11051107
if (!test_and_set_bit(bit, word))
@@ -1125,7 +1127,8 @@ wait_on_bit_lock_io(void *word, int bit, unsigned mode)
11251127
* the @mode allows that signal to wake the process.
11261128
*/
11271129
static inline int
1128-
wait_on_bit_lock_action(void *word, int bit, wait_bit_action_f *action, unsigned mode)
1130+
wait_on_bit_lock_action(unsigned long *word, int bit, wait_bit_action_f *action,
1131+
unsigned mode)
11291132
{
11301133
might_sleep();
11311134
if (!test_and_set_bit(bit, word))

0 commit comments

Comments
 (0)