Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5326401rwb; Tue, 1 Aug 2023 00:06:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlGFBnhT0Ufx1MbX3hIf45u6Bboa13E6GcdYAhPNxhXRD6YL14SRS8+p6JWURioN6shyBhMT X-Received: by 2002:a05:6a21:790a:b0:13d:ee19:7727 with SMTP id bg10-20020a056a21790a00b0013dee197727mr3894092pzc.18.1690873598636; Tue, 01 Aug 2023 00:06:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690873598; cv=none; d=google.com; s=arc-20160816; b=LNOjccNrcPXXetp5+zUt5hfc1gzlVPkL0Tz1wMgUwF2J8+J7J1G8OkB59JeaThzFeo /DiYBb/QBdTtYaWGF1lzhIBWMSbp8NyEtqsNl/wAUfIMluLcCu5hyJNySfNKuInlXy9v +VYyyYRRJk3TYUQ+hlIlhxJT8B2IiHLw0JV/65SuARIxCuuPFI0uXMsAyXtf6h/E02kD A8rzhuQy+SZsoJDdzLVAbjjL0KBU33MefvjcMB0cIXtRjkINbex2bGBW/pDH9yHneL/C wQsdLE61/oeL+MwZnKND8KkQyMOLsxanN5muLsdN8aMgrszU5VyF1wM/4JX+Osi2DeXc 8U/Q== 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:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=qkyMf1jROQESc+dKhHjjFPnh08dBcae/QUx9x+GbCtI=; fh=fHytkiDENrNppzLmiuI0oubsAVMKm0noq0l994U77Qo=; b=PGc2RuABiRUC0LPZTK34OAAsonVx/xrD9jADDNWoHEFARs4Qndn2a2BHF1ejLqoxyY W5RaXmETxUwTBrvsaxvu5nh3LnErG9rKwPD2OB6KJW+99VZvPQKhI4wp2MbKdef7+5Kl bykwwVWEmN4KpRuDTdy5yRUPzkuXZwbvsHOV8ACaTgUaCFFvlXZSBRqTMDTMNCKF5UqX KjGzBm5NhS7ONqwdYKIHtJ7A0NYMGzr0axYW5VeOg5WTaPBg5bILAv9e3FE4gknxENyX a7BERzYqBDGHfAACUBdko8LHS4IT0aZZrl+C5HqtlmN9/BXnaIKtvGy/tIabziKjd+1v EwFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b="XAaP+/+U"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=V8jBjh1H; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h9-20020a170902680900b001badbe8e441si8423195plk.106.2023.08.01.00.06.26; Tue, 01 Aug 2023 00:06:38 -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=@arndb.de header.s=fm2 header.b="XAaP+/+U"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=V8jBjh1H; 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 S230166AbjHAGDJ (ORCPT + 99 others); Tue, 1 Aug 2023 02:03:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229698AbjHAGDH (ORCPT ); Tue, 1 Aug 2023 02:03:07 -0400 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86528127; Mon, 31 Jul 2023 23:03:05 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 775BF3200904; Tue, 1 Aug 2023 02:03:03 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute6.internal (MEProxy); Tue, 01 Aug 2023 02:03:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1690869782; x=1690956182; bh=qk yMf1jROQESc+dKhHjjFPnh08dBcae/QUx9x+GbCtI=; b=XAaP+/+UOTnwvVemks YopMYaMcMUz0s+743h6XRCTAg2WKOijp29Zjj1ombpCZS+VMsL/qqBEmiUPz/qpA ZIp5w4IeU4KKI0hzCExJW5ycpG4u6w5jrjiPCcFNQib/TBeHIOOEKekZYElsdKHa nym0UgIN/QbDR8yXjVyt5EsfgXyoV80wTGbOO56BIhBLmNYu+X6EJiwwXhehGm9l icdLq9ZoN9ZMmbKEd7smNtbj6enzC7nGJ+ReduVHIUrxUYoy4zczCxOVXYe/CYv0 3V7RPMAzPqShh0g4GPkA+WB1+1CT2k3qd+2/jvfVtGh1YpIRNwi19QYgmIkiHHGS /geA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1690869782; x=1690956182; bh=qkyMf1jROQESc +dKhHjjFPnh08dBcae/QUx9x+GbCtI=; b=V8jBjh1HxL7d/irNHDlnPPAOnn6gQ MnBvXgkw8Kcsf1Ltw7zPbvfQEvDmi3MDuBRbd6yRrihNN27JsQiQmndqVrk0KnEe 9QjBQvMytcV5UaWbAdRKPxW5njka3m4UO2GNnIDZQ2CqWGPfAeKnKoscDashq3WX hfkeptDhapzV5twxlCT24zS7/OmFfXu9dUZ0E3cZM7Xvp1P1Dn+nnZZDUUC/P26G 1H+yRk3EgoF+Kp4ky9CyjAgCWz38M7a2+Ojjy4mUP1oXqN6ES1boPJJYdz0FkANM lcea4fXYdTo0p1MdB64OvRuyj4yb502ox+17D7EnRMCVDIcV4eJLJGSdQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrjeehgddutdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id A0937B60089; Tue, 1 Aug 2023 02:03:01 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-592-ga9d4a09b4b-fm-defalarms-20230725.001-ga9d4a09b Mime-Version: 1.0 Message-Id: <2d9c843f-e884-47d3-a825-6402db0a2cb8@app.fastmail.com> In-Reply-To: <87y1ivln1v.ffs@tglx> References: <20230721102237.268073801@infradead.org> <20230721105743.819362688@infradead.org> <87edkonjrk.ffs@tglx> <87mszcm0zw.ffs@tglx> <20230731192012.GA11704@hirez.programming.kicks-ass.net> <87a5vbn5r0.ffs@tglx> <20230731213341.GB51835@hirez.programming.kicks-ass.net> <87y1ivln1v.ffs@tglx> Date: Tue, 01 Aug 2023 08:02:21 +0200 From: "Arnd Bergmann" To: "Thomas Gleixner" , "Peter Zijlstra" Cc: "Jens Axboe" , linux-kernel@vger.kernel.org, "Ingo Molnar" , "Darren Hart" , dave@stgolabs.net, andrealmeid@igalia.com, "Andrew Morton" , urezki@gmail.com, "Christoph Hellwig" , "Lorenzo Stoakes" , linux-api@vger.kernel.org, linux-mm@kvack.org, Linux-Arch , malteskarupke@web.de Subject: Re: [PATCH v1 02/14] futex: Extend the FUTEX2 flags Content-Type: text/plain X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Tue, Aug 1, 2023, at 00:43, Thomas Gleixner wrote: > On Mon, Jul 31 2023 at 23:33, Peter Zijlstra wrote: >> On Mon, Jul 31, 2023 at 11:14:11PM +0200, Thomas Gleixner wrote: >>> --- a/include/uapi/linux/futex.h >>> +++ b/include/uapi/linux/futex.h >>> @@ -74,7 +74,12 @@ >>> struct futex_waitv { >>> __u64 val; >>> __u64 uaddr; >>> - __u32 flags; >>> + union { >>> + __u32 flags; >>> + __u32 size : 2, >>> + : 5, >>> + private : 1; >>> + }; >>> __u32 __reserved; >>> }; >> >> Durr, I'm not sure I remember if that does the right thing across >> architectures -- might just work. But I'm fairly sure this isn't the >> only case of a field in a flags thing in our APIs. Although obviously >> I can't find another case in a hurry :/ > > I know, but that doesn't make these things more readable and neither an > argument against doing it for futex2 :) ... > > Still that explicit bitfield does neither need comments nor does it > leave room for interpretation. It may be clear to the compiler, but without comments or looking up psABI documentation I certainly wouldn't know immediately which bits of the flags word overlay the bitfields for a given combination of __BIG_ENDIAN/__LITTLE_ENDIAN and __BIG_ENDIAN_BITFIELD/__LITTLE_ENDIAN_BITFIELD or architectures with unusual struct alignment requirements (m68k or arm-oabi). I'd prefer to completely avoid the bitfield here. Maybe having exclusive flags for each width would be less confusing, at the cost of needing two more flag bits and a slightly more complicated sanity check, or we could take an extra byte out of the __reserved field to store the length. Arnd