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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EE7CC77B7E for ; Thu, 25 May 2023 13:17:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0D0266B0074; Thu, 25 May 2023 09:17:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0803B6B0075; Thu, 25 May 2023 09:17:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E943A900002; Thu, 25 May 2023 09:16:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D861B6B0074 for ; Thu, 25 May 2023 09:16:59 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 483E3A062F for ; Thu, 25 May 2023 13:16:59 +0000 (UTC) X-FDA: 80828827758.19.0EE9E32 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP id 63F8520041 for ; Thu, 25 May 2023 13:11:20 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=U1iALbTK; dmarc=none; spf=none (imf13.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685020281; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9DEm7cVBdm52kK3UCzMVMzsLM3W+SSD9KxYzTiOP2os=; b=PaTSAKqsxJ50pjV2/gfJJ1COowy2go6qmbaLk+4+2r2PkwLBLrt7umK5fyAiYL0wBpCJxn uat36d6Jm70L7+V78N5Txt4P43J6R2WtfV5dqRmEOYbvDdwEslOFh95O4JNQvAKKaeqMlm wZOvM1Ew45acC1cBJ7T7Ddzl6A9oAjE= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=U1iALbTK; dmarc=none; spf=none (imf13.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685020281; a=rsa-sha256; cv=none; b=xjCD/CEohpyCgbfFhKfoYdhkqGPEzVtDFsh2cILm3FgO70DAQhb/LnHl/uaH1yCe+ToRtV 9sl0zonlP66OxlFu6b7JpYZla0FyRR5reuoQl92bEE/TbNe9BIINJJvVAuprxxSu9LXz1M FWeHYp5uxs26NP9B848TxZkdrvPbk9g= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=9DEm7cVBdm52kK3UCzMVMzsLM3W+SSD9KxYzTiOP2os=; b=U1iALbTK7rHRU7VruFM7TO2E1Z xvRWFPd1doSjCsYDCMHOsTa++oGrg2nEYlCWtLO9dvrCYG9N6QHsuU4eTucS5i/YzLpxsrSFrNYvb TnGFukTMiMyFir0UB6XRsXp7+8l811BLakEig4nBp09A0rwnSvgUO8h8Obxd2EIXiNEj99e87oVpR wwUrVPb3F/WC52qPGfwBWdAQ/yTLMvMbyc9o7/4SrP+Orf6KuaDzcBvOeSUSIZQtnSs2xNgAfKEGX wAZb3MoIN8mFE7OLypmP7Jb+v5G1tAMXpGUnnBN6AvHH0VEO3mjcUXclEe3PAtmDJI25A1jXCr8Et CiIKtoYQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1q2Ajx-00CD2j-1K; Thu, 25 May 2023 13:10:49 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id E6AAC3001AE; Thu, 25 May 2023 15:10:43 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B530C20A78741; Thu, 25 May 2023 15:10:43 +0200 (CEST) Date: Thu, 25 May 2023 15:10:43 +0200 From: Peter Zijlstra To: Arnd Bergmann Cc: Linus Torvalds , Jonathan Corbet , Will Deacon , Boqun Feng , Mark Rutland , Catalin Marinas , dennis@kernel.org, Tejun Heo , Christoph Lameter , Heiko Carstens , gor@linux.ibm.com, Alexander Gordeev , borntraeger@linux.ibm.com, Sven Schnelle , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Joerg Roedel , suravee.suthikulpanit@amd.com, Robin Murphy , David Woodhouse , Baolu Lu , Herbert Xu , "David S . Miller" , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, iommu@lists.linux.dev, Linux-Arch , linux-crypto@vger.kernel.org, Stephen Rothwell , Michael Ellerman Subject: Re: [PATCH v3 08/11] slub: Replace cmpxchg_double() Message-ID: <20230525131043.GT83892@hirez.programming.kicks-ass.net> References: <20230515075659.118447996@infradead.org> <20230515080554.453785148@infradead.org> <20230524093246.GP83892@hirez.programming.kicks-ass.net> <20230525102946.GE38236@hirez.programming.kicks-ass.net> <292934ce-73fa-4077-9051-2ad909828f4a@app.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <292934ce-73fa-4077-9051-2ad909828f4a@app.fastmail.com> X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 63F8520041 X-Stat-Signature: n1hfskozn65qwe6fx89ew4ofs9b4hfhr X-HE-Tag: 1685020280-476946 X-HE-Meta: U2FsdGVkX19j8WSftazvQipFTfccRArTsyY68WG5ns/Jt1I7ZEB8jzH0HXEEGQEZT3SBkSAzNT+T+VEG+0393OGyph82c3fIalb8jEJneGjNTLZH9yHueBOJRlKyJG+bMiOLnpcpIQw7HHLSyGpvzJxO6TO7canONkSDIwKNjYN/cvFJi01onZ5ju/9ls+7BGIMnwGS28wFtQa7EGnINWRgZ+LVRIHvrFGH0O/e4B9+uPQ2vBB2v5SZ5ItLDZrJ63FgXs3FrRZpyo6wvx+lW9y65k0haAg8dSHCNmMPiN7eE6hw4VdnLmc8ShXG6vyZ8Q67ot4GH/gjXs2d3VIZ5Z9hPStps8DQcCrlcDVxKBqwls9kl73m7p1hofiJleFmZ+UiLsFMvlDkYWw4kt1/Bo83icldXSfIvrd+4Qb+dgLfar9rbFeIUzhvTjuWrhe3IXlj3Xv63rEnfyOEAXllavcMYUB6nNkNRHg5qkIunTdw6xP+3nQhIFqjxYsJzh11M6o259+2UmVToQ4AZAvhHOkB4MOgjKvomPp4a+9y2uAxuEUEoxa5csNS9NszTxYGa6S6CC4BCHI71epO+Zd5ZrHHdBAFMQfFQb/evup7p3fCOGgzmPf4gz2byDYbXOSIfE1DOu164o2NyGE+zVDz6EdhMeaWblNRoCaoVFXUlETpjRl6QXVYbJTjiR+1abPiZe8aFahDrNK2Pl1a0mqcF8ZU+hhm3yUgBlSOTMV0qCtXhptun/+ecdsuq/yd+ofQPfZxDY5+W72Bfogco5xwm6PS8rF+4LCjQSMWEzisUu9p3Bcm8JdMQc51vU/V9AkERnz1rs/Kca+JYOMK5+yPzB+dzrxtl8cMEaSOSnTfasYK978cX5aHYOPu5NsMA8pm33TyHPVaoAcjEwq/tQRZBl6pTsUFb0Q0eH8hbVv/TevGiuzhl8hD+TPrS891IEz41u9vYKjQfULR2AGb4Eby AqjP8ooM S8VJ7tXv2VAI6yRzp2bOmoEI02V99icyLOgI4DLl0f0GDpwZ+D+wfdw+WTwn7EMrzILMkB0f5ihn1Wb3afnk5CBCEI0cMxeYdZBsstvzGLnri+v3pwL6RR6tP0BEsz3+Hze9t1+Hxny7EoDEWp1TRSMskcTP6mG3n+dzjFpIlpzdwXCdztu07iFadMfDYX2l0KJzZlzSWjbMYuumyesASiVbW+3a7DAaHy8r3bm1kIctggx0dd7+rMwbna2MPuqugGTkX X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, May 25, 2023 at 12:52:06PM +0200, Arnd Bergmann wrote: > On Thu, May 25, 2023, at 12:29, Peter Zijlstra wrote: > > On Wed, May 24, 2023 at 11:32:47AM +0200, Peter Zijlstra wrote: > >> On Mon, May 15, 2023 at 09:57:07AM +0200, Peter Zijlstra wrote: > > > > This then also means I need to look at this_cpu_cmpxchg128 and > > this_cpu_cmoxchg64 behaviour when we dont have the CPUID feature. > > > > Because current verions seem to assume the instruction is present. > > As far as I could tell when reviewing your series, this_cpu_cmpxchg64() > is always available on all architectures. Depending on compile-time > feature detection this would be either a native instruction that > is guaranteed to work, or the irq-disabled version. On x86, this > is handled at runtime with alternative_io(). > > this_cpu_cmpxchg128() clearly needed the system_has_cmpxchg128() > check, same as system_has_cmpxchg_double() today. So, having just dug through all that, on x86: this_cpu_cmpxchg64() is: X86_CMPXCHG64=n -> fallback, irrespective of CX8 X86_CMPXCHG64=y -> cmpxchg8b X86_64 -> cmpxchg I've changed it to be similar between 32bit and 64bit such that both: cmpxchg#b when CX#, otherwise this_cpu_cmpxchg#b_emu