Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yadav, Arvind" <arvind.yadav@intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>, <matthew.brost@intel.com>,
	<himal.prasad.ghimiray@intel.com>,
	<thomas.hellstrom@linux.intel.com>
Subject: Re: [PATCH 12/13] drm/xe: Skip PM notifier preparation for wedged devices
Date: Tue, 1 Sep 2026 12:33:24 +0530	[thread overview]
Message-ID: <c69906b7-e72b-4ee1-ad90-19b039b57b36@intel.com> (raw)
In-Reply-To: <apXrVcABmFQbBQOX@intel.com>


On 01-09-2026 02:30, Rodrigo Vivi wrote:
> On Thu, Aug 27, 2026 at 03:48:00PM +0530, Arvind Yadav wrote:
>> The system PM notifier runs before the PCI suspend callback and may evict
>> BOs or submit migration work. This work must not start after the device
>> has been declared wedged.
>>
>> Skip PM preparation for a wedged device. Track whether preparation ran
>> so the post callback only performs matching cleanup and releases the
>> runtime PM reference when needed.
>>
>> Cc: Matthew Brost <matthew.brost@intel.com>
>> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>> Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> Assisted-by: Claude:claude-opus-4-8
>> Signed-off-by: Arvind Yadav <arvind.yadav@intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_device_types.h |  2 ++
>>   drivers/gpu/drm/xe/xe_pm.c           | 10 ++++++++++
>>   2 files changed, 12 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
>> index 508ba3872e72..c9dc417878e7 100644
>> --- a/drivers/gpu/drm/xe/xe_device_types.h
>> +++ b/drivers/gpu/drm/xe/xe_device_types.h
>> @@ -471,6 +471,8 @@ struct xe_device {
>>   
>>   	/** @pm_notifier: Our PM notifier to perform actions in response to various PM events. */
>>   	struct notifier_block pm_notifier;
>> +	/** @pm_notifier_active: PM notifier prepare work was performed */
>> +	bool pm_notifier_active;
>>   	/** @pm_block: Completion to block validating tasks on suspend / hibernate prepare */
>>   	struct completion pm_block;
>>   	/** @rebind_resume_list: List of wq items to kick on resume. */
>> diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
>> index 720e083cd279..dd7fd170bc94 100644
>> --- a/drivers/gpu/drm/xe/xe_pm.c
>> +++ b/drivers/gpu/drm/xe/xe_pm.c
>> @@ -457,9 +457,14 @@ static int xe_pm_notifier_callback(struct notifier_block *nb,
>>   	{
>>   		struct xe_validation_ctx ctx;
>>   
>> +		/* Do not start PM preparation after a wedge is declared. */
>> +		if (xe_device_wedged(xe))
>> +			break;
> perhaps we need to return NOTIFY_BAD ?!


Thanks for the review.
I do not think `NOTIFY_BAD` is needed here. A permanently wedged device 
should not prevent system suspend.
pm_notifier_call_chain_robust() passes the notifier result to 
notifier_to_errno(). NOTIFY_BAD becomes -EPERM, which will aborts system 
suspend.

~Arvind

>
>> +
>>   		reinit_completion(&xe->pm_block);
>>   		xe_pm_block_begin_signalling();
>>   		xe_pm_runtime_get(xe);
>> +		xe->pm_notifier_active = true;
>>   		(void)xe_validation_ctx_init(&ctx, &xe->val, NULL,
>>   					     (struct xe_val_flags) {.exclusive = true});
>>   		err = xe_bo_evict_all_user(xe);
>> @@ -480,6 +485,11 @@ static int xe_pm_notifier_callback(struct notifier_block *nb,
>>   	}
>>   	case PM_POST_HIBERNATION:
>>   	case PM_POST_SUSPEND:
>> +		if (!xe->pm_notifier_active)
>> +			break;
>> +
>> +		xe->pm_notifier_active = false;
>> +
>>   		complete_all(&xe->pm_block);
>>   		xe_pm_wake_rebind_workers(xe);
>>   		xe_bo_notifier_unprepare_all_pinned(xe);
>> -- 
>> 2.43.0
>>

  reply	other threads:[~2026-09-01  7:03 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27 10:17 [PATCH 00/13] drm/xe: Isolate wedged devices from hardware access Arvind Yadav
2026-08-27 10:17 ` [PATCH 01/13] drm/xe/irq: Always free requested IRQs on uninstall Arvind Yadav
2026-08-27 10:39   ` Ghimiray, Himal Prasad
2026-08-31 20:30     ` Rodrigo Vivi
2026-08-27 10:17 ` [PATCH 02/13] drm/xe: Separate AER reset state from device wedging Arvind Yadav
2026-08-27 10:36   ` sashiko-bot
2026-08-27 21:55   ` Andi Shyti
2026-08-28  3:32     ` Yadav, Arvind
2026-08-28 11:36   ` [PATCH 2/13] " Raag Jadav
2026-08-27 10:17 ` [PATCH 03/13] drm/xe: Drop queued page faults when device I/O is blocked Arvind Yadav
2026-08-31 20:43   ` Rodrigo Vivi
2026-08-27 10:17 ` [PATCH 04/13] drm/xe: Stop VM work " Arvind Yadav
2026-08-31 20:55   ` Rodrigo Vivi
2026-08-27 10:17 ` [PATCH 05/13] drm/xe: Send wedged notification from a worker Arvind Yadav
2026-08-27 22:12   ` Andi Shyti
2026-08-28  3:39     ` Yadav, Arvind
2026-08-27 10:17 ` [PATCH 06/13] drm/xe: Reuse one dummy page per BO after wedge Arvind Yadav
2026-08-27 10:30   ` sashiko-bot
2026-08-27 10:17 ` [PATCH 07/13] drm/xe: Invalidate existing VRAM mappings on wedge Arvind Yadav
2026-08-27 10:17 ` [PATCH 08/13] drm/xe/irq: Serialize IRQ suspend and resume Arvind Yadav
2026-08-31 21:06   ` Rodrigo Vivi
2026-08-27 10:17 ` [PATCH 09/13] drm/xe: Isolate a wedged device before notifying userspace Arvind Yadav
2026-08-27 10:35   ` sashiko-bot
2026-08-27 10:17 ` [PATCH 10/13] drm/xe/ttm: Reject VRAM allocations on wedged devices Arvind Yadav
2026-08-31 21:03   ` Rodrigo Vivi
2026-09-01  8:19     ` Yadav, Arvind
2026-08-27 10:17 ` [PATCH 11/13] drm/xe/guc: Skip timeout recovery on a wedged device Arvind Yadav
2026-08-31 21:01   ` Rodrigo Vivi
2026-08-27 10:18 ` [PATCH 12/13] drm/xe: Skip PM notifier preparation for wedged devices Arvind Yadav
2026-08-31 21:00   ` Rodrigo Vivi
2026-09-01  7:03     ` Yadav, Arvind [this message]
2026-08-27 10:18 ` [PATCH 13/13] drm/xe: Block BO VM access when device I/O is unavailable Arvind Yadav
2026-08-27 10:30   ` sashiko-bot
2026-08-27 10:24 ` ✗ CI.checkpatch: warning for drm/xe: Isolate wedged devices from hardware access Patchwork
2026-08-27 10:26 ` ✓ CI.KUnit: success " Patchwork
2026-08-27 11:03 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-27 12:16 ` ✓ Xe.CI.FULL: " 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=c69906b7-e72b-4ee1-ad90-19b039b57b36@intel.com \
    --to=arvind.yadav@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=thomas.hellstrom@linux.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