From patchwork Mon May 15 07:57:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 13240933 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 5B8D3C7EE26 for ; Mon, 15 May 2023 08:06:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 39877900004; Mon, 15 May 2023 04:06:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F934280001; Mon, 15 May 2023 04:06:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8642900005; Mon, 15 May 2023 04:06:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8C9A0900006 for ; Mon, 15 May 2023 04:06:52 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2ACBCA13C9 for ; Mon, 15 May 2023 08:06:52 +0000 (UTC) X-FDA: 80791758264.17.5BB6446 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf28.hostedemail.com (Postfix) with ESMTP id 42C18C0008 for ; Mon, 15 May 2023 08:06:50 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=J+RYi2Ol; spf=none (imf28.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684138010; 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: references:references:dkim-signature; bh=axnHoGjIL7t9C+QVLq6pAPgEZLVVerXkwPR51K17BxQ=; b=5lo2uJ5N7D3DKFNHuA5AuqFKMWGvAlCJcsCtgS+yZ1+wZB/k5+XUasxTIULROMxd5YNRMI TmQv4+bKLzolXPLejUmGRISMgYgxKdw8+SrThrE+oCx4hlnmBJiyaTZxrIyrJ+8y0Gb2ed 0joBPP+6Exjjy+o4+4SX+GGqC23ll+A= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684138010; a=rsa-sha256; cv=none; b=b05M+QPCdhbftYlQjj0zXQd20pb9ggXhAe0hGQvY67GlxZAENSrhBYTH/MkbgP8IP5P/5t i11HLjblRgQcjjD+iYcTjrbqtOzUicodcfxxJBmsblHsLN0lSvKfprJyDEY+ORvkhX+Th6 hwgW+8PR5l2J3byDzLqsOt9SO11k1dg= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=J+RYi2Ol; spf=none (imf28.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=axnHoGjIL7t9C+QVLq6pAPgEZLVVerXkwPR51K17BxQ=; b=J+RYi2Olcu/GDwkb7uyoMxOowZ gdnnCNimNXMzjHfiHbHeyq75lJdwzqja8okQUmitQ1ua7iWanYtjpUVa32iVsf63pmox4vvEN+Ejz 1wpagut3YpzUSwNPpwpsl3jsBlJSSesN7UlPVAxsCXGiTi2d8aMeHHRkqQGQKv/P2cwZEs4JCNCfS xBlhWHGUBVitTRjLQwLm3qFy1fFLZshzr1Jf7x5B4z/zbEO4fjLkYFu6HtcQ+JbhA2M4mY6B7vLd7 0ZMD0sEUiA88G6VeDUxFw1EIBsMuAOuqnZrusc8ZVstoP2bAOXDwpltv/Y/kKX6d4HXBKVWWAlia0 mx0Oe8lw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pyTDk-00BQMz-1T; Mon, 15 May 2023 08:06:16 +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 09F29300244; Mon, 15 May 2023 10:06:10 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id AEDEA202FCE90; Mon, 15 May 2023 10:06:10 +0200 (CEST) Message-ID: <20230515080554.047618712@infradead.org> User-Agent: quilt/0.66 Date: Mon, 15 May 2023 09:57:01 +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 02/11] types: Introduce [us]128 References: <20230515075659.118447996@infradead.org> MIME-Version: 1.0 X-Stat-Signature: ma9tqenazed8ogz7eg5fgpyppin1sfou X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 42C18C0008 X-Rspam-User: X-HE-Tag: 1684138009-101608 X-HE-Meta: U2FsdGVkX1812PP9pKAmoxmypcXjipw+Lr1OgRx5HsRliCGhuBNCkhx1HOTSCF2I7ry5txvf+swoc3yZd9qCPCNKG4r76ryGBuI6AARkMivZWPVHSPgFyPCFIsA0DrcZc27R4P+gwI7Ab8YfrKVaBUohtlidPnQ9sbhqtKkv0Dk8IETHiQCr9RJkFa4L9UkSRc36D0rdBwAaMv/5OJMQB+AS7Y/+rTIG4sl5ldeZHwksI3+sjzxVH/rXVdbBsrPeN+vrVQcX1LkfVx+tturxMEAcIKXIZKnMrFE2mpFXN7etVcfdWL5Pg5a+M9DzgVz0qIKeVfrqSNVF9NBGiXUaJaSU2xquq7YM1tROaG6NbPOOlDVsIJGtdaIou9R/ShAVc0l3hPetIAuEkY5MbnG4h5bBp8S2bVr//0wldBPNan5ITc7YSTJ2NGtrC/bWnctumafwzai6XsFxrOMgXq0mt+QQ7HDRWXR/h/uSiDonsfKmw9MWJAuMgtG2GUWF0DrEBiiwquuFGFuwakjV/gOCn099CcTVYCnpqCmR5uTMcRvT56onB1XlTJ82Y3olLWPTN4KKxwqxRPoLXANPVhhtyBmCphlDP7uSGx9bO4Y1dlRC6TaAN/OrlIDRz6Rm0Xs/9Rste5Gclf5iUfQrYkbQWDVOd2QPGXbRfBMQcZr+euzQWu0qJgdfT5qGraNTThkKtZ8bATSnPW/LVsD4/KFH0x39vV9Vs2VD8k7NKz8fGwIH5VlckxHwFX+usfpk9Srh5VuVWdombQ5YPKhUvlo8s6IpJQDRdvdwPGCVrW3MGcdo4kMVyiwniHGC0/vqqJtxDuR6nHHeU9G0xZlnU9tyZ6qyAp4h3uhpUtj1ATiZ2v13NkMczPlKbNK5jTjHFKE/KQrJ8jFAff80KN+ei+weNnC5q/+CDBmYcR18yaf4dwiAIOe3Nh1Stf7DQGvIYINgYwPx1z9kaRpDiRwZ/Ys 7RIXQR7j zJpxMRAJIySC7cXELZzHnES/7OH4H5/XS6RxPsji7lbsLFF4bNxF0aXkUsL3QoMYq6na9z75+ZQa2UhAEBO9YRwJW7zTjqN+I0oJfiJTPEzmw69I+uo8wXDRdR0q2qB4OZoLcnQWpUFwQ5x5sQQrQVOI1OPLyp77El43Ok9DesbBQhzfmGKgskWOvhTNoH7GaIUM+5zi6hJ2W++QWR9btMrmj1gdZ3R6BrKiTbL8K+ulDn+0/ZLvR8sCXDgzwDISUch07tQPaPpC4oshFwoJ8fS+1SWozjV3+Q2F+h0l4wDLY9i/N1YfMRiZR/sOMLEcAiCrFd1ScIX4KPUl1nLjOB0pLbfSWr/IEEiMOWYvzee5oawkOXezQqHjCWHAM1/tqIup79qIewS7T/JjxJXqeqsZVUg== 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: 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) Acked-by: Herbert Xu --- 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 + 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 +#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 --- a/lib/crypto/curve25519-hacl64.c +++ b/lib/crypto/curve25519-hacl64.c @@ -14,8 +14,6 @@ #include #include -typedef __uint128_t u128; - static __always_inline u64 u64_eq_mask(u64 a, u64 b) { u64 x = a ^ b; --- a/lib/crypto/poly1305-donna64.c +++ b/lib/crypto/poly1305-donna64.c @@ -10,8 +10,6 @@ #include #include -typedef __uint128_t u128; - void poly1305_core_setkey(struct poly1305_core_key *key, const u8 raw_key[POLY1305_BLOCK_SIZE]) {