Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp904905lqm; Wed, 1 May 2024 21:53:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQJEmlX3bzg1GRIIgwL0TAB+Sizh8ce9Cl4MeGUhJSIDE3CyfrW/xwYwZmt4LNOKdO6riH5T/ANqvDKikKaQRpuAZ6Ey0xTZ9Ha1ur5w== X-Google-Smtp-Source: AGHT+IFZw0JeDZW875RoyfPrjGeJxvyDAKA+pj13qvAZw8tq+xpbk8QupGhXSE64+8zQJiTDHkHB X-Received: by 2002:a17:906:5659:b0:a51:a288:5af9 with SMTP id v25-20020a170906565900b00a51a2885af9mr2510220ejr.51.1714625592943; Wed, 01 May 2024 21:53:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714625592; cv=pass; d=google.com; s=arc-20160816; b=rY9blGziY9mOYg9rQYG19HeFEUlU0/u8PafFdRkTRNAyn+Nx5nMcqgGf6fm778f2mM Ur5gi6SaGCuMacH+n0CDAOGOF5VyiH1v1UKfbeu2xRekO7g9LRDENaxEkpAzHPIP1JIC p8swx/KotkvHmp+xLYnpT+ebGLYdLmG13OHOd2+5B+QMAomVEXOj0/Gqe7equoL5NM53 N78AQRwiQYQwepZvFfBl4k7NSZlId8E6APO+Xs1FnmAaZwjiKzF6Ea+oaL72D+L3vwDu mwyaTvfMPyBVafmuMT8dnhSJuEVh/kKKm6IKf2CghuTSwxc9zrO7ejbuaToBOb9A1TR4 fTUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=/eMsYhPVNNcz2vMoRM5ukXsDie/BKIKYyU9ZchLdKu4=; fh=NEvDc/lN0PXbUTehuAwAzWv2yu2OurvLFBWe79IsVos=; b=B41hwKrSVczeijUncz1V5A0i8R90Ea/XPXuS7ySjgwJsfLXnNQWbSn+/mPQoP35uum jx3PnAHLzy41yQmbyk8HcWfj5N6Pic6Bg9Hk4O+/YnGrjMjPDggLZ/r6iRGfGkE922vL QR6ueyKkAuLyr3xozCMOJZJeRwwhGbDfyAxlyhw2/JtblM3K0k3CiNhC91/XMpnfiKis X1u+wVc1REQP0eDpj+7c0KLxK5kKSwQRij2juwfMAGgWRIeO/YgB4iIex5ebJqjmG/o1 ubX+Hg8nmhr/O+9qMqf1bG26j7SaX/VpdNPvVlcH1Vcee4PAuDaK8u778ueG+aOcP1xX 4Ujg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@fu-berlin.de header.s=fub01 header.b=n5hAjaXl; arc=pass (i=1 spf=pass spfdomain=zedat.fu-berlin.de dkim=pass dkdomain=fu-berlin.de dmarc=pass fromdomain=physik.fu-berlin.de); spf=pass (google.com: domain of linux-kernel+bounces-165967-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165967-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fu-berlin.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dm6-20020a170907948600b00a55a9f59e62si104912ejc.487.2024.05.01.21.53.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 21:53:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165967-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=fail header.i=@fu-berlin.de header.s=fub01 header.b=n5hAjaXl; arc=pass (i=1 spf=pass spfdomain=zedat.fu-berlin.de dkim=pass dkdomain=fu-berlin.de dmarc=pass fromdomain=physik.fu-berlin.de); spf=pass (google.com: domain of linux-kernel+bounces-165967-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165967-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fu-berlin.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AC2EF1F21DD2 for ; Thu, 2 May 2024 04:53:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4ED631CD18; Thu, 2 May 2024 04:53:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=fu-berlin.de header.i=@fu-berlin.de header.b="n5hAjaXl" Received: from outpost1.zedat.fu-berlin.de (outpost1.zedat.fu-berlin.de [130.133.4.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCB7D12E75; Thu, 2 May 2024 04:53:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=130.133.4.66 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714625584; cv=none; b=k6w5ZRTjPFAFT/yOS+HErYONghVEEjSTiJQT1GPQnF7YRcOj5MXNfz63BzcHgr4gR0tpmAakVWcafWONA/zktPkEWV2bdVIspP5lkwat/CRbXRYXzAf8KHpg/H++yLHWKQGw+keDhnX0SRMqsrLBNsdp+sYnvdwNM88HpMIOTnM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714625584; c=relaxed/simple; bh=Be1NO7/RwxW2Ftlfxne9kCWldkjf/e42obNSaNj/LAo=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=EE+4j4HXsmSmLevpqWf3ruynf4cRagonnXvsbEOnEeZk4ByNk5OPgVpEeFXZX6UyXApFeMb9KGaYgfLVpzjIiydsMcRs8Rx05QH+R9O0dFH7U/lQh/mRTIoNoiUmSTZxfYqYyu7UkvF2Zu/edfHIwEJSGjddXEzwIyF3uC9zUME= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=physik.fu-berlin.de; spf=pass smtp.mailfrom=zedat.fu-berlin.de; dkim=pass (2048-bit key) header.d=fu-berlin.de header.i=@fu-berlin.de header.b=n5hAjaXl; arc=none smtp.client-ip=130.133.4.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=physik.fu-berlin.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zedat.fu-berlin.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fu-berlin.de; s=fub01; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/eMsYhPVNNcz2vMoRM5ukXsDie/BKIKYyU9ZchLdKu4=; t=1714625580; x=1715230380; b=n5hAjaXldDS8Ad9R+oAPVdPigwenDWreiKYyCJFdYbc6Fs8i03Y9X0SqUU9rmIlCRU5uShFztOv Rx/UzFjz18ak8237vsx9JCqspLhfuXxk5r8pfRieqeYE3plgf4vuvCV+PtzclkOSvwKYWUVsseVpV nPcXRQfNMmhjmvtTpxuW5zQFjEcYLHH7wz5/4mAtTrAah+BiZScjUtu5pg1xL+X3yzjpCxYeGqzw3 L8I4nDJWUsCX32AFpjtqrSz7IQ7bUQ0wNSsHQjlWbAEteHjoFngZ0JtYEdmwnovjxdVv2hiHNfTzF lmEr7QpbJCvPvuWMR0q2V+AI1zlNvcm6+joQ==; Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost.zedat.fu-berlin.de (Exim 4.97) with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (envelope-from ) id 1s2ORD-00000003upy-0WBi; Thu, 02 May 2024 06:52:55 +0200 Received: from p57bd90e8.dip0.t-ipconnect.de ([87.189.144.232] helo=suse-laptop.fritz.box) by inpost2.zedat.fu-berlin.de (Exim 4.97) with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (envelope-from ) id 1s2ORC-00000003GON-3gV9; Thu, 02 May 2024 06:52:55 +0200 Message-ID: <1376850f47279e3a3f4f40e3de2784ae3ac30414.camel@physik.fu-berlin.de> Subject: Re: [PATCH v2 cmpxchg 12/13] sh: Emulate one-byte cmpxchg From: John Paul Adrian Glaubitz To: "Paul E. McKenney" , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: elver@google.com, akpm@linux-foundation.org, tglx@linutronix.de, peterz@infradead.org, dianders@chromium.org, pmladek@suse.com, arnd@arndb.de, torvalds@linux-foundation.org, kernel-team@meta.com, Andi Shyti , Palmer Dabbelt , Masami Hiramatsu , linux-sh@vger.kernel.org Date: Thu, 02 May 2024 06:52:53 +0200 In-Reply-To: <20240501230130.1111603-12-paulmck@kernel.org> References: <20240501230130.1111603-12-paulmck@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Original-Sender: glaubitz@physik.fu-berlin.de X-ZEDAT-Hint: PO Hi Paul, On Wed, 2024-05-01 at 16:01 -0700, Paul E. McKenney wrote: > Use the new cmpxchg_emu_u8() to emulate one-byte cmpxchg() on sh. >=20 > [ paulmck: Drop two-byte support per Arnd Bergmann feedback. ] > [ paulmck: Apply feedback from Naresh Kamboju. ] > [ Apply Geert Uytterhoeven feedback. ] >=20 > Signed-off-by: Paul E. McKenney > Cc: Andi Shyti > Cc: Palmer Dabbelt > Cc: Masami Hiramatsu > Cc: Arnd Bergmann > Cc: > --- > arch/sh/Kconfig | 1 + > arch/sh/include/asm/cmpxchg.h | 3 +++ > 2 files changed, 4 insertions(+) >=20 > diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig > index 2ad3e29f0ebec..f47e9ccf4efd2 100644 > --- a/arch/sh/Kconfig > +++ b/arch/sh/Kconfig > @@ -16,6 +16,7 @@ config SUPERH > select ARCH_HIBERNATION_POSSIBLE if MMU > select ARCH_MIGHT_HAVE_PC_PARPORT > select ARCH_WANT_IPC_PARSE_VERSION > + select ARCH_NEED_CMPXCHG_1_EMU > select CPU_NO_EFFICIENT_FFS > select DMA_DECLARE_COHERENT > select GENERIC_ATOMIC64 > diff --git a/arch/sh/include/asm/cmpxchg.h b/arch/sh/include/asm/cmpxchg.= h > index 5d617b3ef78f7..1e5dc5ccf7bf5 100644 > --- a/arch/sh/include/asm/cmpxchg.h > +++ b/arch/sh/include/asm/cmpxchg.h > @@ -9,6 +9,7 @@ > =20 > #include > #include > +#include > =20 > #if defined(CONFIG_GUSA_RB) > #include > @@ -56,6 +57,8 @@ static inline unsigned long __cmpxchg(volatile void * p= tr, unsigned long old, > unsigned long new, int size) > { > switch (size) { > + case 1: > + return cmpxchg_emu_u8(ptr, old, new); > case 4: > return __cmpxchg_u32(ptr, old, new); > } Thanks for the patch. However, I don't quite understand its purpose. There is already a case for 8-byte cmpxchg in the switch statement below: case 1: \ __xchg__res =3D xchg_u8(__xchg_ptr, x); \ break; Does cmpxchg_emu_u8() have any advantages over the native xchg_u8()? Thanks, Adrian --=20 .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913