x86/asm: Some minor cleanups
Borislav Petkov
maintainercover x86/asm: Some minor cleanups
From: Borislav Petkov <[email protected]>
Just some trivial cleanups for things encountered recently, while staring at code.
Borislav Petkov (3):
x86/lib/copy_user_nocache_64.S: Remove FIX_ALIGNMENT define x86/asm: Unify ALIGN_DESTINATION macro x86/lib/asm: Get rid of copy_user_nocache_64.S
arch/x86/include/asm/asm.h | 25 +++++++ arch/x86/lib/Makefile | 2 +- arch/x86/lib/copy_user_64.S | 116 +++++++++++++++++++++++------- arch/x86/lib/copy_user_nocache_64.S | 136 ------------------------------------ 4 files changed, 118 insertions(+), 161 deletions(-) delete mode 100644 arch/x86/lib/copy_user_nocache_64.S
Signature · 1 line
2.3.5
Borislav Petkov
maintainerPATCH 1/3 x86/lib/copy_user_nocache_64.S: Remove FIX_ALIGNMENT define
From: Borislav Petkov <[email protected]>
No code changed:
# arch/x86/lib/copy_user_nocache_64.o:
text data bss dec hex filename
390 0 0 390 186 copy_user_nocache_64.o.before
390 0 0 390 186 copy_user_nocache_64.o.aftermd5:
7fa0577b28700af89d3a67a8b590426e copy_user_nocache_64.o.before.asm 7fa0577b28700af89d3a67a8b590426e copy_user_nocache_64.o.after.asm
--- arch/x86/lib/copy_user_nocache_64.S | 5 ----- 1 file changed, 5 deletions(-)
arch/x86/lib/copy_user_nocache_64.S +0 -5
@@ -8,9 +8,6 @@ #include <linux/linkage.h> #include <asm/dwarf2.h> - -#define FIX_ALIGNMENT 1 - #include <asm/current.h> #include <asm/asm-offsets.h> #include <asm/thread_info.h>
@@ -18,7 +15,6 @@ #include <asm/smap.h> .macro ALIGN_DESTINATION -#ifdef FIX_ALIGNMENT /* check for bad alignment of destination */ movl %edi,%ecx andl $7,%ecx
@@ -40,7 +36,6 @@ _ASM_EXTABLE(100b,103b) _ASM_EXTABLE(101b,103b) -#endif .endm /*
Signature · 1 line
2.3.5
tip-bot for Borislav Petkov
merge bot[tip:x86/asm] x86/asm/uaccess: Remove FIX_ALIGNMENT define from copy_user_nocache_64.S:
x86/asm/uaccess: Remove FIX_ALIGNMENT define from copy_user_nocache_64.S:
Commit-ID: 26e7d9dee8a5b6c844178c8e2d91be540ce311c0 Gitweb: http://git.kernel.org/tip/26e7d9dee8a5b6c844178c8e2d91be540ce311c0 Author: Borislav Petkov <[email protected]> AuthorDate: Wed, 13 May 2015 19:42:22 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 14 May 2015 07:25:34 +0200
x86/asm/uaccess: Remove FIX_ALIGNMENT define from copy_user_nocache_64.S:
No code changed:
# arch/x86/lib/copy_user_nocache_64.o:
text data bss dec hex filename
390 0 0 390 186 copy_user_nocache_64.o.before
390 0 0 390 186 copy_user_nocache_64.o.aftermd5:
7fa0577b28700af89d3a67a8b590426e copy_user_nocache_64.o.before.asm 7fa0577b28700af89d3a67a8b590426e copy_user_nocache_64.o.after.asm
--- arch/x86/lib/copy_user_nocache_64.S | 5 ----- 1 file changed, 5 deletions(-)
arch/x86/lib/copy_user_nocache_64.S +0 -5
@@ -8,9 +8,6 @@ #include <linux/linkage.h> #include <asm/dwarf2.h> - -#define FIX_ALIGNMENT 1 - #include <asm/current.h> #include <asm/asm-offsets.h> #include <asm/thread_info.h>
@@ -18,7 +15,6 @@ #include <asm/smap.h> .macro ALIGN_DESTINATION -#ifdef FIX_ALIGNMENT /* check for bad alignment of destination */ movl %edi,%ecx andl $7,%ecx
@@ -40,7 +36,6 @@ _ASM_EXTABLE(100b,103b) _ASM_EXTABLE(101b,103b) -#endif .endm /*
Borislav Petkov
maintainerPATCH 2/3 x86/asm: Unify ALIGN_DESTINATION macro
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Pull it up into the header and kill duplicate versions. Separately, both macros are identical:
35948b2bd3431aee7149e85cfe4becbc /tmp/a
35948b2bd3431aee7149e85cfe4becbc /tmp/b
--- arch/x86/include/asm/asm.h | 25 +++++++++++++++++++++++++ arch/x86/lib/copy_user_64.S | 24 ------------------------ arch/x86/lib/copy_user_nocache_64.S | 24 ------------------------ 3 files changed, 25 insertions(+), 48 deletions(-)
arch/x86/include/asm/asm.h +25 -0
@@ -63,6 +63,31 @@ _ASM_ALIGN ; \_ASM_PTR (entry); \ .popsection + +.macro ALIGN_DESTINATION + /* check for bad alignment of destination */ + movl %edi,%ecx + andl $7,%ecx + jz 102f /* already aligned */ + subl $8,%ecx + negl %ecx + subl %ecx,%edx +100: movb (%rsi),%al +101: movb %al,(%rdi) + incq %rsi + incq %rdi + decl %ecx + jnz 100b +102: + .section .fixup,"ax" +103: addl %ecx,%edx /* ecx is zerorest also */ + jmp copy_user_handle_tail + .previous + + _ASM_EXTABLE(100b,103b) + _ASM_EXTABLE(101b,103b) + .endm + #else # define _ASM_EXTABLE(from,to) \ " .pushsection \"__ex_table\",\"a\"\n" \
arch/x86/lib/copy_user_64.S +0 -24
@@ -16,30 +16,6 @@ #include <asm/asm.h> #include <asm/smap.h> - .macro ALIGN_DESTINATION - /* check for bad alignment of destination */ - movl %edi,%ecx - andl $7,%ecx - jz 102f /* already aligned */ - subl $8,%ecx - negl %ecx - subl %ecx,%edx -100: movb (%rsi),%al -101: movb %al,(%rdi) - incq %rsi - incq %rdi - decl %ecx - jnz 100b -102: - .section .fixup,"ax" -103: addl %ecx,%edx /* ecx is zerorest also */ - jmp copy_user_handle_tail - .previous - - _ASM_EXTABLE(100b,103b) - _ASM_EXTABLE(101b,103b) - .endm - /* Standard copy_to_user with segment limit checking */ ENTRY(_copy_to_user) CFI_STARTPROC
arch/x86/lib/copy_user_nocache_64.S +0 -24
@@ -14,30 +14,6 @@ #include <asm/asm.h> #include <asm/smap.h> - .macro ALIGN_DESTINATION - /* check for bad alignment of destination */ - movl %edi,%ecx - andl $7,%ecx - jz 102f /* already aligned */ - subl $8,%ecx - negl %ecx - subl %ecx,%edx -100: movb (%rsi),%al -101: movb %al,(%rdi) - incq %rsi - incq %rdi - decl %ecx - jnz 100b -102: - .section .fixup,"ax" -103: addl %ecx,%edx /* ecx is zerorest also */ - jmp copy_user_handle_tail - .previous - - _ASM_EXTABLE(100b,103b) - _ASM_EXTABLE(101b,103b) - .endm - /* * copy_user_nocache - Uncached memory copy with exception handling * This will force destination/source out of cache for more performance.
Signature · 1 line
2.3.5
tip-bot for Borislav Petkov
merge bot[tip:x86/asm] x86/asm/uaccess: Unify the ALIGN_DESTINATION macro
x86/asm/uaccess: Unify the ALIGN_DESTINATION macro
Commit-ID: 9e6b13f761d5914a8c9b83610e8d459653515c94 Gitweb: http://git.kernel.org/tip/9e6b13f761d5914a8c9b83610e8d459653515c94 Author: Borislav Petkov <[email protected]> AuthorDate: Wed, 13 May 2015 19:42:23 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 14 May 2015 07:25:34 +0200
x86/asm/uaccess: Unify the ALIGN_DESTINATION macro
Pull it up into the header and kill duplicate versions. Separately, both macros are identical:
35948b2bd3431aee7149e85cfe4becbc /tmp/a 35948b2bd3431aee7149e85cfe4becbc /tmp/b
--- arch/x86/include/asm/asm.h | 25 +++++++++++++++++++++++++ arch/x86/lib/copy_user_64.S | 24 ------------------------ arch/x86/lib/copy_user_nocache_64.S | 24 ------------------------ 3 files changed, 25 insertions(+), 48 deletions(-)
arch/x86/include/asm/asm.h +25 -0
@@ -63,6 +63,31 @@ _ASM_ALIGN ; \_ASM_PTR (entry); \ .popsection + +.macro ALIGN_DESTINATION + /* check for bad alignment of destination */ + movl %edi,%ecx + andl $7,%ecx + jz 102f /* already aligned */ + subl $8,%ecx + negl %ecx + subl %ecx,%edx +100: movb (%rsi),%al +101: movb %al,(%rdi) + incq %rsi + incq %rdi + decl %ecx + jnz 100b +102: + .section .fixup,"ax" +103: addl %ecx,%edx /* ecx is zerorest also */ + jmp copy_user_handle_tail + .previous + + _ASM_EXTABLE(100b,103b) + _ASM_EXTABLE(101b,103b) + .endm + #else # define _ASM_EXTABLE(from,to) \ " .pushsection \"__ex_table\",\"a\"\n" \
arch/x86/lib/copy_user_64.S +0 -24
@@ -16,30 +16,6 @@ #include <asm/asm.h> #include <asm/smap.h> - .macro ALIGN_DESTINATION - /* check for bad alignment of destination */ - movl %edi,%ecx - andl $7,%ecx - jz 102f /* already aligned */ - subl $8,%ecx - negl %ecx - subl %ecx,%edx -100: movb (%rsi),%al -101: movb %al,(%rdi) - incq %rsi - incq %rdi - decl %ecx - jnz 100b -102: - .section .fixup,"ax" -103: addl %ecx,%edx /* ecx is zerorest also */ - jmp copy_user_handle_tail - .previous - - _ASM_EXTABLE(100b,103b) - _ASM_EXTABLE(101b,103b) - .endm - /* Standard copy_to_user with segment limit checking */ ENTRY(_copy_to_user) CFI_STARTPROC
arch/x86/lib/copy_user_nocache_64.S +0 -24
@@ -14,30 +14,6 @@ #include <asm/asm.h> #include <asm/smap.h> - .macro ALIGN_DESTINATION - /* check for bad alignment of destination */ - movl %edi,%ecx - andl $7,%ecx - jz 102f /* already aligned */ - subl $8,%ecx - negl %ecx - subl %ecx,%edx -100: movb (%rsi),%al -101: movb %al,(%rdi) - incq %rsi - incq %rdi - decl %ecx - jnz 100b -102: - .section .fixup,"ax" -103: addl %ecx,%edx /* ecx is zerorest also */ - jmp copy_user_handle_tail - .previous - - _ASM_EXTABLE(100b,103b) - _ASM_EXTABLE(101b,103b) - .endm - /* * copy_user_nocache - Uncached memory copy with exception handling * This will force destination/source out of cache for more performance.
Borislav Petkov
maintainerPATCH 3/3 x86/lib/asm: Get rid of copy_user_nocache_64.S
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Move __copy_user_nocache() to arch/x86/lib/copy_user_64.S and kill the containing file.
No functionality change.
--- arch/x86/lib/Makefile | 2 +- arch/x86/lib/copy_user_64.S | 92 +++++++++++++++++++++++++++++++ arch/x86/lib/copy_user_nocache_64.S | 107 ------------------------------------ 3 files changed, 93 insertions(+), 108 deletions(-) delete mode 100644 arch/x86/lib/copy_user_nocache_64.S
arch/x86/lib/Makefile +1 -1
@@ -40,6 +40,6 @@ else lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o lib-y += clear_page_64.o copy_page_64.o lib-y += memmove_64.o memset_64.o - lib-y += copy_user_64.o copy_user_nocache_64.o + lib-y += copy_user_64.o lib-y += cmpxchg16b_emu.o endif
arch/x86/lib/copy_user_64.S +92 -0
95 lines not on this page · raw message
arch/x86/lib/copy_user_nocache_64.S deleted +0 -107
107 lines not on this page · raw message
Signature · 1 line
2.3.5
tip-bot for Borislav Petkov
merge bot[tip:x86/asm] x86/asm/uaccess: Get rid of copy_user_nocache_64.S
x86/asm/uaccess: Get rid of copy_user_nocache_64.S
Commit-ID: b41e6ec242cba0151f0b32041cfa728e7ca6e0b7 Gitweb: http://git.kernel.org/tip/b41e6ec242cba0151f0b32041cfa728e7ca6e0b7 Author: Borislav Petkov <[email protected]> AuthorDate: Wed, 13 May 2015 19:42:24 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 14 May 2015 07:25:35 +0200
x86/asm/uaccess: Get rid of copy_user_nocache_64.S
Move __copy_user_nocache() to arch/x86/lib/copy_user_64.S and kill the containing file.
No functionality change.
--- arch/x86/lib/Makefile | 2 +- arch/x86/lib/copy_user_64.S | 92 +++++++++++++++++++++++++++++++ arch/x86/lib/copy_user_nocache_64.S | 107 ------------------------------------ 3 files changed, 93 insertions(+), 108 deletions(-)
arch/x86/lib/Makefile +1 -1
@@ -40,6 +40,6 @@ else lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o lib-y += clear_page_64.o copy_page_64.o lib-y += memmove_64.o memset_64.o - lib-y += copy_user_64.o copy_user_nocache_64.o + lib-y += copy_user_64.o lib-y += cmpxchg16b_emu.o endif
arch/x86/lib/copy_user_64.S +92 -0
95 lines not on this page · raw message
arch/x86/lib/copy_user_nocache_64.S deleted +0 -107
107 lines not on this page · raw message