From patchwork Wed Aug 21 18:10:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 1975089 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=S83nIO0S; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=QCU6HumC; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=p0WM9A7x; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WpwzC6jVnz1yf6 for ; Thu, 22 Aug 2024 05:15:49 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QPoSGyC5wGVXYGkmPdzGFGIIxHfbOI67zvVumNk2LmI=; b=S83nIO0SHfj9ar XKf4to1D+yQplsfu3RPtD6drzY4usmTVyCV4RQJaqnry2aM7GPd3HuxgOE51o1jPy5RzhaQRVRVwZ gRKutdQtzIuh1IiP6VqoxZFkPBPzDdmYI9dKSeGsy5qlz7EPNMFuqRFyeWuUnCqcgcvCl5/JZm9L1 p/5xLSR1QeIr7IUztLW0Eb8tkoyK2VVzDfXhiVYJ5iMtTBXq/UFl5Hv8StbIpfXoXUvZbXZamUjWx Fcu5EnSgktKTEtla8ZAdlR0Fiv+QlzuIh5J72GDPy8qfKXKbHJSMrkJGWGQiT8GkQft51/nOTQkAq d7qqlEDR3/zG4xXZ1kZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgqo7-0000000A9sT-0pEb; Wed, 21 Aug 2024 19:15:47 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgpmn-0000000A1NJ-0jCz for linux-snps-arc@bombadil.infradead.org; Wed, 21 Aug 2024 18:10:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=Muh7bCDteNDBkUKrbn5tFrvRLKWlQXnlCiukZJwE1LY=; b=QCU6HumC680+8Kkj+TbMpvMZDD JWcy6HRHnqkRbKeQhTZ9tz1Pd9aj50cqtqfUcyvntKlNLjGRT9xXzPDmco9nzZJMelm1hCooyrkGy b4kDeU0ycqkLEbO5RR4WX8PcVDNVCfSzEwwA0aMPaFRbbxQ6hCX5GRoWew5pl0t5UtMrt6BpCWTmm 5/j5cySiu9gUJs5BP+wzoVuLROZ/a1NdCiuN+3mkftcQxKayhXXB9F/am1w6F7n/QIq9eHZXigG7a yM+smRAWfdRFjR3mJV4e8glSeXj40b/1gB69y6qO4s9MqCcTPR3Mrx0Wk1t9JPkzZLlYqDviJtV/v pmQWc1iA==; Received: from nyc.source.kernel.org ([147.75.193.91]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgpmj-00000009gDR-3OTi for linux-snps-arc@lists.infradead.org; Wed, 21 Aug 2024 18:10:19 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id DDB50A41DCB; Wed, 21 Aug 2024 18:10:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 245EFC32781; Wed, 21 Aug 2024 18:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724263813; bh=A1ZjBdu0p6P+IfhPi1T9QOGeX9FqrNLLWzvUxef5bSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p0WM9A7xqkbJ6V3TFxkE1zg7hMdY2wf0H9wXcOs8gMzvp7Iuk1RJaGYFlEKX9cMMl oKaSRU0xlpu16fsdGn7pWF3fdq9tpzBJP6HY2YsyHJ+J7nUezAZ4RvoztGhLCd90up SlOPfEwWr7Pk0kbAoac0W+9e67Z31gHtrscgYABO/J8GJs0bYAR8JjIAzisbAZxK7e nNrRtkP1o+NVzyjbp1uq/MHDi6N7ROLxiKSo9BBMr6KzL9E/pmYcGB1qV2gXw/Hzlt So7DeRzdIHynDMUfXd5FKB0iCyMtSalpOla5cFOAgSlTtnzqNWsiC/J6DruxQewb3S V5PJ5HlxDCI/g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id BCD68CE16C1; Wed, 21 Aug 2024 11:10:12 -0700 (PDT) From: "Paul E. McKenney" To: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, elver@google.com Cc: akpm@linux-foundation.org, tglx@linutronix.de, peterz@infradead.org, torvalds@linux-foundation.org, arnd@arndb.de, geert@linux-m68k.org, kernel-team@meta.com, "Paul E. McKenney" , Andi Shyti , Andrzej Hajda , Palmer Dabbelt , linux-snps-arc@lists.infradead.org, Vineet Gupta Subject: [PATCH v2 cmpxchg 2/3] ARC: Emulate one-byte cmpxchg Date: Wed, 21 Aug 2024 11:10:10 -0700 Message-Id: <20240821181011.2604152-2-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <04a6010c-536d-4906-bf7c-b2335a2f54b0@paulmck-laptop> References: <04a6010c-536d-4906-bf7c-b2335a2f54b0@paulmck-laptop> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_191018_009339_8F3B5721 X-CRM114-Status: GOOD ( 12.45 ) X-Spam-Score: -0.4 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Use the new cmpxchg_emu_u8() to emulate one-byte cmpxchg() on arc. [ paulmck: Drop two-byte support per Arnd Bergmann feedback. ] [ paulmck: Apply feedback from Naresh Kamboju. ] [ paulmck: Apply kernel test robot feedback. ] [ paulmck: Apply feedback from Vineet Gup [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 T_SCC_BODY_TEXT_LINE No description available. -0.1 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Use the new cmpxchg_emu_u8() to emulate one-byte cmpxchg() on arc. [ paulmck: Drop two-byte support per Arnd Bergmann feedback. ] [ paulmck: Apply feedback from Naresh Kamboju. ] [ paulmck: Apply kernel test robot feedback. ] [ paulmck: Apply feedback from Vineet Gupta. ] Signed-off-by: Paul E. McKenney Cc: Andi Shyti Cc: Andrzej Hajda Cc: Arnd Bergmann Cc: Palmer Dabbelt Cc: Acked-by: Vineet Gupta --- arch/arc/Kconfig | 1 + arch/arc/include/asm/cmpxchg.h | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index fd0b0a0d4686a..163608fd49d18 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -13,6 +13,7 @@ config ARC select ARCH_HAS_SETUP_DMA_OPS select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE + select ARCH_NEED_CMPXCHG_1_EMU select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC select ARCH_32BIT_OFF_T select BUILDTIME_TABLE_SORT diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h index e138fde067dea..58045c8983404 100644 --- a/arch/arc/include/asm/cmpxchg.h +++ b/arch/arc/include/asm/cmpxchg.h @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -46,6 +47,9 @@ __typeof__(*(ptr)) _prev_; \ \ switch(sizeof((_p_))) { \ + case 1: \ + _prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *)_p_, (uintptr_t)_o_, (uintptr_t)_n_); \ + break; \ case 4: \ _prev_ = __cmpxchg(_p_, _o_, _n_); \ break; \ @@ -65,8 +69,6 @@ __typeof__(*(ptr)) _prev_; \ unsigned long __flags; \ \ - BUILD_BUG_ON(sizeof(_p_) != 4); \ - \ /* \ * spin lock/unlock provide the needed smp_mb() before/after \ */ \