Skip to content

Commit d6bd819

Browse files
committed
powerpc/32: Avoid miscompilation w/GCC 4.6.3 - don't inline copy_to/from_user()
Larry Finger reported that his Powerbook G4 was no longer booting with v4.12-rc, userspace was up but giving weird errors such as: udevd[64]: starting version 175 udevd[64]: Unable to receive ctrl message: Bad address. modprobe: chdir(4.12-rc1): No such file or directory He bisected the problem to commit 3448890 ("powerpc: get rid of zeroing, switch to RAW_COPY_USER"). Al identified that the problem is actually a miscompilation by GCC 4.6.3, which is exposed by the above commit. Al also pointed out that inlining copy_to/from_user() is probably of little or no benefit, which is correct. Using Anton's copy_to_user benchmark, with a pathological single byte copy, we see a small increase in performance by *removing* inlining: Before (inlined): # time ./copy_to_user -w -l 1 -i 10000000 ( x 3 ) real 0m22.063s real 0m22.059s real 0m22.076s After: # time ./copy_to_user -w -l 1 -i 10000000 ( x 3 ) real 0m21.325s real 0m21.299s real 0m21.364s So as a small performance improvement and to avoid the miscompilation, drop inlining copy_to/from_user() on 32-bit. Fixes: 3448890 ("powerpc: get rid of zeroing, switch to RAW_COPY_USER") Reported-by: Larry Finger <[email protected]> Suggested-by: Al Viro <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 797625d commit d6bd819

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

arch/powerpc/include/asm/uaccess.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,7 @@ do { \
267267
extern unsigned long __copy_tofrom_user(void __user *to,
268268
const void __user *from, unsigned long size);
269269

270-
#ifndef __powerpc64__
271-
272-
#define INLINE_COPY_FROM_USER
273-
#define INLINE_COPY_TO_USER
274-
275-
#else /* __powerpc64__ */
276-
270+
#ifdef __powerpc64__
277271
static inline unsigned long
278272
raw_copy_in_user(void __user *to, const void __user *from, unsigned long n)
279273
{

0 commit comments

Comments
 (0)