From patchwork Mon May 15 07:56:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 9333 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6754769vqo; Mon, 15 May 2023 01:22:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ72tIsJ5sBET1RVPYEjwoZuYdWR0s8KeLrkkPsFjM+aaYWN2gMk8AM42KVvDg6DJtJ1OADQ X-Received: by 2002:a05:6a20:7f83:b0:100:5ddc:c6a1 with SMTP id d3-20020a056a207f8300b001005ddcc6a1mr32427279pzj.15.1684138946885; Mon, 15 May 2023 01:22:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684138946; cv=none; d=google.com; s=arc-20160816; b=PlAdwSKIYy80DZi1QWwlRN0fkgKPZocIKujHcM7VUH8BYQW/wBrQb+lQVjyzEHFD4Y Y89sAcvaZoSvuSL1sQgIkN59OoWSSeVBowoYnekzVqKUrERWaTrPT5Bleuh6Sged0nVN Cehav7P73itydynuz/WiR+Vu7+uh+Zzvpk1+1nfcoaJj34/UhC+QswdHKUnDPQ6h3wyV QK20HBKQNAfrzPWQIFcJHotSDnz61OXpTMIkEERJKDM9flOodUmab3hKIJl9ik5H5oK1 XyFa1cz+Zx/FPO/Ukkyay9QRVHn59C6AMiHySpYGgGwbTBeyI6S0j6Q5uQnahBJeWGfE 5Cgw== 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:user-agent:message-id :dkim-signature; bh=oaAnHSQUa44CIjEzLECo4Bz9k0HVG1DLxoBT0I79NeI=; b=akMR1HbZ6nCUUn//ukIJIUTI7/maKINpjqamr3xjelJxQWZX3GkK3kKWQGSU2fJPSD 7FG3qwEZlaHaAySOLwx90dAJtpuJd8Np8YwpJt5f0PnbGKtWHV6ezCY9yM1VBsnUVEvP zPNOGgEBieELRVrwZtmNroYmbubQjgjFkLVATPhAdDJAlFY/3EnOdevGiqq4++h6esJu envcOwfbiDknjTGDbMjFBiOn43dKU/RD3tqTd8qsKMCvn3w4jvVdtbeLA+k3GDJdbmfe 0SeW5O7wxx0SZy5cTB7iqTcLx9VPUdpEW/5J/Ewg8OMNPNrFZs2qb83RwaRTNNmA7ibp +n+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=NfkvPcdW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w63-20020a638242000000b00521075bf591si15780131pgd.534.2023.05.15.01.22.13; Mon, 15 May 2023 01:22:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@infradead.org header.s=casper.20170209 header.b=NfkvPcdW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239146AbjEOIHw (ORCPT + 99 others); Mon, 15 May 2023 04:07:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238458AbjEOIHa (ORCPT ); Mon, 15 May 2023 04:07:30 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE7DF1736; Mon, 15 May 2023 01:07:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Subject:Cc:To:From:Date:Message-ID: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To:References; bh=oaAnHSQUa44CIjEzLECo4Bz9k0HVG1DLxoBT0I79NeI=; b=NfkvPcdWsJTjmoEQrA9fvkbzZc OLWjr4UU1kWvWf66uviIN6aqUIZ1bU0a8aEQPzT/ji1FUTxQToxV1V2kLh8dentwTx5nRMQ4vbB0i gIPkqOaBfpPHRlc4Q9v4DKGIZOs5zR693IMyllbhfUlUJPHFrv0sH5wUWWcgPRBAKgBI1lgDssb4e 9PWNLgpBVKQLGKCOHMSvDJkLwwQ85cxYADGoR5hXnOpJdsJmtsyLLYpk0hwzrXnE5x14WXOtUXAW9 mjJQ2i0rMf3kX9KquBpjBy/2GJyEk+TX/LIQwUBEiDSc3Rf/hALuWs5q5Nr/iPhIXqgtRSb4GdE7Z shGEbmvA==; 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 1pyTDk-003HUQ-Em; Mon, 15 May 2023 08:06:17 +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) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 079C030003A; Mon, 15 May 2023 10:06:10 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id A6A6E202F7F66; Mon, 15 May 2023 10:06:10 +0200 (CEST) Message-ID: <20230515075659.118447996@infradead.org> User-Agent: quilt/0.66 Date: Mon, 15 May 2023 09:56:59 +0200 From: Peter Zijlstra To: torvalds@linux-foundation.org Cc: corbet@lwn.net, will@kernel.org, peterz@infradead.org, boqun.feng@gmail.com, mark.rutland@arm.com, catalin.marinas@arm.com, dennis@kernel.org, tj@kernel.org, cl@linux.com, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, joro@8bytes.org, suravee.suthikulpanit@amd.com, robin.murphy@arm.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, Arnd Bergmann , Herbert Xu , davem@davemloft.net, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, Andrew Morton , vbabka@suse.cz, roman.gushchin@linux.dev, 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@vger.kernel.org, linux-crypto@vger.kernel.org Subject: [PATCH v3 00/11] Introduce cmpxchg128() -- aka. the demise of cmpxchg_double() X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765947680242897677?= X-GMAIL-MSGID: =?utf-8?q?1765947680242897677?= Hi! I seem to have forgotten to post this series last release; so here goes. I'm really hoping to merge it and forget about it. Since Linus hated on cmpxchg_double(), a few patches to get rid of it, as proposed here: https://lkml.kernel.org/r/Y2U3WdU61FvYlpUh@hirez.programming.kicks-ass.net These patches are based on 6.4.0-rc2. Available here: git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git core/wip-u128 Since v2: - reworked this_cpu_cmpxchg() to not implicity do u128 but provide explicit this_cpu_cmpxchg128() (arnd) - added try_cmpxchg12_local() (per the addition of the try_cmpxchg*_local() family of functions) - slight cleanup of the SLUB conversion (due to rebase and having to touch it) - added a 'cleanup' patch for SLUB, since I was staring at that anyway Since v1: - rebaed on Eric's ghash cleanups (hence the cryptodev-2.6 dependency) - rebased on Heiko's s390/cpum_sf CDSG patch - fixed up a bunch of arch code - fixed up the inline asm to use 'u128 *' mem argument so the compiler knows how wide the modification is. - reworked the percpu thing to use union based type-punning instead of _Generic() based casts. Reviewed-by: Arnd Bergmann --- Documentation/core-api/this_cpu_ops.rst | 2 - arch/arm64/include/asm/atomic_ll_sc.h | 56 ++++---- arch/arm64/include/asm/atomic_lse.h | 39 +++--- arch/arm64/include/asm/cmpxchg.h | 48 ++----- arch/arm64/include/asm/percpu.h | 30 +++-- arch/s390/include/asm/cmpxchg.h | 32 +---- arch/s390/include/asm/cpu_mf.h | 2 +- arch/s390/include/asm/percpu.h | 34 +++-- arch/s390/kernel/perf_cpum_sf.c | 16 +-- arch/x86/include/asm/cmpxchg.h | 25 ---- arch/x86/include/asm/cmpxchg_32.h | 2 +- arch/x86/include/asm/cmpxchg_64.h | 63 ++++++++- arch/x86/include/asm/percpu.h | 100 +++++++++------ drivers/iommu/amd/amd_iommu_types.h | 9 +- drivers/iommu/amd/iommu.c | 10 +- drivers/iommu/intel/irq_remapping.c | 8 +- include/asm-generic/percpu.h | 66 ++-------- include/crypto/b128ops.h | 14 +- include/linux/atomic/atomic-arch-fallback.h | 95 +++++++++++++- include/linux/atomic/atomic-instrumented.h | 93 ++++++++++++-- include/linux/dmar.h | 125 +++++++++--------- include/linux/percpu-defs.h | 38 ------ include/linux/slub_def.h | 12 +- include/linux/types.h | 5 + include/uapi/linux/types.h | 4 + lib/crypto/curve25519-hacl64.c | 2 - lib/crypto/poly1305-donna64.c | 2 - mm/slab.h | 49 ++++++- mm/slub.c | 191 ++++++++++++++-------------- scripts/atomic/gen-atomic-fallback.sh | 4 +- scripts/atomic/gen-atomic-instrumented.sh | 19 +-- 31 files changed, 667 insertions(+), 528 deletions(-)