Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3604551rdh; Thu, 28 Sep 2023 17:48:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHg9OR1DCjEnPVI6h+NtqlNFlGbAC7b8kNmzvo7/xD4pmS0LUxIsQvY3vPwWuB/LAjKyVeD X-Received: by 2002:a17:903:230d:b0:1c5:fea0:7f1c with SMTP id d13-20020a170903230d00b001c5fea07f1cmr3081754plh.65.1695948520083; Thu, 28 Sep 2023 17:48:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695948520; cv=none; d=google.com; s=arc-20160816; b=O4Qbg3OhA+b05K52HDPCc4o7TlfjNJHtdZGNxhWhF+5o20ruAPgBhz0ouw265rRjNT E1kYWdT6hu20oEKQSMqBjWqC4LoSvwdP+G1bRkijZbG9Kjrhzq6Dlce3gkenniepVUB8 19CugMwhNUjPksJIsEiFhpjPOfYbpb6obKoCtAHojgGFE8HiQKkqRmJbs5dk0uYZBHp5 5ZbW7glYLvRmPL7oS3PN08uZSghhdB38yL8vvk+9PEKLrmA/HTEuy7WX80gor4iMpOi7 rPHzHRGBwGRqXbahn6Ae/C2VicToqsTldtsjGLaB7RJCrYQpMBunkoOaY2ybus1wvIoZ AeoQ== 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=A3j/9wejDQ+NDD78GYTcXX46SNesqLsHCj3tL/KaE0E=; fh=VQ0oKqaCrCQewXefSeRnd0u6Xo9cEq21RyALpQ5RDbA=; b=RdMb+H0rx1uolrX3p9YdHn1tnPwRvNKIKbo8QnzWW7lXMzJX9OiAXaJq2gQS+zLyK7 qC217xAabvy/n8fFA7oZJLnquZQv2n7guMZU6LK3DMfYbD0BkG0BWqvY0VbJ2Pr0pLTh rMVXnl+7UOl9b0K7lE1FjAvlmVVyGYV/tRhRIz5A1koB9yRsdLwMPdnBLXJEFEE7k6/Z 2D4xtImO/T2dyil24K1m5z62okGUfOcKW6jfxLn8VTr2ZGbhETUNIywNN1XroCXft02J +coQDcKDblKW37jwVUQeYkU9t7TM0ldd56b71wjbRC89WH47yeSnxjHusZkaJ7STbI2W Mn2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EYTkJuHd; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id d11-20020a170902c18b00b001c3c94d212fsi18925843pld.97.2023.09.28.17.48.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 17:48:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EYTkJuHd; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4C8D78220743; Thu, 28 Sep 2023 13:54:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232294AbjI1UyT (ORCPT + 99 others); Thu, 28 Sep 2023 16:54:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232283AbjI1UyQ (ORCPT ); Thu, 28 Sep 2023 16:54:16 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FE3B19F; Thu, 28 Sep 2023 13:54:14 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695934452; 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=A3j/9wejDQ+NDD78GYTcXX46SNesqLsHCj3tL/KaE0E=; b=EYTkJuHdjoZvurePgf/yWXyZ5oPJpCiNFgdwobRZRwPPDC9jJvS4JUEu5GPc/r9WVD6ayB j9kps0A221SwDIAw4jQqym2t+toR7V42FeNbUsU275ZGkZiSzR1Ph5LtoX/dH4F8SZHsgn mUFkrGjar4DUxJvMaMzQ5ENgWkITP5KJ83C4nSRuiLInP6v0adyn1oI7rX76kSytJm6bw3 dZZf5c2/+mttVTw1IhGBnJK29WEZhpGOjf2SIhvVdqZF2CNk/+FaDohilJWZY67rcki0VH PpODGR1zxEl9iCZ7ao0iZY7xrP6ThQmq3d/a6IL3/xN9Spn3PLJ8+Vta+npwLQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695934452; 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=A3j/9wejDQ+NDD78GYTcXX46SNesqLsHCj3tL/KaE0E=; b=HqXj5SW6T6+YgMfTewJs8NsuI03Yde52sXYrIUGj2g+KaVQIGqZqTQ3R7wVLpOsTdJepHy Ge7EkPDHdCvgSwCg== To: Mathieu Desnoyers , Peter Zijlstra Cc: linux-kernel@vger.kernel.org, "Paul E . McKenney" , Boqun Feng , "H . Peter Anvin" , Paul Turner , linux-api@vger.kernel.org, Christian Brauner , Florian Weimer , David.Laight@ACULAB.COM, carlos@redhat.com, Peter Oskolkov , Alexander Mikhalitsyn , Chris Kennelly , Ingo Molnar , Darren Hart , Davidlohr Bueso , =?utf-8?Q?An?= =?utf-8?Q?dr=C3=A9?= Almeida , libc-alpha@sourceware.org, Steven Rostedt , Jonathan Corbet , Noah Goldstein , Daniel Colascione , longman@redhat.com, Mathieu Desnoyers , Florian Weimer Subject: Re: [RFC PATCH v2 1/4] rseq: Add sched_state field to struct rseq In-Reply-To: <20230529191416.53955-2-mathieu.desnoyers@efficios.com> References: <20230529191416.53955-1-mathieu.desnoyers@efficios.com> <20230529191416.53955-2-mathieu.desnoyers@efficios.com> Date: Thu, 28 Sep 2023 22:54:12 +0200 Message-ID: <87o7hmdnnv.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 28 Sep 2023 13:54:21 -0700 (PDT) On Mon, May 29 2023 at 15:14, Mathieu Desnoyers wrote: > +/* > + * rseq_sched_state should be aligned on the cache line size. > + */ > +struct rseq_sched_state { > + /* > + * Version of this structure. Populated by the kernel, read by > + * user-space. > + */ > + __u32 version; > + /* > + * The state is updated by the kernel. Read by user-space with > + * single-copy atomicity semantics. This field can be read by any > + * userspace thread. Aligned on 32-bit. Contains a bitmask of enum > + * rseq_sched_state_flags. This field is provided as a hint by the > + * scheduler, and requires that the page holding this state is > + * faulted-in for the state update to be performed by the scheduler. > + */ > + __u32 state; > + /* > + * Thread ID associated with the thread registering this structure. > + * Initialized by user-space before registration. > + */ > + __u32 tid; > +}; > + > /* > * struct rseq is aligned on 4 * 8 bytes to ensure it is always > * contained within a single cache-line. > @@ -148,6 +180,15 @@ struct rseq { > */ > __u32 mm_cid; > > + __u32 padding1; > + > + /* > + * Restartable sequences sched_state_ptr field. Initialized by > + * userspace to the address at which the struct rseq_sched_state is > + * located. Read by the kernel on rseq registration. > + */ > + __u64 sched_state_ptr; > + Why is this a separate entity instead of being simply embedded into struct rseq? Neither the code comment nor the changelog tells anything about that. If your intention was to provide a solution for process shared futexes then you completely failed to understand how process shared futexes work. If not, then please explain why you need a pointer and the associated hackery to deal with it. Thanks, tglx