From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25CBCC4338F for ; Sun, 25 Jul 2021 03:06:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E8E5660E8E for ; Sun, 25 Jul 2021 03:06:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229831AbhGYCZt (ORCPT ); Sat, 24 Jul 2021 22:25:49 -0400 Received: from wnew1-smtp.messagingengine.com ([64.147.123.26]:41679 "EHLO wnew1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbhGYCZs (ORCPT ); Sat, 24 Jul 2021 22:25:48 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.west.internal (Postfix) with ESMTP id C24C62B0117B; Sat, 24 Jul 2021 23:06:18 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sat, 24 Jul 2021 23:06:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=Y 0C2NEWyArUxSdY7/JsNw6bRjfSzmv0TzsC81VlPyAA=; b=o12QDCitBfNqIdYks l5hTFNOc8KVRK502MYwa9+hKFuKgKtfjIddbmduHdJH/YTS7Iw5zM4PRbLk2nCiZ H3MhD+HUyuesvefHaoELK7u8viFLYau6tOmkSkuH4sa6bBVl5m/FHLE03wxqoUR4 OMp1+rtcI9lI3/SgANSuBktNtrjjJzT3ZCAMUttPv4l2twjx8/8Wr3yCvcNjJXlJ 7vtSCOZB0oZTI3rbKlITlsb2W1ioDhV7pFqWtezS8RLyzcswdrzcpjAgkLNN0gGw Pk2P0AbssxTWwLJIMjHjaC0wRy9lRwlsj3lWSgqMZ79ryawbtBY5eF2tZMTlrYdE fdgjw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=Y0C2NEWyArUxSdY7/JsNw6bRjfSzmv0TzsC81VlPy AA=; b=iz7KAXLJR7LpD1P5sTtN/4lMCha5jryj+NC2/GdajH6RIRuSvp8b33h4u 0GjGbwoCQsY7YtV0X4qThNqeBP44DF1FsFyFYxPf2K+wOwMnXG0g9i8ku7N15wzv xbYusqFxpimmMBStC59/nNz8BM3ZFS8yuKH/OeainZg84QwqCTclw6Gr6oLfqgr9 AKkeHHEkrxe9705/KP0AKoYJ3FezkSl2yQboCGBjBNj4t+5ilKN0nHFOdkcj5B3w od7oS8ptNrC4h2AO0OVp2I8EL0VDi9RREABsf50VSC90iK6QCgRbdSRmEmZSON/J xvKt++olE3d5omzHxEnLJpdbxZO4A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrgedugdeiudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeflihgrgihu nhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqnecugg ftrfgrthhtvghrnheptdduffeifefhhfeiudejhefhlefgiefhudeuheejhefhvdduvefh hffgieejledunecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehf lhihghhorghtrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 24 Jul 2021 23:06:12 -0400 (EDT) Subject: Re: [PATCH RFC 1/2] arch: Introduce ARCH_HAS_HW_XCHG_SMALL To: Arnd Bergmann , Huacai Chen Cc: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Guo Ren , linux-arch , Rui Wang , Xuefeng Li , Huacai Chen References: <20210724123617.3525377-1-chenhuacai@loongson.cn> From: Jiaxun Yang Message-ID: Date: Sun, 25 Jul 2021 11:06:10 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-arch@vger.kernel.org 在 2021/7/25 上午3:24, Arnd Bergmann 写道: > On Sat, Jul 24, 2021 at 2:36 PM Huacai Chen wrote: >> Introduce a new Kconfig option ARCH_HAS_HW_XCHG_SMALL, which means arch >> has hardware sub-word xchg/cmpxchg support. This option will be used as >> an indicator to select the bit-field definition in the qspinlock data >> structure. >> >> Signed-off-by: Huacai Chen > Adding a Kconfig conditional sounds like a good idea, but I have two > concerns about the specific implementation: > > - I think we should have separate symbols for 8-bit, 16-bit and 64-bit > cmpxchg(). I think every architecture needs to support at least 32-bit > cmpxchg() and 64-bit architectures also need to support cmpxchg64(). > I actually have a prototype patch that introduces cmpxchg8() and > cmpxchg16() helpers with the purpose of no longer supporting these > width in the normal cmpxchg(), but that is mostly independent of > whether we want a conditional or not. Yeah that seems a better solution to make supporting status clear, > > - If I remember correctly, there were some concerns about whether using > this information for picking the qspinlock implementation is a good idea. We've checked previous attempt made by Guo Ren about ARCH_USE_QUEUED_SPINLOCKS_XCHG32[1], the concerns of potential livelock do exist. So in this patch Huacai took another, dropping the whole standalone tailing logic to remove the usage of sub-word xchg. It could be understood as partial revert of  69f9cae9 (" locking/qspinlock: Optimize for smaller NR_CPUS") [2] on these architectures. > > Arnd [1]: https://lore.kernel.org/linux-csky/1617201040-83905-2-git-send-email-guoren@kernel.org/ [2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=69f9cae90907e09af95fb991ed384670cef8dd32 Thanks. - Jiaxun