From patchwork Mon Jun 5 07:01:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 103117 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2500680vqr; Mon, 5 Jun 2023 00:11:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7cV2651HyonnhtdRLTu3FN/wfTmrG/Z3RF7mFdXNqiYn8l2dwwm36/9vIyqK/yhrOvr02D X-Received: by 2002:a05:6830:12d5:b0:6b1:593d:539 with SMTP id a21-20020a05683012d500b006b1593d0539mr4771808otq.21.1685949066710; Mon, 05 Jun 2023 00:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685949066; cv=none; d=google.com; s=arc-20160816; b=G/f4G9b0C09/SGPWmVKL+NY+Q2Q0TsiCl+e8VbMb0gKGq1OducSlGFP9fAhorCYNWC DuZJZWK+UdOTmV3qPnCkqQiLHa9KTV70iQTq1YLkg4C/g2B4cETreSqaQQvlGWa9dMCh EWYFgKMHMt1PUtiM87xlSw4GqtnBVQ4Ck0pR0zoRPN3c1dw+20KBUH3uLb3DJwC0A0MN iCI1swM1KqPWCnTRtGXBSLcTwKl7hdYDu4GwEv7M6vSBcXMHP75SenKCZEipN1KMKJq7 XLyPxJHGhkYu0DOFuQrJbzEw8zWf3tBAgTgb49eEjH1QBUPv1Dq//95Ikn2ghj/C1MJ4 107Q== 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; bh=5KytyxGgZNOk2hbRPbjU4ZDbbQU3UMchkl1+Uukl5ww=; b=gmU1zrlHEwJwmygcrqnlAqx2yBj511UpL/xZ8Yozrgt2ceQEeuNWsUPi8GdhKZmG1Y ZKXypJgU7c6IqX4OZ/rh7slfY/clWebvfhFUfO2E9vIXXYsZcT5Z0n2T8+mnFpdOyr6v OjUSY5ZkufnT8e7i+Lpl0lmWk59q05uHOHuHIOoBE899rGal/SmhKJpuohqnCR08+1jZ UNmSmm+Aya6hTPD+WaIYQPQl5ey0pVx5lhGTzMYkkJYr3/u4wvAcAbI26P+v4uAeF2qo y/3fvt+DxnH1Y2OP742QKqLzFXqsg942lrZsZig9dyqmKyuNNP1daTQO/Dly9iF+UDv0 51DA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b193-20020a6334ca000000b0051b35cb52b2si5100737pga.565.2023.06.05.00.10.54; Mon, 05 Jun 2023 00:11:06 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230377AbjFEHDZ (ORCPT + 99 others); Mon, 5 Jun 2023 03:03:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230369AbjFEHCv (ORCPT ); Mon, 5 Jun 2023 03:02:51 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8DED9E6F; Mon, 5 Jun 2023 00:02:17 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 328DD1682; Mon, 5 Jun 2023 00:02:59 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E1EDF3F793; Mon, 5 Jun 2023 00:02:11 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: akiyks@gmail.com, boqun.feng@gmail.com, corbet@lwn.net, keescook@chromium.org, linux@armlinux.org.uk, linux-doc@vger.kernel.org, mark.rutland@arm.com, mchehab@kernel.org, paulmck@kernel.org, peterz@infradead.org, rdunlap@infradead.org, sstabellini@kernel.org, will@kernel.org Subject: [PATCH v2 16/27] locking/atomic: scripts: factor out order template generation Date: Mon, 5 Jun 2023 08:01:13 +0100 Message-Id: <20230605070124.3741859-17-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230605070124.3741859-1-mark.rutland@arm.com> References: <20230605070124.3741859-1-mark.rutland@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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?1767845728254257480?= X-GMAIL-MSGID: =?utf-8?q?1767845728254257480?= Currently gen_proto_order_variants() hard codes the path for the templates used for order fallbacks. Factor this out into a helper so that it can be reused elsewhere. This results in no change to the generated headers, so there should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Reviewed-by: Kees Cook Cc: Boqun Feng Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Will Deacon --- scripts/atomic/gen-atomic-fallback.sh | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/scripts/atomic/gen-atomic-fallback.sh b/scripts/atomic/gen-atomic-fallback.sh index 7a6bcea8f565b..337330865fa2e 100755 --- a/scripts/atomic/gen-atomic-fallback.sh +++ b/scripts/atomic/gen-atomic-fallback.sh @@ -32,6 +32,20 @@ gen_template_fallback() fi } +#gen_order_fallback(meta, pfx, name, sfx, order, atomic, int, args...) +gen_order_fallback() +{ + local meta="$1"; shift + local pfx="$1"; shift + local name="$1"; shift + local sfx="$1"; shift + local order="$1"; shift + + local tmpl_order=${order#_} + local tmpl="${ATOMICDIR}/fallbacks/${tmpl_order:-fence}" + gen_template_fallback "${tmpl}" "${meta}" "${pfx}" "${name}" "${sfx}" "${order}" "$@" +} + #gen_proto_fallback(meta, pfx, name, sfx, order, atomic, int, args...) gen_proto_fallback() { @@ -56,20 +70,6 @@ cat << EOF EOF } -gen_proto_order_variant() -{ - local meta="$1"; shift - local pfx="$1"; shift - local name="$1"; shift - local sfx="$1"; shift - local order="$1"; shift - local atomic="$1" - - local basename="arch_${atomic}_${pfx}${name}${sfx}" - - printf "#define ${basename}${order} ${basename}${order}\n" -} - #gen_proto_order_variants(meta, pfx, name, sfx, atomic, int, args...) gen_proto_order_variants() { @@ -117,9 +117,9 @@ gen_proto_order_variants() printf "#else /* ${basename}_relaxed */\n\n" - gen_template_fallback "${ATOMICDIR}/fallbacks/acquire" "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@" - gen_template_fallback "${ATOMICDIR}/fallbacks/release" "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@" - gen_template_fallback "${ATOMICDIR}/fallbacks/fence" "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@" + gen_order_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@" + gen_order_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@" + gen_order_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@" printf "#endif /* ${basename}_relaxed */\n\n" }