From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3F6926ED5D for ; Wed, 8 Jul 2026 20:01:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.216.53 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783540921; cv=pass; b=TeGsCCZtia1JaYir/Z8SBXvN0494O9YBa4yeUb2gbVfCvOO9eFgEYBqJvSLBlpwrtsUDznuL3izVrDzpxducTfe0rQRBesPaIlJxKRGL3vCZrJrM2kQvEjOYBj7VEWfdAdX+K9gXApRIF/4MsScPSUmF58/hYfsOW0Pbhv0/7SA= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783540921; c=relaxed/simple; bh=Fm3C+6v+QcVoXQI1VsMQWoJuJ2KbqL1FTAN4/Uo7qfs=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=LkGDXEEn6RIUYEBm2M8I68gUmSD/ShAAQKrk+H00hY22oUlHPbON4teiv5x7YRXoAjuR9LRot7ntFJtdkiPBOTm3bbA2YQprzvxmE8HSmyAA1tGeA/YPm/COqE4sf1tLnkMwdPSqmXT3G7fp/adAudgI5+HQhGwIbEnG6nu+43Q= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=aRo5/9jA; arc=pass smtp.client-ip=209.85.216.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="aRo5/9jA" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-36b9d265355so1092987a91.2 for ; Wed, 08 Jul 2026 13:01:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1783540918; cv=none; d=google.com; s=arc-20260327; b=Ol6xPoeN1yLkV1pXqz3UVGi6/vC6JRCYgnefRMVVt65gWLmi2JetPyGabBrE8GvLGW iRFHyjYd+Ni4TRrw/3g/eumYdjod+At0R1OEJosPdMZitnHKMHxYO1IQNj/rYyz6d4zx d8FhjmnkB0np31zBMFPBZ/SfjfqJGacHFyFk5qWXXLL/DMvR/0ac06lRXJFxPzdeZA8y X3lwutzBSBpvc2MaJVyMYNnLh0JuY76kICJPtMWu0boVUzmH5UZoP5psWEcgjSydZHeM UsBWhH3aKHj7W2985LFDsRDyhxOsu/TRORaqecz6YAIZX7Jju75CYIHfpy6V6R5FuyLm cobw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=2VwUNvJyy0XFQLrNMc5Y1g8HN8/ZRLZkIO25Zw6/L3k=; fh=BSet45WPMVXeacNne6IDfuegZHXp1W0O9h3Dh+00/kY=; b=XHMMtLzO1of7Xcl0oITaBbqj/Zw1EUKUK8WGhQtFaaaxmK+4K8Q8QnTV6wrtkZyWql eljYOG5BPt9i1hNmd/N+EuKGa/pEX2Y6Qv4m0enamia67LWCO2lZY4mFJDOKPrn2ZUT3 jLoIxZNWQXocrJ9leKh2Ugmqghr1kEtzVc4Z8qlrQrTAON/oxYCbQ2ZwZBwGzwkOBtP9 NMNlDdXU0qzfIhlTRLYNkCDYxhJKfHZa9LGkl240U1FqlbctS3M/gWLTFUaui4Avr7FK 4JONpHsPKFm7eURBB73HmppllNe75lwqMl2qG0+k71z44i4PgtIw2Dk42xpjLWm38Czf OWng==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783540918; x=1784145718; darn=vger.kernel.org; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to:content-type; bh=2VwUNvJyy0XFQLrNMc5Y1g8HN8/ZRLZkIO25Zw6/L3k=; b=aRo5/9jAhg6Be+pLB8FDapVWKdh8ZutgYCP6eeugvJAYs2Z3jI5XjqWkrVT7gkXRyk n+kwCTKuS/SJGUtF4p0HEzzPIikQ7WrKSErCpEKlLjrzX5p89x7ybKNkaP/g56gPijry QNo03NRJnm85vyA7LcyAEa+IYkYK4TfDZyFhDWQeJjjg8DZrm5uYYCNRTS12Qm64db6Q GfJBHPjq8P0unnQfUUjBfsbTuXth4pasNZe+r2P2NlhPX4iID6iunlKemrZ2Qb5E68FI Ha+5aF8NRuqGByU5JLXdnvpdgnC1ckULjsynOGCoRANTLjDfUmO7tImuMasFQGF09/8h j/AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783540918; x=1784145718; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=2VwUNvJyy0XFQLrNMc5Y1g8HN8/ZRLZkIO25Zw6/L3k=; b=ruuJ1E/6ufEd4yIWR87VRqyBu4Plk/+zSFZqEhV8Ew3QOVH2rnzPHuP/qzMkKKDo3H RyEefbL6QfmXrH3Du/gi2SRM4NIb8JxsQ4pGHwxMS41YPyOlRmvNjghx7k6jwxd2tuJm zH9/085lwdqqzI2B40dvqrpX+aoTufMvnXZMtny8wZ7HGCNOxWA+M5vMdNXzqemNtTZB jg4k8VT8Z9XGeFPyQ4iS0r7xw2/apPgeCW6Bq624rBl5vaCmg+5e5M9KuOk6X+EgyU1o M4nlZCf8QFOfVTAKqum+86e0GMBGy2XtVHRrCg437wpKAW+uU2I6TCI9NnYlHCFi1RlX NIRg== X-Gm-Message-State: AOJu0YzWJSj9bNk4L79qvbZKv3HX/yCtfba561UJQdwmGwqZTWYlHHZN yj+4AFUIEcKN6Y1geStOpVmCmtmL8RTrMpoYrKCHMHoK0g+zBNXCu9RGT2XEHensrIrVfh3BQvs FTpgzJANbBc4Ps/0IOcdri8vDqE9SwB0POY1veQg= X-Gm-Gg: AfdE7ck5uj3TSB/6/FYzvltmYKwSUXV0dXsxes+fAHbgj1XQdejMXYdEa/mkqiRxab6 0HUdmeO1hKroWFp8vj24uvzLKRTUvN6AwC3fu2wI6JPbQPm7V7C7WHxicIZaL5QqC4lNAEgivCS 6IqDe9QnerpC+ILDR104ASrmfXxYPOOWWRm0nUuwsdPBe5NuqzvB4rX7HXktfSabLZ2wQ58t0d1 gBiElAX0hoZeUy8le2MZi3lsT2BgTzCdMEnbnGOkYbnf1+cgkH8Go/en8GEZPCf3PQFrL0X0Otu U+N4ZzJkQnwvMNPV2DlDS4RLaFslxb0IOrB6Df0+ri5VpKOwylyZx/Z/9UugQVIztucyAE9EkTy HimV5TE7dC6YPgp5WszUx+Uw= X-Received: by 2002:a05:6a20:a106:b0:3bf:80c9:6b3e with SMTP id adf61e73a8af0-3c0bc9a6799mr4367378637.30.1783540917277; Wed, 08 Jul 2026 13:01:57 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260617121335.2036954-1-haakon.bugge@oracle.com> <20260617121335.2036954-5-haakon.bugge@oracle.com> In-Reply-To: From: John Stultz Date: Wed, 8 Jul 2026 13:01:45 -0700 X-Gm-Features: AVVi8CeLCUHthvnxfBoq2WfOivGI_oqP0jQNvq6Co0JIk6fBS4RDPzB8D33AT08 Message-ID: Subject: Re: [PATCH 4/4] test-ww_mutex: Retry lock acquisition after timeout if deadlocked To: Haakon Bugge Cc: "linux-kernel@vger.kernel.org" , Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long , Ingo Molnar Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jun 22, 2026 at 6:48=E2=80=AFAM Haakon Bugge wrote: > > On 18 Jun 2026, at 20:55, John Stultz wrote: > On Wed, Jun 17, 2026 at 5:13=E2=80=AFAM H=C3=A5kon Bugge wrote: > > >> stress_inorder_work() terminates when its timeout expires. If the > >> final lock acquisition attempt returns -EDEADLK at that point, the > >> test may report a false failure even though the deadlock would have > >> been resolved shortly thereafter. Retry a limited number of times > >> after timeout before reporting failure. > >> > >> Without this commit, we may see in the log: > >> > >> Beginning ww (wound) mutex selftests > >> stress (stress_inorder_work) failed with -35 > >> > >> Fixes: cfa92b6d5207 ("locking/ww_mutex/test: Make sure we bail out ins= tead of livelock") > >> Signed-off-by: H=C3=A5kon Bugge > >> --- > >> kernel/locking/test-ww_mutex.c | 3 ++- > >> 1 file changed, 2 insertions(+), 1 deletion(-) > >> > >> diff --git a/kernel/locking/test-ww_mutex.c b/kernel/locking/test-ww_m= utex.c > >> index 6b29a7a8f5fba..95de03179eac0 100644 > >> --- a/kernel/locking/test-ww_mutex.c > >> +++ b/kernel/locking/test-ww_mutex.c > >> @@ -444,6 +444,7 @@ static void stress_inorder_work(struct work_struct= *work) > >> struct ww_acquire_ctx ctx; > >> int *order; > >> int err; > >> + int attempts_after_tmout =3D 10000; > >> > >> stress->result =3D -ENOMEM; > >> > >> @@ -476,7 +477,7 @@ static void stress_inorder_work(struct work_struct= *work) > >> ww_mutex_unlock(&locks[order[n]]); > >> > >> if (err =3D=3D -EDEADLK) { > >> - if (!time_after(jiffies, stress->timeout)) { > >> + if ((!time_after(jiffies, stress->timeout)) ||= attempts_after_tmout--) { > >> ww_mutex_lock_slow(&locks[order[contend= ed]], &ctx); > >> goto retry; > >> } > > > > Thanks for sending this out! I definitely have seen timeouts hit in my > > previous testing. Though, the approach here of "trying harder after > > the timeout" at first glance strikes me as like a procrastinator's > > panic. :) > > Hehe, I think the undersigned is a good example of a procrastinator ;-) > > > It might be nice to have a bit more context in the commit message as > > to the soundness of this approach. > > I wrote something about it the cover letter: > > > It is worth mentioning that the last patch retries up to 10,000 lock > acquisitions after timeout. This value was determined empirically: 10 > and 100 retries were insufficient on the test systems, while 10,000 > provided stable results and avoided false negatives. > > > Shall I add that to the commit message? That would be great. > > If the deadlock resolution takes > > longer then we expect in time, > > That is not the case. When we terminate due to timeout, we have no > resolution of the deadlock. I view it as there is a probability we run > into deadlock, let's say 10%, for each iteration. Now, if we terminate > due to timeout - and - we are unlucky and the last iteration > deadlocked, we cannot just return -EDEADLK, as that will mark the test > as failed. Instead, we retry some more iterations in order to resolve > the deadlock. But with the retry count needing to be set to 10,000 it seems like more then just being unlucky on the last iteration, no? I'm still a bit wary on this change, but I am very eager to see these occasional failures be sorted out, so thank you for your efforts here! thanks -john