From: Raag Jadav <raag.jadav@intel.com>
To: "Tauro, Riana" <riana.tauro@intel.com>
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
netdev@vger.kernel.org, rodrigo.vivi@intel.com,
maarten@lankhorst.se, airlied@gmail.com, simona@ffwll.ch,
kuba@kernel.org
Subject: Re: [PATCH v1 3/3] drm/xe/drm_ras: Add per node cleanup action
Date: Wed, 20 May 2026 12:39:40 +0200 [thread overview]
Message-ID: <ag2PbIWctfd6yRTw@black.igk.intel.com> (raw)
In-Reply-To: <5d52d3dd-2154-48e2-b849-0ca2aa74fb13@intel.com>
On Wed, May 20, 2026 at 12:53:52PM +0530, Tauro, Riana wrote:
> On 5/15/2026 1:58 AM, Raag Jadav wrote:
> > cleanup_node_param() is not registered in case of counter allocation
> > failure, which results in stale memory of previous node that isn't
> > cleaned up on unwind.
>
> It is registered.
>
> ret = assign_node_params(xe, node, i);
> if (ret)
> cleanup_node_param(ras, i);
Is that also true for previous node params (in case second node
registration fails)?
> > Add per node cleanup action which guarantees
> > cleanup on unwind and also simplifies the cleanup logic.
> >
> > Fixes: b40db12b542f ("drm/xe/xe_drm_ras: Add support for XE DRM RAS")
> > Signed-off-by: Raag Jadav <raag.jadav@intel.com>
> > ---
> > drivers/gpu/drm/xe/xe_drm_ras.c | 42 +++++++++++++--------------------
> > 1 file changed, 17 insertions(+), 25 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/xe/xe_drm_ras.c b/drivers/gpu/drm/xe/xe_drm_ras.c
> > index 89640ffb1c33..40abde29a26f 100644
> > --- a/drivers/gpu/drm/xe/xe_drm_ras.c
> > +++ b/drivers/gpu/drm/xe/xe_drm_ras.c
> > @@ -131,14 +131,20 @@ static int assign_node_params(struct xe_device *xe, struct drm_ras_node *node,
> > return 0;
> > }
> > -static void cleanup_node_param(struct xe_drm_ras *ras, const enum drm_xe_ras_error_severity severity)
> > +static void cleanup_node_param(struct drm_ras_node *node)
> > {
> > - struct drm_ras_node *node = &ras->node[severity];
> > -
> > kfree(node->device_name);
> > node->device_name = NULL;
> > }
> > +static void cleanup_node(struct drm_device *drm, void *arg)
> > +{
> > + struct drm_ras_node *node = arg;
> > +
> > + drm_ras_node_unregister(node);
> > + cleanup_node_param(node);
> > +}
> > +
> > static int register_nodes(struct xe_device *xe)
> > {
> > struct xe_drm_ras *ras = &xe->ras;
> > @@ -150,13 +156,19 @@ static int register_nodes(struct xe_device *xe)
> > ret = assign_node_params(xe, node, i);
> > if (ret) {
> > - cleanup_node_param(ras, i);
> > + cleanup_node_param(node);
>
> At this point drm_ras node is not registered.
Yes, and I don't believe we're attempting to unregister here :)
> > return ret;
> > }
> > ret = drm_ras_node_register(node);
> > if (ret) {
> > - cleanup_node_param(ras, i);
> > + cleanup_node_param(node);
>
> Ditto
Ditto.
Raag
> > + return ret;
> > + }
> > +
> > + ret = drmm_add_action_or_reset(&xe->drm, cleanup_node, node);
> > + if (ret) {
> > + cleanup_node(&xe->drm, node);
> > return ret;
> > }
> > }
> > @@ -164,20 +176,6 @@ static int register_nodes(struct xe_device *xe)
> > return 0;
> > }
> > -static void xe_drm_ras_unregister_nodes(struct drm_device *device, void *arg)
> > -{
> > - struct xe_device *xe = arg;
> > - struct xe_drm_ras *ras = &xe->ras;
> > - int i;
> > -
> > - for_each_error_severity(i) {
> > - struct drm_ras_node *node = &ras->node[i];
> > -
> > - drm_ras_node_unregister(node);
> > - cleanup_node_param(ras, i);
> > - }
> > -}
> > -
> > /**
> > * xe_drm_ras_init() - Initialize DRM RAS
> > * @xe: xe device instance
> > @@ -204,11 +202,5 @@ int xe_drm_ras_init(struct xe_device *xe)
> > return err;
> > }
> > - err = drmm_add_action_or_reset(&xe->drm, xe_drm_ras_unregister_nodes, xe);
> > - if (err) {
> > - drm_err(&xe->drm, "Failed to add action for Xe DRM RAS (%pe)\n", ERR_PTR(err));
> > - return err;
> > - }
> > -
> > return 0;
> > }
next prev parent reply other threads:[~2026-05-20 10:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 20:28 [PATCH v1 0/3] DRM RAS Fixes Raag Jadav
2026-05-14 20:28 ` [PATCH v1 1/3] drm/ras: Cancel and free message on get counter failure Raag Jadav
2026-05-20 7:12 ` Tauro, Riana
2026-05-14 20:28 ` [PATCH v1 2/3] drm/xe/drm_ras: Make counter allocation drm managed Raag Jadav
2026-05-20 9:51 ` Tauro, Riana
2026-05-20 10:36 ` Raag Jadav
2026-05-14 20:28 ` [PATCH v1 3/3] drm/xe/drm_ras: Add per node cleanup action Raag Jadav
2026-05-20 7:23 ` Tauro, Riana
2026-05-20 10:39 ` Raag Jadav [this message]
2026-05-14 22:07 ` ✓ CI.KUnit: success for DRM RAS Fixes Patchwork
2026-05-14 23:04 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-15 16:47 ` ✗ 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=ag2PbIWctfd6yRTw@black.igk.intel.com \
--to=raag.jadav@intel.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=kuba@kernel.org \
--cc=maarten@lankhorst.se \
--cc=netdev@vger.kernel.org \
--cc=riana.tauro@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.