From: Lucas De Marchi <lucas.demarchi@intel.com>
To: <intel-xe@lists.freedesktop.org>
Subject: [PATCH v2 01/11] drivers: base: devres: Allow to release group on device release
Date: Fri, 21 Feb 2025 16:10:41 -0800 [thread overview]
Message-ID: <20250222001051.3012936-2-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20250222001051.3012936-1-lucas.demarchi@intel.com>
When releasing a device, if the release action causes a group to be
released, a warning is emitted because it can't find the group. This
happens because devres_release_all() moves the entire list to a todo
list and also move the group markers. Considering r* normal resource
nodes and g1 a group resource node:
g1 -----------.
v v
r1 -> r2 -> g1[0] -> r3-> g[1] -> r4
After devres_release_all(), dev->devres_head becomes empty and the todo
list it iterates on becomes:
g1
v
r1 -> r2 -> r3-> r4 -> g1[0]
When a call to component_del() is made and takes down the aggregate
device, a warning like this happen:
RIP: 0010:devres_release_group+0x362/0x530
...
Call Trace:
<TASK>
component_unbind+0x156/0x380
component_unbind_all+0x1d0/0x270
mei_component_master_unbind+0x28/0x80 [mei_hdcp]
take_down_aggregate_device+0xc1/0x160
component_del+0x1c6/0x3e0
intel_hdcp_component_fini+0xf1/0x170 [xe]
xe_display_fini+0x1e/0x40 [xe]
Because the devres group corresponding to the hdcp component cannot be
found. Just ignore this corner case: if the dev->devres_head is empty
and the caller is trying to remove a group, it's likely in the process
of device cleanup so just ignore it instead of warning.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
drivers/base/devres.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/base/devres.c b/drivers/base/devres.c
index 93e7779ef21e8..b955a2f9520bf 100644
--- a/drivers/base/devres.c
+++ b/drivers/base/devres.c
@@ -687,6 +687,13 @@ int devres_release_group(struct device *dev, void *id)
spin_unlock_irqrestore(&dev->devres_lock, flags);
release_nodes(dev, &todo);
+ } else if (list_empty(&dev->devres_head)) {
+ /*
+ * dev is probably dying via devres_release_all(): groups
+ * have already been removed and are on the process of
+ * being released - don't touch and don't warn.
+ */
+ spin_unlock_irqrestore(&dev->devres_lock, flags);
} else {
WARN_ON(1);
spin_unlock_irqrestore(&dev->devres_lock, flags);
--
2.48.1
next prev parent reply other threads:[~2025-02-22 0:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-22 0:10 [PATCH v2 00/11] Cleanup error handling on probe, batch 2 Lucas De Marchi
2025-02-22 0:10 ` Lucas De Marchi [this message]
2025-02-22 0:10 ` [PATCH v2 02/11] drivers: base: devres: Fix find_group() documentation Lucas De Marchi
2025-02-22 0:10 ` [PATCH v2 03/11] drivers: base: component: Add debug message for unbind Lucas De Marchi
2025-02-22 7:19 ` Upadhyay, Tejas
2025-02-22 0:10 ` [PATCH v2 04/11] drm/xe: Stop setting drvdata to NULL Lucas De Marchi
2025-02-22 0:10 ` [PATCH v2 05/11] drm/xe: Switch from xe to devm actions Lucas De Marchi
2025-02-22 0:10 ` [PATCH v2 06/11] drm/xe: Drop remove callback support Lucas De Marchi
2025-02-22 0:10 ` [PATCH v2 07/11] drm/xe/display: Drop xe_display_driver_remove() Lucas De Marchi
2025-02-22 0:10 ` [PATCH v2 08/11] drm/xe: Move survivability entirely to xe_pci Lucas De Marchi
2025-02-24 4:40 ` Riana Tauro
2025-02-22 0:10 ` [PATCH v2 09/11] drm/xe: Stop ignoring errors from xe_heci_gsc_init() Lucas De Marchi
2025-02-22 0:10 ` [PATCH v2 10/11] drm/xe: Rename update_device_info() after sriov Lucas De Marchi
2025-02-22 0:10 ` [PATCH v2 11/11] drm/xe: Stop ignoring errors from xe_ttm_sys_mgr_init() Lucas De Marchi
2025-02-22 0:16 ` ✓ CI.Patch_applied: success for Cleanup error handling on probe, batch 2 (rev2) Patchwork
2025-02-22 0:17 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-22 0:18 ` ✓ CI.KUnit: success " Patchwork
2025-02-22 0:34 ` ✓ CI.Build: " Patchwork
2025-02-22 0:37 ` ✓ CI.Hooks: " Patchwork
2025-02-22 0:38 ` ✓ CI.checksparse: " Patchwork
2025-02-22 1:04 ` ✓ Xe.CI.BAT: " Patchwork
2025-02-22 14:19 ` ✗ Xe.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=20250222001051.3012936-2-lucas.demarchi@intel.com \
--to=lucas.demarchi@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/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