From: sashiko-bot@kernel.org
To: "Vinod Govindapillai" <vinod.govindapillai@intel.com>
Cc: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v5 03/10] drm/xe/pm: avoid reclaim when arming PME wakeup
Date: Fri, 11 Sep 2026 08:22:28 +0000 [thread overview]
Message-ID: <20260911082228.D4F351F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260911080448.778316-4-vinod.govindapillai@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Misuse of Memory Allocator API: using memalloc_noreclaim_save() improperly grants emergency memory reserves to ACPI methods.
--
commit 7547491908f27fd6d8049619891faf97cc3918e3
Author: Vinod Govindapillai <vinod.govindapillai@intel.com>
drm/xe/pm: avoid reclaim when arming PME wakeup
This commit wraps calls to pci_enable_wake() with memalloc_noreclaim_save()
and memalloc_noreclaim_restore() in xe_pci_runtime_suspend(). The goal is to
avoid deadlocks with the xe_shrinker by preventing allocations from entering
reclaim while holding the runtime PM lock.
> diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> index 9b486e8ad2b5c..4369f0d9efb1e 100644
> --- a/drivers/gpu/drm/xe/xe_pci.c
> +++ b/drivers/gpu/drm/xe/xe_pci.c
> @@ -1384,10 +1384,13 @@ static int xe_pci_runtime_suspend(struct device *dev)
> {
> struct pci_dev *pdev = to_pci_dev(dev);
> struct xe_device *xe = pdev_to_xe_device(pdev);
> + unsigned int flags;
> int err;
>
> + flags = memalloc_noreclaim_save();
> xe->pme.enabled = xe->pme.capable && !xe->d3cold.allowed &&
> pci_enable_wake(pdev, PCI_D3hot, true) == 0;
> + memalloc_noreclaim_restore(flags);
[Severity: Medium]
Could this use of memalloc_noreclaim_save() improperly grant emergency memory
reserves to ACPI methods?
Using memalloc_noreclaim_save() sets the PF_MEMALLOC flag for the current
task, which grants allocations access to the ALLOC_NO_WATERMARKS emergency
memory reserves. These reserves are strictly intended for tasks that are
actively freeing memory to guarantee forward progress.
Since ACPI methods inside pci_enable_wake() can perform arbitrary evaluation
and allocation, granting them emergency reserves risks depleting these
reserves.
To avoid the deadlock with xe_shrinker without abusing PF_MEMALLOC, would it
be safer to use memalloc_nofs_save() instead?
Stripping __GFP_FS causes can_backup to be false in xe_shrinker_scan(), which
makes the shrinker exit early without attempting to acquire the runtime PM
lock.
>
> /*
> * We hold an additional reference to the runtime PM to keep PF in D0
> @@ -1401,7 +1404,9 @@ static int xe_pci_runtime_suspend(struct device *dev)
> err = xe_pm_runtime_suspend(xe);
> if (err) {
> if (xe->pme.enabled) {
> + flags = memalloc_noreclaim_save();
> pci_enable_wake(pdev, PCI_D3hot, false);
> + memalloc_noreclaim_restore(flags);
[Severity: Medium]
Does this error path have the same issue with granting emergency memory
reserves to pci_enable_wake() via memalloc_noreclaim_save() as mentioned
above?
> xe->pme.enabled = false;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260911080448.778316-1-vinod.govindapillai@intel.com?part=3
next prev parent reply other threads:[~2026-09-11 8:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 8:04 [PATCH v5 00/10] pm_pme support on display hotplug Vinod Govindapillai
2026-09-11 8:04 ` [PATCH v5 01/10] drm/xe/pm: initialize the device's system wakeup capabilities Vinod Govindapillai
2026-09-11 8:04 ` [PATCH v5 02/10] drm/xe/pm: introduce PM PME support Vinod Govindapillai
2026-09-11 8:04 ` [PATCH v5 03/10] drm/xe/pm: avoid reclaim when arming PME wakeup Vinod Govindapillai
2026-09-11 8:22 ` sashiko-bot [this message]
2026-09-11 8:04 ` [PATCH v5 04/10] drm/i915: add pme_enabled() to the parent interface Vinod Govindapillai
2026-09-11 8:04 ` [PATCH v5 05/10] drm/i915/xe: plug the pme_enabed implementation for xe Vinod Govindapillai
2026-09-11 8:04 ` [PATCH v5 06/10] drm/i915/hotplug: add helpers to track HPDs can generate PME Vinod Govindapillai
2026-09-11 13:00 ` Jani Nikula
2026-09-11 15:36 ` Govindapillai, Vinod
2026-09-11 8:04 ` [PATCH v5 07/10] drm/i915: plug the pm runtime handlers with PME HPD handling Vinod Govindapillai
2026-09-11 8:04 ` [PATCH v5 08/10] drm/xe/pm: clear PME HPD flag on runtime suspend error handler Vinod Govindapillai
2026-09-11 8:20 ` sashiko-bot
2026-09-11 8:04 ` [PATCH v5 09/10] drm/i915/irq: conditional HPD IRQ resets based on PME capability Vinod Govindapillai
2026-09-11 8:27 ` sashiko-bot
2026-09-11 8:04 ` [PATCH v5 10/10] drm/i915/hotplug: avoid HPD polling if the device is PME capable Vinod Govindapillai
2026-09-11 8:34 ` sashiko-bot
2026-09-11 9:19 ` ✓ i915.CI.BAT: success for pm_pme support on display hotplug (rev5) Patchwork
2026-09-12 5:04 ` ✗ 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=20260911082228.D4F351F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vinod.govindapillai@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