Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5971770rwl; Thu, 29 Dec 2022 05:51:07 -0800 (PST) X-Google-Smtp-Source: AMrXdXvjtQfYm4x3RcS/L+DDFlyIu0qKZOdg6dustkVEfCTLJUCnGI3EwUgNMzre0Ife+xfQ7KvG X-Received: by 2002:a05:6a20:12ca:b0:ab:e8a7:6137 with SMTP id v10-20020a056a2012ca00b000abe8a76137mr41977463pzg.3.1672321867287; Thu, 29 Dec 2022 05:51:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672321867; cv=none; d=google.com; s=arc-20160816; b=nhizmhM6uSAJ6Q7EyF7bSjGHqC9iD8NFWLsNOg111xF2LDPj1+5KwMzT+71XJx1z8y m7JbEKQpG5yVrs4UcLkOUvKn+zdxN5TNlIuVRd0Avr/numb9eoZRyiwLFMYlX51cQCMc Je3NzqHgPjkF6qYArheC8RQeg9cy14R89X+SnZUNgv6ADk30c4brCF1PZFjVYzvNrSs7 cFmTqQAtqQFnhLJ3qrkdo7GGyRBxbgZVONd1hq600Gl0yVOgSyhj3DypD26qtJ37cUMf zf2xnr4ozmEPpMiDibFgOTmv0cOBCzqK2XjIeq3+8YQifLFS59qw7D6l7/hkSh2eBxgp 3PaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=lvF0202SLOTzT8hbWZsF0xJL4uK7PlwT0Y7oJgXZa8M=; b=czMNKHTmz/HXujWUUD7MxPJRC43Hu6W73xy8jTHUZPHT5Z1pEs7fQVtumAPqZy9Ph7 TK7inltHxwRNZBD5W+8a2G9l2AGHuIzSg6Zvbo+9gJ3U+QhlrQMYsdE4OZ2H93bjBKb6 8e6rKtoFul2bIQQdp0S3Q1Rvfs+gQSslLnvACvhFaUAOeQTXYWDU5RG5QbHlT0rwLe9j LNb9wNDCQiTlgZ1g50MDayOfG6+ayPtJKRHhN13mhcoL8Ks1ILulXLl9X6s0syMnI1Zt jnmUQlV2DWv5aNZF7CiXi1+0IvGahR8bQxc0+4UMo8Ux2ha1ZEWv8SQLV9+Cxrvq713p yaCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=nLBnuo5M; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Jr7RZJ44; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n127-20020a634085000000b00479079b77a6si18999828pga.105.2022.12.29.05.50.46; Thu, 29 Dec 2022 05:51:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=nLBnuo5M; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Jr7RZJ44; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233575AbiL2Nkf (ORCPT + 99 others); Thu, 29 Dec 2022 08:40:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233578AbiL2NkI (ORCPT ); Thu, 29 Dec 2022 08:40:08 -0500 Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B73517073; Thu, 29 Dec 2022 05:37:37 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id D47B95818EC; Thu, 29 Dec 2022 08:36:54 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute6.internal (MEProxy); Thu, 29 Dec 2022 08:36:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1672321014; x=1672328214; bh=lvF0202SLO TzT8hbWZsF0xJL4uK7PlwT0Y7oJgXZa8M=; b=nLBnuo5MB8ib40z9s0xLWilN6X /WXV1Zqm3SxWb/ruB/kuFnhd7wdVmFZDNY+gYekuqiDs/3zSKTYpDCWeSGomp00d RPXAAm15lH7k/HckP7H41S1nTIssGFqnGEUCiAueXZhfqHbgvsgt2V/PjS5+24eK AZrmaFdvUCvnyYqeGiXNjFNJi0Nt+kY19b5QAViPegESXxc5lkw5/x38rzXBkE3E iMI/LuxJaJhu/PzxHG/w2bIL1OevR4DRQqXzZhgnnNrL6JlGZ2hfawrGtcjmfT5j 4NFrf2y4B2F4odzFC/4UEfyR9o8m6Tb2OX8h3xaP+cQbWCLPHyzz+PMCgWqQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1672321014; x=1672328214; bh=lvF0202SLOTzT8hbWZsF0xJL4uK7 PlwT0Y7oJgXZa8M=; b=Jr7RZJ443Rh8Qo+omI31KtzhJxzRr/gmnxzyHbaByHQ4 STqt+Vc4cv+k0j8Dn73jUOrcx91eQtuXMzjq9aHKcghW7M7CCsGYLd01CHiSCaAJ imgUtF7DvNdZzdYbFAKU118qzhWZ45FFNkuq01JO3G44O8dNsNM026hoPloISUUK uLAuPol2cYeE+H6rlz4SUHqOMhoDdaT6jlH1aTcg49YvTbDlhhD5kYpLI5s8bJxE VEdpvdUeBr2HOtE5jiNe1JbI9qe+BqGW8ENvyet3ESOPsDs6y7wveuue+TeGQ6OF 63+RmCQO5AYjeEdbwbZySMWQsDDFqh1CfW/rw6fbgQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrieeggdehgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdetrhhn ugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrghtth gvrhhnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedtkeet ffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrh hnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 640B9B60086; Thu, 29 Dec 2022 08:36:52 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1185-g841157300a-fm-20221208.002-g84115730 Mime-Version: 1.0 Message-Id: <1d88ba9f-5541-4b67-9cc8-a361eef36547@app.fastmail.com> In-Reply-To: <20221219154119.286760562@infradead.org> References: <20221219153525.632521981@infradead.org> <20221219154119.286760562@infradead.org> Date: Thu, 29 Dec 2022 14:36:32 +0100 From: "Arnd Bergmann" To: "Peter Zijlstra" , "Linus Torvalds" Cc: "Jonathan Corbet" , "Will Deacon" , "Boqun Feng" , "Mark Rutland" , "Catalin Marinas" , dennis@kernel.org, "Tejun Heo" , "Christoph Lameter" , hca@linux.ibm.com, gor@linux.ibm.com, "Alexander Gordeev" , borntraeger@linux.ibm.com, svens@linux.ibm.com, "Herbert Xu" , "David S . Miller" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , x86@kernel.org, "H. Peter Anvin" , joro@8bytes.org, suravee.suthikulpanit@amd.com, "Robin Murphy" , dwmw2@infradead.org, baolu.lu@linux.intel.com, "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, linux-crypto@vger.kernel.org, iommu@lists.linux.dev, Linux-Arch Subject: Re: [RFC][PATCH 07/12] percpu: Wire up cmpxchg128 Content-Type: text/plain X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, Dec 19, 2022, at 16:35, Peter Zijlstra wrote: > In order to replace cmpxchg_double() with the newly minted > cmpxchg128() family of functions, wire it up in this_cpu_cmpxchg(). > > Signed-off-by: Peter Zijlstra (Intel) Does this work on x86 chips without X86_FEATURE_CX16? As far as I can tell, the new percpu_cmpxchg128_op uses the cmpxchg16b instruction unconditionally without checking for the feature bit first, and is now used by this_cpu_cmpxchg() unconditionally as well. This is fine for the moment if the only user is mm/slub.c and that retains the system_has_cmpxchg128() runtime check, but I think a better interface would be to guarantee that this_cpu_cmpxchg() always ends up either in a working inline asm or the generic fallback but not an invalid opcode. For consistency, I would also suggest this_cpu_cmpxchg() to take the same argument types as cmpxchg(): at most 'unsigned long' sized, with additional this_cpu_cmpxchg64() and this_cpu_cmpxchg128() macros that take fixed-size arguments. I have an older patch set that additionally converts all 8-bit and 16-bit cmpxchg()/xchg() calls to cmpxchg_8()/ xchg_8()/cmpxchg_16()/xchg_16() and and leaves only the fixed-32bit and variable typed 'unsigned long' sized callers for the weakly typed variant. Arnd