From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.173 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796250991; b=PCpEmbzalC8CXTRWE8gsYCDgPo2AHvUdvaUoD4RzYB1LP+SF7+76HcKKgU9wUPSRsZBa hsQqJGPA16U3jN6+hL2QOcMqpeyagoNNUTZnWujdS1fF2pm0NQADDWY0/Pg8S+9H975nk S022FO1varE3gJFp0U9uMIokWL2fSVDYpLybMynXBRuyCymxIIRw9Khvi987dmhKbh/ef PFAETd13RIggsdArHqB+1pBGf7k8pKtYEiKP6AoXy3j4SzhbIJz23NOBjLCczM5tiRoHW S55yqndgK1k5zbIeqp9tduo/I4otAZ6g9kHBfZN84TKrZU8fhMlMC4HZrw22JzVZ8aw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796250991; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key; bh=hd2+DJfMhzt9rPqZN99BQPM26bdWjsDKwlOzt9lbYBI=; b=rior1rozaRw0ys2uQbWcxsK8ZceSZ36cJedldX6cfDyr7UgOGoCHfh4W1zb1WDVyORu5 12uXm3zQTz7LcosH+A6VVp/vK+5M7Aqorz+tp3YhCcJ/9AnAvMFyxDOfKhPEp/nSgBB37 /LeIUvU9FCDal33BcbS3nktJ0uz+eOxGt1sPTzp7CxCQ3vktQ8Fk2fQ9BKu/7LtpgRQIc NsAg1SnfLc4lPQWe3oqchYLoGJwlIKqpnCB9twgXRuex5YXffwgSJeq/87wleeNlIeKIc YBxmgsBCNaPHXB9gHKz5mwFNVlgmIiXVZYAYzZZ5X54EY4DZmlELaR/IbRnk6yfZZdQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=DAcQvVJl; arc=none smtp.remote-ip=209.85.128.173 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A2A3606A68E for ; Wed, 2 Dec 2026 22:36:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7A2A3606A68E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com 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=DAcQvVJl Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-8b0d126f631so120838007b3.2 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=vger.kernel.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=DAcQvVJlrFHHSpN1D6KlhSJeMtpUDo6Wm8ZJZqadpQ+8Oxcrbyn0fiwKtWfA/bAXwq rYlnTwUngqWxcwE39dUjBSj/6oVJDsYGh3lSDAF8MCt7E787d3qAiGGX11ylKmVYLBgC 5xhShGJi2CD7ME8NUzV/spGAsDoEVl9tniibuxsHhK4oIrdJ9gyh8P6iuCyuaVl6n6WQ B/UAd+yOBP22zbWuXMuQpX/S1fzjQZrFgG1ep5/m7gX5dUD2ZjgjgvXQvfbCb3BUIFwG dEhJQ3JTb244Kzfcwn3soQ7Pn4zhv1SqXlaZ30X7Ude5TguQVsUHV/AV7GraxFVbjV4D hGXg== 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=wNtvUP1liPZjHOiN20cxVodaKHMbvqJ5isXD6fCkCsJW7k5euNq9tcChixIITYJAE8 0v6MZ/dG7Dj48tJ2sBwsW7RHxLYqgGJgljFrlnzd4iO5tTqjSd4gnfON6U23+ISH1+zx 2zmf7TuKMF1D8NcIYEnmUOJNA3TJpUJaspxOoj8VA65sO5cDYHnjV+0c8lkREGDZV0sU yNhGOPqy7s+BNqAYTjQeCHC4KiE5iu1ogWkX8OMyrLb2Zwkl6Z5nTPky5C1xvN/4O4A1 mq5NR+N+gw2jnIEgZpAZcbYA8yLNIgTwhzhdhje+75t4L4qZ+5D7KpfTKCapBMggcGqA zUYg== X-Forwarded-Encrypted: i=1; AL+hErH1TMo06lYCuWz7YfoWkhsXKUZ/1M9JaKAf7wkFkpeTZNB04j1g2bKycVbxHzTDGJk93vUuCKC1EW9fQAk=@vger.kernel.org X-Gm-Message-State: APuU4Z/9QaDAaJss1hvY0e3soSV1X8HUZBWim8m1INzZwwBeW9+b1/B6 229Hv9/7SneY45Q72bEs9I4NjgdbKm1MaZ058evzF8fg8ebIB2qKCREV X-Gm-Gg: AZFdTZfFnZoOWV14tfIa94ttaG8s6QLpnC9w7fbdUHbeCXIeeHr+p+FdnPQJ0kEc1pg i0hknB5nwkXRLRalFEN09axemHZUJ6aV8x7jGD/ggPDwhaana+WQmNInFcE56rub6OtAnnROq3u EMJF4o4J042W85qTuIuz014m0a9gj6LdJNhNQepm37pzx8IFpFPaSYAWXDQP4G4n0B3Nb/UcveP Yw4yxPWaxy9bsUHXtNo4w03lynio7k48gRbj+BRNGO6RKDO3zZgS3igr7IrWutikMSay6EcJh19 hNQwAyC9lMFb6FksOCal5V7lYfb19dqwqj6vREYgGb+MgE+wpJYNJ6xfgCepQa9vkFtOcAS0BAj eps07ITag0sX/an6lxmjxA8X0Afv1plFINjhcl5+v8egiQIZ6kKVMd37ghSX5c9oX624+Jh6zux zwFTITWQRkPk7R9iniebopUzpy3QFhfZm8ua+XDbLTnWgV5mndChZoV0kMuCh5enyiLmzCyVrAX rpF0/mBxy1+gldnUWQbVq2hdPm+3GBf13PD+3O79izK/+ccPZUA1kUoLC1NNdswjkGu8TzH82QF d76gkjp8uWKgb9dRNgSiHvA2xQMdlt7PULmR5KjIQmOLlDUUXGLRY6Q9au2mdwDc9ovNuEwHBGG pvC5nYe6YwazXtAdyaqDthzAFDnmDg+lcrsP9D9RVncYYiv72bCZZggpkZiUjQVG8QTX8ZK94Un hfcw5E8CuaEQj69gOynDST/YsI2Ddas2MPZX7RglQ= 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-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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