From patchwork Fri Jul 14 13:38:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 13313718 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 DE150C001B0 for ; Fri, 14 Jul 2023 14:16:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8028E6B0071; Fri, 14 Jul 2023 10:16:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B27A6B0074; Fri, 14 Jul 2023 10:16:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B4BC6B0078; Fri, 14 Jul 2023 10:16:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 33B0C6B0071 for ; Fri, 14 Jul 2023 10:16:28 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id EDF2EB0499 for ; Fri, 14 Jul 2023 14:16:27 +0000 (UTC) X-FDA: 81010417614.03.8064366 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf05.hostedemail.com (Postfix) with ESMTP id 2CC7010002C for ; Fri, 14 Jul 2023 14:16:24 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=lRL7aZNY; dmarc=none; spf=none (imf05.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689344185; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references:dkim-signature; bh=HW8jsz2GyXNfhVb1jlu8VDTtcMIZFa9q1VNsHdld6PQ=; b=WnpQ0wK1GVvrUQpD/oKTGI6IqcsR7t/k3IDKESkuNfcEfTcnpJy222D81NocRW6EqO9uM3 jB4LAOzQ0kzsji0g7GIrevimhfhvLBQyQOvqRwomeDznU5jVXqdA5+1Q4Ao53gqbNVR4Rw IoFLbbrN1GQcovu5sTJhF3cb/DElGDw= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=lRL7aZNY; dmarc=none; spf=none (imf05.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689344185; a=rsa-sha256; cv=none; b=W8GG1u5Rglt7oYimgkbzdiAq2t4jPnrZ663G1KeaZnnb2x0OZd/Oe5QY6JodF7AFa62GRU 9390estqt/9PqMzqFyWdH1PR4eqE3zLxYCYtDsLhN3lOid7fufym/UaY4GmRMf323HSiMO qHX04muX2L166Hh0naesTpdn2X9SNBg= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Subject:Cc:To:From:Date:Message-ID: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To:References; bh=HW8jsz2GyXNfhVb1jlu8VDTtcMIZFa9q1VNsHdld6PQ=; b=lRL7aZNYsMs5HiLE4UqIN1R97i vKfGxMyqrryTTEI+qzS9LkdJoPNbQeg72+9sa5ovK3ExIDXqvzwSkbeNXaSLMax+T88zUzqbx2DAw UaIFG0v2ZxZ9TI3k3FfjCn6fc7mzlK3sfR6loxZMbgS3bB/1sm+QPnlEe67Gt+9mLN1Cr+7qw/cfo FBt4vU7r/+D/kzdgQqdkRZcHAlcrIC2IznD6JhS5OaYkFQ4uz4rR6hBPx0rPe40ccz1JyxD/ExSBM 1XgGDYiydelOnL3AHefER6uBgKSDBLvWA/z+lh3IdqvSmB676INv57o+5q7JwovFwcJPNIxcpsK8s 23w8K6Sw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qKJah-0016z1-3R; Fri, 14 Jul 2023 14:16:15 +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 9D1DB3001FD; Fri, 14 Jul 2023 16:16:13 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 590FE21372892; Fri, 14 Jul 2023 16:16:13 +0200 (CEST) Message-ID: <20230714133859.305719029@infradead.org> User-Agent: quilt/0.66 Date: Fri, 14 Jul 2023 15:38:59 +0200 From: Peter Zijlstra To: tglx@linutronix.de, axboe@kernel.dk Cc: linux-kernel@vger.kernel.org, peterz@infradead.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: [RFC][PATCH 00/10] futex: More Futex2 bits X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 2CC7010002C X-Stat-Signature: 93c4ozc9n64h6u1oa114tkmcc88s4cy5 X-HE-Tag: 1689344184-324781 X-HE-Meta: U2FsdGVkX19IPP6WZvuaXTvS7vSl72i+ZuimtyZV1rIDD823v1Q881GWsgcVM//P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ZYvyvgTtr8tSpMBgPJwNiD4 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: Hi, Reviewing Jens' series to add io_uring futex support got me looking at futex again, and I realized the current flags situation is a mess. After cleaning that up I decided to continue and implement most of the missing flags for futex2. I initially also wanted to add a futex_wait() syscall, but given the amount and kind of arguments that needs, that's just not going to work on 32bit. futex_waitv() will have to do for now. I've not yet done futex_requeue(), that's even worse than futex_wait() and I think the only option is to do something like: sys_futex_requeue(struct futex_waitv __user futexes[2], unsigned int flags, int nr_wake, int nr_requeue) Where we use struct futex_wativ to specify the two futexes (addr and flags) and cmp value. Additionally, robust futexes can fundamentally only support 32bit unless we go make more lists. The 'small' futex support is very limited, esp. when combined with FUTEX2_NUMA mixing sizes is really not an option. The requeue variant above would be able to specify different sizes for each futex and might just do. The whole series is *very* lightly tested, as in, it builds and boots, but I've not yet written a single line of user code to trigger any of the new paths. Please handle with care etc.. ;-) Jens, given you do a completely new futex interface, it probably makes more sense if you use FUTEX2 flags and a u64 value and mask. I'm hoping this series clarifies that situation a little instead of making it a worse mess. Many of these things have been brewing over the past several years but nobody put it all together before.