Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
To: Andi Shyti <andi.shyti@kernel.org>,
	Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Cc: <intel-gfx@lists.freedesktop.org>, <andi.shyti@linux.intel.com>,
	<krzysztof.karas@intel.com>, <krzysztof.niemiec@intel.com>,
	<chris.p.wilson@intel.com>
Subject: Re: [PATCH] drm/i915/selftests: Fix unlocked mm.stolen in reset selftest
Date: Thu, 27 Aug 2026 10:39:47 +0200	[thread overview]
Message-ID: <DKZLAJT619PA.2D39BHW4MUAIT@intel.com> (raw)
In-Reply-To: <ao8a-Y4re7PRKjIr@zenone.zhora.eu>

Hi Andi,

On Wed Aug 26, 2026 at 7:31 PM CEST, Andi Shyti wrote:
> Hi Sebastian,
>
> Have you checked sashiko's reviews? They look valid to me.
>
I checked, and there are already existing issues, probably wrth fixing,
but they're outside the scope of this patch.

> ...
>
>> @@ -95,9 +96,12 @@ __igt_reset_stolen(struct intel_gt *gt,
>>  				      ggtt->error_capture.start,
>>  				      PAGE_SIZE);
>>  
>> -		if (!__drm_mm_interval_first(&gt->i915->mm.stolen,
>> -					     page << PAGE_SHIFT,
>> -					     ((page + 1) << PAGE_SHIFT) - 1))
>> +		mutex_lock(&gt->i915->mm.stolen_lock);
>> +		unused = !__drm_mm_interval_first(&gt->i915->mm.stolen,
>> +						  page << PAGE_SHIFT,
>> +						  ((page + 1) << PAGE_SHIFT) - 1);
>> +		mutex_unlock(&gt->i915->mm.stolen_lock);
>> +		if (unused)
>
> this is always false.
Nothing really changes here, even if the if statement is always false,
we still need to guarantee safe access.

>
>>  			memset_io(s, STACK_MAGIC, PAGE_SIZE);
>
> And this needs to be inside the lock.
I don't really understand why, could you tell me more please?

>
>>  
>>  		in = (void __force *)s;
>> @@ -143,10 +147,12 @@ __igt_reset_stolen(struct intel_gt *gt,
>>  			in = tmp;
>>  		x = crc32_le(0, in, PAGE_SIZE);
>>  
>> -		if (x != crc[page] &&
>> -		    !__drm_mm_interval_first(&gt->i915->mm.stolen,
>> -					     page << PAGE_SHIFT,
>> -					     ((page + 1) << PAGE_SHIFT) - 1)) {
>> +		mutex_lock(&gt->i915->mm.stolen_lock);
>> +		unused = !__drm_mm_interval_first(&gt->i915->mm.stolen,
>> +						  page << PAGE_SHIFT,
>> +						  ((page + 1) << PAGE_SHIFT) - 1);
>> +		mutex_unlock(&gt->i915->mm.stolen_lock);
>> +		if (x != crc[page] && unused) {
>
> this is also always false and besides it needs to be included
> inside the locks.
Same here.

-- 
Best regards,
Sebastian


  reply	other threads:[~2026-08-27  8:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 13:40 [PATCH] drm/i915/selftests: Fix unlocked mm.stolen in reset selftest Sebastian Brzezinka
2026-08-21 13:48 ` sashiko-bot
2026-08-21 14:36 ` ✓ i915.CI.BAT: success for " Patchwork
2026-08-21 18:19 ` ✗ i915.CI.Full: failure " Patchwork
2026-08-25 16:29 ` ✓ i915.CI.BAT: success for drm/i915/selftests: Fix unlocked mm.stolen in reset selftest (rev2) Patchwork
2026-08-25 19:36 ` ✗ i915.CI.Full: failure " Patchwork
2026-08-26  8:49 ` [PATCH] drm/i915/selftests: Fix unlocked mm.stolen in reset selftest Krzysztof Karas
2026-08-26  9:11   ` Sebastian Brzezinka
2026-08-26 17:31 ` Andi Shyti
2026-08-27  8:39   ` Sebastian Brzezinka [this message]
2026-08-27 23:17     ` Andi Shyti

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=DKZLAJT619PA.2D39BHW4MUAIT@intel.com \
    --to=sebastian.brzezinka@intel.com \
    --cc=andi.shyti@kernel.org \
    --cc=andi.shyti@linux.intel.com \
    --cc=chris.p.wilson@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=krzysztof.karas@intel.com \
    --cc=krzysztof.niemiec@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