From: Matt Turner <mattst88@gmail.com>
To: "Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Sunil Khatri" <sunil.khatri@amd.com>,
"Trigger Huang" <Trigger.Huang@amd.com>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, Matt Turner <mattst88@gmail.com>,
Gregoire Pean <gpean@netflix.com>
Subject: [PATCH 09/14] drm/amdgpu: record the submitting thread of the hung job in the coredump
Date: Wed, 02 Dec 2026 17:36:15 -0500 [thread overview]
Message-ID: <20261202-amdgpu-devcoredump-v1-9-3dfa0e033b97@gmail.com> (raw)
In-Reply-To: <20261202-amdgpu-devcoredump-v1-0-3dfa0e033b97@gmail.com>
The process and thread in the devcoredump header come from the VM's
task info, which amdgpu_vm_set_task_info() updates on every submission
to record the thread that last submitted to the VM. In a multithreaded
process that is not necessarily the thread that submitted the job that
hung.
Record the submitting thread and its process in the job at CS time, as
amdgpu_vm_set_task_info() does for the VM, and print them in the
coredump header in the same layout as the VM's task info.
Suggested-by: Gregoire Pean <gpean@netflix.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 5 +++++
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c | 16 ++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.h | 4 ++++
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 6 ++++++
4 files changed, 31 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 71e2b83faa12..858a723ed667 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -311,6 +311,11 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
GFP_KERNEL, &p->jobs[i]);
if (ret)
goto free_all_kdata;
+ p->jobs[i]->submit_tgid = current->tgid;
+ p->jobs[i]->submit_pid = current->pid;
+ get_task_comm(p->jobs[i]->submit_process_name,
+ current->group_leader);
+ get_task_comm(p->jobs[i]->submit_comm, current);
switch (p->adev->enforce_isolation[fpriv->xcp_id]) {
case AMDGPU_ENFORCE_ISOLATION_DISABLE:
default:
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
index 033e1b94fcd7..62a0ae0aff87 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
@@ -604,6 +604,16 @@ amdgpu_devcoredump_format(char *buffer, size_t count, struct amdgpu_coredump_inf
coredump->reset_task_info.task.comm,
coredump->reset_task_info.task.pid);
+ /*
+ * The VM's task info above is the last thread that submitted to the
+ * VM; this is the thread that submitted the hung job.
+ */
+ if (coredump->submit_pid)
+ drm_printf(&p,
+ "submitter process_name: %s TGID: %d thread: %s PID: %d\n",
+ coredump->submit_process_name, coredump->submit_tgid,
+ coredump->submit_comm, coredump->submit_pid);
+
/* SOC Information */
drm_printf(&p, "\nSOC Information\n");
drm_printf(&p, "SOC Device id: %d\n", coredump->adev->pdev->device);
@@ -877,6 +887,12 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool skip_vram_check,
}
coredump->pasid = job->pasid;
coredump->vmid = job->vmid;
+ coredump->submit_tgid = job->submit_tgid;
+ coredump->submit_pid = job->submit_pid;
+ memcpy(coredump->submit_process_name, job->submit_process_name,
+ sizeof(coredump->submit_process_name));
+ memcpy(coredump->submit_comm, job->submit_comm,
+ sizeof(coredump->submit_comm));
coredump->num_ibs = job->num_ibs;
for (i = 0; i < job->num_ibs; ++i) {
struct amdgpu_coredump_ib_info *ib = &coredump->ibs[i];
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.h
index d62031369e56..c0192d0c583a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.h
@@ -81,6 +81,10 @@ struct amdgpu_coredump_info {
unsigned int pasid;
unsigned int vmid;
+ pid_t submit_tgid;
+ pid_t submit_pid;
+ char submit_process_name[TASK_COMM_LEN];
+ char submit_comm[TASK_COMM_LEN];
int num_ibs;
struct amdgpu_coredump_ib_info ibs[] __counted_by(num_ibs);
};
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h
index 18e788f0e790..0a6263781387 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h
@@ -100,6 +100,12 @@ struct amdgpu_job {
bool enforce_isolation;
bool run_cleaner_shader;
+ /* thread that submitted the job, for the devcoredump */
+ pid_t submit_tgid;
+ pid_t submit_pid;
+ char submit_process_name[TASK_COMM_LEN];
+ char submit_comm[TASK_COMM_LEN];
+
uint32_t num_ibs;
struct amdgpu_ib ibs[];
};
--
2.56.1
next prev parent reply other threads:[~2026-12-02 22:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 22:36 [PATCH 00/14] drm/amdgpu: capture more of the hang state in the devcoredump Matt Turner
2026-12-02 22:36 ` [PATCH 01/14] drm/amdgpu: dump the IP state of each device in an XGMI hive Matt Turner
2026-12-02 22:36 ` [PATCH 02/14] drm/amdgpu: only give the hung job to its own device's coredump Matt Turner
2026-12-02 22:36 ` [PATCH 03/14] drm/amdgpu: don't overwrite the IP state while a coredump is formatted Matt Turner
2026-12-02 22:36 ` [PATCH 04/14] drm/amdgpu: take a coredump before resets done by a reset handler Matt Turner
2026-12-02 22:36 ` [PATCH 05/14] drm/amdgpu: copy the VM fault info when the hang is detected Matt Turner
2026-12-02 22:36 ` [PATCH 06/14] drm/amdgpu/gfx10-12: dump CP_STAT and the IB2 state of each gfx queue Matt Turner
2026-12-02 22:36 ` [PATCH 07/14] drm/amdgpu: copy the IB contents before formatting the devcoredump Matt Turner
2026-12-02 22:36 ` [PATCH 08/14] drm/amdgpu: copy the IB contents when the hang is detected Matt Turner
2026-12-02 22:36 ` Matt Turner [this message]
2026-12-02 22:36 ` [PATCH 10/14] drm/amdgpu: dump the unsignaled fences of each ring in the coredump Matt Turner
2026-12-02 22:36 ` [PATCH 11/14] drm/amdgpu: report dropped devcoredumps Matt Turner
2026-12-02 22:36 ` [PATCH 12/14] drm/amdgpu: list the VM mappings of the hung job in the coredump Matt Turner
2026-12-02 22:36 ` [PATCH 13/14] drm/amdgpu: add AMDGPU_VM_PAGE_DUMP to include BOs " Matt Turner
2026-12-02 22:36 ` [PATCH 14/14] drm/amdgpu: bump the devcoredump version Matt Turner
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=20261202-amdgpu-devcoredump-v1-9-3dfa0e033b97@gmail.com \
--to=mattst88@gmail.com \
--cc=Trigger.Huang@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gpean@netflix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=sunil.khatri@amd.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 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.