From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: <yaolu@kylinos.cn>
Cc: <ashutosh.dixit@intel.com>, <dri-devel@lists.freedesktop.org>,
<intel-xe@lists.freedesktop.org>, <jose.souza@intel.com>,
<linux-kernel@vger.kernel.org>, <matthew.brost@intel.com>,
<thomas.hellstrom@linux.intel.com>,
<umesh.nerlige.ramappa@intel.com>
Subject: Re: [PATCH v2] drm/xe/oa: Remove sysfs entry on idr_alloc failure in xe_oa_add_config_ioctl()
Date: Mon, 31 Aug 2026 17:18:34 -0400 [thread overview]
Message-ID: <apXvqnzYi56oQ0L1@intel.com> (raw)
In-Reply-To: <20260831014218.28515-1-yaolu@kylinos.cn>
On Mon, Aug 31, 2026 at 09:42:18AM +0800, yaolu@kylinos.cn wrote:
> From: Lu Yao <yaolu@kylinos.cn>
>
> If idr_alloc() fails after create_dynamic_oa_sysfs_entry() has
> succeeded, the error path frees the OA config without removing the
> metrics sysfs group.
>
> Remove the sysfs group before releasing the config, and fix up the
> misleading error message copied from the sysfs creation failure path.
>
> Fixes: cdf02fe1a94a ("drm/xe/oa/uapi: Add/remove OA config perf ops")
> Signed-off-by: Lu Yao <yaolu@kylinos.cn>
> ---
> drivers/gpu/drm/xe/xe_oa.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> ---
> v1->v2: using a new goto suggested by Rodrigo
Thank you
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
and pushed
> Link: https://lore.kernel.org/all/apGuQY7vZRIUZghZ@intel.com
>
> diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
> index 9c5384b95c63..ab09dcff5860 100644
> --- a/drivers/gpu/drm/xe/xe_oa.c
> +++ b/drivers/gpu/drm/xe/xe_oa.c
> @@ -2435,9 +2435,9 @@ int xe_oa_add_config_ioctl(struct drm_device *dev, u64 data, struct drm_file *fi
>
> oa_config->id = idr_alloc(&oa->metrics_idr, oa_config, 1, 0, GFP_KERNEL);
> if (oa_config->id < 0) {
> - drm_dbg(&oa->xe->drm, "Failed to create sysfs entry for OA config\n");
> + drm_dbg(&oa->xe->drm, "Failed to allocate id for OA config\n");
> err = oa_config->id;
> - goto sysfs_err;
> + goto id_alloc_err;
> }
>
> id = oa_config->id;
> @@ -2448,6 +2448,8 @@ int xe_oa_add_config_ioctl(struct drm_device *dev, u64 data, struct drm_file *fi
>
> return id;
>
> +id_alloc_err:
> + sysfs_remove_group(oa->metrics_kobj, &oa_config->sysfs_metric);
> sysfs_err:
> mutex_unlock(&oa->metrics_lock);
> reg_err:
> --
> 2.25.1
>
prev parent reply other threads:[~2026-08-31 21:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 6:08 [PATCH] " yaolu
2026-08-28 15:50 ` Rodrigo Vivi
2026-08-31 1:42 ` [PATCH v2] " yaolu
2026-08-31 21:18 ` Rodrigo Vivi [this message]
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=apXvqnzYi56oQ0L1@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=ashutosh.dixit@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jose.souza@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.brost@intel.com \
--cc=thomas.hellstrom@linux.intel.com \
--cc=umesh.nerlige.ramappa@intel.com \
--cc=yaolu@kylinos.cn \
/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
all inboxes | Powered by JetHome®