[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2c3c957f-8353-4bcc-bc30-b92a1db1acfb@amd.com>
Date: Mon, 12 May 2025 16:53:37 +0200
From: Christian König <christian.koenig@....com>
To: Krzysztof Karas <krzysztof.karas@...el.com>,
André Almeida <andrealmeid@...lia.com>
Cc: Alex Deucher <alexander.deucher@....com>, siqueira@...lia.com,
airlied@...il.com, simona@...ll.ch, Raag Jadav <raag.jadav@...el.com>,
rodrigo.vivi@...el.com, jani.nikula@...ux.intel.com,
Xaver Hugl <xaver.hugl@...il.com>,
"Pierre-Loup A . Griffais" <pgriffais@...vesoftware.com>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
kernel-dev@...lia.com, amd-gfx@...ts.freedesktop.org,
intel-xe@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org
Subject: Re: [PATCH v2 1/3] drm: Create an app info option for wedge events
On 5/12/25 08:08, Krzysztof Karas wrote:
> Hi André,
>
> [...]
>
>> @@ -582,6 +584,14 @@ int drm_dev_wedged_event(struct drm_device *dev, unsigned long method)
>> drm_info(dev, "device wedged, %s\n", method == DRM_WEDGE_RECOVERY_NONE ?
>> "but recovered through reset" : "needs recovery");
>>
>> + if (info) {
>> + snprintf(pid_string, sizeof(pid_string), "PID=%u", info->pid);
>> + snprintf(comm_string, sizeof(comm_string), "APP=%s", info->comm);
>> + } else {
>> + snprintf(pid_string, sizeof(pid_string), "%s", "PID=-1");
>> + snprintf(comm_string, sizeof(comm_string), "%s", "APP=none");
>
> I think using PID=-1 and APP=none might be misleading, because
> something did cause the wedge if we landed here.
Yeah, that certainly won't fly. 1 is a perfectly valid pid.
I would just set pid_string and comm_string to empty if info isn't available.
Regards,
Christian.
You could use
> "PID=unknown" and "APP=unknown" or ensure these arrays are
> zeroed and fill them only if "info" is available:
>
> - char *envp[] = { event_string, NULL };
> + char pid_string[15] = {}, comm_string[TASK_COMM_LEN] = {};
> + char *envp[] = { event_string, pid_string, comm_string, NULL };
>
> [...]
>
> + if (info) {
> + snprintf(pid_string, sizeof(pid_string), "PID=%u", info->pid);
> + snprintf(comm_string, sizeof(comm_string), "APP=%s", info->comm);
> + }
>
> Then, when printing the logs later you could check if they have
> a value and only use them if they do (or handle that however
> you would see fit :) ).
>
> Best Regards,
> Krzysztof
Powered by blists - more mailing lists