Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: "Krzysztof Karas" <krzysztof.karas@intel.com>,
	"André Almeida" <andrealmeid@igalia.com>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	siqueira@igalia.com, airlied@gmail.com, simona@ffwll.ch,
	Raag Jadav <raag.jadav@intel.com>,
	rodrigo.vivi@intel.com, jani.nikula@linux.intel.com,
	Xaver Hugl <xaver.hugl@gmail.com>,
	"Pierre-Loup A . Griffais" <pgriffais@valvesoftware.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	kernel-dev@igalia.com, amd-gfx@lists.freedesktop.org,
	intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 1/3] drm: Create an app info option for wedge events
Date: Mon, 12 May 2025 16:53:37 +0200	[thread overview]
Message-ID: <2c3c957f-8353-4bcc-bc30-b92a1db1acfb@amd.com> (raw)
In-Reply-To: <x3ep3offdy5on6hckumvpsvnlfnmjdfqjlcyv7hojitzsn5u3k@opnou6grp7ad>



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


  parent reply	other threads:[~2025-05-12 14:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-11 22:47 [PATCH v2 0/3] drm: Create an app info option for wedge events André Almeida
2025-05-11 22:47 ` [PATCH v2 1/3] " André Almeida
2025-05-12  6:08   ` Krzysztof Karas
2025-05-12 13:40     ` André Almeida
2025-05-12 14:53     ` Christian König [this message]
2025-05-12 15:34   ` Rodrigo Vivi
2025-05-11 22:47 ` [PATCH v2 2/3] drm/doc: Add a section about "App information" for the wedge API André Almeida
2025-05-12 18:37   ` Raag Jadav
2025-05-11 22:47 ` [PATCH v2 3/3] drm/amdgpu: Make use of drm_wedge_app_info André Almeida
2025-05-11 22:53 ` ✓ CI.Patch_applied: success for drm: Create an app info option for wedge events (rev2) Patchwork
2025-05-11 22:54 ` ✗ CI.checkpatch: warning " Patchwork
2025-05-11 22:55 ` ✓ CI.KUnit: success " Patchwork
2025-05-11 23:03 ` ✓ CI.Build: " Patchwork
2025-05-11 23:05 ` ✓ CI.Hooks: " Patchwork
2025-05-11 23:07 ` ✗ CI.checksparse: warning " Patchwork
2025-05-11 23:35 ` ✓ Xe.CI.BAT: success " Patchwork
2025-05-12  0:48 ` ✗ Xe.CI.Full: failure " 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=2c3c957f-8353-4bcc-bc30-b92a1db1acfb@amd.com \
    --to=christian.koenig@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=andrealmeid@igalia.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=kernel-dev@igalia.com \
    --cc=krzysztof.karas@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pgriffais@valvesoftware.com \
    --cc=raag.jadav@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=siqueira@igalia.com \
    --cc=xaver.hugl@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox