Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Krzysztof Karas <krzysztof.karas@intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: Andi Shyti <andi.shyti@linux.intel.com>,
	Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>,
	Sebastian Brzezinka <sebastian.brzezinka@intel.com>,
	Krzysztof Niemiec <krzysztof.niemiec@intel.com>,
	Krzysztof Karas <krzysztof.karas@intel.com>
Subject: Re: [PATCH] drm/i915/gt: Do not destroy uninitialized timer
Date: Tue, 29 Sep 2026 14:19:50 +0300	[thread overview]
Message-ID: <6fe898848efe8a91c7794d5c461fe34b98fec683@intel.com> (raw)
In-Reply-To: <20260929111259.2359138-1-krzysztof.karas@intel.com>

On Tue, 29 Sep 2026, Krzysztof Karas <krzysztof.karas@intel.com> wrote:
> If intel_ring_begin() fails in live_emit_pte_full_ring(), then
> cleanup is performed on an uninitialized timer.
>
> Check if the timer has been set up, before trying to remove it.
>
> Assisted-by: Copilot-Claude-Opus-5
> Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/selftest_migrate.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/selftest_migrate.c b/drivers/gpu/drm/i915/gt/selftest_migrate.c
> index 5b986a7687d9..6793ba028146 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_migrate.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_migrate.c
> @@ -552,6 +552,7 @@ static int live_emit_pte_full_ring(void *arg)
>  	struct intel_context *ce;
>  	struct i915_request *rq, *prev;
>  	struct spinner_timer st;
> +	bool timer_set = false;
>  	struct sgt_dma it;
>  	int len, sz, err;
>  	u32 *cs;
> @@ -641,6 +642,7 @@ static int live_emit_pte_full_ring(void *arg)
>  
>  	timer_setup_on_stack(&st.timer, spinner_kill, 0);
>  	mod_timer(&st.timer, jiffies + 2 * HZ);
> +	timer_set = true;
>  
>  	/*
>  	 * This should wait for the spinner to be killed, otherwise we should go
> @@ -660,8 +662,10 @@ static int live_emit_pte_full_ring(void *arg)
>  
>  out_rq:
>  	i915_request_add(rq); /* GEM_BUG_ON(rq->reserved_space > ring->space)? */
> -	timer_delete_sync(&st.timer);
> -	timer_destroy_on_stack(&st.timer);
> +	if (timer_set) {
> +		timer_delete_sync(&st.timer);
> +		timer_destroy_on_stack(&st.timer);
> +	}

Usually you'd have separate goto labels for the cleanup you do. Like, we
have "out_unpin" for when "out_rq" is not needed. We should have one for
timer cleanup as well.

BR,
Jani.

>  out_unpin:
>  	intel_context_unpin(ce);
>  out_put:

-- 
Jani Nikula, Intel

  reply	other threads:[~2026-09-29 11:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 11:12 [PATCH] drm/i915/gt: Do not destroy uninitialized timer Krzysztof Karas
2026-09-29 11:19 ` Jani Nikula [this message]
2026-09-29 11:42 ` Sebastian Brzezinka
2026-09-29 12:43   ` Jani Nikula
2026-09-29 13:26 ` ✓ i915.CI.BAT: success for " Patchwork
2026-09-29 16:58 ` ✗ i915.CI.Full: failure " Patchwork

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=6fe898848efe8a91c7794d5c461fe34b98fec683@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=andi.shyti@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=janusz.krzysztofik@linux.intel.com \
    --cc=krzysztof.karas@intel.com \
    --cc=krzysztof.niemiec@intel.com \
    --cc=sebastian.brzezinka@intel.com \
    /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