All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Badal Nilawar" <badal.nilawar@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v6 05/10] drm/xe/cper: Log CPER records for aggregate counter retrieval
Date: Wed, 28 Oct 2026 10:30:31 +0000	[thread overview]
Message-ID: <sashiko-outbox-187748@kernel.org> (raw)
In-Reply-To: <20261028095723.734387-17-badal.nilawar@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/xe/ras: leak offlined_pages XArray on xe_cper_sysfs_init() error
--

commit 6077a66c6338e4db5c918ef6aa2f82fb393dd9be
Author: Badal Nilawar <badal.nilawar@intel.com>

drm/xe/cper: Log CPER records for aggregate counter retrieval

This commit adds a cper_on_query sysfs attribute to control whether CPER
records are emitted when userspace queries RAS error counters, and updates
xe_ras_get_counter() and xe_ras_init() to support it.

> diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
> index 0555b86b63b27..6664153b3cae7 100644
> --- a/drivers/gpu/drm/xe/xe_ras.c
> +++ b/drivers/gpu/drm/xe/xe_ras.c

[ ... ]

> @@ -1246,5 +1284,9 @@ int xe_ras_init(struct xe_device *xe)
>  	if (ret)
>  		xe_err(xe, "Failed to create GPU health sysfs, err=%d\n", ret);
>  
> +	ret = xe_cper_sysfs_init(xe);
> +	if (ret)
> +		return ret;
> +
>  	return devm_add_action_or_reset(xe->drm.dev, ras_fini, xe);
>  }

[Severity: Medium]
Does returning early here on xe_cper_sysfs_init() failure leak the entries
allocated in state->offlined_pages?

Earlier in xe_ras_init(), state->offlined_pages is initialized and populated:

drivers/gpu/drm/xe/xe_ras.c:xe_ras_init() {
	...
	xa_init(&state->offlined_pages);

	/* Fetch the offline list before queue to avoid duplication */
	get_offline_list(xe);
	get_offline_queue(xe);
	...
	xe_ras_process_errors(xe);
}

Those helpers store entries into state->offlined_pages via xa_store(...,
GFP_KERNEL), which is normally cleaned up by ras_fini():

static void ras_fini(void *arg)
{
	struct xe_device *xe = arg;

	xa_destroy(&xe->ras.state.offlined_pages);
}

If xe_cper_sysfs_init() fails and returns before devm_add_action_or_reset()
registers ras_fini(), nothing calls xa_destroy(&state->offlined_pages). Should
devm_add_action_or_reset(xe->drm.dev, ras_fini, xe) be registered right after
xa_init(), or should xa_destroy() be called on this error path (or should
xe_cper_sysfs_init() failure be logged as non-fatal like gpu_health_group
above)?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261028095723.734387-12-badal.nilawar@intel.com?part=5

  reply	other threads:[~2026-10-28 10:30 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28  9:57 [PATCH v6 00/10] Add CPER logging support for CRI Badal Nilawar
2026-10-28  9:57 ` [PATCH v6 01/10] drm/xe/cper: Add CPER reporting entry point for xe_log Badal Nilawar
2026-10-28 16:22   ` Raag Jadav
2026-10-28  9:57 ` [PATCH v6 02/10] drm/xe/cper: Retrieve the error counter record for CPER reporting Badal Nilawar
2026-10-28 16:25   ` Raag Jadav
2026-10-28  9:57 ` [PATCH v6 03/10] drm/xe/cper: Initialize Intel-specific CPER header Badal Nilawar
2026-10-28 16:34   ` Raag Jadav
2026-10-28  9:57 ` [PATCH v6 04/10] drm/xe/cper: Construct CPER record for hardware errors Badal Nilawar
2026-10-28 16:52   ` Raag Jadav
2026-10-28  9:57 ` [PATCH v6 05/10] drm/xe/cper: Log CPER records for aggregate counter retrieval Badal Nilawar
2026-10-28 10:30   ` sashiko-bot [this message]
2026-10-28 17:05   ` Raag Jadav
2026-10-28  9:57 ` [PATCH v6 06/10] drm/xe/cper: Emit cper record to trace buf Badal Nilawar
2026-10-28 17:06   ` Raag Jadav
2026-10-28  9:57 ` [PATCH v6 07/10] drm/xe/xe_ras: Report device memory errors using SIGID Badal Nilawar
2026-10-28 17:07   ` Raag Jadav
2026-10-28  9:57 ` [PATCH v6 08/10] drm/xe/xe_ras: Report core compute " Badal Nilawar
2026-10-28  9:57 ` [PATCH v6 09/10] drm/xe/xe_ras: Report soc internal " Badal Nilawar
2026-10-28 17:17   ` Raag Jadav
2026-10-28  9:57 ` [PATCH v6 10/10] drm/xe/xe_ras: Report correctable " Badal Nilawar
2026-10-28 10:05 ` ✗ CI.checkpatch: warning for Add CPER logging support for CRI (rev6) Patchwork
2026-10-28 10:07 ` ✓ CI.KUnit: success " Patchwork
2026-10-28 10:43 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-28 18:37 ` ✓ 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=sashiko-outbox-187748@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=badal.nilawar@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.