From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 25AE63858D34 for ; Thu, 2 May 2024 09:52:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 25AE63858D34 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 25AE63858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714643534; cv=none; b=rQmmyO8P5XKWtwKFhuLsYfh5rblTMJ070IGWHHGZLiY6Tpk9dsFW6IqLXlG5GObOHy9eHZdlx3xGuXuvGAlhd86tk9DZcLf6czdKSZiy+bwZSwgb8u3PSwNo52x60AQsY5Iwnb2dVek51dpokIADZbc2wu8GjKfPL5+U0xe6fDo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714643534; c=relaxed/simple; bh=1K2m1ZK4jkv/p2zkpmXkXg4nPfMK7vRZ98Av3byv4fM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ucyK7J8as9be0imJsAbDyt+iYqlBiPxNV6z+71TM66Ua63cI61uzqXmS+cPHxhtQgF1QcigFo2rtIcta39Hhw8YwkXd2gGld0kwb5Wq1/hs47WUi0k8mXHoQc3B6BSro0X2fHWf7pKF+zG4677AaY6aZQLDYsqrW/o3rO5c8va0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714643531; 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=tstmt5L3lDWDwvbX2UANesO3SfpQYRIvnhHG8+Nwf7U=; b=jCwzNDhvHmSjuQXyIeDErwkOK1ojp5MptpiIfqooC15zXrAbwuNauSFKv9op6gkCd3jOjc j3dcf+xOvrx+fFU/yfvE4oKc+XOJQdc2jHrDLLMjrW4+Cq53+KgfFiZ4PLsXXBJbpb+lDp Tves04muNp7EBh+XvVjnvAaZjr2ejqU= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-638-r9Oadj5OMiu_itETd4b5Kg-1; Thu, 02 May 2024 05:52:06 -0400 X-MC-Unique: r9Oadj5OMiu_itETd4b5Kg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F3DF1C05149; Thu, 2 May 2024 09:52:05 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF688C271A9; Thu, 2 May 2024 09:51:58 +0000 (UTC) From: Florian Weimer To: Christian Brauner Cc: =?utf-8?Q?Andr=C3=A9?= Almeida , Mathieu Desnoyers , Peter Zijlstra , Thomas Gleixner , linux-kernel@vger.kernel.org, "Paul E . McKenney" , Boqun Feng , "H . Peter Anvin" , Paul Turner , linux-api@vger.kernel.org, David.Laight@aculab.com, carlos@redhat.com, Peter Oskolkov , Alexander Mikhalitsyn , Chris Kennelly , Ingo Molnar , Darren Hart , Davidlohr Bueso , libc-alpha@sourceware.org, Steven Rostedt , Jonathan Corbet , Noah Goldstein , Daniel Colascione , longman@redhat.com, kernel-dev@igalia.com Subject: Re: [RFC PATCH 0/1] Add FUTEX_SPIN operation In-Reply-To: <20240502-gezeichnet-besonderen-d277879cd669@brauner> (Christian Brauner's message of "Thu, 2 May 2024 10:45:41 +0200") References: <20240425204332.221162-1-andrealmeid@igalia.com> <20240426-gaumen-zweibeinig-3490b06e86c2@brauner> <20240502-gezeichnet-besonderen-d277879cd669@brauner> Date: Thu, 02 May 2024 11:51:56 +0200 Message-ID: <8734r0o81v.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Christian Brauner: > Unless I'm missing something the question here is PID (as in TGID aka > thread-group leader id gotten via getpid()) vs TID (thread specific id > gotten via gettid()). You want the thread-specific id as you want to > interact with the futex state of a specific thread not the thread-group > leader. > > Aside from that TIDs are subject to the same race conditions that PIDs > are. They are allocated from the same pool (see alloc_pid()). For most mutex types (but not robust mutexes), it is undefined in userspace if a thread exits while it has locked a mutex. Such a usage condition would ensure that the race doesn't happen, I believe. >From a glibc perspective, we typically cannot use long-term file descriptors (that are kept open across function calls) because some applications do not expect them, or even close them behind our back. Thanks, Florian