Message ID | 20221219154119.087799661@infradead.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2462922wrn; Mon, 19 Dec 2022 07:46:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf6NFxkQvP/g2qosob9ev7nGQjpaBlSd5RBusIdIsbj9b2UHr7hTG0mYQsSgxacayxVN9kBL X-Received: by 2002:a62:870d:0:b0:576:f02e:d0ef with SMTP id i13-20020a62870d000000b00576f02ed0efmr45103783pfe.4.1671464789738; Mon, 19 Dec 2022 07:46:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671464789; cv=none; d=google.com; s=arc-20160816; b=czmRsny9cEW9wJFc7RJq1FuC/KYiE7svZcrM2oLLebYNhiMTXIcr510VJGb651NCwd hwvls8+nzWAP9gG6cONWsn7ahYYh652OuAgEg/s6K9CEMb7P/CvZ6ccF/0o6+m8AgXEw m7Qg5CWwPvuvy7VBHoyssuB1WMZ9esvewTVyjPJyAo1KWa4UgwQhUfWkWT8rdeValTWC 3j+3lVfXsqRSxZ0iVztXCrbihSvwojR0jpvVTuYHg8z5AP0qhlA71L458TKVYa/0Co8q Vn9yJItZG4btt/dSBeeU3IarCUDAUZCeT1tpNFY1tQ0LjK5q4+w4VkymyhIEMqYm0pTn d0/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=LatshXnMYCOGTRlakBz337bCR5sPE/9cJhDhXQqvVDY=; b=idq/0PEU5Z2xBWz+WJBjG12XRQoy/qbHpjwaP8YW5gUB2RScLNusRPgfp8hla+Nz9q fU+lZ6MoR/Sq7MOc+iGguh1JnphHV6sLspcroNl3mzfAWy3/PpWmCf2mxJjf/CF92aMa T7wvYRkxUvBasUo4NHIekK+CMNQtcvQ+OS7FcIj2nm6JJec5rLkANTdNFQvaFYQCGNhI jWCsus1bSipSG10pUvrtuJ1kfCUdgz6IfMZPCduIM45duvFIPdjoe2BLNCvXh6OnUGcB A+N14XZdz3hiLf1DHzYea+OSeJ80+IVrLMY1mbUf0FF8RQI/gBpUxK0QSnTUKLpKEQBD 88WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Aw3O8XqI; 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 i10-20020aa78d8a000000b0056c37608f45si9841072pfr.348.2022.12.19.07.46.14; Mon, 19 Dec 2022 07:46:29 -0800 (PST) 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=Aw3O8XqI; 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 S232684AbiLSPqB (ORCPT <rfc822;abdi.embedded@gmail.com> + 99 others); Mon, 19 Dec 2022 10:46:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232556AbiLSPpa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 19 Dec 2022 10:45:30 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04A7813D53; Mon, 19 Dec 2022 07:44:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=LatshXnMYCOGTRlakBz337bCR5sPE/9cJhDhXQqvVDY=; b=Aw3O8XqIY/S7IlsVQ/vztRWMgZ 9MZkonC3mns2/7yAkQNiwPXzwmfBls4vaouAPRXYWbYwoAstiZ4ypUsECL7omaUYUtnI+EZ6P2V3q y/xcU1yy7FDkewopYOQj1Nhj8XcQ428K57j1QJkMCYDX1H0YnXT/ueX2JiIkaqg3dGA8DpE+uDHuZ XbkHNHNiVQLGrU4dprOjpr2trbXxO1lIDg6Cer+yAbg1xvT5Wewrt05BD6+u3Lj5CFMlGQOOT7hNz 97N20DbnzOeiDbQdYLEw7Y4vbsRRe+9WwBIoqo4YmUd5wlZH4B2ZRAk6v1VeIfq+JnxA7jHGols8G ZrKZ2grg==; 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 1p7IIS-000qwd-Of; Mon, 19 Dec 2022 15:43:21 +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 9DABD300422; Mon, 19 Dec 2022 16:43:06 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 7217320A25F3F; Mon, 19 Dec 2022 16:43:06 +0100 (CET) Message-ID: <20221219154119.087799661@infradead.org> User-Agent: quilt/0.66 Date: Mon, 19 Dec 2022 16:35:29 +0100 From: Peter Zijlstra <peterz@infradead.org> 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, Herbert Xu <herbert@gondor.apana.org.au>, davem@davemloft.net, 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 <arnd@arndb.de>, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, Andrew Morton <akpm@linux-foundation.org>, 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, linux-crypto@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org Subject: [RFC][PATCH 04/12] types: Introduce [us]128 References: <20221219153525.632521981@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752657863525570135?= X-GMAIL-MSGID: =?utf-8?q?1752657863525570135?= |
Series |
Introduce cmpxchg128() -- aka. the demise of cmpxchg_double()
|
|
Commit Message
Peter Zijlstra
Dec. 19, 2022, 3:35 p.m. UTC
Introduce [us]128 (when available). Unlike [us]64, ensure they are
always naturally aligned.
This also enables 128bit wide atomics (which require natural
alignment) such as cmpxchg128().
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
include/linux/types.h | 5 +++++
include/uapi/linux/types.h | 4 ++++
2 files changed, 9 insertions(+)
Comments
Hi! > Introduce [us]128 (when available). Unlike [us]64, ensure they are > always naturally aligned. > > This also enables 128bit wide atomics (which require natural > alignment) such as cmpxchg128(). > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> > --- > include/linux/types.h | 5 +++++ > include/uapi/linux/types.h | 4 ++++ > 2 files changed, 9 insertions(+) > > --- a/include/linux/types.h > +++ b/include/linux/types.h > @@ -10,6 +10,11 @@ > #define DECLARE_BITMAP(name,bits) \ > unsigned long name[BITS_TO_LONGS(bits)] > > +#ifdef __SIZEOF_INT128__ > +typedef __s128 s128; > +typedef __u128 u128; > +#endif Should this come as a note here? > Introduce [us]128 (when available). Unlike [us]64, ensure they are > always naturally aligned. BR, Pavel
--- a/include/linux/types.h +++ b/include/linux/types.h @@ -10,6 +10,11 @@ #define DECLARE_BITMAP(name,bits) \ unsigned long name[BITS_TO_LONGS(bits)] +#ifdef __SIZEOF_INT128__ +typedef __s128 s128; +typedef __u128 u128; +#endif + typedef u32 __kernel_dev_t; typedef __kernel_fd_set fd_set; --- a/include/uapi/linux/types.h +++ b/include/uapi/linux/types.h @@ -13,6 +13,10 @@ #include <linux/posix_types.h> +#ifdef __SIZEOF_INT128__ +typedef __signed__ __int128 __s128 __attribute__((aligned(16))); +typedef unsigned __int128 __u128 __attribute__((aligned(16))); +#endif /* * Below are truly Linux-specific types that should never collide with