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 1ABFCC433FE for ; Sat, 5 Nov 2022 13:29:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0173E6B0071; Sat, 5 Nov 2022 09:29:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EE22E6B0073; Sat, 5 Nov 2022 09:29:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D83BF6B0074; Sat, 5 Nov 2022 09:29:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C2EA36B0071 for ; Sat, 5 Nov 2022 09:29:56 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 864124171E for ; Sat, 5 Nov 2022 13:29:56 +0000 (UTC) X-FDA: 80099471592.19.9905F47 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf03.hostedemail.com (Postfix) with ESMTP id E3C3D20003 for ; Sat, 5 Nov 2022 13:29:55 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 074316090C; Sat, 5 Nov 2022 13:29:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51B8FC433D6; Sat, 5 Nov 2022 13:29:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1667654991; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=R8ndFeWwtbidwmu8ZqWvQNw9vpteG/tvbT1CnALU5sI=; b=hjcmsaqxZPJdNb/SShsGMITrrANeiPj7TEDeov/h5qjjSx35qyF/bbDL+rKwFHLBcZXap/ x5QfUFasXInh1eguji7rbPDV99dvXawiiWB9WQp3JE4dXklrhu+cF23SckzuMZZi6yuzPm RAabW9uqEENLVS2JPtg0zCTbsamtm7E= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 091ecb54 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 5 Nov 2022 13:29:50 +0000 (UTC) Date: Sat, 5 Nov 2022 14:29:47 +0100 From: "Jason A. Donenfeld" To: Linus Torvalds Cc: Peter Zijlstra , Nathan Chancellor , Uros Bizjak , x86@kernel.org, willy@infradead.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, aarcange@redhat.com, kirill.shutemov@linux.intel.com, jroedel@suse.de Subject: Re: [PATCH 11/13] x86_64: Remove pointless set_64bit() usage Message-ID: References: <20221022111403.531902164@infradead.org> <20221022114425.168036718@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667654996; a=rsa-sha256; cv=none; b=N8gEa5FsLSWi9ukNl2dzW69D/WVoiocoMpyE8w4WC9LOQv2C5pfsgfZJBF0A6dBt4dXKKy hrG7Nnqb0oSEYbyHH9DJsx7c/uE+z7IEuAC/2SsjOzuEIDUFOrWJYESqCJ3tV4q4ZXp3Pd GgWDX1IxiNe+9mZXW23QO79m5EEds9s= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b=hjcmsaqx; dmarc=pass (policy=quarantine) header.from=zx2c4.com; spf=pass (imf03.hostedemail.com: domain of "SRS0=HBtZ=3F=zx2c4.com=Jason@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=HBtZ=3F=zx2c4.com=Jason@kernel.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667654996; 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=R8ndFeWwtbidwmu8ZqWvQNw9vpteG/tvbT1CnALU5sI=; b=ONjJmAos83MqJSjrG8BjfUtHxtvjegXrs16HuGg2CF+CZWmLyvz7DrvKWVvMlfSi5iwds6 3vzbECRw/XJGiC0SfE54sike+U0wwWpP0AURQpiiFb8Xar1sYU5+kppOIzPPG++kWZpTn+ KC046r0EzL0klRN42yQlLcLF7iZUk8s= X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: E3C3D20003 X-Rspam-User: Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=zx2c4.com header.s=20210105 header.b=hjcmsaqx; dmarc=pass (policy=quarantine) header.from=zx2c4.com; spf=pass (imf03.hostedemail.com: domain of "SRS0=HBtZ=3F=zx2c4.com=Jason@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=HBtZ=3F=zx2c4.com=Jason@kernel.org" X-Stat-Signature: cz616gswf3mr9icdzxi9f5bnte5hi87e X-HE-Tag: 1667654995-699241 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 Fri, Nov 04, 2022 at 10:15:08AM -0700, Linus Torvalds wrote: > On Fri, Nov 4, 2022 at 9:01 AM Peter Zijlstra wrote: > > > > So cmpxchg_double() does a cmpxchg on a double long value and is > > currently supported by: i386, x86_64, arm64 and s390. > > > > On all those, except i386, two longs are u128. > > > > So how about we introduce u128 and cmpxchg128 -- then it directly > > mirrors the u64 and cmpxchg64 usage we already have. It then also > > naturally imposses the alignment thing. > > Ack, except that we might have some "u128" users that do *not* > necessarily want any alignment thing. > > But maybe we could at least start with an u128 type that is marked as > being fully aligned, and if some other user comes in down the line > that wants relaxed alignment we can call it "u128_unaligned" or > something. Hm, sounds maybe not so nice for another use case: arithmetic code that makes use of u128 for efficient computations, but otherwise has no particular alignment requirements. For example, `typedef __uint128_t u128;` in: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/crypto/poly1305-donna64.c https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/crypto/curve25519-hacl64.c I always thought it'd be nice to see that typedef alongside the others in the shared kernel headers, but figured the requirement for 64-bit and libgcc for some operations on some architectures made it a bit less general purpose, so I never proposed it. Jason