Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4942747rdb; Fri, 15 Sep 2023 18:25:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRZQD+aKuYXYdeBQZAEFWszAbJgG99FO9kxT73hxG5+C9kb/7R0fQYLFlufVThs9hmADek X-Received: by 2002:a05:620a:461f:b0:76f:839:6bdd with SMTP id br31-20020a05620a461f00b0076f08396bddmr3857487qkb.3.1694827500380; Fri, 15 Sep 2023 18:25:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694827500; cv=none; d=google.com; s=arc-20160816; b=PRqoMoH29VgjyP6OaWEqavOTG7PdS5hSvNPBvlBM3oOaRFSCRLBHw130bJlCKdiiT4 /Ggu8baPoq/KuPzNMHVcahwdVvQQgrZA5hN0YyXcmJB2VQaG9C+bGDifVaFEEv+jGyb5 9o6BhRZDkfvu/SnlbG+/CU6xQue7vz2Ih1QoYToVN0Oz3uUufZ9ldFumymSc5SpGhuEp lhwC2p6bgQCh4TpQU4WYD679t7hUz7wIJjkcxVS6ig7Kb9Au8ppNU/omMj7AUPlG3138 ozH1JzGAtogQW7tex8ub1Sz3Fs6xjGFjyV0iWR2pGWj00Ypb9hCG8lG4BWYZPB0WXQgu cxcA== 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=6EBV41RIEaRQJ/bvvEj83J2s787qIb+bZO0o/tTL46o=; fh=Exu8p2J0bt/MoYkEByA/Woj5EWTdUoRsvJYmK88z1hY=; b=MDMqxmYnFMwT6NVVNF3tUvYIA8XZGJdDUweBv5cJ5sBHPdmNQ+elGu/OzII5bfW0Lu vIf7HDMCqUMEJU4lONkIg5cOFdpZbKJEOjsvFivYkHTAFi7O8sG5InK033pyrOUmAhmT ec2AHxewxePH1aVwCa0/695UBSKxBU4bAbXnhn1v6aq2n1O4WEKanLzt6QfV3Ddn7GMz 2JT/OzsGfd9uJ8vO55k6SF4PKuyoo9JDZAEwbNmKqtKSIEn1H2GOmMUxOpnp/H0a77hj NHSganJky8v9huKrwoBT+KXA2wEwEY57vszUcLy72I1N/dptcDMF+TYA4QIEj0oHmN9O dfyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=PGQxstVh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id ei52-20020a056a0080f400b0068a6d3f6a14si4001655pfb.360.2023.09.15.18.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 18:25:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=PGQxstVh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 69BBA8540AF4; Fri, 15 Sep 2023 11:38:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236753AbjIOSiQ (ORCPT + 99 others); Fri, 15 Sep 2023 14:38:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236511AbjIOSho (ORCPT ); Fri, 15 Sep 2023 14:37:44 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83E7D196; Fri, 15 Sep 2023 11:37:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=6EBV41RIEaRQJ/bvvEj83J2s787qIb+bZO0o/tTL46o=; b=PGQxstVhyCK0bbn5NHcYRNn1ww TxkyLFF82AJXaUuPCP6DmEIuZbEa0EI2ja1MyNLl3TdgTTfLGsIjYXP4J5tsPhGSDcF4Lowtd/gxr WmuuHVRLsydmaX8bgQiQF/TghtX7r/DGahRcDs+Z8x33x9u9jN+r0263r9IdacDiIbu5vI+zvQue/ CUN2QU8Lx2GRWbdVVFYgK0NfRCOq1DP4DgN1U15kTUtq3xrZm+drFqyseUENixVGv3Jf5rprOB25c 1fBweM05s0kmBDCS73000UmQyQJG9ZJmwSibr6lcT6hX4gnU+xO7zy4dEck0fA2C6m5EnJs/hCw5q ZJpNOApA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qhDgj-00BMIj-Ml; Fri, 15 Sep 2023 18:37:09 +0000 From: "Matthew Wilcox (Oracle)" To: linux-kernel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, torvalds@linux-foundation.org, Nicholas Piggin Subject: [PATCH 08/17] alpha: Implement xor_unlock_is_negative_byte Date: Fri, 15 Sep 2023 19:36:58 +0100 Message-Id: <20230915183707.2707298-9-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230915183707.2707298-1-willy@infradead.org> References: <20230915183707.2707298-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 15 Sep 2023 11:38:46 -0700 (PDT) Inspired by the alpha clear_bit() and arch_atomic_add_return(), this will surely be more efficient than the generic one defined in filemap.c. Signed-off-by: Matthew Wilcox (Oracle) --- arch/alpha/include/asm/bitops.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/alpha/include/asm/bitops.h b/arch/alpha/include/asm/bitops.h index bafb1c1f0fdc..138930e8a504 100644 --- a/arch/alpha/include/asm/bitops.h +++ b/arch/alpha/include/asm/bitops.h @@ -286,6 +286,27 @@ arch___test_and_change_bit(unsigned long nr, volatile unsigned long *addr) #define arch_test_bit generic_test_bit #define arch_test_bit_acquire generic_test_bit_acquire +static inline bool xor_unlock_is_negative_byte(unsigned long mask, + volatile unsigned long *p) +{ + unsigned long temp, old; + + __asm__ __volatile__( + "1: ldl_l %0,%4\n" + " xor %0,%3,%0\n" + " xor %0,%3,%2\n" + " stl_c %0,%1\n" + " beq %0,2f\n" + ".subsection 2\n" + "2: br 1b\n" + ".previous" + :"=&r" (temp), "=m" (*p), "=&r" (old) + :"Ir" (mask), "m" (*p)); + + return (old & BIT(7)) != 0; +} +#define xor_unlock_is_negative_byte xor_unlock_is_negative_byte + /* * ffz = Find First Zero in word. Undefined if no zero exists, * so code should check against ~0UL first.. -- 2.40.1