amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Khatri, Sunil" <sukhatri@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Sunil Khatri" <sunil.khatri@amd.com>,
	dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	"David Airlie" <airlied@linux.ie>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Tvrtko Ursulin <tvrtko.ursulin@igalia.com>,
	Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Subject: Re: [PATCH V8 1/5] drm: add drm_file_err function to add process info
Date: Mon, 28 Apr 2025 14:49:42 +0300	[thread overview]
Message-ID: <871ptcy089.fsf@intel.com> (raw)
In-Reply-To: <f9c5edeb-ffc8-4a25-a80b-3ae8de9b62da@amd.com>

On Mon, 28 Apr 2025, "Khatri, Sunil" <sukhatri@amd.com> wrote:
> On 4/22/2025 2:33 PM, Christian König wrote:
>> Am 17.04.25 um 18:10 schrieb Sunil Khatri:
>>> Add a drm helper function which appends the process information for
>>> the drm_file over drm_err formatted output.
>>>
>>> v5: change to macro from function (Christian Koenig)
>>>      add helper functions for lock/unlock (Christian Koenig)
>>>
>>> v6: remove __maybe_unused and make function inline (Jani Nikula)
>>>      remove drm_print.h
>>>
>>> v7: Use va_format and %pV to concatenate fmt and vargs (Jani Nikula)
>>>
>>> v8: Code formatting and typos (Ursulin tvrtko)
>>>
>>> Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
>>> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
>> Any objections to merge this through amd-staging-drm-next?
> Gentle reminder here folks ??

It might help to Cc the drm-misc maintainers, though even that doesn't
always guarantee a reply. ;D

Done now.

Anyway, since I commented on an earlier version, and my feedback was
addressed,

Acked-by: Jani Nikula <jani.nikula@intel.com>

even though that does not help you merge via the amd tree.


BR,
Jani.


>> The follow up amdgpu patches all depend on stuff in there which is not yet merged to drm-misc-next.
>>
>> Thanks,
>> Christian.
>>
>>> ---
>>>   drivers/gpu/drm/drm_file.c | 34 ++++++++++++++++++++++++++++++++++
>>>   include/drm/drm_file.h     |  3 +++
>>>   2 files changed, 37 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
>>> index c299cd94d3f7..dd351f601acd 100644
>>> --- a/drivers/gpu/drm/drm_file.c
>>> +++ b/drivers/gpu/drm/drm_file.c
>>> @@ -986,6 +986,40 @@ void drm_show_fdinfo(struct seq_file *m, struct file *f)
>>>   }
>>>   EXPORT_SYMBOL(drm_show_fdinfo);
>>>   
>>> +/**
>>> + * drm_file_err - log process name, pid and client_name associated with a drm_file
>>> + * @file_priv: context of interest for process name and pid
>>> + * @fmt: printf() like format string
>>> + *
>>> + * Helper function for clients which needs to log process details such
>>> + * as name and pid etc along with user logs.
>>> + */
>>> +void drm_file_err(struct drm_file *file_priv, const char *fmt, ...)
>>> +{
>>> +	va_list args;
>>> +	struct va_format vaf;
>>> +	struct pid *pid;
>>> +	struct task_struct *task;
>>> +	struct drm_device *dev = file_priv->minor->dev;
>>> +
>>> +	va_start(args, fmt);
>>> +	vaf.fmt = fmt;
>>> +	vaf.va = &args;
>>> +
>>> +	mutex_lock(&file_priv->client_name_lock);
>>> +	rcu_read_lock();
>>> +	pid = rcu_dereference(file_priv->pid);
>>> +	task = pid_task(pid, PIDTYPE_TGID);
>>> +
>>> +	drm_err(dev, "comm: %s pid: %d client: %s ... %pV", task ? task->comm : "Unset",
>>> +		task ? task->pid : 0, file_priv->client_name ?: "Unset", &vaf);
>>> +
>>> +	va_end(args);
>>> +	rcu_read_unlock();
>>> +	mutex_unlock(&file_priv->client_name_lock);
>>> +}
>>> +EXPORT_SYMBOL(drm_file_err);
>>> +
>>>   /**
>>>    * mock_drm_getfile - Create a new struct file for the drm device
>>>    * @minor: drm minor to wrap (e.g. #drm_device.primary)
>>> diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h
>>> index 94d365b22505..5c3b2aa3e69d 100644
>>> --- a/include/drm/drm_file.h
>>> +++ b/include/drm/drm_file.h
>>> @@ -446,6 +446,9 @@ static inline bool drm_is_accel_client(const struct drm_file *file_priv)
>>>   	return file_priv->minor->type == DRM_MINOR_ACCEL;
>>>   }
>>>   
>>> +__printf(2, 3)
>>> +void drm_file_err(struct drm_file *file_priv, const char *fmt, ...);
>>> +
>>>   void drm_file_update_pid(struct drm_file *);
>>>   
>>>   struct drm_minor *drm_minor_acquire(struct xarray *minors_xa, unsigned int minor_id);

-- 
Jani Nikula, Intel

      reply	other threads:[~2025-04-28 11:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17 16:10 [PATCH V8 1/5] drm: add drm_file_err function to add process info Sunil Khatri
2025-04-17 16:10 ` [PATCH V8 2/5] drm/amdgpu: add drm_file reference in userq_mgr Sunil Khatri
2025-04-22  8:37   ` Christian König
2025-04-22  8:57     ` Khatri, Sunil
2025-04-17 16:10 ` [PATCH V8 3/5] drm/amdgpu: use drm_file_err in fence timeouts Sunil Khatri
2025-04-17 16:10 ` [PATCH V8 4/5] drm/amdgpu: change DRM_ERROR to drm_file_err in amdgpu_userqueue.c Sunil Khatri
2025-04-17 16:10 ` [PATCH V8 5/5] drm/amdgpu: change DRM_DBG_DRIVER to drm_dbg_driver Sunil Khatri
2025-04-22  9:03 ` [PATCH V8 1/5] drm: add drm_file_err function to add process info Christian König
2025-04-28 11:39   ` Khatri, Sunil
2025-04-28 11:49     ` Jani Nikula [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=871ptcy089.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=pierre-eric.pelloux-prayer@amd.com \
    --cc=simona@ffwll.ch \
    --cc=sukhatri@amd.com \
    --cc=sunil.khatri@amd.com \
    --cc=tvrtko.ursulin@igalia.com \
    --cc=tzimmermann@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).