dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/probe-helper: reschedule output poll immediately if a delayed event is pending
Date: Fri, 04 Dec 2026 11:25:10 +0000	[thread overview]
Message-ID: <sashiko-outbox-249670@kernel.org> (raw)
In-Reply-To: <20261204-drm-output-poll-10s-fix-v1-1-46fa0816517b@bootlin.com>

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 <luca.ceresoli@bootlin.com>

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_probe_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)
>  	}
>  
>  	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_event
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 = 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.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-drm-output-poll-10s-fix-v1-1-46fa0816517b@bootlin.com?part=1

      reply	other threads:[~2026-12-04 11:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 11:07 [PATCH] drm/probe-helper: reschedule output poll immediately if a delayed event is pending Luca Ceresoli
2026-12-04 11:25 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-249670@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox