From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA7ECC7EE2F for ; Mon, 29 May 2023 19:36:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229607AbjE2Tga (ORCPT ); Mon, 29 May 2023 15:36:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229603AbjE2Tg3 (ORCPT ); Mon, 29 May 2023 15:36:29 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30466CD for ; Mon, 29 May 2023 12:35:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685388942; 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=b8SqjRaOI7SSEDak/JLmJD7dtB3ewVlNqCAod3ToFvI=; b=I5PjyQe+Ocmy9IUEXRKF6VgJl351PqZ+G3rJZxAVp10Jty9O4m4JFRVJCwyYjSYa1H+pvc vQIRQ/2fj+3SWdb/dv9k+Knt9qdiKLCMcrIKRyXkOrP+1L5TlZxwqhFuvtH4MC06vjqLxn bEPRRM1jgwmuC7wcVehW9RnynylyAas= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-151-QShCzv_1NS-KmvGGCjnC8g-1; Mon, 29 May 2023 15:35:38 -0400 X-MC-Unique: QShCzv_1NS-KmvGGCjnC8g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1D51F3806624; Mon, 29 May 2023 19:35:37 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 95058C154D1; Mon, 29 May 2023 19:35:32 +0000 (UTC) From: Florian Weimer To: Mathieu Desnoyers Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, Thomas Gleixner , "Paul E . McKenney" , Boqun Feng , "H . Peter Anvin" , Paul Turner , linux-api@vger.kernel.org, Christian Brauner , David.Laight@ACULAB.COM, carlos@redhat.com, Peter Oskolkov , Alexander Mikhalitsyn , Chris Kennelly , Ingo Molnar , Darren Hart , Davidlohr Bueso , =?utf-8?Q?Andr=C3=A9?= Almeida , libc-alpha@sourceware.org, Steven Rostedt , Jonathan Corbet , Noah Goldstein , Daniel Colascione , longman@redhat.com Subject: Re: [RFC PATCH v2 1/4] rseq: Add sched_state field to struct rseq References: <20230529191416.53955-1-mathieu.desnoyers@efficios.com> <20230529191416.53955-2-mathieu.desnoyers@efficios.com> Date: Mon, 29 May 2023 21:35:30 +0200 In-Reply-To: <20230529191416.53955-2-mathieu.desnoyers@efficios.com> (Mathieu Desnoyers's message of "Mon, 29 May 2023 15:14:13 -0400") Message-ID: <87wn0r6id9.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org * Mathieu Desnoyers: > +/* > + * 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; > +}; How does the version handshake protocol in practice? Given that this user-allocated? I don't see why we can't stick this directly into struct rseq because it's all public anyway. The TID field would be useful in its own right. Thanks, Florian