Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp1730324rdh; Sat, 25 Nov 2023 00:34:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IF6+urU9O2FgQ3zAeXN1O814lR2uqnkaKdczJVzUMi06uC8FVlOgYOWEH1Q8Uwe2uo2lon0 X-Received: by 2002:a05:6808:6541:b0:3b8:5dbd:3344 with SMTP id fn1-20020a056808654100b003b85dbd3344mr1050134oib.53.1700901282567; Sat, 25 Nov 2023 00:34:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700901282; cv=none; d=google.com; s=arc-20160816; b=fMbMYMrE21g6FR5rLJI75jAR7IiPF11fh9qIUludIZea31ZY3Y0SK/jvJTERL9bJdF lI9gEd2/Xm3g+W7JskaW110UA/ehOSarFY5JewYrPrRfFo8fOLXnw4aTSwNVFdThDDZj MUZyinv0Bk8e5gtylD+W0mYpOxMKBSUofEYOBHx3hXcBfq+Q44ZHORVMasoYJFKar61L Tlv73FNdy3o5S6IIwtrKrDZ8KBD2SYr7y3yzOgaAzP8cP3+nUftoohHFnWuFEgFPjczo S2a1eVMLXp061DFhERpPqVh8O1KUdMSDBPXgwZvL1q0ViCF4O02CUTRCtFKqQpxWBgo9 OaYw== 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=CliTJFywb9HE7Q/+kS/XqMkPVuzR296W94THFRYOK3E=; fh=srb/EijQIrMEdOeqn3qQX6qrsAGyqHAqeSFkl/qDdLM=; b=x6BPGHMWsdeJA6s4zRHWsWaRr8CGxFnlGzWGNenfl/+XQIZbvGgM8YxlzAXn5gaIxp EsWzX9Falit5t8Me1Likr5FY2oNXvRHQiTfo1lGEFcYUUQCrcFchwJN/HBqHCAz6dII3 B7UXeVjqfOPE7JzOIqXpqolCA2oCeISzwf8syVJJlizTy8hR9wnVHK/gUiMHy1QI6a9D Lo81SEF2kHCwwiRLrE7aT09bB62/Z/jlugiAkQe2nTJHATP8ClEg9iE9f/fONvkp85uk +yo48i0RTUfZ1InixVhzqyoATKcoQnlQnmEBkpw+LGr9NqGUg+CEgaVCzku8in9HVnCG BFdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UjamK1+9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id bz3-20020a056a02060300b005be2508ce03si5920871pgb.569.2023.11.25.00.34.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 00:34:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UjamK1+9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 3914980BEAAD; Sat, 25 Nov 2023 00:34:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231873AbjKYIeO (ORCPT + 99 others); Sat, 25 Nov 2023 03:34:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231785AbjKYIeC (ORCPT ); Sat, 25 Nov 2023 03:34:02 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F288CDE for ; Sat, 25 Nov 2023 00:34:07 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5559CC433C8; Sat, 25 Nov 2023 08:34:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700901247; bh=yNvTs5UAx1BPwJURTZLeQZMlvThqxFtraUOhYepUN5M=; h=From:To:Cc:Subject:Date:From; b=UjamK1+9ds2rJGs2WYR5sxyO4tcp6KWr2aF1r20jgEr59ZYHAzGTRPAC1pWeqHUq6 eqBJmXhEmwS2V3z+4K3ONEYLkC4ijNo6z/9Q/4otmf4kCPE5zsbnP1BLekrGVYeATV Vn9M79nY6o8gIbBPet/QBUnOOsst56flsG8QUNklHC6IH9voZfb9qn8gUzAPyBzS4Q M9e8Ghy3DF6Ne0z3+irHpZ9fsn4oz3LprYK6O6eE8DwXqlmKd4DOMvtTx+j9SiBDIZ dmwC+I9tGn1ZU8uNTnXHkkJ4dTizhS45yLz+8s+NDE85jqq56MK/xQamaRSp8dDGgT yDJrnB07prqUQ== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/2] riscv: enable lockless lockref implementation Date: Sat, 25 Nov 2023 16:21:42 +0800 Message-Id: <20231125082144.311-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 fry.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 (fry.vger.email [0.0.0.0]); Sat, 25 Nov 2023 00:34:35 -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] 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