From patchwork Mon Dec 17 16:03:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 154013 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2640223ljp; Mon, 17 Dec 2018 08:11:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vz+TIheQfEqYWSDho+1Brx9r37TkVT6vR01hZTiQTesr/tqgRBtL2Jnc5mVvHypp46dZwh X-Received: by 2002:a17:902:27a8:: with SMTP id d37mr13461055plb.182.1545063070047; Mon, 17 Dec 2018 08:11:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545063070; cv=none; d=google.com; s=arc-20160816; b=jghznraKI10oLNNzS2OOsFVz5DgRsEeO+bScrHGUFwc0gazQkR5eX0CCwHKtieHETw Hds9NyYzSx680q3y2I3FQMEzuDU7w97PHeIqVO3VJYjdka3ZSojkOl0gCnrMucgNM8oX tv0yon3W2N2I278Pea8OsXY5j9kTEiYn5W2QG7HcQhz70jcg2htPfL/xKHwAwpdF8mDo ha8YKKS0j8Pw/5/zT0hwWC2EsabfIrfVO8o5vFnlHLf2IYsCPN0aecRrtqko45jH8GeX 6baWFGJXJbJW1gP5paCa3OV1oJktQYbNPmGJaxj5XbvdWY0u46G0GKA6Ns0WyHx17TO0 7sBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=4SKjXoI2Jxb7F0Ixp5LIs9imyh9UsRJoHsSQtzSTnpI=; b=tyhbX8PRCtiFczsdYCqokpxlMvP1W4BD2e64SUo1k1/QKxn6rG4JTYBzb6sbIVl+no Waj3ZiwhNxXJa7cpOUMu/n6KGlzBZFmEsxwIJRy3lBM21njmBL8Xx8DOo/2nweyDz3HT tuDVIVdNA/NMhVNBBHNwLS5InKTafrjxCl7b2KFj9fsT5/3uRkUlkyDvsjY+dl3fMWeg 4Ti114+hUyv3QhfXP8CB6KRcyIvmx2Mw1PTFlXHDN9/kEV6P3fQTgO7GdKwHGh3Hyhu7 LuEZ4L87R+Ote2iMwXLQ9o7S6XdrFCMhSSVQNEiAzAlWa8Czbovv8+tcu57IUngb9iK0 FFMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Ob0D0mxV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9si7573140pgn.524.2018.12.17.08.11.09; Mon, 17 Dec 2018 08:11:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Ob0D0mxV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388165AbeLQQK5 (ORCPT + 31 others); Mon, 17 Dec 2018 11:10:57 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:64908 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387635AbeLQQK4 (ORCPT ); Mon, 17 Dec 2018 11:10:56 -0500 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-07.nifty.com with ESMTP id wBHG3bRh008119; Tue, 18 Dec 2018 01:03:45 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com wBHG3bRh008119 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1545062626; bh=4SKjXoI2Jxb7F0Ixp5LIs9imyh9UsRJoHsSQtzSTnpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ob0D0mxV+BsEDq6V+1LAf0RhGlCEM1YU31zLHp3MSmuJpGmgessOc4JqsfHqmIRjy en0clOvcCoQLoQ1A8LHb9/MHkNZbg3iOmvogaWc1wZWPBHH+xXtiLpoB63U0a+qymH 7CBQFGfP9IiOOytKQNiXoKyTMMONZvypdX1TjswZx8VCg/Qdsj6t9Pw12PVUqQFEtM jdhzDyR+IJaDskeKs6Y6xs7I2nXm6mNzMOGs3a6eP6hi+w5+FOVxPHPv6PmNZJeK0O /np0CI0VSaaqALy7qf4Exg/OeLcoMyuIHPxXTXuGI4oeuOjdF6gLIGxF/MuQCBO9+h +oG/9cmWVEgHA== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: x86@kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" Cc: Richard Biener , Segher Boessenkool , Peter Zijlstra , Juergen Gross , Josh Poimboeuf , Kees Cook , Linus Torvalds , Masahiro Yamada , Nadav Amit , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Alok Kataria Subject: [PATCH v3 04/12] Revert "x86/paravirt: Work around GCC inlining bugs when compiling paravirt ops" Date: Tue, 18 Dec 2018 01:03:19 +0900 Message-Id: <1545062607-8599-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545062607-8599-1-git-send-email-yamada.masahiro@socionext.com> References: <1545062607-8599-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit 494b5168f2de009eb80f198f668da374295098dd. The in-kernel workarounds will be replaced with GCC's new "asm inline" syntax. Signed-off-by: Masahiro Yamada --- arch/x86/include/asm/paravirt_types.h | 56 ++++++++++++++++++----------------- arch/x86/kernel/macros.S | 1 - 2 files changed, 29 insertions(+), 28 deletions(-) -- 2.7.4 diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index 26942ad..488c596 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h @@ -348,11 +348,23 @@ extern struct paravirt_patch_template pv_ops; #define paravirt_clobber(clobber) \ [paravirt_clobber] "i" (clobber) +/* + * Generate some code, and mark it as patchable by the + * apply_paravirt() alternate instruction patcher. + */ +#define _paravirt_alt(insn_string, type, clobber) \ + "771:\n\t" insn_string "\n" "772:\n" \ + ".pushsection .parainstructions,\"a\"\n" \ + _ASM_ALIGN "\n" \ + _ASM_PTR " 771b\n" \ + " .byte " type "\n" \ + " .byte 772b-771b\n" \ + " .short " clobber "\n" \ + ".popsection\n" + /* Generate patchable code, with the default asm parameters. */ -#define paravirt_call \ - "PARAVIRT_CALL type=\"%c[paravirt_typenum]\"" \ - " clobber=\"%c[paravirt_clobber]\"" \ - " pv_opptr=\"%c[paravirt_opptr]\";" +#define paravirt_alt(insn_string) \ + _paravirt_alt(insn_string, "%c[paravirt_typenum]", "%c[paravirt_clobber]") /* Simple instruction patching code. */ #define NATIVE_LABEL(a,x,b) "\n\t.globl " a #x "_" #b "\n" a #x "_" #b ":\n\t" @@ -373,6 +385,16 @@ unsigned native_patch(u8 type, void *ibuf, unsigned long addr, unsigned len); int paravirt_disable_iospace(void); /* + * This generates an indirect call based on the operation type number. + * The type number, computed in PARAVIRT_PATCH, is derived from the + * offset into the paravirt_patch_template structure, and can therefore be + * freely converted back into a structure offset. + */ +#define PARAVIRT_CALL \ + ANNOTATE_RETPOLINE_SAFE \ + "call *%c[paravirt_opptr];" + +/* * These macros are intended to wrap calls through one of the paravirt * ops structs, so that they can be later identified and patched at * runtime. @@ -509,7 +531,7 @@ int paravirt_disable_iospace(void); /* since this condition will never hold */ \ if (sizeof(rettype) > sizeof(unsigned long)) { \ asm volatile(pre \ - paravirt_call \ + paravirt_alt(PARAVIRT_CALL) \ post \ : call_clbr, ASM_CALL_CONSTRAINT \ : paravirt_type(op), \ @@ -519,7 +541,7 @@ int paravirt_disable_iospace(void); __ret = (rettype)((((u64)__edx) << 32) | __eax); \ } else { \ asm volatile(pre \ - paravirt_call \ + paravirt_alt(PARAVIRT_CALL) \ post \ : call_clbr, ASM_CALL_CONSTRAINT \ : paravirt_type(op), \ @@ -546,7 +568,7 @@ int paravirt_disable_iospace(void); PVOP_VCALL_ARGS; \ PVOP_TEST_NULL(op); \ asm volatile(pre \ - paravirt_call \ + paravirt_alt(PARAVIRT_CALL) \ post \ : call_clbr, ASM_CALL_CONSTRAINT \ : paravirt_type(op), \ @@ -664,26 +686,6 @@ struct paravirt_patch_site { extern struct paravirt_patch_site __parainstructions[], __parainstructions_end[]; -#else /* __ASSEMBLY__ */ - -/* - * This generates an indirect call based on the operation type number. - * The type number, computed in PARAVIRT_PATCH, is derived from the - * offset into the paravirt_patch_template structure, and can therefore be - * freely converted back into a structure offset. - */ -.macro PARAVIRT_CALL type:req clobber:req pv_opptr:req -771: ANNOTATE_RETPOLINE_SAFE - call *\pv_opptr -772: .pushsection .parainstructions,"a" - _ASM_ALIGN - _ASM_PTR 771b - .byte \type - .byte 772b-771b - .short \clobber - .popsection -.endm - #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_PARAVIRT_TYPES_H */ diff --git a/arch/x86/kernel/macros.S b/arch/x86/kernel/macros.S index 71d8b71..66ccb8e 100644 --- a/arch/x86/kernel/macros.S +++ b/arch/x86/kernel/macros.S @@ -10,4 +10,3 @@ #include #include #include -#include