From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4545606A69D for ; Wed, 2 Dec 2026 22:36:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=xNDg50RP Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 338731125B5; Wed, 2 Dec 2026 22:36:38 +0000 (UTC) Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) by gabe.freedesktop.org (Postfix) with ESMTPS id 844501125A5 for ; Wed, 2 Dec 2026 22:36:31 +0000 (UTC) Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-8b4e2ec4b42so75639437b3.0 for ; Wed, 02 Dec 2026 14:36:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796250990; x=1796855790; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=hd2+DJfMhzt9rPqZN99BQPM26bdWjsDKwlOzt9lbYBI=; b=xNDg50RPqSsYpmNong3j1crJZvYWgKe/E50bh+iCVFro1z38qRHLkJ4YLi2KlnwerJ vBS86C6jQSKG/jC+8WoXQJIoJ6TiwTxNG3nCctaoq1j2JssBx+kfEayTldyMtIfhx9vx IgCGVWgEWWSJpYEwe0CbjtTI6ewA5egdgPpS6MS69nI8eSVnePjdRoGMu36y8k/sEsyK +DlmhoJlMGJD0BAghcutpYa3+Nu2jQ23XcjsASlYpINaZhhCmS9BRV4IKV3B4//W0Vnp gnCGruOQMjN9BwtAhHuhtY7jujaynOQuurGffmKEpb0wF3nBh9OZApvtzDVCaZf1JXtW /uRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796250990; x=1796855790; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=hd2+DJfMhzt9rPqZN99BQPM26bdWjsDKwlOzt9lbYBI=; b=hKGzoRgtmFShZVLoCPDTT195WnQXGhh9RaHFlVryYcyi5vq65Ka8v/O2bZ3jR3mjJQ E4rNvT0EloZ0GLay9OMKF1rxPdhIi5nQJ5GdEN6TFn8X3o+2lub4RS4TkgqdofTWOGhv svhNlwS6mPjKI46MNmvTRpeFCdSZcTEWvybym9yj9kp5JcYEfUM8n0yCLmAGaLxmGGIT i3xvfMM79p8rEERmCn6SVESN4me01I+sASnRv9NkBEhJoYvcYBJCq4rcGUSMxBvJ97je RZJLwhJ3m+pr/G9H01DmbE9CJWVx2O32QXDt/AreXFTnKCM9Jmfhbno87PyRYqRAhNRC 86tA== X-Gm-Message-State: APuU4Z/9yLe0ILcEgd/GeOgRjBO1hJoIfbu6e9Fkd7mJNG3DAdqhS9wz OFDFUgKdHjhiwOj0U3g4m16r90edwG2w+q1vAOizumdOk7PdQJV7GEk+ X-Gm-Gg: AZFdTZdaLFi25S6dLfjOWiXkU7vou9pWgkoXzaFHXVNJYUAgLkjVuUdXcJvp7BkvN96 XMsjBiQSv+XlIdjz37sH1rxeg8an4l3VzQGevISGbWpWcIRsgM21ch6btN8/oDBBYl/opukZgV0 uVyvTN8FKGCCqIFrpqJtL9fmIaXxj8nSU9CYXeMctk9VTtCSUP82Hk1wGqYCE9hOKgGlhsvoc2z v4LwXJ2Vwi+PT/jXDh9WDntWObBIpWOvgOOcIxYhj5aev/frcPbFPlATTzyK1dHrAM5Xq0Nz6uv Vn2LTq7Lq/9YEermLCwpQJklBuxJYBVNU9CiXBxBmG9U5FpE3GWVZal4IIyoyqKWQ/jTpS/6wPz zUGU3r0nMud3ra97Bmo7L6Z1wWz1s1idKO62Q7nsheWDDl+CQpk2/IvGbkBIWhw01LjLe9pujfV l5PoGnMgHiYzZ6Noa+EZFC9WYTUbcRFHUiOXisPj8/uTPmLpMUVAz821CB117Wz4CQ9DRKOPRI4 7PJHzbKVcm0gYvI5qWbupeNaT6s5r5BJC7tmp7YGYOX0qcF1KGl5b1D4gmrkqbZHOvBCkg4gVZF e33XuMKHHTD4KDGP6YiWlMD2tJRArcd/Kpneou379+sz+dzmTzji2UXFqDo9QycbZrekIAS0c7A ovao11sqc1oQqmDSV23WJPluCzAdFB9/9yXjcdOvqWqvN3FFl3iL0BEOf2TQu+G/pLJDvDZ6kds MKShZaUa5v2e7E8A8WYbahEYcWe05CtC8+tXSiXhE= X-Received: by 2002:a05:690c:7209:b0:8b3:90df:3952 with SMTP id 00721157ae682-8b5204766bamr171958407b3.30.1796250990424; Wed, 02 Dec 2026 14:36:30 -0800 (PST) Received: from localhost (107-220-129-194.lightspeed.chrlnc.sbcglobal.net. [107.220.129.194]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b52028d89csm166566577b3.15.2026.12.02.14.36.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 14:36:29 -0800 (PST) From: Matt Turner Date: Wed, 02 Dec 2026 17:36:15 -0500 Subject: [PATCH 09/14] drm/amdgpu: record the submitting thread of the hung job in the coredump X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261202-amdgpu-devcoredump-v1-9-3dfa0e033b97@gmail.com> References: <20261202-amdgpu-devcoredump-v1-0-3dfa0e033b97@gmail.com> In-Reply-To: <20261202-amdgpu-devcoredump-v1-0-3dfa0e033b97@gmail.com> To: Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Sunil Khatri , Trigger Huang Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Matt Turner , Gregoire Pean X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4393; i=mattst88@gmail.com; h=from:subject:message-id; bh=XESm/QI0zdwbJR1awZdxtEtCvLbUpWWtL5pa/XUAIrI=; b=owGbwMvMwCW25rVmCc8sv+mMp9WSGLIF5kaYsUa47WjQFW89eWX+6p82p7bV7Hkkq3sy4e2rZ 60fTonLdXxkYRDjYpgppsgSt16RZVbbjqU+p6V/wcxhZQIZIi3SwAAELAx8uYl5pUY6Rnqm2oZ6 hkCGjlE8RE6PQSOzuLg0tUg3raDIIS+/JLEkMz+vWC+/IDWvIL1ALy0zrSQjI7+oOBVohF5eaom pq6ObkaGBiaWjhZmThaOpibOzk6GTm6Ojs6uTkaW5iYGzpaOJq6U5AxenAMw1vSsZGZ5tytU8y8 +5VnfNmTm1f2UUzzn3Hbebypqi9PDysaYHl8MY/mfreHrsmJsnrdFwf+dv/ia/zc4cmZKGKQZMR w5KrC6sYAQA X-Developer-Key: i=mattst88@gmail.com; a=openpgp; fpr=3BB639E56F861FA2E86505690FDD682D974CA72A X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "amd-gfx" X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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 Signed-off-by: Matt Turner --- 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