Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1701073rdb; Sat, 2 Dec 2023 06:16:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSdfvczCaH41N9ysdltx2Etc7EsULKAqljekYXLh+ufHuZAXa46ist45p87k2dIvrQpqs7 X-Received: by 2002:a05:6e02:12ee:b0:35d:5d53:eae8 with SMTP id l14-20020a056e0212ee00b0035d5d53eae8mr1726282iln.62.1701526567182; Sat, 02 Dec 2023 06:16:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701526567; cv=none; d=google.com; s=arc-20160816; b=a2+K1YNX9Qxo7ytbTYOtnRmT54ezyriXNj7ZaPeB8n+HLU81MRU6VvFk79XIviKUx2 1h6sMsTRZA7v4z2q2LfEa3Q4/QEFZMpiVbK5eO6vgZYYLyNsDqteKt4Ji7r3NyUsusQg ry8qvWAhhk+60JHenJpwXH0s+LzYNtpn5SEIf1/KNSgDXyz/ZQZ6z3pAMUAMq3R/06tR WRrP1wM/LkvYaFQFGLF3DANPzIhgO06hF6bJ1sdwF7Maoj49YhYGFjDT9eg3JsEcFTAy EPJNz0QO9aZiQAfrsKfbpFZM1RvTsG4fxv9cvTEMhAbm3yZzN7a8fjGrHjIy5TtV7CdY 1XGA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=y5u3K/XOH7dbsLlHsJhSPIFH1+wrkXbfYRrS/ZV2iWM=; fh=srb/EijQIrMEdOeqn3qQX6qrsAGyqHAqeSFkl/qDdLM=; b=dIunRPUik2FfE8JioNJIReu0eD18A0usw/ebnnL/5iCqWwwwW7GzqhDDmb741HMPf2 BwK66NliMbgcK3/fvaLHA1tK0tO/Bgewynfl+exWRckFAJIKL7i3EY2SpzirQ/sJiIJe 2MYx0eRVQ0tooWt6T4CAEvUvIswGnrsU8Vfd8tCy2xM/wW2Pg8XvK5gKChaThL3Jb8UC m36yPcp5DtT/y3U/6yOVl1zhTDQs1COK7ZyDBVFWs0G630W5csyrCLgxWkhJe20Vbs8q KWWvwHAGJMLNCBfRwSZ+bohBDlF3uRziecQURIJCzehpgGb/uEyBLQFmQ6KxUCeONfEt +Byg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="E9/n4SDN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id bq19-20020a056a02045300b005c6646565d2si733822pgb.629.2023.12.02.06.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 06:16:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="E9/n4SDN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id EF3A580613A0; Sat, 2 Dec 2023 06:16:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232934AbjLBOPq (ORCPT + 99 others); Sat, 2 Dec 2023 09:15:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232924AbjLBOPn (ORCPT ); Sat, 2 Dec 2023 09:15:43 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D91B89E for ; Sat, 2 Dec 2023 06:15:49 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 388EDC433C9; Sat, 2 Dec 2023 14:15:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701526549; bh=S2+zqveKrbdhHD/E0gLVDfqMZhNfNga2QuZZLKEkKts=; h=From:To:Cc:Subject:Date:From; b=E9/n4SDNzT+7E/XzeFkmkbteR4trXt4gqLfwdTDooFabkERe72aNvNceCOKnJiIYV w1q2lRB4TxZZ/zydPWbcLvVuaZ0pWcsjOrDyYZeTLao7Tu8hDxlCWHSx6OUOyt2xVF mBovBn2E6dFggfIw8zzWNmgQu+ICALfWlrB8FvBpzDKy5iqXeMuFtKYNaR6sFQXjFU cA8y7YjlJNL+pfYyjKZK6PITtwrbk1V4SJbB7BqdQHa0NyW8mPV4W4g5BgocoxYl8p KuUDlCV+V4KOreLLQyhwwAkc7cFqoOGNxe4bo6aq77YkRcSJ/cSM48jhOAFzOweMwp hGxKuRGbbxaMQ== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/2] riscv: enable lockless lockref implementation Date: Sat, 2 Dec 2023 22:03:21 +0800 Message-Id: <20231202140323.315-1-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Sat, 02 Dec 2023 06:16:04 -0800 (PST) This series selects ARCH_USE_CMPXCHG_LOCKREF to enable the cmpxchg-based lockless lockref implementation for riscv. Then, implement arch_cmpxchg64_{relaxed|acquire|release}. After patch1: Using Linus' test case[1] on TH1520 platform, I see a 11.2% improvement. On JH7110 platform, I see 12.0% improvement. After patch2: on both TH1520 and JH7110 platforms, I didn't see obvious performance improvement with Linus' test case [1]. IMHO, this may be related with the fence and lr.d/sc.d hw implementations. In theory, lr/sc without fence could give performance improvement over lr/sc plus fence, so add the code here to leave performance improvement room on newer HW platforms. Link: http://marc.info/?l=linux-fsdevel&m=137782380714721&w=4 [1] Since v1: - only select ARCH_USE_CMPXCHG_LOCKREF if 64BIT Jisheng Zhang (2): riscv: select ARCH_USE_CMPXCHG_LOCKREF riscv: cmpxchg: implement arch_cmpxchg64_{relaxed|acquire|release} arch/riscv/Kconfig | 1 + arch/riscv/include/asm/cmpxchg.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) -- 2.42.0