From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 AEF2738DD3 for ; Fri, 31 Jul 2026 00:40:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785458423; cv=none; b=utNUZA/QkJaCEKdtek5cqER3EJgP2/bk2ifEBeKFm0ksx/JvmTwXFBdJKkiE/oggj8GZn97gp43P5IAtxkXDgEkS7DhGXI6BU5qDlwVe11Jwwh9CkHP4KlZsuPC5K7pG91b+SOpi5pWTrqtgt6tzAgbTb4pRTYpQC9MVP0gMaSQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785458423; c=relaxed/simple; bh=q0DsiICfiRZmOIUvhdBSbriKzlwVPTDzTrZ4wz+s0Ik=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KakvD5BJCGtpdkZHu8QO6Ogcit3gFngSZBC0e4ni8ZwOsy2Mg7yIunCfRsp+ek6nQSv6UcLYYSQA7003+z6LUae8zKWzw6SwJFiLmxyp0TS3wNK23MM0ZGashqBLmR66RUtSAs+JGsNohoSx8/qutpEeeH/7FqB8Fm/hkZp+uo8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LXoNgjtf; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LXoNgjtf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 818BB1F00AC4; Fri, 31 Jul 2026 00:40:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785458421; bh=XKZ4dI/4IJbFmKwgwXr2MPq7ciPb81pXaFmY0srbgWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LXoNgjtftUefy9vby4jpUGAauNCaPzG08bf4yTTSMLn1CbCFqc2ivrMwLbLKVaznW XcICKI7kaWLJU3b49EluVTx4qZvNkTBc7qo6hPwX/tsvWqDaBCPxNRGZ1h9bRMkNPy /9Cp97vE9gN4YeELoi7K+vw5WhkhLhqCnGPeaumwAyl+wwPSBy8Sv+sYczM0120wUF LWBAwmnJ+2ogTS0fJGDfZ6GZn7htgwG/semfqX9GCUZp8jwdeWV1N4nMsGcgRUB8vS bMrQO6xbku8q50eHQXZyPzLfzoNdp6l3Oz4k60t2pic+1mhsBCOL8ReH3QARcQnJra +nApMy0hXyTCg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 3BC19CE0F7B; Thu, 30 Jul 2026 17:40:21 -0700 (PDT) From: "Paul E. McKenney" To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner Cc: "Peter Zijlstra (Intel)" , linux-kernel@vger.kernel.org, kernel-team@meta.com, "Paul E. McKenney" , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak Subject: [PATCH RFC 3/9] wait: Use accessor for hrtimer_sleeper ->task field Date: Thu, 30 Jul 2026 17:40:13 -0700 Message-Id: <20260731004019.3530210-3-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The hrtimer_sleeper structure's ->task field is used as a flag to indicate that the associated hrtimer has expired. This means that the hrtimer handler can be storing to this field while other code is loading from it to check for expiry. Note that additional races appear for hrtimers that can be restarted, which could be argued to be a user error. However, that is no reason to let the compiler introduce additional confusion, and to this end, the hrtimer_sleeper_task_get() was introduced, use of which also has the benefit of avoiding open-code access to hrtimer_sleeper innards. Therefore, apply this accessor to the __wait_event_hrtimeout() macro. KCSAN located this issue. Signed-off-by: Paul E. McKenney Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Juri Lelli Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Steven Rostedt Cc: Ben Segall Cc: Mel Gorman Cc: Valentin Schneider Cc: K Prateek Nayak Cc: Anna-Maria Behnsen Cc: Frederic Weisbecker Cc: Thomas Gleixner --- include/linux/wait.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/wait.h b/include/linux/wait.h index dce055e6add390..00cdce75837e72 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -556,7 +556,7 @@ do { \ } \ \ __ret = ___wait_event(wq_head, condition, state, 0, 0, \ - if (!__t.task) { \ + if (!hrtimer_sleeper_task_get(&__t)) { \ __ret = -ETIME; \ break; \ } \ -- 2.40.1