Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.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 772FD40B363 for ; Mon, 13 Jul 2026 16:37:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783960654; cv=none; b=Uwd1lN7aUhEy1zzOoBMqxhSwT1nKiTrxB/mIlXb1rVFYvCRknmPqhnTUdeIOsTvNqIuQdpKRGWi+Jha5NtbVe5bCAJQPJGI4CAnDP6+s2jr+vA+h4tDvT+AJfaXTzmslO0VYPQqZ9H/VC07ELuyQFMK+Dv6Bth8AzCyip8Ctu48= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783960654; c=relaxed/simple; bh=UGTiE9PoEA6SS5x8rGxLLEUGs1EIv+4aqcJb978TU+I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QIZOMYyt+hutQb3gYIMCgJ/h+FQ483+r5EZ+fRSNodqfcbfXHOxYqJGohQvhmc3GNlX43DFRSLOh7WCXpCnD8pKCmqz+bL6Yjai9tdXC9Sez+CF5UdbBJlvnjvcV5jUp4EVCzWnyBFUWfwgIWmqkjZ4K4dw/ihxt9WqS7YA2BXo= 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=nf+yVtRW; arc=none smtp.client-ip=205.220.177.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="nf+yVtRW" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66DC8oik1379899; Mon, 13 Jul 2026 16:37:20 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=8axs6/DwKqTZCcXgaGEvGg2rDdG/OlqeZDwlUMVsX+c=; b= nf+yVtRWEgIF00IZKz/JBI0jLQJBg68evp3sd3dJsHRR5GFgRkHSx0OiKeGyGg78 NpeklqhNCzzlL7vc4UpHvao5FGJW17ufQkoKcB8mfPIiBO2NVRZzyqkedqgjmsOR on3mi2BxRbwce0OnoKtDNN+xE8DtDY8sWh33T82dpXSjW7ZAH/SJJnb+zmby76RF pou0dpAmPPOVclLWRkpHRuzakBROr7066b6FILyuT5/viib1BT3oyx7TQHe35nPg w22HXa/Dhr0MilQt5Xz3M4Iu4KFBxi4zq9s1VPGPnrBndMM3tN7rtwLI5FYqWJco /mTkPo5lWY3FIk/TIBO23A== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4fbed82hvd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 16:37:19 +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 66DGXY1C004717; Mon, 13 Jul 2026 16:37:19 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4fbc9gfde4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 16:37:19 +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 66DGbFQK020425; Mon, 13 Jul 2026 16:37:18 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-3; Mon, 13 Jul 2026 16:37:18 +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 , Chris Wilson Cc: =?UTF-8?q?H=C3=A5kon=20Bugge?= , John Stultz , Ingo Molnar Subject: [PATCH v2 2/4] test-ww_mutex: Report errors from stress workers Date: Mon, 13 Jul 2026 18:37:06 +0200 Message-ID: <20260713163712.638876-3-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: vT0cb_UcXptQdGfq6lEhQRdlkWrt9YYp X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDE3MyBTYWx0ZWRfX+GLvX0MhZ9bA M5EN8b1boJO3Xxwj6hYKwo1Mht4EORa90xCz0yyZwzG2kzssuAsQ9JK+sMLI1XP4U0psEskmE+2 roAuzCAlwxYpQyXiyl0mN9hEg+YBUYtvY5q+3iY2ss1EOa0ekSEY X-Authority-Analysis: v=2.4 cv=JKALdcKb c=1 sm=1 tr=0 ts=6a55143f 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=o5oIOnhZENCTenyL_yNV:22 a=yPCof4ZbAAAA:8 a=1XWaLZrsAAAA:8 a=HWq8w0C2B1yOpf0TK-AA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=5yU3S35YU4bGjq-dph-N:22 a=Bho9c0fBagfJEIQBS7DQ:22 cc=ntf awl=host:12221 X-Proofpoint-ORIG-GUID: vT0cb_UcXptQdGfq6lEhQRdlkWrt9YYp X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDE3MyBTYWx0ZWRfX8K3WtvoylYv+ CoblD8ScVAXI/f/4ftzDUwZQUUKxPUfh/0ilteTlbvbwJI8wH9bmK5AEIu3omrmUbvJh2/ZuYY/ Fpig6GurZ/5kGRfUBqtzd93pmdDXDN/bo8vAsdLhYyaJlDbRdn/lYzrpRw8/j1xBE4Ajp1ZHe6V Y8TlxsqrHj35AJrCJyVhKzhp4f89+hNsDsNWf0XgPnvozEJZV/b4v+OwZ5oC8+5ZoFSNoYuLUj0 e1dWV1Nv2ASyRYrlQi6Vbbb0S5m6eoC8Or+6SZ5TA5L1avgd/2a8cMA9gobcx6nvwoFoH9fJemp Ay/NQNrDuggsAhWvtH5lmyEWBvMRe7Wh5UHKUsx7RfCTi9JCmHMHC7nrXyQx15QrvP667uBOisn e5fdnyuBA1cs6O4opZgSaJjEj2hPo52Qtc0RwDVVG6BdSkh0yOhnqTcWSZLNFdpOZ8tj6kouPFn 3EXjF1PQIzXhtcTedixYyhWbtySnEiKvtep9eOp8= If any of stress_one_work(), stress_reorder_work(), or stress_inorder_work() fails, the error is not conveyed back to the test harness function stress(). We may then see in the log: stress (stress_inorder_work) failed with -35 Beginning ww (die) mutex selftests All ww mutex selftests passed Besides being a contradiction by terms, the failure to return error from said worker functions leads to false-positive results. We fix that by adding a *result* variable to *struct stress*, update it in said worker functions, and finally, in stress(), scan the *stress_array* and report the first error if any. Fixes: 2a0c11282881 ("locking/ww_mutex: Add kselftests for ww_mutex stress") Signed-off-by: HÃ¥kon Bugge Acked-by: John Stultz --- v1 -> v2: * Added John's a-b --- kernel/locking/test-ww_mutex.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/kernel/locking/test-ww_mutex.c b/kernel/locking/test-ww_mutex.c index 8311ff38ab683..5ed91f2cf30d9 100644 --- a/kernel/locking/test-ww_mutex.c +++ b/kernel/locking/test-ww_mutex.c @@ -392,6 +392,7 @@ struct stress { struct ww_class *class; unsigned long timeout; int nlocks; + int result; }; struct rnd_state rng; @@ -440,6 +441,9 @@ static void stress_inorder_work(struct work_struct *work) struct ww_mutex *locks = stress->locks; struct ww_acquire_ctx ctx; int *order; + int err; + + stress->result = -ENOMEM; order = get_random_order(nlocks); if (!order) @@ -447,7 +451,7 @@ static void stress_inorder_work(struct work_struct *work) do { int contended = -1; - int n, err; + int n; ww_acquire_init(&ctx, stress->class); retry: @@ -485,6 +489,7 @@ static void stress_inorder_work(struct work_struct *work) } while (!time_after(jiffies, stress->timeout)); kfree(order); + stress->result = err; } struct reorder_lock { @@ -501,6 +506,8 @@ static void stress_reorder_work(struct work_struct *work) int *order; int n, err; + stress->result = -ENOMEM; + order = get_random_order(stress->nlocks); if (!order) return; @@ -545,6 +552,8 @@ static void stress_reorder_work(struct work_struct *work) ww_acquire_fini(&ctx); } while (!time_after(jiffies, stress->timeout)); + stress->result = err; + out: list_for_each_entry_safe(ll, ln, &locks, link) kfree(ll); @@ -569,6 +578,8 @@ static void stress_one_work(struct work_struct *work) break; } } while (!time_after(jiffies, stress->timeout)); + + stress->result = err; } #define STRESS_INORDER BIT(0) @@ -581,6 +592,7 @@ static int stress(struct ww_class *class, int nlocks, int nthreads, unsigned int struct ww_mutex *locks; struct stress *stress_array; int n, count; + int res = 0; locks = kmalloc_objs(*locks, nlocks); if (!locks) @@ -635,10 +647,15 @@ static int stress(struct ww_class *class, int nlocks, int nthreads, unsigned int for (n = 0; n < nlocks; n++) ww_mutex_destroy(&locks[n]); + + /* Report the first error */ + for (n = 0; !res && n < count; n++) + res = stress_array[n].result; + kfree(stress_array); kfree(locks); - return 0; + return res; } static int run_tests(struct ww_class *class) -- 2.43.5