From patchwork Mon Dec 17 16:03:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 154012 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2640068ljp; Mon, 17 Dec 2018 08:11:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/WfqTwIvoqeQIUAcMSajpKADskRJpOTHNBurPQ+LqzSUS3W+EjLORbXhPhSer3i+uZ5qBQo X-Received: by 2002:a63:f901:: with SMTP id h1mr12617628pgi.154.1545063062790; Mon, 17 Dec 2018 08:11:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545063062; cv=none; d=google.com; s=arc-20160816; b=zOnTLRZkDy4DjdYMXHlS4sWgRkn6zoo3hzo+AkPOOm4f1VEcsMyDI8Tc8zg8oobCle wsivK29tNB7wx+aWCudAQJUo6d0itUC/439PfFpBGqcora8YLd/w1YmAF2lSLv6R5n9I PMeB9VOgh0UGEC5DzBTel4cWd60kBhw+75/Ld5TY9z1do7JYNvHNgm6Zk8Y47MmeVmnf AUlnoYCpwwTl/uXOq7sqpVnXGH/ouYTJkhoQa0YWkdaUlMr9VBBVoviOkuwKk/2uxY4S IQtC9cOC/PgbFwptvLYpA497nNDwfhSKCI7QyL+Fe0u6D5fA+rdv7Yxx4cDlczofArba L9lg== 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=XsfYrfLZf85NxXPieKuHNNRf8I2glcI/qdIVKn3J7kY=; b=Fanpwv/KrFNGSAYf3F+IziusQ7Uh49EXNy6BqegABA5/k+7T2Hjwh044G9iryWMzur 815ZJGQvD5B3YnJ0G64PJgprvm+lEdoiD4+f6521IUYTw/Nk4Pq/ef54bPVa/LTsEH0l VbDnJ1FuchIvWHgQS18oPJQBcE0Y8sD5F4clwpmAkkmmxX1Ig4VM/0RRYXnjLFBMdgLY vPeUcBA3Q/b0LBFrfedVIqPhasgmON4wzec8g4MlhEWJvEzKzHOhQ3wiZo+jOe8f6kEP ty1G+Yt4nM4gqtY5nLC5LCfS8RF7p/etVKmubsbAIWPTq3RKmXW1gXdHdxkynDeyBtC5 zZjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=uutzTQnL; 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 z3si10744030pln.430.2018.12.17.08.11.02; Mon, 17 Dec 2018 08:11:02 -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=uutzTQnL; 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 S2388225AbeLQQLB (ORCPT + 31 others); Mon, 17 Dec 2018 11:11:01 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:64948 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388139AbeLQQK6 (ORCPT ); Mon, 17 Dec 2018 11:10:58 -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 wBHG3bRi008119; Tue, 18 Dec 2018 01:03:46 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com wBHG3bRi008119 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1545062627; bh=XsfYrfLZf85NxXPieKuHNNRf8I2glcI/qdIVKn3J7kY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uutzTQnL21q2QZDhUPf4psTVjZy0+/QJsWpElxrBnOAhrsOagz/uEC7B7aeDv00O6 9SHdNTTXtKHH+VUv73W+oNC/qvPxtn+8/3kAY8f+NgtF/tpBS6oQzQRSrVCjvcvgFb Ma5Q39i+32vtzlNcj0yE1FXmDYzxe+Y5Pvdwp+uQsL442mm/e2uoVzYqZE/ybTNGHC BFO/SZf/Wd5aR/o/m0DC0ymv9/vIqtfK5+BgR25RMmJm3Mp5hFdAhIDjv84TnV+Dns PuP84ulppu9LzgGqTHGs9mquVTjSu9Ky20p5gav0SN/gV71qK+w4pBz2mRLBShB7An gg4m7RQvpWqtA== 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-arch@vger.kernel.org, Arnd Bergmann , linux-kernel@vger.kernel.org, Nadav Amit Subject: [PATCH v3 05/12] Revert "x86/bug: Macrofy the BUG table section handling, to work around GCC inlining bugs" Date: Tue, 18 Dec 2018 01:03:20 +0900 Message-Id: <1545062607-8599-6-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 f81f8ad56fd1c7b99b2ed1c314527f7d9ac447c6. The in-kernel workarounds will be replaced with GCC's new "asm inline" syntax. Signed-off-by: Masahiro Yamada --- arch/x86/include/asm/bug.h | 98 ++++++++++++++++++++-------------------------- arch/x86/kernel/macros.S | 1 - include/asm-generic/bug.h | 8 ++-- 3 files changed, 46 insertions(+), 61 deletions(-) -- 2.7.4 diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index 5090035..6804d66 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -4,8 +4,6 @@ #include -#ifndef __ASSEMBLY__ - /* * Despite that some emulators terminate on UD2, we use it for WARN(). * @@ -22,15 +20,53 @@ #define LEN_UD2 2 +#ifdef CONFIG_GENERIC_BUG + +#ifdef CONFIG_X86_32 +# define __BUG_REL(val) ".long " __stringify(val) +#else +# define __BUG_REL(val) ".long " __stringify(val) " - 2b" +#endif + +#ifdef CONFIG_DEBUG_BUGVERBOSE + +#define _BUG_FLAGS(ins, flags) \ +do { \ + asm volatile("1:\t" ins "\n" \ + ".pushsection __bug_table,\"aw\"\n" \ + "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ + "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \ + "\t.word %c1" "\t# bug_entry::line\n" \ + "\t.word %c2" "\t# bug_entry::flags\n" \ + "\t.org 2b+%c3\n" \ + ".popsection" \ + : : "i" (__FILE__), "i" (__LINE__), \ + "i" (flags), \ + "i" (sizeof(struct bug_entry))); \ +} while (0) + +#else /* !CONFIG_DEBUG_BUGVERBOSE */ + #define _BUG_FLAGS(ins, flags) \ do { \ - asm volatile("ASM_BUG ins=\"" ins "\" file=%c0 line=%c1 " \ - "flags=%c2 size=%c3" \ - : : "i" (__FILE__), "i" (__LINE__), \ - "i" (flags), \ + asm volatile("1:\t" ins "\n" \ + ".pushsection __bug_table,\"aw\"\n" \ + "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ + "\t.word %c0" "\t# bug_entry::flags\n" \ + "\t.org 2b+%c1\n" \ + ".popsection" \ + : : "i" (flags), \ "i" (sizeof(struct bug_entry))); \ } while (0) +#endif /* CONFIG_DEBUG_BUGVERBOSE */ + +#else + +#define _BUG_FLAGS(ins, flags) asm volatile(ins) + +#endif /* CONFIG_GENERIC_BUG */ + #define HAVE_ARCH_BUG #define BUG() \ do { \ @@ -46,54 +82,4 @@ do { \ #include -#else /* __ASSEMBLY__ */ - -#ifdef CONFIG_GENERIC_BUG - -#ifdef CONFIG_X86_32 -.macro __BUG_REL val:req - .long \val -.endm -#else -.macro __BUG_REL val:req - .long \val - 2b -.endm -#endif - -#ifdef CONFIG_DEBUG_BUGVERBOSE - -.macro ASM_BUG ins:req file:req line:req flags:req size:req -1: \ins - .pushsection __bug_table,"aw" -2: __BUG_REL val=1b # bug_entry::bug_addr - __BUG_REL val=\file # bug_entry::file - .word \line # bug_entry::line - .word \flags # bug_entry::flags - .org 2b+\size - .popsection -.endm - -#else /* !CONFIG_DEBUG_BUGVERBOSE */ - -.macro ASM_BUG ins:req file:req line:req flags:req size:req -1: \ins - .pushsection __bug_table,"aw" -2: __BUG_REL val=1b # bug_entry::bug_addr - .word \flags # bug_entry::flags - .org 2b+\size - .popsection -.endm - -#endif /* CONFIG_DEBUG_BUGVERBOSE */ - -#else /* CONFIG_GENERIC_BUG */ - -.macro ASM_BUG ins:req file:req line:req flags:req size:req - \ins -.endm - -#endif /* CONFIG_GENERIC_BUG */ - -#endif /* __ASSEMBLY__ */ - #endif /* _ASM_X86_BUG_H */ diff --git a/arch/x86/kernel/macros.S b/arch/x86/kernel/macros.S index 66ccb8e..852487a 100644 --- a/arch/x86/kernel/macros.S +++ b/arch/x86/kernel/macros.S @@ -9,4 +9,3 @@ #include #include #include -#include diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index cdafa5e..20561a6 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -17,8 +17,10 @@ #ifndef __ASSEMBLY__ #include -struct bug_entry { +#ifdef CONFIG_BUG + #ifdef CONFIG_GENERIC_BUG +struct bug_entry { #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS unsigned long bug_addr; #else @@ -33,10 +35,8 @@ struct bug_entry { unsigned short line; #endif unsigned short flags; -#endif /* CONFIG_GENERIC_BUG */ }; - -#ifdef CONFIG_BUG +#endif /* CONFIG_GENERIC_BUG */ /* * Don't use BUG() or BUG_ON() unless there's really no way out; one