From patchwork Sun Jan 14 23:23:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Woodhouse, David" X-Patchwork-Id: 860555 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-471221-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="fEictVmT"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zKXc74Db6z9sBW for ; Mon, 15 Jan 2018 10:23:51 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id; q=dns; s=default; b=B8mHtncGZMN6aEy RuHBhc8+kTQ0v6sTDQRkqyx7dJbNKr8G8YCJwhnJcjlk4a2ahzShQO95XeDfbM0H 7YKmdHpGAt6tHYG32JCnz5Bnrc7WtusE6QvR2Fev9Grs1vdkcMb1w5rA+vOjK6Tq s0+I5sq6YP8duIm19SL+0eOBcvoU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id; s=default; bh=aF++hAQMFmMgn1gb86Dxq ujV8ds=; b=fEictVmTh4EOq/dcVEpvnwiEo89NnB0QLO3vlhTcqVBGPHcEjH92M 561eltx7MHOqD7cyDyIBtrHLEqy7eItyWfamQF73Y4gc0/TvhtH7AIRR0g8jClpl T6TlqjzeMxpqwPMeQ1ZbP8Uq5dSyqYIlJEcjRAOHViGbX40HOtFTuo= Received: (qmail 49643 invoked by alias); 14 Jan 2018 23:23:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 49633 invoked by uid 89); 14 Jan 2018 23:23:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-33.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_COUK, SPF_PASS, T_RP_MATCHES_RCVD, USER_IN_DEF_SPF_WL autolearn=ham version=3.3.2 spammy=quarter, HX-Envelope-From:prvs, minute X-HELO: smtp-fw-33001.amazon.com Received: from smtp-fw-33001.amazon.com (HELO smtp-fw-33001.amazon.com) (207.171.190.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 14 Jan 2018 23:23:42 +0000 Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2c-5f221cf9.us-west-2.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 14 Jan 2018 23:23:39 +0000 Received: from uc8d3ff76b9bc5848a9cc.ant.amazon.com (pdx2-ws-svc-lb17-vlan3.amazon.com [10.247.140.70]) by email-inbound-relay-2c-5f221cf9.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w0ENNaW1087952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 14 Jan 2018 23:23:38 GMT Received: from uc8d3ff76b9bc5848a9cc.ant.amazon.com (localhost [127.0.0.1]) by uc8d3ff76b9bc5848a9cc.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id w0ENNYAq016985; Mon, 15 Jan 2018 00:23:34 +0100 Received: (from dwmw@localhost) by uc8d3ff76b9bc5848a9cc.ant.amazon.com (8.15.2/8.15.2/Submit) id w0ENNYLl016982; Mon, 15 Jan 2018 00:23:34 +0100 From: David Woodhouse To: gcc-patches@gcc.gnu.org, LKML , Linus Torvalds , tglx@linutronix.de, hjl.tools@gmail.com Subject: [PATCH] x86/retpoline: Switch thunk names to match final GCC patches Date: Mon, 15 Jan 2018 00:23:32 +0100 Message-Id: <1515972212-16570-1-git-send-email-dwmw@amazon.co.uk> At the last minute, they were switched from __x86_indirect_thunk_rax to __x86_indirect_thunk_ax without the 'r' or 'e' on the register name. Except for the _r[89..] versions, obviously. This is not entirely an improvement, IMO. Reluctantly-signed-off-by: David Woodhouse --- I think we *shouldn't* do this. Uros said we could look at it and make a decision, and GCC would implement what we decide. Up to Linus. I'm sending this because I've built the compiler with the proposed changes and tested it, and it's quarter past Monday and I'm done. Not because I really want it. arch/x86/entry/entry_64.S | 2 +- arch/x86/include/asm/asm-prototypes.h | 24 ++++++++++---------- arch/x86/lib/retpoline.S | 41 +++++++++++++++++------------------ 3 files changed, 32 insertions(+), 35 deletions(-) diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 59874bc..e393163 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -269,7 +269,7 @@ entry_SYSCALL_64_fastpath: */ #ifdef CONFIG_RETPOLINE movq sys_call_table(, %rax, 8), %rax - call __x86_indirect_thunk_rax + call __x86_indirect_thunk_ax #else call *sys_call_table(, %rax, 8) #endif diff --git a/arch/x86/include/asm/asm-prototypes.h b/arch/x86/include/asm/asm-prototypes.h index 0927cdc..df80478 100644 --- a/arch/x86/include/asm/asm-prototypes.h +++ b/arch/x86/include/asm/asm-prototypes.h @@ -18,19 +18,7 @@ extern void cmpxchg8b_emu(void); #endif #ifdef CONFIG_RETPOLINE -#ifdef CONFIG_X86_32 -#define INDIRECT_THUNK(reg) extern asmlinkage void __x86_indirect_thunk_e ## reg(void); -#else -#define INDIRECT_THUNK(reg) extern asmlinkage void __x86_indirect_thunk_r ## reg(void); -INDIRECT_THUNK(8) -INDIRECT_THUNK(9) -INDIRECT_THUNK(10) -INDIRECT_THUNK(11) -INDIRECT_THUNK(12) -INDIRECT_THUNK(13) -INDIRECT_THUNK(14) -INDIRECT_THUNK(15) -#endif +#define INDIRECT_THUNK(reg) extern asmlinkage void __x86_indirect_thunk_ ## reg(void); INDIRECT_THUNK(ax) INDIRECT_THUNK(bx) INDIRECT_THUNK(cx) @@ -39,4 +27,14 @@ INDIRECT_THUNK(si) INDIRECT_THUNK(di) INDIRECT_THUNK(bp) INDIRECT_THUNK(sp) +#ifdef CONFIG_64BIT +INDIRECT_THUNK(r8) +INDIRECT_THUNK(r9) +INDIRECT_THUNK(r10) +INDIRECT_THUNK(r11) +INDIRECT_THUNK(r12) +INDIRECT_THUNK(r13) +INDIRECT_THUNK(r14) +INDIRECT_THUNK(r15) +#endif /* CONFIG_64BIT */ #endif /* CONFIG_RETPOLINE */ diff --git a/arch/x86/lib/retpoline.S b/arch/x86/lib/retpoline.S index cb45c6c..7da2c90 100644 --- a/arch/x86/lib/retpoline.S +++ b/arch/x86/lib/retpoline.S @@ -8,14 +8,14 @@ #include #include -.macro THUNK reg - .section .text.__x86.indirect_thunk.\reg +.macro THUNK reg suffix + .section .text.__x86.indirect_thunk.\suffix -ENTRY(__x86_indirect_thunk_\reg) +ENTRY(__x86_indirect_thunk_\suffix) CFI_STARTPROC JMP_NOSPEC %\reg CFI_ENDPROC -ENDPROC(__x86_indirect_thunk_\reg) +ENDPROC(__x86_indirect_thunk_\suffix) .endm /* @@ -26,23 +26,22 @@ ENDPROC(__x86_indirect_thunk_\reg) * the simple and nasty way... */ #define EXPORT_THUNK(reg) EXPORT_SYMBOL(__x86_indirect_thunk_ ## reg) -#define GENERATE_THUNK(reg) THUNK reg ; EXPORT_THUNK(reg) +#define GENERATE_THUNK(reg, suffix) THUNK reg suffix; EXPORT_THUNK(suffix) -GENERATE_THUNK(_ASM_AX) -GENERATE_THUNK(_ASM_BX) -GENERATE_THUNK(_ASM_CX) -GENERATE_THUNK(_ASM_DX) -GENERATE_THUNK(_ASM_SI) -GENERATE_THUNK(_ASM_DI) -GENERATE_THUNK(_ASM_BP) -GENERATE_THUNK(_ASM_SP) +GENERATE_THUNK(_ASM_AX, ax) +GENERATE_THUNK(_ASM_BX, bx) +GENERATE_THUNK(_ASM_CX, cx) +GENERATE_THUNK(_ASM_DX, dx) +GENERATE_THUNK(_ASM_SI, si) +GENERATE_THUNK(_ASM_DI, di) +GENERATE_THUNK(_ASM_BP, bp) #ifdef CONFIG_64BIT -GENERATE_THUNK(r8) -GENERATE_THUNK(r9) -GENERATE_THUNK(r10) -GENERATE_THUNK(r11) -GENERATE_THUNK(r12) -GENERATE_THUNK(r13) -GENERATE_THUNK(r14) -GENERATE_THUNK(r15) +GENERATE_THUNK(r8, r8) +GENERATE_THUNK(r9, r9) +GENERATE_THUNK(r10, r10) +GENERATE_THUNK(r11, r11) +GENERATE_THUNK(r12, r12) +GENERATE_THUNK(r13, r13) +GENERATE_THUNK(r14, r14) +GENERATE_THUNK(r15, r15) #endif