Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3885572ybh; Tue, 6 Aug 2019 03:02:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWwpR2uINq+MU5vsoI960q1oUNQcd4/vSueUM0o6QWl3BjVqqDht7JZ9+PUSiSu6j3ON9r X-Received: by 2002:a17:902:8c98:: with SMTP id t24mr2414879plo.320.1565085731087; Tue, 06 Aug 2019 03:02:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565085731; cv=none; d=google.com; s=arc-20160816; b=BWEz3BUmPmXqvNB42R+WU+nOh6N89M/cE0pme1mFSG9mmg5rizpM9IhBhMLzKGRPoz SQh8UCeikexou2I37SkCkNbxNvC6Yy7vgdiR5wcZHjPNs87ZIlRM3oOpe8Lr18/Cne92 DryiFvGjslr4KJy9DIIrqdKB7FMYnzv20gGxVeo+c1GaLFLdO5gJ7M+dULWfE6UA8wTl IvOro2hoIRFhFT55bUqQlavH79Ko61YEzhp8Jy/Xv9041SbaBL3gWoCqT4ajnGmnMyG9 h4pyxieQDxIbJugwN74D18GRK+67vMjoPUEzDMHx3dMpyMqdfiKtNwvsVgx7P5cuKwrx l+Lg== 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; bh=BrBBFjqsIPWSTPOwNEcUeajfoMogUhxNa7dexawAwRQ=; b=0eEmSHpTQZQispgCfT8Ht6JCEjUgWeQV/WTwDBiMoIJhE8+JpOCFE5Q1xNpZz/NEHR 1w9EdxHRkd9YRAYJSPfCZo72Sb5qnSZW9gZH01NSKsHtznl/f311TW1LJl02g9oGWDwk RFy/LGO2v0w1VUk7SFcKsWG9+up1Q+0gk1+o05WLos83beIgatuclvMUrVlRgDct/oub ocbIhzS3mPgCL1rndtCBPOD152y5wz1kReVzhDIbzlU0AqN9uC9Vo3rdlTzQ0H5lV3LC Ozvr3ItE8F83iLA9XYLg681wah4Rhwoxc2OGdt1rMho+6x8yWrGbahCq0+erWWsBsAWJ pXVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Un6oFivG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f18si46575978pfq.169.2019.08.06.03.01.49; Tue, 06 Aug 2019 03:02:11 -0700 (PDT) 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=@linaro.org header.s=google header.b=Un6oFivG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732577AbfHFKBD (ORCPT + 99 others); Tue, 6 Aug 2019 06:01:03 -0400 Received: from mail-yb1-f193.google.com ([209.85.219.193]:39656 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732560AbfHFKBD (ORCPT ); Tue, 6 Aug 2019 06:01:03 -0400 Received: by mail-yb1-f193.google.com with SMTP id s142so445130ybc.6 for ; Tue, 06 Aug 2019 03:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BrBBFjqsIPWSTPOwNEcUeajfoMogUhxNa7dexawAwRQ=; b=Un6oFivG+UxJxUJOYr8+LA93ywEnvAQtUBkTGho7Ltp6aiGVqv555mAWbj39vVVe4T tTAZGZRpv3XowvmjuMFxMrBReXJdTs8FxGKnoziDeXG0a4qL4zmORnd9YynujYMNhNfH 4ecvqroC3gmCOKv5mJHmY4V38pqK6HNSb1geNVBH3Ivvtta3hsjCkmzLX9KUaWgVC6lX kJB08KuTYFEWh/U6h9qYHQxR8vAbQxOtxHmBwM3NjyhcgI62tYhGmkw/q+wYGZwhLkHO 4UzK1unsE6K15NH9p83nxGH/Qi30CQ2wvypdep65rye0RfNW5eLhw6/oUpCmj6Y9CEBx AQ2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BrBBFjqsIPWSTPOwNEcUeajfoMogUhxNa7dexawAwRQ=; b=XAoDcf/Uckqss/Fkew3weJt3YZZFfqtoZwkwFMlCbQCmpj1NpU9uM3p6IERKEp+PA+ vD8Jqr57Ym1qKIcqX4hNDoYHsQ3KRKXDlLN7t5ymYenIdRhMguYD3kVtZIfMWLWEfp3/ pS029rYVQ9plljcK63zVTe0Dibjrxf74WumyGSAfGsOI+TGHvJmP0M01IC6aYBBXZ6Fz bBUYHp95OAr0tw6qPr+7lk8ANHMyCArbQttDqgkBhPCFVNo7FLvVU1uv1qWpBjWrYfmX heCVXUqtUThvIJTAMFyI6MBm/Oz3WbPTt7lhBcequ2jCd62Q0gwa7jFak55oTjUVa59x faag== X-Gm-Message-State: APjAAAUljwPhjSP4NoZyZEr8LqxIHGybNTdIpJ6z6HmlfL07oeYZ6IcJ yGnlEk40J+ibb7z/6lyAOf5xjQ== X-Received: by 2002:a25:8410:: with SMTP id u16mr1788923ybk.466.1565085662057; Tue, 06 Aug 2019 03:01:02 -0700 (PDT) Received: from localhost.localdomain (li1322-146.members.linode.com. [45.79.223.146]) by smtp.gmail.com with ESMTPSA id h12sm18316685ywm.91.2019.08.06.03.00.53 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 06 Aug 2019 03:01:01 -0700 (PDT) From: Leo Yan To: Russell King , Oleg Nesterov , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Arnd Bergmann , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , "Naveen N. Rao" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Masami Hiramatsu Cc: Leo Yan Subject: [PATCH v2 1/3] error-injection: Consolidate override function definition Date: Tue, 6 Aug 2019 18:00:13 +0800 Message-Id: <20190806100015.11256-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190806100015.11256-1-leo.yan@linaro.org> References: <20190806100015.11256-1-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The function override_function_with_return() is defined separately for each architecture and every architecture's definition is almost same with each other. E.g. x86 and powerpc both define function in its own asm/error-injection.h header and override_function_with_return() has the same definition, the only difference is that x86 defines an extra function just_return_func() but it is specific for x86 and is only used by x86's override_function_with_return(), so don't need to export this function. This patch consolidates override_function_with_return() definition into asm-generic/error-injection.h header, thus all architectures can use the common definition. As result, the architecture specific headers are removed; the include/linux/error-injection.h header also changes to include asm-generic/error-injection.h header rather than architecture header, furthermore, it includes linux/compiler.h for successful compilation. Signed-off-by: Leo Yan --- arch/powerpc/include/asm/error-injection.h | 13 ------------- arch/x86/include/asm/error-injection.h | 13 ------------- include/asm-generic/error-injection.h | 6 ++++++ include/linux/error-injection.h | 6 +++--- 4 files changed, 9 insertions(+), 29 deletions(-) delete mode 100644 arch/powerpc/include/asm/error-injection.h delete mode 100644 arch/x86/include/asm/error-injection.h diff --git a/arch/powerpc/include/asm/error-injection.h b/arch/powerpc/include/asm/error-injection.h deleted file mode 100644 index 62fd24739852..000000000000 --- a/arch/powerpc/include/asm/error-injection.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ - -#ifndef _ASM_ERROR_INJECTION_H -#define _ASM_ERROR_INJECTION_H - -#include -#include -#include -#include - -void override_function_with_return(struct pt_regs *regs); - -#endif /* _ASM_ERROR_INJECTION_H */ diff --git a/arch/x86/include/asm/error-injection.h b/arch/x86/include/asm/error-injection.h deleted file mode 100644 index 47b7a1296245..000000000000 --- a/arch/x86/include/asm/error-injection.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_ERROR_INJECTION_H -#define _ASM_ERROR_INJECTION_H - -#include -#include -#include -#include - -asmlinkage void just_return_func(void); -void override_function_with_return(struct pt_regs *regs); - -#endif /* _ASM_ERROR_INJECTION_H */ diff --git a/include/asm-generic/error-injection.h b/include/asm-generic/error-injection.h index 95a159a4137f..80ca61058dd2 100644 --- a/include/asm-generic/error-injection.h +++ b/include/asm-generic/error-injection.h @@ -16,6 +16,8 @@ struct error_injection_entry { int etype; }; +struct pt_regs; + #ifdef CONFIG_FUNCTION_ERROR_INJECTION /* * Whitelist ganerating macro. Specify functions which can be @@ -28,8 +30,12 @@ static struct error_injection_entry __used \ .addr = (unsigned long)fname, \ .etype = EI_ETYPE_##_etype, \ }; + +void override_function_with_return(struct pt_regs *regs); #else #define ALLOW_ERROR_INJECTION(fname, _etype) + +static inline void override_function_with_return(struct pt_regs *regs) { } #endif #endif diff --git a/include/linux/error-injection.h b/include/linux/error-injection.h index 280c61ecbf20..635a95caf29f 100644 --- a/include/linux/error-injection.h +++ b/include/linux/error-injection.h @@ -2,16 +2,16 @@ #ifndef _LINUX_ERROR_INJECTION_H #define _LINUX_ERROR_INJECTION_H -#ifdef CONFIG_FUNCTION_ERROR_INJECTION +#include +#include -#include +#ifdef CONFIG_FUNCTION_ERROR_INJECTION extern bool within_error_injection_list(unsigned long addr); extern int get_injectable_error_type(unsigned long addr); #else /* !CONFIG_FUNCTION_ERROR_INJECTION */ -#include static inline bool within_error_injection_list(unsigned long addr) { return false; -- 2.17.1