From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9E85606A32C for ; Fri, 4 Dec 2026 11:25:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jshmSK/f Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4D8D6112F03; Fri, 4 Dec 2026 11:25:17 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5DE8F112EFA for ; Fri, 4 Dec 2026 11:25:11 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 263FA41AA6; Fri, 4 Dec 2026 11:25:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC8571F00897; Fri, 4 Dec 2026 11:25:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796383511; bh=MnTbCj3oJC9xsIDbbNUdS2P9ulOSsIcc1bOwNXao9+Q=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=jshmSK/fywOFoKld4HKtVbCK++L1NtSRkTHg4NYNVjVcCJZxPGEU0V4euLFjKd9UE Y1j5ehmuzaIpbykMDhUyc5APxTxxcrl2XsSiqO8o9ebvEGi+muMTdrwG4DwAeCRXfc cvKKaSxwGeEkooWkgcxQTvDOv1uyjZ84Mh4z4Zmisl4fG9MAtneEEvdTVn+9Jqflh5 2jCd5syKQtYiHCRe9MVvK0O6Gle8VzUHlJLzeBeWSSQ51Oe7m5SDGtP3PFH2qekIhG 3uv8ZC5+7DJyyZwZeXQvlTMpQw0dDJtkLug5BXFU8O2yFfbwUHaZ9pfx6YAvPIQFVW HVjBEUGPAw20Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] drm/probe-helper: reschedule output poll immediately if a delayed event is pending To: "Luca Ceresoli" Cc: dri-devel@lists.freedesktop.org In-Reply-To: <20261204-drm-output-poll-10s-fix-v1-1-46fa0816517b@bootlin.com> References: <20261204-drm-output-poll-10s-fix-v1-1-46fa0816517b@bootlin.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 11:25:10 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] drm/probe-helper: data race on delayed_event in output_poll_execute() -- commit 3590d56e25fc2268f6037c709a9c3de88bf75348 Author: Luca Ceresoli drm/probe-helper: reschedule output poll immediately if a delayed event is = pending This commit changes output_poll_execute() to reschedule after 10 ms instead= of DRM_OUTPUT_POLL_PERIOD when mutex_trylock() fails and dev->mode_config.delayed_event is set. > diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_pro= be_helper.c > index 856b40fdaac4a..fb93ae6f70e97 100644 > --- a/drivers/gpu/drm/drm_probe_helper.c > +++ b/drivers/gpu/drm/drm_probe_helper.c > @@ -797,7 +797,13 @@ static void output_poll_execute(struct work_struct *= work) > } > =20 > if (!mutex_trylock(&dev->mode_config.mutex)) { > - schedule_delayed_work(delayed_work, DRM_OUTPUT_POLL_PERIOD); > + /* > + * Cannot get the lock: reschedule after the default > + * interval, or "very soon" if a delayed event is pending > + */ > + schedule_delayed_work(delayed_work, > + dev->mode_config.delayed_event ? > + msecs_to_jiffies(10) : DRM_OUTPUT_POLL_PERIOD); > return; > } [Severity: Low] Does this unlocked read of dev->mode_config.delayed_event introduce a data race? All writers update the plain bool dev->mode_config.delayed_event under dev->mode_config.mutex with plain stores. Because this branch runs while another thread holds that mutex, output_poll_execute() can read delayed_eve= nt concurrently with drm_helper_probe_single_connector_modes() setting it: CPU0 CPU1 status_store() mutex_lock(&mode_config.mutex) ... drm_helper_probe_single_connector_modes() output_poll_execute() !mutex_trylock(&mode_config.mutex) mode_config.delayed_event =3D true read mode_config.delayed_event <-- data race This unmarked concurrent access triggers KCSAN reports under CONFIG_KCSAN. Using READ_ONCE() here, paired with WRITE_ONCE() on the writes in drm_helper_probe_single_connector_modes() and output_poll_execute(), would keep this lockless check race-free. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204-drm-output= -poll-10s-fix-v1-1-46fa0816517b@bootlin.com?part=3D1