Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1314401 > unrolled thread
| Started by | Borislav Petkov <bp@alien8.de> |
|---|---|
| First post | 2016-01-21 19:40 +0100 |
| Last post | 2016-01-21 20:00 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 3/5] x86/cpufeature: Get rid of the non-asm goto variant Borislav Petkov <bp@alien8.de> - 2016-01-21 19:40 +0100
Re: [PATCH 3/5] x86/cpufeature: Get rid of the non-asm goto variant "H. Peter Anvin" <hpa@zytor.com> - 2016-01-21 20:00 +0100
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2016-01-21 19:40 +0100 |
| Subject | [PATCH 3/5] x86/cpufeature: Get rid of the non-asm goto variant |
| Message-ID | <qTsjg-I1-11@gated-at.bofh.it> |
From: Borislav Petkov <bp@suse.de>
I can simply quote hpa from the mail:
"Get rid of the non-asm goto variant and just fall back to dynamic if
asm goto is unavailable. It doesn't make any sense, really, if it is
supposed to be safe, and by now the asm goto-capable gcc is in more wide
use. (Originally the gcc 3.x fallback to pure dynamic didn't exist,
either.)"
Booy, am I lazy.
Signed-off-by: Borislav Petkov <bp@suse.de>
Suggested-by: "H. Peter Anvin" <hpa@zytor.com>
---
arch/x86/include/asm/cpufeature.h | 38 +-------------------------------------
1 file changed, 1 insertion(+), 37 deletions(-)
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 2b0abb241205..e4759223f82c 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -174,43 +174,7 @@ static __always_inline __pure bool _static_cpu_has(u16 bit)
t_dynamic:
return __static_cpu_has(bit);
#else
- u8 flag;
- /* Open-coded due to __stringify() in ALTERNATIVE() */
- asm volatile("1: movb $2,%0\n"
- "2:\n"
- ".section .altinstructions,\"a\"\n"
- " .long 1b - .\n" /* src offset */
- " .long 3f - .\n" /* repl offset */
- " .word %P2\n" /* always replace */
- " .byte 2b - 1b\n" /* source len */
- " .byte 4f - 3f\n" /* replacement len */
- " .byte 0\n" /* pad len */
- ".previous\n"
- ".section .discard,\"aw\",@progbits\n"
- " .byte 0xff + (4f-3f) - (2b-1b)\n" /* size check */
- ".previous\n"
- ".section .altinstr_replacement,\"ax\"\n"
- "3: movb $0,%0\n"
- "4:\n"
- ".previous\n"
- ".section .altinstructions,\"a\"\n"
- " .long 1b - .\n" /* src offset */
- " .long 5f - .\n" /* repl offset */
- " .word %P1\n" /* feature bit */
- " .byte 4b - 3b\n" /* src len */
- " .byte 6f - 5f\n" /* repl len */
- " .byte 0\n" /* pad len */
- ".previous\n"
- ".section .discard,\"aw\",@progbits\n"
- " .byte 0xff + (6f-5f) - (4b-3b)\n" /* size check */
- ".previous\n"
- ".section .altinstr_replacement,\"ax\"\n"
- "5: movb $1,%0\n"
- "6:\n"
- ".previous\n"
- : "=qm" (flag)
- : "i" (bit), "i" (X86_FEATURE_ALWAYS));
- return (flag == 2 ? __static_cpu_has(bit) : flag);
+ return boot_cpu_has(bit);
#endif /* CC_HAVE_ASM_GOTO */
}
--
2.3.5
[toc] | [next] | [standalone]
| From | "H. Peter Anvin" <hpa@zytor.com> |
|---|---|
| Date | 2016-01-21 20:00 +0100 |
| Message-ID | <qTsCC-Pl-1@gated-at.bofh.it> |
| In reply to | #1314401 |
On 01/21/16 10:34, Borislav Petkov wrote: > From: Borislav Petkov <bp@suse.de> > > I can simply quote hpa from the mail: > > "Get rid of the non-asm goto variant and just fall back to dynamic if > asm goto is unavailable. It doesn't make any sense, really, if it is > supposed to be safe, and by now the asm goto-capable gcc is in more wide > use. (Originally the gcc 3.x fallback to pure dynamic didn't exist, > either.)" > > Booy, am I lazy. > Laughed-at-by: H. Peter Anvin <hpa@zytor.com> ;) -hpa
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web