Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7727582rwr; Wed, 10 May 2023 11:44:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5r7+XmlmQeYPhhmZxGsmpwJNpbFB8nDQkSQ4J7iGejMIlQKQbi/I6oRbCtekv121jzAP3d X-Received: by 2002:a05:6a00:1902:b0:63f:4a9:679b with SMTP id y2-20020a056a00190200b0063f04a9679bmr23983006pfi.15.1683744248885; Wed, 10 May 2023 11:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683744248; cv=none; d=google.com; s=arc-20160816; b=vyoS81lFdTbfrHGHsBpT3sdHRV85RdEYNZa4P6/D7+Q/hB9PYqT2aKczGrOBxPSJDX 15zehVrsBrV7K88w+P0H+6HE4pi4+7G289vX3aosjIcP0ASLoVU0B6sCpPTmdnQt5QYz 4yKc9NGEWFO1w8M2TCsp1W+Mj3Jvc3vn1kwcuI5myHlwL5E9+3Ux+yrKNzBTDNW24oTm jo475QLNawiK4O30KptMN+IshM664viYRAHqN/VmtFKPDlPVtUXLx2tSAVVUgDNjB7qa 76UFpABaLlH+JWThhWPUJPfhYIAPmnm6K6I0CGWNV7L00KZYhyjfM7WZ9uuJFySXxGpn aSFw== 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=PHshiQ7uMs0NhQd/9DEx5xyGBepZ9abIcdZU/Ij/VPs=; b=Fy7CPNDtTiq/dQFxXdv2leLWrnJCc/t6Xu4SerCHkmuLOVknBLJtZw48CCwKthtVuO wK5UFj7sDzZKBKH0gUIAvIWct3pvHOcwh5XdK2pMvM0kNwKEbDjz6okXA8+Bc0xl4F7p THS3nPGGoI6XUGC/pHXuErt9xVmA4gVdLsetYz5jfy7d0S6qIVNpkUk4sqXo8agw3ODk AtVtsPRxGYgeKmePVnxrAj5ZTqpQ1i+hsZ95u/uJKL9SbjZ0JDy7yn1tv0QuMe9qTQFS jhGAlqh2xzNsiq3xVMTK1GWtnIT75xFulYfoBGzWfNE78Yt7r+/YnxUVL3eEoSw16+ji 3zTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SpL4jW3l; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f64-20020a625143000000b00643a50dd697si5554920pfb.265.2023.05.10.11.43.56; Wed, 10 May 2023 11:44:08 -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=SpL4jW3l; 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 S236634AbjEJSTg (ORCPT + 99 others); Wed, 10 May 2023 14:19:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236267AbjEJSS3 (ORCPT ); Wed, 10 May 2023 14:18:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B52E6EB5; Wed, 10 May 2023 11:18:07 -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 dfw.source.kernel.org (Postfix) with ESMTPS id DB41663FA0; Wed, 10 May 2023 18:17:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DC51C433B0; Wed, 10 May 2023 18:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683742645; bh=y/ijSymqpBi0ZgYxVDYAOqEJwBeBohZdg/EiWWO4gQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SpL4jW3lgLQL6fdbONVbO9vIjML/uzlFGHsP8A+ANFzC0DO+iBakWjs1iRMeeKkuC uAdO67olpmJ8qNeOmlSgkTU316iYAQmFy6t8xx0sxKFUGlDM3BZ1oZuCDpRX64bHbc bY92jOyaLQnDqoxFG2z6gC/r3EHhLGcCf9S+Wr/VIieW06uYdeTAAJpV27IboEiM0j uZ7URj6RR2acCpL3FPQm+HTUnTh0K2ZLCmSmsU8cCfJW+rXORx4RWrBropKCd2jw/F eLjQMEmchBZv5bvUNSeotqC+kCWj3LuMy6Sdg7bGUfolbwzzcldmMkaYy8pWT1bylZ 9BVkZQHNkLQ8Q== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 09D44CE21D3; Wed, 10 May 2023 11:17:19 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, akiyks@gmail.com, linux-doc@vger.kernel.org, kernel-team@meta.com, "Paul E. McKenney" , Will Deacon , Peter Zijlstra , Boqun Feng , Mark Rutland Subject: [PATCH locking/atomic 18/19] locking/atomic: Refrain from generating duplicate fallback kernel-doc Date: Wed, 10 May 2023 11:17:16 -0700 Message-Id: <20230510181717.2200934-18-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <19135936-06d7-4705-8bc8-bb31c2a478ca@paulmck-laptop> References: <19135936-06d7-4705-8bc8-bb31c2a478ca@paulmck-laptop> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 The gen-atomics.sh script currently generates 42 duplicate definitions: arch_atomic64_add_negative arch_atomic64_add_negative_acquire arch_atomic64_add_negative_release arch_atomic64_dec_return arch_atomic64_dec_return_acquire arch_atomic64_dec_return_release arch_atomic64_fetch_andnot arch_atomic64_fetch_andnot_acquire arch_atomic64_fetch_andnot_release arch_atomic64_fetch_dec arch_atomic64_fetch_dec_acquire arch_atomic64_fetch_dec_release arch_atomic64_fetch_inc arch_atomic64_fetch_inc_acquire arch_atomic64_fetch_inc_release arch_atomic64_inc_return arch_atomic64_inc_return_acquire arch_atomic64_inc_return_release arch_atomic64_try_cmpxchg arch_atomic64_try_cmpxchg_acquire arch_atomic64_try_cmpxchg_release arch_atomic_add_negative arch_atomic_add_negative_acquire arch_atomic_add_negative_release arch_atomic_dec_return arch_atomic_dec_return_acquire arch_atomic_dec_return_release arch_atomic_fetch_andnot arch_atomic_fetch_andnot_acquire arch_atomic_fetch_andnot_release arch_atomic_fetch_dec arch_atomic_fetch_dec_acquire arch_atomic_fetch_dec_release arch_atomic_fetch_inc arch_atomic_fetch_inc_acquire arch_atomic_fetch_inc_release arch_atomic_inc_return arch_atomic_inc_return_acquire arch_atomic_inc_return_release arch_atomic_try_cmpxchg arch_atomic_try_cmpxchg_acquire arch_atomic_try_cmpxchg_release These duplicates are presumably to handle different architectures generating hand-coded definitions for different subsets of the atomic operations. However, generating duplicate kernel-doc headers is undesirable. Therefore, generate only the first kernel-doc definition in a group of duplicates. A comment indicates the name of the function and the fallback script that generated it. Reported-by: Akira Yokosawa Signed-off-by: Paul E. McKenney Cc: Will Deacon Cc: Peter Zijlstra Cc: Boqun Feng Cc: Mark Rutland --- include/linux/atomic/atomic-arch-fallback.h | 386 +++---------------- scripts/atomic/chkdup.sh | 27 ++ scripts/atomic/fallbacks/acquire | 3 + scripts/atomic/fallbacks/add_negative | 5 + scripts/atomic/fallbacks/add_unless | 5 + scripts/atomic/fallbacks/andnot | 5 + scripts/atomic/fallbacks/dec | 5 + scripts/atomic/fallbacks/dec_and_test | 5 + scripts/atomic/fallbacks/dec_if_positive | 5 + scripts/atomic/fallbacks/dec_unless_positive | 5 + scripts/atomic/fallbacks/fence | 3 + scripts/atomic/fallbacks/fetch_add_unless | 5 + scripts/atomic/fallbacks/inc | 5 + scripts/atomic/fallbacks/inc_and_test | 5 + scripts/atomic/fallbacks/inc_not_zero | 5 + scripts/atomic/fallbacks/inc_unless_negative | 5 + scripts/atomic/fallbacks/read_acquire | 5 + scripts/atomic/fallbacks/release | 3 + scripts/atomic/fallbacks/set_release | 5 + scripts/atomic/fallbacks/sub_and_test | 5 + scripts/atomic/fallbacks/try_cmpxchg | 5 + scripts/atomic/gen-atomics.sh | 4 + 22 files changed, 163 insertions(+), 343 deletions(-) create mode 100644 scripts/atomic/chkdup.sh diff --git a/include/linux/atomic/atomic-arch-fallback.h b/include/linux/atomic/atomic-arch-fallback.h index 41aa94f0aacd..2d56726f8662 100644 --- a/include/linux/atomic/atomic-arch-fallback.h +++ b/include/linux/atomic/atomic-arch-fallback.h @@ -639,13 +639,7 @@ arch_atomic_inc_return_relaxed(atomic_t *v) #else /* arch_atomic_inc_return_relaxed */ #ifndef arch_atomic_inc_return_acquire -/** - * arch_atomic_inc_return_acquire - Atomic inc with acquire ordering - * @v: pointer of type atomic_t - * - * Atomically increment @v using acquire ordering. - * Return new value. - */ +// Fallback acquire omitting duplicate arch_atomic_inc_return_acquire() kernel-doc header. static __always_inline int arch_atomic_inc_return_acquire(atomic_t *v) { @@ -657,13 +651,7 @@ arch_atomic_inc_return_acquire(atomic_t *v) #endif #ifndef arch_atomic_inc_return_release -/** - * arch_atomic_inc_return_release - Atomic inc with release ordering - * @v: pointer of type atomic_t - * - * Atomically increment @v using release ordering. - * Return new value. - */ +// Fallback release omitting duplicate arch_atomic_inc_return_release() kernel-doc header. static __always_inline int arch_atomic_inc_return_release(atomic_t *v) { @@ -674,13 +662,7 @@ arch_atomic_inc_return_release(atomic_t *v) #endif #ifndef arch_atomic_inc_return -/** - * arch_atomic_inc_return - Atomic inc with full ordering - * @v: pointer of type atomic_t - * - * Atomically increment @v using full ordering. - * Return new value. - */ +// Fallback fence omitting duplicate arch_atomic_inc_return() kernel-doc header. static __always_inline int arch_atomic_inc_return(atomic_t *v) { @@ -769,13 +751,7 @@ arch_atomic_fetch_inc_relaxed(atomic_t *v) #else /* arch_atomic_fetch_inc_relaxed */ #ifndef arch_atomic_fetch_inc_acquire -/** - * arch_atomic_fetch_inc_acquire - Atomic inc with acquire ordering - * @v: pointer of type atomic_t - * - * Atomically increment @v using acquire ordering. - * Return old value. - */ +// Fallback acquire omitting duplicate arch_atomic_fetch_inc_acquire() kernel-doc header. static __always_inline int arch_atomic_fetch_inc_acquire(atomic_t *v) { @@ -787,13 +763,7 @@ arch_atomic_fetch_inc_acquire(atomic_t *v) #endif #ifndef arch_atomic_fetch_inc_release -/** - * arch_atomic_fetch_inc_release - Atomic inc with release ordering - * @v: pointer of type atomic_t - * - * Atomically increment @v using release ordering. - * Return old value. - */ +// Fallback release omitting duplicate arch_atomic_fetch_inc_release() kernel-doc header. static __always_inline int arch_atomic_fetch_inc_release(atomic_t *v) { @@ -804,13 +774,7 @@ arch_atomic_fetch_inc_release(atomic_t *v) #endif #ifndef arch_atomic_fetch_inc -/** - * arch_atomic_fetch_inc - Atomic inc with full ordering - * @v: pointer of type atomic_t - * - * Atomically increment @v using full ordering. - * Return old value. - */ +// Fallback fence omitting duplicate arch_atomic_fetch_inc() kernel-doc header. static __always_inline int arch_atomic_fetch_inc(atomic_t *v) { @@ -915,13 +879,7 @@ arch_atomic_dec_return_relaxed(atomic_t *v) #else /* arch_atomic_dec_return_relaxed */ #ifndef arch_atomic_dec_return_acquire -/** - * arch_atomic_dec_return_acquire - Atomic dec with acquire ordering - * @v: pointer of type atomic_t - * - * Atomically decrement @v using acquire ordering. - * Return new value. - */ +// Fallback acquire omitting duplicate arch_atomic_dec_return_acquire() kernel-doc header. static __always_inline int arch_atomic_dec_return_acquire(atomic_t *v) { @@ -933,13 +891,7 @@ arch_atomic_dec_return_acquire(atomic_t *v) #endif #ifndef arch_atomic_dec_return_release -/** - * arch_atomic_dec_return_release - Atomic dec with release ordering - * @v: pointer of type atomic_t - * - * Atomically decrement @v using release ordering. - * Return new value. - */ +// Fallback release omitting duplicate arch_atomic_dec_return_release() kernel-doc header. static __always_inline int arch_atomic_dec_return_release(atomic_t *v) { @@ -950,13 +902,7 @@ arch_atomic_dec_return_release(atomic_t *v) #endif #ifndef arch_atomic_dec_return -/** - * arch_atomic_dec_return - Atomic dec with full ordering - * @v: pointer of type atomic_t - * - * Atomically decrement @v using full ordering. - * Return new value. - */ +// Fallback fence omitting duplicate arch_atomic_dec_return() kernel-doc header. static __always_inline int arch_atomic_dec_return(atomic_t *v) { @@ -1045,13 +991,7 @@ arch_atomic_fetch_dec_relaxed(atomic_t *v) #else /* arch_atomic_fetch_dec_relaxed */ #ifndef arch_atomic_fetch_dec_acquire -/** - * arch_atomic_fetch_dec_acquire - Atomic dec with acquire ordering - * @v: pointer of type atomic_t - * - * Atomically decrement @v using acquire ordering. - * Return old value. - */ +// Fallback acquire omitting duplicate arch_atomic_fetch_dec_acquire() kernel-doc header. static __always_inline int arch_atomic_fetch_dec_acquire(atomic_t *v) { @@ -1063,13 +1003,7 @@ arch_atomic_fetch_dec_acquire(atomic_t *v) #endif #ifndef arch_atomic_fetch_dec_release -/** - * arch_atomic_fetch_dec_release - Atomic dec with release ordering - * @v: pointer of type atomic_t - * - * Atomically decrement @v using release ordering. - * Return old value. - */ +// Fallback release omitting duplicate arch_atomic_fetch_dec_release() kernel-doc header. static __always_inline int arch_atomic_fetch_dec_release(atomic_t *v) { @@ -1080,13 +1014,7 @@ arch_atomic_fetch_dec_release(atomic_t *v) #endif #ifndef arch_atomic_fetch_dec -/** - * arch_atomic_fetch_dec - Atomic dec with full ordering - * @v: pointer of type atomic_t - * - * Atomically decrement @v using full ordering. - * Return old value. - */ +// Fallback fence omitting duplicate arch_atomic_fetch_dec() kernel-doc header. static __always_inline int arch_atomic_fetch_dec(atomic_t *v) { @@ -1262,14 +1190,7 @@ arch_atomic_fetch_andnot_relaxed(int i, atomic_t *v) #else /* arch_atomic_fetch_andnot_relaxed */ #ifndef arch_atomic_fetch_andnot_acquire -/** - * arch_atomic_fetch_andnot_acquire - Atomic andnot with acquire ordering - * @i: value to complement then AND - * @v: pointer of type atomic_t - * - * Atomically complement then AND @i with @v using acquire ordering. - * Return old value. - */ +// Fallback acquire omitting duplicate arch_atomic_fetch_andnot_acquire() kernel-doc header. static __always_inline int arch_atomic_fetch_andnot_acquire(int i, atomic_t *v) { @@ -1281,14 +1202,7 @@ arch_atomic_fetch_andnot_acquire(int i, atomic_t *v) #endif #ifndef arch_atomic_fetch_andnot_release -/** - * arch_atomic_fetch_andnot_release - Atomic andnot with release ordering - * @i: value to complement then AND - * @v: pointer of type atomic_t - * - * Atomically complement then AND @i with @v using release ordering. - * Return old value. - */ +// Fallback release omitting duplicate arch_atomic_fetch_andnot_release() kernel-doc header. static __always_inline int arch_atomic_fetch_andnot_release(int i, atomic_t *v) { @@ -1299,14 +1213,7 @@ arch_atomic_fetch_andnot_release(int i, atomic_t *v) #endif #ifndef arch_atomic_fetch_andnot -/** - * arch_atomic_fetch_andnot - Atomic andnot with full ordering - * @i: value to complement then AND - * @v: pointer of type atomic_t - * - * Atomically complement then AND @i with @v using full ordering. - * Return old value. - */ +// Fallback fence omitting duplicate arch_atomic_fetch_andnot() kernel-doc header. static __always_inline int arch_atomic_fetch_andnot(int i, atomic_t *v) { @@ -1699,18 +1606,7 @@ arch_atomic_try_cmpxchg_relaxed(atomic_t *v, int *old, int new) #else /* arch_atomic_try_cmpxchg_relaxed */ #ifndef arch_atomic_try_cmpxchg_acquire -/** - * arch_atomic_try_cmpxchg_acquire - Atomic try_cmpxchg with acquire ordering - * @v: pointer of type atomic_t - * @old: desired old value to match - * @new: new value to put in - * - * Atomically compares @new to *@v, and if equal, - * stores @new to *@v, providing acquire ordering. - * Returns @true if the cmpxchg operation succeeded, - * and false otherwise. Either way, stores the old - * value of *@v to *@old. - */ +// Fallback acquire omitting duplicate arch_atomic_try_cmpxchg_acquire() kernel-doc header. static __always_inline bool arch_atomic_try_cmpxchg_acquire(atomic_t *v, int *old, int new) { @@ -1722,18 +1618,7 @@ arch_atomic_try_cmpxchg_acquire(atomic_t *v, int *old, int new) #endif #ifndef arch_atomic_try_cmpxchg_release -/** - * arch_atomic_try_cmpxchg_release - Atomic try_cmpxchg with release ordering - * @v: pointer of type atomic_t - * @old: desired old value to match - * @new: new value to put in - * - * Atomically compares @new to *@v, and if equal, - * stores @new to *@v, providing release ordering. - * Returns @true if the cmpxchg operation succeeded, - * and false otherwise. Either way, stores the old - * value of *@v to *@old. - */ +// Fallback release omitting duplicate arch_atomic_try_cmpxchg_release() kernel-doc header. static __always_inline bool arch_atomic_try_cmpxchg_release(atomic_t *v, int *old, int new) { @@ -1744,18 +1629,7 @@ arch_atomic_try_cmpxchg_release(atomic_t *v, int *old, int new) #endif #ifndef arch_atomic_try_cmpxchg -/** - * arch_atomic_try_cmpxchg - Atomic try_cmpxchg with full ordering - * @v: pointer of type atomic_t - * @old: desired old value to match - * @new: new value to put in - * - * Atomically compares @new to *@v, and if equal, - * stores @new to *@v, providing full ordering. - * Returns @true if the cmpxchg operation succeeded, - * and false otherwise. Either way, stores the old - * value of *@v to *@old. - */ +// Fallback fence omitting duplicate arch_atomic_try_cmpxchg() kernel-doc header. static __always_inline bool arch_atomic_try_cmpxchg(atomic_t *v, int *old, int new) { @@ -1900,15 +1774,7 @@ arch_atomic_add_negative_relaxed(int i, atomic_t *v) #else /* arch_atomic_add_negative_relaxed */ #ifndef arch_atomic_add_negative_acquire -/** - * arch_atomic_add_negative_acquire - Atomic add_negative with acquire ordering - * @i: value to add - * @v: pointer of type atomic_t - * - * Atomically add @i with @v using acquire ordering. - * Return @true if the result is negative, or @false when - * the result is greater than or equal to zero. - */ +// Fallback acquire omitting duplicate arch_atomic_add_negative_acquire() kernel-doc header. static __always_inline bool arch_atomic_add_negative_acquire(int i, atomic_t *v) { @@ -1920,15 +1786,7 @@ arch_atomic_add_negative_acquire(int i, atomic_t *v) #endif #ifndef arch_atomic_add_negative_release -/** - * arch_atomic_add_negative_release - Atomic add_negative with release ordering - * @i: value to add - * @v: pointer of type atomic_t - * - * Atomically add @i with @v using release ordering. - * Return @true if the result is negative, or @false when - * the result is greater than or equal to zero. - */ +// Fallback release omitting duplicate arch_atomic_add_negative_release() kernel-doc header. static __always_inline bool arch_atomic_add_negative_release(int i, atomic_t *v) { @@ -1939,15 +1797,7 @@ arch_atomic_add_negative_release(int i, atomic_t *v) #endif #ifndef arch_atomic_add_negative -/** - * arch_atomic_add_negative - Atomic add_negative with full ordering - * @i: value to add - * @v: pointer of type atomic_t - * - * Atomically add @i with @v using full ordering. - * Return @true if the result is negative, or @false when - * the result is greater than or equal to zero. - */ +// Fallback fence omitting duplicate arch_atomic_add_negative() kernel-doc header. static __always_inline bool arch_atomic_add_negative(int i, atomic_t *v) { @@ -2500,13 +2350,7 @@ arch_atomic64_inc_return_relaxed(atomic64_t *v) #else /* arch_atomic64_inc_return_relaxed */ #ifndef arch_atomic64_inc_return_acquire -/** - * arch_atomic64_inc_return_acquire - Atomic inc with acquire ordering - * @v: pointer of type atomic64_t - * - * Atomically increment @v using acquire ordering. - * Return new value. - */ +// Fallback acquire omitting duplicate arch_atomic64_inc_return_acquire() kernel-doc header. static __always_inline s64 arch_atomic64_inc_return_acquire(atomic64_t *v) { @@ -2518,13 +2362,7 @@ arch_atomic64_inc_return_acquire(atomic64_t *v) #endif #ifndef arch_atomic64_inc_return_release -/** - * arch_atomic64_inc_return_release - Atomic inc with release ordering - * @v: pointer of type atomic64_t - * - * Atomically increment @v using release ordering. - * Return new value. - */ +// Fallback release omitting duplicate arch_atomic64_inc_return_release() kernel-doc header. static __always_inline s64 arch_atomic64_inc_return_release(atomic64_t *v) { @@ -2535,13 +2373,7 @@ arch_atomic64_inc_return_release(atomic64_t *v) #endif #ifndef arch_atomic64_inc_return -/** - * arch_atomic64_inc_return - Atomic inc with full ordering - * @v: pointer of type atomic64_t - * - * Atomically increment @v using full ordering. - * Return new value. - */ +// Fallback fence omitting duplicate arch_atomic64_inc_return() kernel-doc header. static __always_inline s64 arch_atomic64_inc_return(atomic64_t *v) { @@ -2630,13 +2462,7 @@ arch_atomic64_fetch_inc_relaxed(atomic64_t *v) #else /* arch_atomic64_fetch_inc_relaxed */ #ifndef arch_atomic64_fetch_inc_acquire -/** - * arch_atomic64_fetch_inc_acquire - Atomic inc with acquire ordering - * @v: pointer of type atomic64_t - * - * Atomically increment @v using acquire ordering. - * Return old value. - */ +// Fallback acquire omitting duplicate arch_atomic64_fetch_inc_acquire() kernel-doc header. static __always_inline s64 arch_atomic64_fetch_inc_acquire(atomic64_t *v) { @@ -2648,13 +2474,7 @@ arch_atomic64_fetch_inc_acquire(atomic64_t *v) #endif #ifndef arch_atomic64_fetch_inc_release -/** - * arch_atomic64_fetch_inc_release - Atomic inc with release ordering - * @v: pointer of type atomic64_t - * - * Atomically increment @v using release ordering. - * Return old value. - */ +// Fallback release omitting duplicate arch_atomic64_fetch_inc_release() kernel-doc header. static __always_inline s64 arch_atomic64_fetch_inc_release(atomic64_t *v) { @@ -2665,13 +2485,7 @@ arch_atomic64_fetch_inc_release(atomic64_t *v) #endif #ifndef arch_atomic64_fetch_inc -/** - * arch_atomic64_fetch_inc - Atomic inc with full ordering - * @v: pointer of type atomic64_t - * - * Atomically increment @v using full ordering. - * Return old value. - */ +// Fallback fence omitting duplicate arch_atomic64_fetch_inc() kernel-doc header. static __always_inline s64 arch_atomic64_fetch_inc(atomic64_t *v) { @@ -2776,13 +2590,7 @@ arch_atomic64_dec_return_relaxed(atomic64_t *v) #else /* arch_atomic64_dec_return_relaxed */ #ifndef arch_atomic64_dec_return_acquire -/** - * arch_atomic64_dec_return_acquire - Atomic dec with acquire ordering - * @v: pointer of type atomic64_t - * - * Atomically decrement @v using acquire ordering. - * Return new value. - */ +// Fallback acquire omitting duplicate arch_atomic64_dec_return_acquire() kernel-doc header. static __always_inline s64 arch_atomic64_dec_return_acquire(atomic64_t *v) { @@ -2794,13 +2602,7 @@ arch_atomic64_dec_return_acquire(atomic64_t *v) #endif #ifndef arch_atomic64_dec_return_release -/** - * arch_atomic64_dec_return_release - Atomic dec with release ordering - * @v: pointer of type atomic64_t - * - * Atomically decrement @v using release ordering. - * Return new value. - */ +// Fallback release omitting duplicate arch_atomic64_dec_return_release() kernel-doc header. static __always_inline s64 arch_atomic64_dec_return_release(atomic64_t *v) { @@ -2811,13 +2613,7 @@ arch_atomic64_dec_return_release(atomic64_t *v) #endif #ifndef arch_atomic64_dec_return -/** - * arch_atomic64_dec_return - Atomic dec with full ordering - * @v: pointer of type atomic64_t - * - * Atomically decrement @v using full ordering. - * Return new value. - */ +// Fallback fence omitting duplicate arch_atomic64_dec_return() kernel-doc header. static __always_inline s64 arch_atomic64_dec_return(atomic64_t *v) { @@ -2906,13 +2702,7 @@ arch_atomic64_fetch_dec_relaxed(atomic64_t *v) #else /* arch_atomic64_fetch_dec_relaxed */ #ifndef arch_atomic64_fetch_dec_acquire -/** - * arch_atomic64_fetch_dec_acquire - Atomic dec with acquire ordering - * @v: pointer of type atomic64_t - * - * Atomically decrement @v using acquire ordering. - * Return old value. - */ +// Fallback acquire omitting duplicate arch_atomic64_fetch_dec_acquire() kernel-doc header. static __always_inline s64 arch_atomic64_fetch_dec_acquire(atomic64_t *v) { @@ -2924,13 +2714,7 @@ arch_atomic64_fetch_dec_acquire(atomic64_t *v) #endif #ifndef arch_atomic64_fetch_dec_release -/** - * arch_atomic64_fetch_dec_release - Atomic dec with release ordering - * @v: pointer of type atomic64_t - * - * Atomically decrement @v using release ordering. - * Return old value. - */ +// Fallback release omitting duplicate arch_atomic64_fetch_dec_release() kernel-doc header. static __always_inline s64 arch_atomic64_fetch_dec_release(atomic64_t *v) { @@ -2941,13 +2725,7 @@ arch_atomic64_fetch_dec_release(atomic64_t *v) #endif #ifndef arch_atomic64_fetch_dec -/** - * arch_atomic64_fetch_dec - Atomic dec with full ordering - * @v: pointer of type atomic64_t - * - * Atomically decrement @v using full ordering. - * Return old value. - */ +// Fallback fence omitting duplicate arch_atomic64_fetch_dec() kernel-doc header. static __always_inline s64 arch_atomic64_fetch_dec(atomic64_t *v) { @@ -3123,14 +2901,7 @@ arch_atomic64_fetch_andnot_relaxed(s64 i, atomic64_t *v) #else /* arch_atomic64_fetch_andnot_relaxed */ #ifndef arch_atomic64_fetch_andnot_acquire -/** - * arch_atomic64_fetch_andnot_acquire - Atomic andnot with acquire ordering - * @i: value to complement then AND - * @v: pointer of type atomic64_t - * - * Atomically complement then AND @i with @v using acquire ordering. - * Return old value. - */ +// Fallback acquire omitting duplicate arch_atomic64_fetch_andnot_acquire() kernel-doc header. static __always_inline s64 arch_atomic64_fetch_andnot_acquire(s64 i, atomic64_t *v) { @@ -3142,14 +2913,7 @@ arch_atomic64_fetch_andnot_acquire(s64 i, atomic64_t *v) #endif #ifndef arch_atomic64_fetch_andnot_release -/** - * arch_atomic64_fetch_andnot_release - Atomic andnot with release ordering - * @i: value to complement then AND - * @v: pointer of type atomic64_t - * - * Atomically complement then AND @i with @v using release ordering. - * Return old value. - */ +// Fallback release omitting duplicate arch_atomic64_fetch_andnot_release() kernel-doc header. static __always_inline s64 arch_atomic64_fetch_andnot_release(s64 i, atomic64_t *v) { @@ -3160,14 +2924,7 @@ arch_atomic64_fetch_andnot_release(s64 i, atomic64_t *v) #endif #ifndef arch_atomic64_fetch_andnot -/** - * arch_atomic64_fetch_andnot - Atomic andnot with full ordering - * @i: value to complement then AND - * @v: pointer of type atomic64_t - * - * Atomically complement then AND @i with @v using full ordering. - * Return old value. - */ +// Fallback fence omitting duplicate arch_atomic64_fetch_andnot() kernel-doc header. static __always_inline s64 arch_atomic64_fetch_andnot(s64 i, atomic64_t *v) { @@ -3560,18 +3317,7 @@ arch_atomic64_try_cmpxchg_relaxed(atomic64_t *v, s64 *old, s64 new) #else /* arch_atomic64_try_cmpxchg_relaxed */ #ifndef arch_atomic64_try_cmpxchg_acquire -/** - * arch_atomic64_try_cmpxchg_acquire - Atomic try_cmpxchg with acquire ordering - * @v: pointer of type atomic64_t - * @old: desired old value to match - * @new: new value to put in - * - * Atomically compares @new to *@v, and if equal, - * stores @new to *@v, providing acquire ordering. - * Returns @true if the cmpxchg operation succeeded, - * and false otherwise. Either way, stores the old - * value of *@v to *@old. - */ +// Fallback acquire omitting duplicate arch_atomic64_try_cmpxchg_acquire() kernel-doc header. static __always_inline bool arch_atomic64_try_cmpxchg_acquire(atomic64_t *v, s64 *old, s64 new) { @@ -3583,18 +3329,7 @@ arch_atomic64_try_cmpxchg_acquire(atomic64_t *v, s64 *old, s64 new) #endif #ifndef arch_atomic64_try_cmpxchg_release -/** - * arch_atomic64_try_cmpxchg_release - Atomic try_cmpxchg with release ordering - * @v: pointer of type atomic64_t - * @old: desired old value to match - * @new: new value to put in - * - * Atomically compares @new to *@v, and if equal, - * stores @new to *@v, providing release ordering. - * Returns @true if the cmpxchg operation succeeded, - * and false otherwise. Either way, stores the old - * value of *@v to *@old. - */ +// Fallback release omitting duplicate arch_atomic64_try_cmpxchg_release() kernel-doc header. static __always_inline bool arch_atomic64_try_cmpxchg_release(atomic64_t *v, s64 *old, s64 new) { @@ -3605,18 +3340,7 @@ arch_atomic64_try_cmpxchg_release(atomic64_t *v, s64 *old, s64 new) #endif #ifndef arch_atomic64_try_cmpxchg -/** - * arch_atomic64_try_cmpxchg - Atomic try_cmpxchg with full ordering - * @v: pointer of type atomic64_t - * @old: desired old value to match - * @new: new value to put in - * - * Atomically compares @new to *@v, and if equal, - * stores @new to *@v, providing full ordering. - * Returns @true if the cmpxchg operation succeeded, - * and false otherwise. Either way, stores the old - * value of *@v to *@old. - */ +// Fallback fence omitting duplicate arch_atomic64_try_cmpxchg() kernel-doc header. static __always_inline bool arch_atomic64_try_cmpxchg(atomic64_t *v, s64 *old, s64 new) { @@ -3761,15 +3485,7 @@ arch_atomic64_add_negative_relaxed(s64 i, atomic64_t *v) #else /* arch_atomic64_add_negative_relaxed */ #ifndef arch_atomic64_add_negative_acquire -/** - * arch_atomic64_add_negative_acquire - Atomic add_negative with acquire ordering - * @i: value to add - * @v: pointer of type atomic64_t - * - * Atomically add @i with @v using acquire ordering. - * Return @true if the result is negative, or @false when - * the result is greater than or equal to zero. - */ +// Fallback acquire omitting duplicate arch_atomic64_add_negative_acquire() kernel-doc header. static __always_inline bool arch_atomic64_add_negative_acquire(s64 i, atomic64_t *v) { @@ -3781,15 +3497,7 @@ arch_atomic64_add_negative_acquire(s64 i, atomic64_t *v) #endif #ifndef arch_atomic64_add_negative_release -/** - * arch_atomic64_add_negative_release - Atomic add_negative with release ordering - * @i: value to add - * @v: pointer of type atomic64_t - * - * Atomically add @i with @v using release ordering. - * Return @true if the result is negative, or @false when - * the result is greater than or equal to zero. - */ +// Fallback release omitting duplicate arch_atomic64_add_negative_release() kernel-doc header. static __always_inline bool arch_atomic64_add_negative_release(s64 i, atomic64_t *v) { @@ -3800,15 +3508,7 @@ arch_atomic64_add_negative_release(s64 i, atomic64_t *v) #endif #ifndef arch_atomic64_add_negative -/** - * arch_atomic64_add_negative - Atomic add_negative with full ordering - * @i: value to add - * @v: pointer of type atomic64_t - * - * Atomically add @i with @v using full ordering. - * Return @true if the result is negative, or @false when - * the result is greater than or equal to zero. - */ +// Fallback fence omitting duplicate arch_atomic64_add_negative() kernel-doc header. static __always_inline bool arch_atomic64_add_negative(s64 i, atomic64_t *v) { @@ -3958,4 +3658,4 @@ arch_atomic64_dec_if_positive(atomic64_t *v) #endif #endif /* _LINUX_ATOMIC_FALLBACK_H */ -// 7c2c97cd48cf9c672efc44b9fed5a37b8970dde4 +// 9bf9febc5288ed9539d1b3cfbbc6e36743b74c3b diff --git a/scripts/atomic/chkdup.sh b/scripts/atomic/chkdup.sh new file mode 100644 index 000000000000..04bb4f5c5c34 --- /dev/null +++ b/scripts/atomic/chkdup.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# Check to see if the specified atomic is already in use. This is +# done by keeping filenames in the temporary directory specified by the +# environment variable T. +# +# Usage: +# chkdup.sh name fallback +# +# The "name" argument is the name of the function to be generated, and +# the "fallback" argument is the name of the fallback script that is +# doing the generation. +# +# If the function is a duplicate, output a comment saying so and +# exit with non-zero (error) status. Otherwise exit successfully +# +# If the function is a duplicate, output a comment saying so and +# exit with non-zero (error) status. Otherwise exit successfully. + +if test -f ${T}/${1} +then + echo // Fallback ${2} omitting duplicate "${1}()" kernel-doc header. + exit 1 +fi +touch ${T}/${1} +exit 0 diff --git a/scripts/atomic/fallbacks/acquire b/scripts/atomic/fallbacks/acquire index 08fc6c30a9ef..a349935ac7fe 100755 --- a/scripts/atomic/fallbacks/acquire +++ b/scripts/atomic/fallbacks/acquire @@ -1,5 +1,8 @@ +if /bin/sh ${ATOMICDIR}/chkdup.sh arch_${atomic}_${pfx}${name}${sfx}_acquire acquire +then acqrel=acquire . ${ATOMICDIR}/acqrel.sh +fi cat << EOF static __always_inline ${ret} arch_${atomic}_${pfx}${name}${sfx}_acquire(${params}) diff --git a/scripts/atomic/fallbacks/add_negative b/scripts/atomic/fallbacks/add_negative index c032e8bec6e2..b105fdfe8fd1 100755 --- a/scripts/atomic/fallbacks/add_negative +++ b/scripts/atomic/fallbacks/add_negative @@ -1,3 +1,5 @@ +if /bin/sh ${ATOMICDIR}/chkdup.sh arch_${atomic}_add_negative${order} add_negative +then cat <