All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Philipp Stanner" <phasta@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [RFC PATCH 2/2] drm/i915: Adjust to RCU-less fence
Date: Tue, 08 Sep 2026 11:21:07 +0000	[thread overview]
Message-ID: <20260908112107.E4B311F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260908105926.1120378-3-phasta@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Leftover `rcu_dereference()` calls on local stack arrays after removing `rcu_read_lock()`, causing compile errors and lockdep warnings.
--

commit 19905da799945ee74ece58c7907776bf754a26d6
Author: Philipp Stanner <phasta@kernel.org>

drm/i915: Adjust to RCU-less fence

This commit adjusts the i915 driver to accommodate changes in dma_fence 
that allow for handling fences without relying on RCU functionality.

> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_requests.c b/drivers/gpu/drm/i915/gt/intel_gt_requests.c
> index 93298820bee2c..724c4359f6884 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_requests.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_requests.c
> @@ -238,6 +238,8 @@ void intel_gt_fini_requests(struct intel_gt *gt)
>  
>  void intel_gt_watchdog_work(struct work_struct *work)
>  {
> +	char driver[64] = "";
> +	char timeline[64] = "";
>  	struct intel_gt *gt =
>  		container_of(work, typeof(*gt), watchdog.work);
>  	struct i915_request *rq, *rn;
> @@ -250,17 +252,13 @@ void intel_gt_watchdog_work(struct work_struct *work)
>  	llist_for_each_entry_safe(rq, rn, first, watchdog.link) {
>  		if (!i915_request_completed(rq)) {
>  			struct dma_fence *f = &rq->fence;
> -			const char __rcu *timeline;
> -			const char __rcu *driver;
>  
> -			rcu_read_lock();
> -			driver = dma_fence_driver_name(f);
> -			timeline = dma_fence_timeline_name(f);
> +			dma_fence_driver_name(f, driver, 64);
> +			dma_fence_timeline_name(f, timeline, 64);
>  			pr_notice("Fence expiration time out i915-%s:%s:%llx!\n",
>  				  rcu_dereference(driver),
>  				  rcu_dereference(timeline),

[Severity: Low]
Does this cause a compilation error? The patch changes the driver and timeline
variables to be local stack arrays, but rcu_dereference() expects a scalar
pointer, not a character array.

Additionally, if it does compile, could this trigger a lockdep warning since 
rcu_read_lock() was removed from this function?

>  				  f->seqno);
> -			rcu_read_unlock();
>  			i915_request_cancel(rq, -EINTR);
>  		}
>  		i915_request_put(rq);

[ ... ]

> diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
> index d2c7b1090df08..2a3df13217b94 100644
> --- a/drivers/gpu/drm/i915/i915_request.c
> +++ b/drivers/gpu/drm/i915/i915_request.c
> @@ -2185,7 +2185,7 @@ void i915_request_show(struct drm_printer *m,
>  		       const char *prefix,
>  		       int indent)
>  {
> -	const char __rcu *timeline;
> +	char timeline[64] = "";
>  	char buf[80] = "";
>  	int x = 0;
>  
> @@ -2221,8 +2221,7 @@ void i915_request_show(struct drm_printer *m,
>  
>  	x = print_sched_attr(&rq->sched.attr, buf, x, sizeof(buf));
>  
> -	rcu_read_lock();
> -	timeline = dma_fence_timeline_name((struct dma_fence *)&rq->fence);
> +	dma_fence_timeline_name((struct dma_fence *)&rq->fence, timeline, 64);
>  	drm_printf(m, "%s%.*s%c %llx:%lld%s%s %s @ %dms: %s\n",
>  		   prefix, indent, "                ",
>  		   queue_status(rq),
> @@ -2232,7 +2231,6 @@ void i915_request_show(struct drm_printer *m,
>  		   buf,
>  		   jiffies_to_msecs(jiffies - rq->emitted_jiffies),
>  		   rcu_dereference(timeline));

[Severity: Low]
Similar to intel_gt_watchdog_work() above, is it safe to keep the
rcu_dereference() call wrapped around the timeline character array here now
that it is stack allocated and rcu_read_lock() is no longer held?

> -	rcu_read_unlock();
>  }
>  
>  static bool engine_match_ring(struct intel_engine_cs *engine, struct i915_request *rq)

[ ... ]

> diff --git a/drivers/gpu/drm/i915/i915_sw_fence.c b/drivers/gpu/drm/i915/i915_sw_fence.c
> index f24f616e23ee6..d0e733beff863 100644
> --- a/drivers/gpu/drm/i915/i915_sw_fence.c
> +++ b/drivers/gpu/drm/i915/i915_sw_fence.c
> @@ -427,25 +427,23 @@ static void dma_i915_sw_fence_wake(struct dma_fence *dma,
>  
>  static void timer_i915_sw_fence_wake(struct timer_list *t)
>  {
> +	char driver[64] = "";
> +	char timeline[64] = "";
>  	struct i915_sw_dma_fence_cb_timer *cb = timer_container_of(cb, t,
>  								   timer);
>  	struct i915_sw_fence *fence;
> -	const char __rcu *timeline;
> -	const char __rcu *driver;
>  
>  	fence = xchg(&cb->base.fence, NULL);
>  	if (!fence)
>  		return;
>  
> -	rcu_read_lock();
> -	driver = dma_fence_driver_name(cb->dma);
> -	timeline = dma_fence_timeline_name(cb->dma);
> +	dma_fence_driver_name(cb->dma, driver, 64);
> +	dma_fence_timeline_name(cb->dma, timeline, 64);
>  	pr_notice("Asynchronous wait on fence %s:%s:%llx timed out (hint:%ps)\n",
>  		  rcu_dereference(driver),
>  		  rcu_dereference(timeline),

[Severity: Low]
Does this code also suffer from the same issue? The rcu_dereference() macro is 
still being applied to the driver and timeline stack arrays after 
rcu_read_lock() was removed.

>  		  cb->dma->seqno,
>  		  i915_sw_fence_debug_hint(fence));
> -	rcu_read_unlock();
>  
>  	i915_sw_fence_set_error_once(fence, -ETIMEDOUT);
>  	i915_sw_fence_complete(fence);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260908105926.1120378-2-phasta@kernel.org?part=2

  reply	other threads:[~2026-09-08 11:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 10:59 [RFC PATCH 1/2] dma-fence: Solve dma_fence's problems with additional spinlock Philipp Stanner
2026-09-08 10:59 ` [RFC PATCH 2/2] drm/i915: Adjust to RCU-less fence Philipp Stanner
2026-09-08 11:21   ` sashiko-bot [this message]
2026-09-08 11:12 ` [RFC PATCH 1/2] dma-fence: Solve dma_fence's problems with additional spinlock sashiko-bot

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=20260908112107.E4B311F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=phasta@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.