Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5018578rwb; Mon, 31 Jul 2023 16:53:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlEoosQwhbXs6bmf+BuSct4RT8fhlhFZagckj04y8ywaxapVhVjgyw6YhM18Tkhd6SRvrpoq X-Received: by 2002:a17:902:eb4d:b0:1bc:98c:b1c5 with SMTP id i13-20020a170902eb4d00b001bc098cb1c5mr4666662pli.35.1690847611692; Mon, 31 Jul 2023 16:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690847611; cv=none; d=google.com; s=arc-20160816; b=uJPmgm9AJepJQlw8IXWdnO3zUvkzSA2cUVnCSIi7A94aCcZdDVmXyicgj5IekCsN+7 zcoCXjYkwhzNHKpiHG/aJsTQpxojTtKuTk1PuGl6qQHP9RWBDxD6vjSZEj6X08zEv4Qb KTpwd91XDDXihIbS0tzS6/FVuLZ/usWyfOpFqRcJNUVryEyadU84IkYxDqf4rxwN9tbW O5qJPexPpdYgIQR7VD1S9ey7nCx6fhl2f6nfQONw6MslXExYK2os5Ir6UyGCn9M0EvH8 kwIEyXMKSAT473vQXrDLd+q27pf2CEzEdbVan984ojXhS+TaE+oHWXUBXZEK+HlnCWLe /f+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=33Fq0Wu+LfDasDHlhoRJ+tEuyTqh8mt568Pu/UPLqZ0=; fh=zGDN1CZMxX1GwOGZrU/RxkVv6QR1VFEr4KRxlp0xNd0=; b=kPPkAaROULHP04puiUX/huns3Rgkqsvx4RHHnihCJoIGHQJfWkfBHHpocxHzbWkJFD cPlUihPRh3lhDCOsmt5YfpxM/hQjJ/rIqlL/yLwCdm9IQyDd0kMmnkQnNWP+6ad6iKoR K94EHAhDfV9xjV4DP6ipgfaZgUKjg1IWpXYgn5NZRvXfsgw0Wk6BuO76knwNhM01ff8c Qa2P12pPB3S5aciFjEsNHQYkCjQF48nGEnoqioty7JL3YzBmt9A7WKVldFiq6E1idXsx CsyY+JPT+ez7nWBG0EKurtDokDOuFwLs2OJlErU+BQNIr9+7x00FSjAANVYvf8Qf7NAB i4DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=PHQpaRnD; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a17090301c900b001b7fd6f95f6si5465770plh.515.2023.07.31.16.53.20; Mon, 31 Jul 2023 16:53:31 -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=@linutronix.de header.s=2020 header.b=PHQpaRnD; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230356AbjGaWnp (ORCPT + 99 others); Mon, 31 Jul 2023 18:43:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231861AbjGaWni (ORCPT ); Mon, 31 Jul 2023 18:43:38 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50DE21FD3; Mon, 31 Jul 2023 15:43:27 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690843404; 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=33Fq0Wu+LfDasDHlhoRJ+tEuyTqh8mt568Pu/UPLqZ0=; b=PHQpaRnDsOkNetg825gd7IMakLKEP04uFP8GjAkP881xDRNXfPSgpbfOr3P/ZzLgdLAcog t84/0kkZB8NqGFR3FI2hQNvWMOLbKioKkFwRxkdH20Fa27GvDIm0eywiEooeOxvDwJnTUQ 7sULS3F2uUNKXpQByKioVMv0LN8JAUeUK56WYbfHkE8OeeH297dNymSbkyU4DVgQAASEBL RJovwWu7lOUgjmS/tGHcenWqOndXgJvUa/6STM+ARb/+OlxVyQ4tkiV4DBd8inkCx83kIq OyRIsZ33PKZchkj8QQIzWFKvLakZfO/1wjzytu0JTjG2FzHcVCS/YC3y6O7T1g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690843404; 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=33Fq0Wu+LfDasDHlhoRJ+tEuyTqh8mt568Pu/UPLqZ0=; b=PRvRmlunvV0e6RaleyV3C7+1OWJpkshHGoUIFIKaYZat4z36ufWvuSv5CP4m/eqDs0eWe2 zwip5a5ebJA1mqCA== To: Peter Zijlstra Cc: axboe@kernel.dk, linux-kernel@vger.kernel.org, mingo@redhat.com, dvhart@infradead.org, dave@stgolabs.net, andrealmeid@igalia.com, Andrew Morton , urezki@gmail.com, hch@infradead.org, lstoakes@gmail.com, Arnd Bergmann , linux-api@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, malteskarupke@web.de Subject: Re: [PATCH v1 02/14] futex: Extend the FUTEX2 flags In-Reply-To: <20230731213341.GB51835@hirez.programming.kicks-ass.net> 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> Date: Tue, 01 Aug 2023 00:43:24 +0200 Message-ID: <87y1ivln1v.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain 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_PASS,T_SCC_BODY_TEXT_LINE 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 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 :) > Also, sys_futex_{wake,wait}() have this thing as a syscall argument, > surely you don't want to put this union there as well? Why not? The anon union does not break the ABI unless I'm missing something. Existing user space can still use 'flags' and people who care about readability can use the bitfield, no? Its inside struct futex_waitv and not an explicit syscall argument, right? > I'd much prefer to just keep the 'unsigned int flags' thing and perhaps > put a comment on-top of the '#define FUTEX2_*' thingies. Note that > having it a field instead of a bunch of flags makes sense, since you can > only have a single size, not a combination of sizes. I'm aware of that by now :) Still that explicit bitfield does neither need comments nor does it leave room for interpretation. Thanks, tglx