From patchwork Mon Dec 17 16:03:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 154011 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2640011ljp; Mon, 17 Dec 2018 08:11:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/VjEjX4Pul1+LeGNkU2OKSq4/mvOEB6Prc9Ju5onCn00mxydHqdcJt9CEMah94uE6VN3ABG X-Received: by 2002:a63:a16:: with SMTP id 22mr12722843pgk.318.1545063059955; Mon, 17 Dec 2018 08:10:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545063059; cv=none; d=google.com; s=arc-20160816; b=Q5vXK4+CmPuG2y6djTh22ynaPl6K5YIJVtqptwsQzlFT7RhV2oMqF/mTHHHO7hS0ba Yr4QGNyUTfHEnzSnZfomu5MAapwyCeLZ0d4+Qcod4+zQzMjWKxhASPCzxhfBxIAQ6AQt 3wLvWXBXWB9pM70u573mtkRzLeEA1p9KAwnaDCehRVIUp2iyqL9xsT/m4bQCXcuVdp7I YPsK5GRwxCsCnbgU0vhLJjYAcwnj7+vAnnEzNtPHAk+u8OwBcnJd+uMzRjJjyH7dyq0J BYm6eH66f3NpQDgXmmrIWjp/WrWvAoSrOWY6AFuhZrgfCWggmqAXKgk50WcBnz1B24e6 17sA== 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=1OFuCwKdWclDokp4HuH6tNSQ6qZ1JvrJw7BVa4cUhdc=; b=0MXVO2+gnLrLpMyJn1Zqe4nrPf/JIbP5erXZSYDQIQdF78TuBVwt8+PgGwUpA8VsYH 2MDoPDzLWl2ipVijVT9gns7CoHNh8MRFhpAf3D6UDzWZtkcTa40A3cLocWWejWKCdC/z nZzXv8iULBCZaIf3apeiJVhtEUHfDDzv2C0JEjBoHyimDiHwykSUfqOlzzcFnfBGrQ6o eK8KtejIACwgyIc1VxFeAOWpgag3cYGVcettbOrES0QQHchEbMWGePdy+/RhVWCBh8bS tv5jXqbYo5jak2eeyS4xjh7JJHbz+2pphUjNSZVoSw1Vdu77F3daZAb+eBQWr8vIAizn SmQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Aa5XnttE; 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 36si11346047pgt.213.2018.12.17.08.10.59; Mon, 17 Dec 2018 08:10:59 -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=Aa5XnttE; 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 S2388209AbeLQQK6 (ORCPT + 31 others); Mon, 17 Dec 2018 11:10:58 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:64878 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727841AbeLQQKy (ORCPT ); Mon, 17 Dec 2018 11:10:54 -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 wBHG3bRe008119; Tue, 18 Dec 2018 01:03:40 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com wBHG3bRe008119 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1545062621; bh=1OFuCwKdWclDokp4HuH6tNSQ6qZ1JvrJw7BVa4cUhdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aa5XnttEaP0u87mkoYRbDobvtL9zWX6FMR7V5pC4wzQSegovxMFNURtB0DPvIRwAT /qz1BwVUAj9dQ+hpXCO401fOoPGzDISU9OHQpWhSoxTx8DLVznFePYMiaxITsh035O /vJj0KZJZQNf0WRfT9crTwlzplyVDR6mv+34YtiRUdExcswaKwQgooU7y4iH9whNx+ f+his9eQTy8QimfffPkmCDaGeDleMiAqpLwSGmM21+Ve5SnjdFdWho3cCXNH49wTcg Wc7QbePYfUOBbXKvKOLNAUi2JRq9fwvGWE/D1SZo5peh10gd6DnQ1+s2zjF28HIC9v BagTcdX1sGEBA== 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 , linux-kernel@vger.kernel.org, Ard Biesheuvel , Nadav Amit Subject: [PATCH v3 01/12] Revert "x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs" Date: Tue, 18 Dec 2018 01:03:16 +0900 Message-Id: <1545062607-8599-2-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 partially reverts commit 5bdcd510c2ac9efaf55c4cbd8d46421d8e2320cd. The in-kernel workarounds will be replaced with GCC's new "asm inline" syntax. Only the asm_volatile_goto parts were reverted. The other cleanups (removal of unneeded #error, replacement of STATIC_JUMP_IF_TRUE/FALSE with STATIC_JUMP_IF_NOP/JMP) are kept. Signed-off-by: Masahiro Yamada --- arch/x86/include/asm/jump_label.h | 22 +++++++++++++++++----- arch/x86/kernel/macros.S | 1 - 2 files changed, 17 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/arch/x86/include/asm/jump_label.h b/arch/x86/include/asm/jump_label.h index a5fb34f..cf88ebf 100644 --- a/arch/x86/include/asm/jump_label.h +++ b/arch/x86/include/asm/jump_label.h @@ -20,9 +20,15 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool branch) { - asm_volatile_goto("STATIC_BRANCH_NOP l_yes=\"%l[l_yes]\" key=\"%c0\" " - "branch=\"%c1\"" - : : "i" (key), "i" (branch) : : l_yes); + asm_volatile_goto("1:" + ".byte " __stringify(STATIC_KEY_INIT_NOP) "\n\t" + ".pushsection __jump_table, \"aw\" \n\t" + _ASM_ALIGN "\n\t" + ".long 1b - ., %l[l_yes] - . \n\t" + _ASM_PTR "%c0 + %c1 - .\n\t" + ".popsection \n\t" + : : "i" (key), "i" (branch) : : l_yes); + return false; l_yes: return true; @@ -30,8 +36,14 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch) { - asm_volatile_goto("STATIC_BRANCH_JMP l_yes=\"%l[l_yes]\" key=\"%c0\" " - "branch=\"%c1\"" + asm_volatile_goto("1:" + ".byte 0xe9\n\t .long %l[l_yes] - 2f\n\t" + "2:\n\t" + ".pushsection __jump_table, \"aw\" \n\t" + _ASM_ALIGN "\n\t" + ".long 1b - ., %l[l_yes] - . \n\t" + _ASM_PTR "%c0 + %c1 - .\n\t" + ".popsection \n\t" : : "i" (key), "i" (branch) : : l_yes); return false; diff --git a/arch/x86/kernel/macros.S b/arch/x86/kernel/macros.S index 161c950..bf8b9c9 100644 --- a/arch/x86/kernel/macros.S +++ b/arch/x86/kernel/macros.S @@ -13,4 +13,3 @@ #include #include #include -#include