Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3420010pxf; Mon, 29 Mar 2021 01:31:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVt5ZnATEr7at+Ihu4gbz1Kg8LqDTwRO524c4Be2NhjbdwoGmmfoyu0qIEC7ldFL/T9uxV X-Received: by 2002:a17:906:26d4:: with SMTP id u20mr23125125ejc.114.1617006699208; Mon, 29 Mar 2021 01:31:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617006699; cv=none; d=google.com; s=arc-20160816; b=wTydeFZDQh0KYZNibQhdiHiZAbSsYEJzTIewSVECN3V+9WHz2O2rh6uqVpIrcB2wAF FxuyKe3NjcMRxLdvbGgM3IgK0p9ayGEGj51PoC7hIB+fFBaJDzySYjN2U7Da3VPXefKV TKpsWsZU4rB2FkCQqcdWeOLsaLc8EUCl6ICZ4JBkjPRK151LDuUAx/YM0bkoGLi1P7yq 8R33ckpLi1nbJWsjuK1qG1OpCYph4D3M1IL7Ko/BpFLQ4dkI4lOIhmts6uJeqU5e6nDT PFc5D7JLZJDEiyO9s399MgtYepy2tr9JUP5rr+uD11aAbVHrlTMK66a5Hy4/r3IgcICa sMIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vx1+Zfv5mlUpG7jLzPzBgk2+R66qHf9hHGkj3nfKJ4U=; b=jkzODlO1dt6SiA0LPnEuic7/f+68hWKAv1HHXfcwmNkDBtzgsczw2q+mrUFgUcb+9C zW8EO63tBPEauVA937AHa8sQPeVPaIwHj2IBh8is5CFDeFeAm/WIE0VrDB3wBa5vVVwn 3w3kpkeE/71iom9fSN6Mj6jFd0qQxjXqtf/bFNow1d94S3Jxtj/S55KZewSqkWNu18p8 zsMJEYwj0sMOI3sJN3BO0cR+Z6weII7ll4168YGk+jeuau3SEsjvXfSWtmSmDanoeu4G gdGBF5ZJxq9rQk93Co4MCrJx7WYEdCvGPed6sbPG0ZW+7HWdWGbdiEuC5cmyThxk65EM vH1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vWX1KMhr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x12si11803554edd.423.2021.03.29.01.31.16; Mon, 29 Mar 2021 01:31:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vWX1KMhr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233622AbhC2I3l (ORCPT + 99 others); Mon, 29 Mar 2021 04:29:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:34276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233018AbhC2IS5 (ORCPT ); Mon, 29 Mar 2021 04:18:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 08B31619AD; Mon, 29 Mar 2021 08:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617005937; bh=QDDrb5e6R0I/Ek2pDzfHlUtE/9FEmRIQZxNtVtNQcAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vWX1KMhrPZI4dIaBOjbbIyXvZuBc67R4sz+eP4odKm3ogUq2b7i/aG/k1pZwmLtrr S4XAK/0c19JrUsWmF/oBaPI9LbDRT5eYyYQpQ5Gmyul/RAHImZ5C5s498RNhV/ikyA aZ1DDzkAmREjFaZGREttFkQU584HQcBC1vaXrPGQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter Zijlstra (Intel)" , Frederic Weisbecker , Ingo Molnar , Sasha Levin Subject: [PATCH 5.10 057/221] static_call: Pull some static_call declarations to the type headers Date: Mon, 29 Mar 2021 09:56:28 +0200 Message-Id: <20210329075631.099974701@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Zijlstra [ Upstream commit 880cfed3a012d7863f42251791cea7fe78c39390 ] Some static call declarations are going to be needed on low level header files. Move the necessary material to the dedicated static call types header to avoid inclusion dependency hell. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Frederic Weisbecker Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Link: https://lkml.kernel.org/r/20210118141223.123667-4-frederic@kernel.org Signed-off-by: Sasha Levin --- include/linux/static_call.h | 21 ------------------- include/linux/static_call_types.h | 27 +++++++++++++++++++++++++ tools/include/linux/static_call_types.h | 27 +++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 21 deletions(-) diff --git a/include/linux/static_call.h b/include/linux/static_call.h index 695da4c9b338..a2c064585c03 100644 --- a/include/linux/static_call.h +++ b/include/linux/static_call.h @@ -107,26 +107,10 @@ extern void arch_static_call_transform(void *site, void *tramp, void *func, bool #define STATIC_CALL_TRAMP_ADDR(name) &STATIC_CALL_TRAMP(name) -/* - * __ADDRESSABLE() is used to ensure the key symbol doesn't get stripped from - * the symbol table so that objtool can reference it when it generates the - * .static_call_sites section. - */ -#define __static_call(name) \ -({ \ - __ADDRESSABLE(STATIC_CALL_KEY(name)); \ - &STATIC_CALL_TRAMP(name); \ -}) - #else #define STATIC_CALL_TRAMP_ADDR(name) NULL #endif - -#define DECLARE_STATIC_CALL(name, func) \ - extern struct static_call_key STATIC_CALL_KEY(name); \ - extern typeof(func) STATIC_CALL_TRAMP(name); - #define static_call_update(name, func) \ ({ \ BUILD_BUG_ON(!__same_type(*(func), STATIC_CALL_TRAMP(name))); \ @@ -174,7 +158,6 @@ extern int static_call_text_reserved(void *start, void *end); }; \ ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name) -#define static_call(name) __static_call(name) #define static_call_cond(name) (void)__static_call(name) #define EXPORT_STATIC_CALL(name) \ @@ -207,7 +190,6 @@ struct static_call_key { }; \ ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name) -#define static_call(name) __static_call(name) #define static_call_cond(name) (void)__static_call(name) static inline @@ -252,9 +234,6 @@ struct static_call_key { .func = NULL, \ } -#define static_call(name) \ - ((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func)) - static inline void __static_call_nop(void) { } /* diff --git a/include/linux/static_call_types.h b/include/linux/static_call_types.h index 89135bb35bf7..08f78b1b88b4 100644 --- a/include/linux/static_call_types.h +++ b/include/linux/static_call_types.h @@ -4,6 +4,7 @@ #include #include +#include #define STATIC_CALL_KEY_PREFIX __SCK__ #define STATIC_CALL_KEY_PREFIX_STR __stringify(STATIC_CALL_KEY_PREFIX) @@ -32,4 +33,30 @@ struct static_call_site { s32 key; }; +#define DECLARE_STATIC_CALL(name, func) \ + extern struct static_call_key STATIC_CALL_KEY(name); \ + extern typeof(func) STATIC_CALL_TRAMP(name); + +#ifdef CONFIG_HAVE_STATIC_CALL + +/* + * __ADDRESSABLE() is used to ensure the key symbol doesn't get stripped from + * the symbol table so that objtool can reference it when it generates the + * .static_call_sites section. + */ +#define __static_call(name) \ +({ \ + __ADDRESSABLE(STATIC_CALL_KEY(name)); \ + &STATIC_CALL_TRAMP(name); \ +}) + +#define static_call(name) __static_call(name) + +#else + +#define static_call(name) \ + ((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func)) + +#endif /* CONFIG_HAVE_STATIC_CALL */ + #endif /* _STATIC_CALL_TYPES_H */ diff --git a/tools/include/linux/static_call_types.h b/tools/include/linux/static_call_types.h index 89135bb35bf7..08f78b1b88b4 100644 --- a/tools/include/linux/static_call_types.h +++ b/tools/include/linux/static_call_types.h @@ -4,6 +4,7 @@ #include #include +#include #define STATIC_CALL_KEY_PREFIX __SCK__ #define STATIC_CALL_KEY_PREFIX_STR __stringify(STATIC_CALL_KEY_PREFIX) @@ -32,4 +33,30 @@ struct static_call_site { s32 key; }; +#define DECLARE_STATIC_CALL(name, func) \ + extern struct static_call_key STATIC_CALL_KEY(name); \ + extern typeof(func) STATIC_CALL_TRAMP(name); + +#ifdef CONFIG_HAVE_STATIC_CALL + +/* + * __ADDRESSABLE() is used to ensure the key symbol doesn't get stripped from + * the symbol table so that objtool can reference it when it generates the + * .static_call_sites section. + */ +#define __static_call(name) \ +({ \ + __ADDRESSABLE(STATIC_CALL_KEY(name)); \ + &STATIC_CALL_TRAMP(name); \ +}) + +#define static_call(name) __static_call(name) + +#else + +#define static_call(name) \ + ((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func)) + +#endif /* CONFIG_HAVE_STATIC_CALL */ + #endif /* _STATIC_CALL_TYPES_H */ -- 2.30.1