From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796072082; b=mQcIEX0J+ZAzNR8FUZDCtHkOQ93aoJKpAPkImidtf0KzMx6d2OGmxV0YLOWnW3FO0kbM ggWZduMk59hJKwA1V0dCNC+cQlDLfMrduIn0pugkW+p1FR+q+619u3FVMxduoMWYgtnUU etBf6fTS9YxIRu7L0u1208i64GSXEYt/aC1Jf/Cjbn2uQ6uG0L9SCsZqyrpD4MR673KmG ehgiXP9CIPvwIZ9bDhMMY+SCZeJJ0Wn8tKmQZ2hSZNlkh7hBRxTVeK7oPKBN45tVXcPxt pBLzsQVcMJe69KQatrREonbAJ4rJf11kXmWPLvmLtD3kXNFmb9OlZ+UY2G++Owj0m7A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796072082; h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References: Date:Message-ID:MIME-Version:Content-Type; bh=YG2WR0JaenJjit0F218E+WLAiB8s7pCWrOo8dQcgFJk=; b=vutmUaQyGfRnvCyM9D+UDEcHMQTToio200NnBUHIIB8T/iDJQILArMsRJHUvKbY5/ymH U4KxOEWDcg+imjhyOBoNqup7vsaTCmTwHk9lGP2IGaHtd6dAb+EjcK3rDIjq39PbTHBE9 b+zoBYWhWwS9SefDcifwHp3XkjIWjOQWqUVjfrrWVMmd6dM+Os1awgqtiQ6eCl5KACztr XrOp0dXgwcADzeOTkmJq7feEy6JWyGsQlIbin0cjoq5dtbmsFaKKFQVoItbkcdi2RPESG 6v6AkSPshuBcFGxh5EtZuC/40ZK3WEIL9i6npnK69SXULa5gyHCxbEAi9AXWYp8MVdg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IyRryuk+; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C659C606A31A; Mon, 30 Nov 2026 20:54:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IyRryuk+ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DC321F000C1; Mon, 30 Nov 2026 20:54:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796072082; bh=YG2WR0JaenJjit0F218E+WLAiB8s7pCWrOo8dQcgFJk=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=IyRryuk+uOXvDQoL9UcR6iYSZU+h8U6yuW3hR5dPG0xaCAtG7Z912e9njfjalLb0s D79UjluEZhtgAOt3nmvJEt44ihvXzpB9Ma4j670HN15UlSEbGCgNWCZYG0amgM2tky tlZwroyPeh+2IGTNTlzZNQ5uhZVEo22GUSlYIYP2FNWLzBVd3RDUb+NZQ58NKXuwdk azEiM4ctM/+Lk0ie95Mf+lOA5nloJLqJrqtaLmyZ3WthATPwE+C7mzO/PYaHW1VRsm 5WdAR4xz+Kr6ngnD9TCUumqWiBb+5SqfZWhPmYZeQXA42lpieY4oxjkf3LqNAAYby8 REM2/emLnNK2Q== From: Thomas Gleixner To: Mathieu Desnoyers , mingo@redhat.com, peterz@infradead.org Cc: linux-kernel@vger.kernel.org, dvhart@infradead.org, dave@stgolabs.net, andrealmeid@igalia.com, shuah@kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH] selftests/futex: Retry the wake in futex_wait instead of sleeping In-Reply-To: <7636700d-1aed-4e6f-adc6-720b1aa98501@efficios.com> References: <20261108142309.1527337-1-mathieu.desnoyers@efficios.com> <7636700d-1aed-4e6f-adc6-720b1aa98501@efficios.com> Date: Mon, 30 Nov 2026 21:54:38 +0100 Message-ID: <878q2aqbu9.ffs@fw13> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain On Sun, Nov 08 2026 at 09:34, Mathieu Desnoyers wrote: > On 2026-11-08 09:23, Mathieu Desnoyers wrote: >> Each futex_wait test starts a waiter thread, which calls futex_wait() >> with a 30ms timeout. The main thread sleeps 10ms, then expects >> futex_wake() to wake one waiter. So the test assumes that the waiter >> reaches futex_wait() within 10ms, and that the main thread runs again >> within 30ms. >> >> A busy machine breaks both. The built-in locktorture at times holds a >> spinlock for 100ms with preemption off. With it, private_futex failed in >> about 0.5% of the runs in 8-CPU VMs, on v7.4-rc1. >> Timestamps showed two cases. The waiter started up to 75ms late, after >> the wake. Or the main thread woke up to 105ms late, after the waiter >> had timed out. >> >> Fix this by retrying futex_wake() every millisecond until it wakes the >> waiter, for up to 5s. Give the waiter a timeout of 10s, so that it >> outlasts the retries. The tests then wait for the waiter, instead of >> assuming when it runs. >> >> With this patch, private_futex passed 6000 runs of 6000 in the same VMs, >> and the three tests 2000 runs of 2000. > Self-nack. That's flaky as well. A bounded retry can still fail. This > needs a proper synchronization flag. Will respin a v2. See: 6c4a1b972643 ("selftests/futex: Provide thread creation and synchronization helpers") 23dd3f884926 ("selftests/futex: Use thread synchronization helpers instead of usleep()")