From patchwork Wed Mar 22 04:00:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Poimboeuf X-Patchwork-Id: 73180 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2151349wrt; Tue, 21 Mar 2023 21:12:59 -0700 (PDT) X-Google-Smtp-Source: AK7set/mEwSy+yLLIGG+F3/Sj1XXu1LY8EhRdrhbrFaNykVmt83F3W9+ENZuMUhIGVcORvfmn27L X-Received: by 2002:a17:907:7654:b0:8b1:7857:2331 with SMTP id kj20-20020a170907765400b008b178572331mr5624534ejc.65.1679458378918; Tue, 21 Mar 2023 21:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679458378; cv=none; d=google.com; s=arc-20160816; b=kJEHQJmtcuF8LpiNHiR6YcK3cnCas2/7sdvQHfxwk10E+yjnTYk50sfm0Vt/IFqASg N5WJ2G6KRZhnKGrGGiHZFzqwJhLkqYgo1VvbSayu6cCnznL65StN0PpyHcFidfZcR65O E8p5YhtSCFIEIw4jR3nupM/e8ngNp7dd2Z2G7J6na9/8KDc2Xw1SCMSek9aXh0164e7N egnTq/87yI0140e96kFpgeY6v1q5oNDCuAM5NN4Yqjem3c0iXE5EHSf0/Td/abGE7lYm vKu35VjJ4lVZSwL5pX7NaHTBhR38ohu+9w5bKibfNYxkZWZpZqhe33U59WZGCdKgBvBB /vYw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Hqg/nJeNL2hF1IPON1uDEwVpvC3pqf0PV7DSc7wPtF8=; b=zuTLioK1dvpdoEcvT0Zqq248xcfgbTQ9PBuMkIwBe/M7fDRqRSgQp2qHQ2djqxOyZ7 IwBfY2YQb055IY0tiV6K9UF2c3Dn7JSw6OhJDbzU9UpL+VRwkQxja3N78qYscxB3MFyT KStbBBVYyQo3rCrga2lKmVStQwZPB3tLHY8KvHGDzfotz2hzMCBn8xyWB1ZHaXP1PRH+ hh0Z7vz/cIJFWTYxyxOQkek6onD5XVQ5mWjK41l3tutZ7wBtX40zgSqZn2/G2LGdsVKA tUV80X1MvSaF378V4FOkmN9y1PIEnwIc2iItFyEasBLPneB8fN4crRSRaRevJutHp2sd wIvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="l/6zCufX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v9-20020a170906338900b0093346a7ad4esi10382943eja.1005.2023.03.21.21.12.35; Tue, 21 Mar 2023 21:12:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="l/6zCufX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230325AbjCVEAu (ORCPT + 99 others); Wed, 22 Mar 2023 00:00:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230273AbjCVEA2 (ORCPT ); Wed, 22 Mar 2023 00:00:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CF9447403 for ; Tue, 21 Mar 2023 21:00:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 20DB6B81AFA for ; Wed, 22 Mar 2023 04:00:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 578E3C4339B; Wed, 22 Mar 2023 04:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679457624; bh=vb0/E/xQnHYZirAzUsMS9BEEJ9l0yo4puA34UlEsHUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l/6zCufXDJX0jYzyqmaYDnjYZANV3vCTW3je5V0JNsAqbwav52XjOmIVH7ItDH6Uh 24ZVp6rHzdLHyIHYwXcBbkGR8UQhEdchmfLCL/FJm68Map3H+1+Nz/ffAEu7dYBiim pp+TklmKMf6pX3n61kSD3dPgpU2CTS8hxh3VMee4O0YgRRsLlWPK5SD8SJNjXV+e+B fqvpsXnlLPmGfhsa675S8VtpwJ2I8uB3aDpoj+QnBJi6W16hppSc79BtofGybFZKwi c4uAhok6UPaqpeYfhK2Mk52HFpLVuNBtF7iWvzGD7pXO6cxiH0mnP+wkuVRmNx5BjS EYIoEVnVsUhmg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Mark Rutland , Jason Baron , Steven Rostedt , Ard Biesheuvel , Christophe Leroy , Paolo Bonzini , Sean Christopherson , Sami Tolvanen , Nick Desaulniers , Will McVicker , Kees Cook , linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 04/11] static_call: Remove static_call.h dependency on cpu.h Date: Tue, 21 Mar 2023 21:00:10 -0700 Message-Id: <252c12888b50482ee5bda8415a67cdc971285843.1679456900.git.jpoimboe@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-type: text/plain X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761039749171002944?= X-GMAIL-MSGID: =?utf-8?q?1761039749171002944?= Uninline __static_call_update() to remove static_call.h's dependency on cpu.h. This will make it much easier to include static_call.h in common header files like . Signed-off-by: Josh Poimboeuf --- block/bio.c | 1 + include/linux/static_call.h | 10 +--------- kernel/cgroup/cgroup.c | 1 + kernel/static_call.c | 12 ++++++++++++ sound/soc/intel/avs/trace.c | 1 + 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/block/bio.c b/block/bio.c index fd11614bba4d..a2ca0680fd18 100644 --- a/block/bio.c +++ b/block/bio.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "blk.h" diff --git a/include/linux/static_call.h b/include/linux/static_call.h index 890ddc0c3190..abce40166039 100644 --- a/include/linux/static_call.h +++ b/include/linux/static_call.h @@ -132,7 +132,6 @@ */ #include -#include #include #ifdef CONFIG_HAVE_STATIC_CALL @@ -246,14 +245,7 @@ static inline int static_call_init(void) { return 0; } #define static_call_cond(name) (void)__static_call(name) -static inline -void __static_call_update(struct static_call_key *key, void *tramp, void *func) -{ - cpus_read_lock(); - WRITE_ONCE(key->func, func); - arch_static_call_transform(NULL, tramp, func, false); - cpus_read_unlock(); -} +extern void __static_call_update(struct static_call_key *key, void *tramp, void *func); static inline int static_call_text_reserved(void *start, void *end) { diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 935e8121b21e..4f29f509d9ce 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -58,6 +58,7 @@ #include #include #include +#include #include #define CREATE_TRACE_POINTS diff --git a/kernel/static_call.c b/kernel/static_call.c index e9c3e69f3837..63486995fd82 100644 --- a/kernel/static_call.c +++ b/kernel/static_call.c @@ -1,8 +1,20 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include long __static_call_return0(void) { return 0; } EXPORT_SYMBOL_GPL(__static_call_return0); + +#ifndef CONFIG_HAVE_STATIC_CALL_INLINE +void __static_call_update(struct static_call_key *key, void *tramp, void *func) +{ + cpus_read_lock(); + WRITE_ONCE(key->func, func); + arch_static_call_transform(NULL, tramp, func, false); + cpus_read_unlock(); +} +EXPORT_SYMBOL_GPL(__static_call_update); +#endif diff --git a/sound/soc/intel/avs/trace.c b/sound/soc/intel/avs/trace.c index c63eea909b5e..b033b560e6d2 100644 --- a/sound/soc/intel/avs/trace.c +++ b/sound/soc/intel/avs/trace.c @@ -7,6 +7,7 @@ // #include +#include #define CREATE_TRACE_POINTS #include "trace.h"