Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp2419255rwl; Sat, 5 Nov 2022 06:37:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7g1itNmYae911Ei+/2TvM3TqZwE2D+N+rmUwEec0SJqdKx4ScpYhfNTWmZYDRSKXKmBKGq X-Received: by 2002:a17:902:988e:b0:186:907a:a029 with SMTP id s14-20020a170902988e00b00186907aa029mr41511096plp.97.1667655463296; Sat, 05 Nov 2022 06:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667655463; cv=none; d=google.com; s=arc-20160816; b=em2hewQy/oQJc+WJTsaAv6BsYXhk4e8K9cz+y8e6PDvNK7xQib356y19U5QxV6b7Up adrivJBtRSK5svFOnnInPNdjWWw9SwhzW8dZpG1RNdWbjIsUo7qtcQKpXVRUCx1ryiSh BtjmTJ74n6bC7M9Ah7Wnu8dubvpC35pDK6io4MnKKFSjHeD7CHvktlNV3zHs2aSgvhgj gbAiGfkUL3eLpMzuGTpfyhNphGQDtRWTNHzfdoO8ikBFenHQO+JUvvc3eVo7gmAq/F7l b2LBAgjIOAryf79N1b7CFfRBJjuFzNBzwE8f5/4MUHm8Vc1YMcz2/f6JCOtJ10lxPOax qHkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=R8ndFeWwtbidwmu8ZqWvQNw9vpteG/tvbT1CnALU5sI=; b=s4YzSI7xpjiEChlpj1ZIDLiYJLQYY78zEGngLlS/zwMzRNUpT6U+VPYrlylkXbS3uS p7fFlsBZiUdf1A9tbZuYscQUkwWPBCVBjjDMr5WSsIb2OcIWI9ZlzNnAVRPTCmNZ57Qn Yq/7Qw2pxu2bKbLces8aYKgLUhJxr/riUAnRTLWt4Nm/+mwimFyyvsBPbj3ioPNNbuxy tbdjXrjzbRZ5/U4VuBCsO5Q7VuvmEoTFE1D90mW4eboqQyFrpk/xKroyNL8c5Imv9+Dx Lz+FJlFumXdOsl/Fk5/vOXgb5f/4z9xWm2DfiXQgZF3rJAYhSyVNYuOSl2RLKMvk/k7X GUYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=hjcmsaqx; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 33-20020a630e61000000b004610dceef13si3516001pgo.336.2022.11.05.06.37.31; Sat, 05 Nov 2022 06:37:43 -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=@zx2c4.com header.s=20210105 header.b=hjcmsaqx; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229581AbiKEN37 (ORCPT + 96 others); Sat, 5 Nov 2022 09:29:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbiKEN36 (ORCPT ); Sat, 5 Nov 2022 09:29:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C537DFFF for ; Sat, 5 Nov 2022 06:29:57 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id CDBA8B82D6B for ; 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) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="hjcmsaqx" 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: X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,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-kernel@vger.kernel.org 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