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 7BFFB156C6A; Sat, 19 Sep 2026 00:14:31 +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=1789776873; cv=none; b=J6dynlLecBt9TgKGjht5piZxvWL/0AzPLL1a3s7DTcvJQUFqI4Dp1Kmwn9SFyWyEReNclg/3JLaujHoWazMFtnhBm1m5bmZEvENv3axB+SriJtC95LFpfQzSfQuo+seIW9Ef1HPyfoF1pLjOhx5uVCMEDUX60ncPrBytu8+Dfe0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789776873; c=relaxed/simple; bh=v+ZaxiWnoeOv5V1TUsSJCEIwiuynh2GEfQw75nHBCPg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=t/rUX4gQYfHDUFzKkPt1blViZa+wMp0IRiRftIoT1vxWWzqzoR41m8f6DbF+3X0NInHGsCoSj6aFYloieieqmA20FFLeRmFNgR+77KA9+K1A6J7CeO64xrvZfZJGamv5nQK/0fcKYKciVIP1Yw1DaVXxE5S5w3gr/EfzwxVYBN4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jIgIWE7k; 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="jIgIWE7k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 296C11F0089D; Sat, 19 Sep 2026 00:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789776871; bh=nrf4PVA632AohFceVt31TLXePWhHXHnaJl6XXJyTHyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jIgIWE7k+IFqTPqk+PY0hieYs1SkOr8XSkPbd6KxPLzZeKZcumqn+c4ipEUgzpACu 28cU7Wyz90ofHiyL1/zvg3rsRutr47K5QB2F5PDrSFDBjNazhHZnsaKS1/SEUfsk5r HT5HQKoPVOXp34FSpngGM5GhH/6nxXVeoLE0gKRuPGB2JUsmLVnEO67GSEZcxV5mpt 5rjvIZGs06SutHmWJP5nVDxZz2dCc+++uREOfpeAN94RpTf4C+Di2agYKSlxc5R4iP yaxNMX5jR5oYE6EfCAA3NZOplzcwn91MGBYx6pIpi0v2+wbbcbBlvlCBXzvSncPMGa n31krMUnRukoA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id D3B49CE17C1; Fri, 18 Sep 2026 17:14:30 -0700 (PDT) From: "Paul E. McKenney" To: Anna-Maria Behnsen , Frederic Weisbecker , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, netdev@vger.kernel.org, kernel-team@meta.com, "Paul E. McKenney" , Jens Axboe Subject: [PATCH 04/12] io-uring/rw: Use accessor for hrtimer_sleeper ->task field Date: Fri, 18 Sep 2026 17:14:20 -0700 Message-Id: <20260919001428.3133388-4-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <5dca353c-6b3f-4d01-8808-bef2c0dd7af7@paulmck-laptop> References: <5dca353c-6b3f-4d01-8808-bef2c0dd7af7@paulmck-laptop> 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 io_hybrid_iopoll_delay() function. KCSAN located this issue. Signed-off-by: Paul E. McKenney Cc: Jens Axboe Cc: Anna-Maria Behnsen Cc: Frederic Weisbecker Cc: Thomas Gleixner Cc: Cc: Cc: Cc: --- io_uring/rw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_uring/rw.c b/io_uring/rw.c index 95106dd1d7eb..3f4cbdb8b2be 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -1285,7 +1285,7 @@ static u64 io_hybrid_iopoll_delay(struct io_ring_ctx *ctx, struct io_kiocb *req) set_current_state(TASK_INTERRUPTIBLE); hrtimer_sleeper_start_expires(&timer, mode); - if (timer.task) + if (hrtimer_sleeper_task_get(&timer)) io_schedule(); hrtimer_cancel(&timer.timer); -- 2.40.1