Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EC8643C047 for ; Mon, 13 Jul 2026 16:37:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783960658; cv=none; b=GA8MREmRsanJS3TgPDYbPz4bQcyaM/DwqkHTBUtU99W1NRDm8kgHV6aRPk5bWCUh88ytrTARINxjTWgyL5gH3nG9LTQoBJvstB3y6YkW7Q4CtclYV8HApPPtmGbHfRCv2lX+E1cSrd6YM6ndtp3As2q3ipRDLLYDu8KkpN7J5s8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783960658; c=relaxed/simple; bh=v4IgEPdGPqOrGJq+/TaWpyCT4EpVpuoBwGTOn770zMo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lHs3PfXVjoZyJ5FWzo4YDRbc8LE3wZrgJqFOyZPyRjxF/vaU3GM142JtX7Pok7LpYkp6SFJ7Mbx02BdwZIPPFLY+vaO7EQLRlaM9P1n++dfXFTlYexzW3biEBoxjQiA/AEmQdUybJ8X4rjrRsmNOB2jt21GM8UrzaVDh9+h4FdA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=DwoT372g; arc=none smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="DwoT372g" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66DCBwaW1396297; Mon, 13 Jul 2026 16:37:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2025-04-25; bh=/jpE0dd15855ovfNfjvRg/RHhGfqJgMvKJl89LxcNGs=; b= DwoT372gIZS9jJHwQ/UaRgOJ+zy3/tybOB3Ix/fkChNRYKij5vJsXtj+bV+nGuFY G6zVU4u1oxIAJLnxrGsiTX4/T/J7go16bm05arNosIriXjDH6+J5VcSCQScpRzvk J1E89190DR7bJHRsFSpSrHlQlGBCtCwguKxDCa3bExhabUNCckQnegPZR5FtPWkG 2yFqRkaI032SvYFHB0dErmUKq3n66yK1nr/sd/mjiG/H6q4H5qriGYPYWZdQAQx3 l3P1kNWzDJE5GaEjZ/+AlNKMGJY8HJ4ds+lmkln3ldIoShyVxLLu58vq3KALZh8f 3yG/a5Z8EeDwU9MRvvHZgw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4fbef0tha9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 16:37:25 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 66DGXYo4004663; Mon, 13 Jul 2026 16:37:24 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4fbc9gfdhd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 16:37:24 +0000 (GMT) Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 66DGbFQO020425; Mon, 13 Jul 2026 16:37:23 GMT Received: from lab61.no.oracle.com (lab61.no.oracle.com [10.172.144.82]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 4fbc9gfdas-5; Mon, 13 Jul 2026 16:37:23 +0000 (GMT) From: =?UTF-8?q?H=C3=A5kon=20Bugge?= To: linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long , John Stultz Cc: =?UTF-8?q?H=C3=A5kon=20Bugge?= , Ingo Molnar Subject: [PATCH v2 4/4] test-ww_mutex: Retry lock acquisition after timeout if deadlocked Date: Mon, 13 Jul 2026 18:37:08 +0200 Message-ID: <20260713163712.638876-5-haakon.bugge@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260713163712.638876-1-haakon.bugge@oracle.com> References: <20260713163712.638876-1-haakon.bugge@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_04,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2606160000 definitions=main-2607130172 X-Proofpoint-GUID: Dta1mq8BgmJxMbyHtI54ZlYjmUOkjN8m X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDE3MyBTYWx0ZWRfX2/zlo8vPMlTX M11J+nSWdY9G5tzeKpbDZB9kbHa0FR7+BDyg3SZeoM6ddO8OT9u/Rl3GRBqiS5OO0511JL24/3R etuD8xk0mngc+oknyQxTgPWJZtdP7/DAKS4+lABxI72WSxYozuhi X-Authority-Analysis: v=2.4 cv=KJZqylFo c=1 sm=1 tr=0 ts=6a551445 b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=M51BFTxLslgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=EIcjfB9IiI4px24ztqRk:22 a=yPCof4ZbAAAA:8 a=EReQOji3x1dJbK8aeRgA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=5yU3S35YU4bGjq-dph-N:22 a=Bho9c0fBagfJEIQBS7DQ:22 cc=ntf awl=host:12221 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDE3MyBTYWx0ZWRfX60QuJBXz0Mf8 Sw2qVYBC6hz5CYfPAepbKQcN4ugTyTf69UyKfUMvvy6uvvQqJuIi3yapiO+Rw/uI7+SwRE/mwhi 8acAxcZCoEOkmcAkjV/O4xVsRrmTW6xyrkwrHaF+OZmVBteuc8kYw5tOzxsCk6SthG9pv/5p+my 7VhYsznzVDkDeAG1sqJndqfHtaIMfmhbSuEarwWqs9NE+DZTn1HEt7QY/MmfHvQWI3cPqrcN87Q vhDAGUllcv0efcJKrrBq6Q/YpKIKJGUCcyfLsrELNUrqU6FYmc2VXl+2YAkTXqevqXoNzIxCPbA /KKWHFNVwusF2+Vr0yUUVmEtCSTWJP3EbaDnRnsgEurfhRkSG5iJ1L/uG9LqXVya05U5Zc64wns j9IBDRsszF213GQr2746XeZ2pzGHmCmWSrk1l7NIJRihUmo8XobaTUt8x+OjXQqhfzKL1dD/d8C A/v/9aueIzQfW8rzmeszcjvL4pPHVz83kKHPlg3A= X-Proofpoint-ORIG-GUID: Dta1mq8BgmJxMbyHtI54ZlYjmUOkjN8m 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. With a high number of threads and few locks, there is a very high probability that a thread will be subject to lock contention. That implies, when the loop times out, we will most probably have been exposed to a -EDEADLK return. Therefore, we retry a finite number of times after timeout before reporting failure. We retry up to 10,000 loops 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. 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 instead of livelock") Signed-off-by: HÃ¥kon Bugge --- v1 -> v2: * Reworded commit message --- 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_mutex.c index 190b8ac5c5520..e97f7d94ca5ef 100644 --- a/kernel/locking/test-ww_mutex.c +++ b/kernel/locking/test-ww_mutex.c @@ -457,6 +457,7 @@ static void stress_inorder_work(struct work_struct *work) struct ww_acquire_ctx ctx; int *order; int err; + int attempts_after_tmout = 10000; stress->result = -ENOMEM; @@ -489,7 +490,7 @@ static void stress_inorder_work(struct work_struct *work) ww_mutex_unlock(&locks[order[n]]); if (err == -EDEADLK) { - if (!time_after(jiffies, stress->timeout)) { + if ((!time_after(jiffies, stress->timeout)) || attempts_after_tmout--) { ww_mutex_lock_slow(&locks[order[contended]], &ctx); goto retry; } -- 2.43.5