Message ID | 20231104090603.4253-1-wuqiang.matt@bytedance.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp1543024vqu; Sat, 4 Nov 2023 02:07:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHY7s3Ni4EPHC4Dnxwy6SxIQYPEFa3lBx9eyxf1q9Rd9VFDY5So/lcwwxGZpJwT93WNWewe X-Received: by 2002:a05:6870:e38c:b0:1e9:fc64:14b4 with SMTP id x12-20020a056870e38c00b001e9fc6414b4mr28789635oad.33.1699088820832; Sat, 04 Nov 2023 02:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699088820; cv=none; d=google.com; s=arc-20160816; b=noc0Za4Tg5t5Zg9PdUQD8BFuEBqm6K67L9ChVRcC6fNwv2586yEE/+j9twotphHWnN o+EU6d7aMRdHnK7YYp0wuxIf5nc5/o9gKITzW1BkvfM6TiDRTCsnAnloCcbwd8unMRAK Tqjze2cLmfS2jer7UCas3zzus9EzeAU430YPBCysSqIRrH1nuMeJbSOhPm1P/1Anh2n2 RxtGMIMAr8v4oolrcd29oS7IUrkDftIwj5AMYsh/dJqM1RCkjYzONLaWtf8ghMBwTdSc vNurB32GnA8rBoc5Ki3CJ05Ry6ckzFTECB7OyBG1FhkPw8uJNfCDvmcN9kCHJbHItwBq 9dpg== 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=kBC4c9FAt9Gr/4aY1zrwIt9ZU0ReMokHXCMgH7+KRKY=; fh=/4boh8F4Y/XzR9GxppXCQmTCFxhoW4AKsaIvcykyQRA=; b=hNrb/nbDV5mPo5+kkYlXIvQKeo2VrLhcKoVLAB+L98QZeTrnAE7JJS7VAkmgOL0+De iAqdkxSxiiGyAhYQexmt/6RCLkoNeEfVS0E9OyqGpN4Yxn43d2QzjP9bLOjImBgtiNqe E5GzjwgV9h1vJsz4aDSbaRt3YEhafeeYxvc82iHWqPHeZTacR/Qo/dXWbmimpvIm8xpI O7JBxJPr795IqLmW0PKisMD8RJJ0UeFUqV6dLj1neb/2ClvVQaJTcnEFg3H3+ChU1i03 WS2sLZQqIkTBwcyfVO46AROLbwgFrq1uCwOl+fVrcc+4uVwReGD8PqAcgje/wXQWEcHu mT2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=iD+vrumW; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id g130-20020a636b88000000b00578c3b7af9fsi2560271pgc.184.2023.11.04.02.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Nov 2023 02:07:00 -0700 (PDT) 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=@bytedance.com header.s=google header.b=iD+vrumW; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 973A0809B6FF; Sat, 4 Nov 2023 02:06:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230460AbjKDJGj (ORCPT <rfc822;lhua1029@gmail.com> + 35 others); Sat, 4 Nov 2023 05:06:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjKDJGi (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 4 Nov 2023 05:06:38 -0400 Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69462194 for <linux-kernel@vger.kernel.org>; Sat, 4 Nov 2023 02:06:13 -0700 (PDT) Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3b2e73a17a0so1829037b6e.3 for <linux-kernel@vger.kernel.org>; Sat, 04 Nov 2023 02:06:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1699088772; x=1699693572; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kBC4c9FAt9Gr/4aY1zrwIt9ZU0ReMokHXCMgH7+KRKY=; b=iD+vrumWXtZDmHSGj6lYqbHv8qNt85yoA2VdJwWD/884QncWClUlBtXwVCz9UEznJj Zxd74VEqNlqTYi8dZyuZCGxLIJy/7nZjrQ5dX4Fm9O9b+ClEEPyCqNlI334WDTBKStwe mGyV16YI6LDGn8dWatYkRQxW3o75rxTq2/UkM2ofL7JZqc6dRA70x83LWcT7vgBVASY9 pb6zf7dXnv42slMToGMfYQdMbqTTai0rbdsIO5eTLFV+NLXe+Ha4OTJtMwleriAVNbFI fSA1UVPqR1NN3MezXGTn41QwVpfVnewIAMH0OjUJhFnNZ2d5BbxQ1J4cD1jhWy88V+TS 2iBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699088772; x=1699693572; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kBC4c9FAt9Gr/4aY1zrwIt9ZU0ReMokHXCMgH7+KRKY=; b=dFfJ1GNl6EOMzxOyCbSkvPEtNCVES6AuPL2rak9XEEi3tEN6AB9MxZbd6w3lF2RPi/ cyW9ooKCw5iW/tmMBs/u4jDpYvUgq23UEw2Wqvfw8PsgFzG4DOc0f++PzwHZpfWYzK80 KlLeNS4TjKO/3ulUJQx1GDW38LGFd77AXDc78mZtAp4vi6uGZkcGxpyVtC56XpgVplZE 14aRKHH7mpPBwJY+vNSz4XPHPvUccddn73p8w7vQE9jsZ+IpdtDQMUlWLN1HQwsTmSUS 3/5aGD9NhlNtj5Ce27HSU6/CC2aLQaIaGJcySmIhhOfpwscCLpohG6+uXul+CyM2YimD q5QA== X-Gm-Message-State: AOJu0YxYcFVC7z97ztuQSQLY75sXiAMbHTJunQ4eIsFSA0LYEFAfZ0Nx BW3UZDae3idDD5oBY9sFqCX2sA== X-Received: by 2002:a05:6808:1389:b0:3b2:e60d:27f6 with SMTP id c9-20020a056808138900b003b2e60d27f6mr29896164oiw.29.1699088772632; Sat, 04 Nov 2023 02:06:12 -0700 (PDT) Received: from devz1.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id c4-20020aa78c04000000b0068be3489b0dsm2656148pfd.172.2023.11.04.02.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Nov 2023 02:06:12 -0700 (PDT) From: "wuqiang.matt" <wuqiang.matt@bytedance.com> To: chris@zankel.net, jcmvbkbc@gmail.com, andi.shyti@linux.intel.com, andrzej.hajda@intel.com, palmer@rivosinc.com, geert@linux-m68k.org Cc: linux-kernel@vger.kernel.org, mattwu@163.com, "wuqiang.matt" <wuqiang.matt@bytedance.com> Subject: [PATCH v1] locking/atomic: xtensa: define arch_cmpxchg_local as __cmpxchg_local Date: Sat, 4 Nov 2023 17:06:03 +0800 Message-Id: <20231104090603.4253-1-wuqiang.matt@bytedance.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> 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, 04 Nov 2023 02:06:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781623759723820097 X-GMAIL-MSGID: 1781623759723820097 |
Series |
[v1] locking/atomic: xtensa: define arch_cmpxchg_local as __cmpxchg_local
|
|
Commit Message
wuqiang.matt
Nov. 4, 2023, 9:06 a.m. UTC
The xtensa architecture already has __cmpxchg_local defined upon the
native __cmpxchg_u32 and __generic_cmpxchg_local
Signed-off-by: wuqiang.matt <wuqiang.matt@bytedance.com>
---
arch/xtensa/include/asm/cmpxchg.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Sat, Nov 4, 2023 at 2:06 AM wuqiang.matt <wuqiang.matt@bytedance.com> wrote: > > The xtensa architecture already has __cmpxchg_local defined upon the > native __cmpxchg_u32 and __generic_cmpxchg_local This description does not make clear why this change is needed. Could you please expand it to cover the 'why' part? > Signed-off-by: wuqiang.matt <wuqiang.matt@bytedance.com> > --- > arch/xtensa/include/asm/cmpxchg.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/xtensa/include/asm/cmpxchg.h b/arch/xtensa/include/asm/cmpxchg.h > index 675a11ea8de7..956c9925df1c 100644 > --- a/arch/xtensa/include/asm/cmpxchg.h > +++ b/arch/xtensa/include/asm/cmpxchg.h > @@ -108,7 +108,7 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr, > * them available. > */ > #define arch_cmpxchg_local(ptr, o, n) \ > - ((__typeof__(*(ptr)))__generic_cmpxchg_local((ptr), (unsigned long)(o),\ > + ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \ > (unsigned long)(n), sizeof(*(ptr)))) > #define arch_cmpxchg64_local(ptr, o, n) __generic_cmpxchg64_local((ptr), (o), (n)) > #define arch_cmpxchg64(ptr, o, n) arch_cmpxchg64_local((ptr), (o), (n)) > -- > 2.40.1 >
On 2023/11/4 17:31, Max Filippov wrote: > On Sat, Nov 4, 2023 at 2:06 AM wuqiang.matt <wuqiang.matt@bytedance.com> wrote: >> >> The xtensa architecture already has __cmpxchg_local defined upon the >> native __cmpxchg_u32 and __generic_cmpxchg_local > > This description does not make clear why this change is needed. Could you > please expand it to cover the 'why' part? The purpose of __cmpxchg_local() should be for arch_cmpxchg_local(), similarly for other architectures like x86/arm/powerpc. I noticed that arc/hexagon/openrisc/sh don't have arch_cmpxchg_local defined because my patch triggered an error in kernel building. Then found xtensa's definition of arch_cmpxchg_local() is not reasonable, so proposed this patch to improve. This change is not a must, but an improvement to simply make the codes of arch_cmpxchg_local() more reasonable. The patch link that introduced try_cmpxchg_local and triggered building error: https://lore.kernel.org/all/20231023112452.6290-1-wuqiang.matt@bytedance.com/ >> Signed-off-by: wuqiang.matt <wuqiang.matt@bytedance.com> >> --- >> arch/xtensa/include/asm/cmpxchg.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/xtensa/include/asm/cmpxchg.h b/arch/xtensa/include/asm/cmpxchg.h >> index 675a11ea8de7..956c9925df1c 100644 >> --- a/arch/xtensa/include/asm/cmpxchg.h >> +++ b/arch/xtensa/include/asm/cmpxchg.h >> @@ -108,7 +108,7 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr, >> * them available. >> */ >> #define arch_cmpxchg_local(ptr, o, n) \ >> - ((__typeof__(*(ptr)))__generic_cmpxchg_local((ptr), (unsigned long)(o),\ >> + ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \ >> (unsigned long)(n), sizeof(*(ptr)))) >> #define arch_cmpxchg64_local(ptr, o, n) __generic_cmpxchg64_local((ptr), (o), (n)) >> #define arch_cmpxchg64(ptr, o, n) arch_cmpxchg64_local((ptr), (o), (n)) >> -- >> 2.40.1 >> > >
diff --git a/arch/xtensa/include/asm/cmpxchg.h b/arch/xtensa/include/asm/cmpxchg.h index 675a11ea8de7..956c9925df1c 100644 --- a/arch/xtensa/include/asm/cmpxchg.h +++ b/arch/xtensa/include/asm/cmpxchg.h @@ -108,7 +108,7 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr, * them available. */ #define arch_cmpxchg_local(ptr, o, n) \ - ((__typeof__(*(ptr)))__generic_cmpxchg_local((ptr), (unsigned long)(o),\ + ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \ (unsigned long)(n), sizeof(*(ptr)))) #define arch_cmpxchg64_local(ptr, o, n) __generic_cmpxchg64_local((ptr), (o), (n)) #define arch_cmpxchg64(ptr, o, n) arch_cmpxchg64_local((ptr), (o), (n))