All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: intel-xe@lists.freedesktop.org,
	Riana Tauro <riana.tauro@intel.com>,
	Badal Nilawar <badal.nilawar@intel.com>
Subject: Re: [PATCH] drm/xe/xe_gt_idle: Drop redundant newline in name
Date: Fri, 02 Feb 2024 22:37:55 -0800	[thread overview]
Message-ID: <85bk8yaw8s.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <d4gva7kobelqwu42jwkh2xcmxuk33t6m3isusugjcwdrhawco4@gmoeozpspw6x>

On Fri, 02 Feb 2024 21:36:58 -0800, Lucas De Marchi wrote:
>

Hi Lucas,

> On Fri, Feb 02, 2024 at 02:56:23PM -0800, Ashutosh Dixit wrote:
> > Newline in name is redunant and produces an unnecessary empty line during
> > 'cat name'. Newline is added during sysfs_emit. See '27a1a1e2e47d ("drm/xe:
> > stringify the argument to avoid potential vulnerability")'.
>
> $ git grep sprintf -- drivers/gpu/drm/xe
> drivers/gpu/drm/xe/xe_debugfs.c:                        sprintf(name, "vram%d_mm", mem_type - XE_PL_VRAM0);
> drivers/gpu/drm/xe/xe_exec_queue.c:             sprintf(q->name, "rcs%d", instance);
> drivers/gpu/drm/xe/xe_exec_queue.c:             sprintf(q->name, "vcs%d", instance);
> drivers/gpu/drm/xe/xe_exec_queue.c:             sprintf(q->name, "vecs%d", instance);
> drivers/gpu/drm/xe/xe_exec_queue.c:             sprintf(q->name, "bcs%d", instance);
> drivers/gpu/drm/xe/xe_exec_queue.c:             sprintf(q->name, "ccs%d", instance);
> drivers/gpu/drm/xe/xe_exec_queue.c:             sprintf(q->name, "gsccs%d", instance);
> drivers/gpu/drm/xe/xe_gt_debugfs.c:     sprintf(name, "gt%d", gt->info.id);
> drivers/gpu/drm/xe/xe_gt_idle.c:                sprintf(gtidle->name, "gt%d-mc\n", gt->info.id);
> drivers/gpu/drm/xe/xe_gt_idle.c:                sprintf(gtidle->name, "gt%d-rc\n", gt->info.id);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->sched_props.job_timeout_max);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->sched_props.job_timeout_min);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->sched_props.job_timeout_ms);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->defaults.job_timeout_ms);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->defaults.job_timeout_min);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->defaults.job_timeout_max);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->sched_props.timeslice_max);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->sched_props.timeslice_min);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->sched_props.timeslice_us);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->defaults.timeslice_us);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->defaults.timeslice_min);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->defaults.timeslice_max);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->sched_props.preempt_timeout_us);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->defaults.preempt_timeout_us);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->defaults.preempt_timeout_min);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->defaults.preempt_timeout_max);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->sched_props.preempt_timeout_max);
> drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c:  return sprintf(buf, "%u\n", eclass->sched_props.preempt_timeout_min);
> drivers/gpu/drm/xe/xe_hw_fence.c:       sprintf(ctx->name, "%s", name);
>
>
> it looks like all these in xe_hw_engine_class_sysfs.c have the same
> problem. Can you fix them all together?

No, these are actually ok, they don't add 2 newlines like the ones I fixed.

It would probably have been better to use sysfs_emit to emit these values,
instead of sprintf, but they don't add an additional newline. So if you
want I can add a patch which changes these to sysfs_emit, but maybe not
needed, and that would be a second patch.

Thanks.
--
Ashutosh

  reply	other threads:[~2024-02-03  6:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02 22:56 [PATCH] drm/xe/xe_gt_idle: Drop redundant newline in name Ashutosh Dixit
2024-02-03  1:09 ` ✓ CI.Patch_applied: success for drm/xe/xe_gt_idle: Drop redundant newline in name (rev2) Patchwork
2024-02-03  1:09 ` ✓ CI.checkpatch: " Patchwork
2024-02-03  1:10 ` ✓ CI.KUnit: " Patchwork
2024-02-03  1:17 ` ✓ CI.Build: " Patchwork
2024-02-03  1:18 ` ✓ CI.Hooks: " Patchwork
2024-02-03  1:19 ` ✓ CI.checksparse: " Patchwork
2024-02-03  1:42 ` ✓ CI.BAT: " Patchwork
2024-02-03  5:36 ` [PATCH] drm/xe/xe_gt_idle: Drop redundant newline in name Lucas De Marchi
2024-02-03  6:37   ` Dixit, Ashutosh [this message]
2024-02-05  5:07 ` Riana Tauro
  -- strict thread matches above, loose matches on Subject: below --
2024-02-06 19:27 Ashutosh Dixit
2024-02-02 22:35 Ashutosh Dixit
2024-02-02 22:49 ` Dixit, Ashutosh

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=85bk8yaw8s.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=riana.tauro@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 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.