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 4D009606A322 for ; Wed, 2 Dec 2026 22:36:49 +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=kMxBeCGa Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6979B1125B3; Wed, 2 Dec 2026 22:36:43 +0000 (UTC) Received: from mail-yx1-f42.google.com (mail-yx1-f42.google.com [74.125.224.42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5EF651125A8 for ; Wed, 2 Dec 2026 22:36:35 +0000 (UTC) Received: by mail-yx1-f42.google.com with SMTP id 956f58d0204a3-677bc4704cbso15889100d50.0 for ; Wed, 02 Dec 2026 14:36:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796250994; x=1796855794; 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=Q8iR5gZSmLjfans4S2aPuzYbZHymnbK8VrzdqGQaVk8=; b=kMxBeCGajLyhw7KtAgNDS6SwG5dXW5rg74FDjUJL7MjEA+XaxS4ZS04+7x5+V/6iyT 6mDgMfQ5yxrLNrcbHsdIengqddyOCL2b/cV6+HnusZghmO8lSolZUEgE43Q6xW6fgFMg lwoMssQjJY3WajxjfVn3fiAiOCmS7xhagKTCPIZwaFOb364cHPJ1eHrYuW+Ho7E9mmo7 OUJxRKKS1mPsoPqVvEFlqZwoneaNjy5AcJCGa3FECUC8/w2/y0tWJie4mVrBQeF32ieQ LiJwPAnvk9VSOYxhjYuEef3u/6FBlXGTRSfcLSEskXxqAI3xmnAmt/LfrJbpZ3rV03es +dzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796250994; x=1796855794; 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=Q8iR5gZSmLjfans4S2aPuzYbZHymnbK8VrzdqGQaVk8=; b=lX3NeCH1Pk/JAicg71rosRSrphPfo2fP3pwRN3omycnQ77uKSYCXDx8Y3YHtTwB5cn kmr6/BJ3j9uZgDngbpT/0mZ4Slz9xnJUfjaw1a+z/GygxoBb6+oTZcQc4UNSaDwSTVz3 c2oht6f3Y6ryWbR1nzJGYAhg4Usa9hDBa0fUUmpq2uWiTgiLkM743/JF7Eux3LZ+8PdI TUcn+WRAnNUY945BOtLlFmE5u8RHDKrOyX+ti0CzlaBAKWE+ZcxMuTvchpR7o326RXH3 XB4cNYSoNOGZ1lybnk2QWsXMi+E0HkyH4D/Y6FeNPeRV2+FZ/svMTAv1wCDe/92bsYPP HjFg== X-Gm-Message-State: APuU4Z8ITUZlllIWCZWU1DjW4eXG/t11h9zPc9mosDNeIOy3XyRbuQL5 b7jopPnda4KcBgMszmDpFHssHRIevb23/gIVf+q1zJa3FSDV2nzmKhYb X-Gm-Gg: AZFdTZdX56ze5hztSj8b34wHWzT8+c8fs5ByBL+YI/q5NKp9x0WPbtj+ZAyb56FUFE/ KMzQ4QwaCBwe6Tb2Q+Gaz8SA1nY7k7tmJJnlvpEn51LaXCai715Fc3QoxPhg4gPYs2+j1iB53ZB SJtQnJ1jEMq+0jdszwSIlEkce2++g89saJv76ATxn0vqc8yZmQS0Dy7trJED9DquUNjz+/Vu+fj RSxGm1HwrlnCq6ve304qg/o5yfDfVirp+sj+0rkxqKi7A9p6zDtlBgdPJqucYDKPID5TpxzQmdS H+Dpsl0e+/uN+q0eXZySJbggO/W8ZU2nGzkmxGk+xAdpRMWNxAp31/Su6y018E2k3+SYhZ2Nrzz MhyZ6HMg19/cCF7iHe3t5xVRw5UWuS3vz+DmiU7/8x3qnP4/xVqglR+1dadNg6WhqhG5wsemCq0 tQ+TYNqgPDY10PVWBimxJqB2QwMdKnLbXRawnRuNTEmC7/TuA9RD0lftiqwoX/DN9OMDMsWj2Lq t8efqHNZkclV8fOYp8PFeG++Pi1N2yB+glzK6ujOBclddiuxRvsb5nJUTHaJJNVjOfn4rAE8vUr MznueaTw7C+IXnsM7uZ5SaH3zFBfvrOVfPv0VCeY2i+5tlbPWJ9mIGE7cRj4JiuZiuvhfVOoEdT MS6fPDPfvZW/JDH2ymdhC0NjOc2K0iZ6RFt2EEFdETf8HujLfCfLQRC2Vhd3MqstM+0nNuBFFOZ Ow2HoW7n7IG4yJqd85Zw== X-Received: by 2002:a05:690e:450d:20b0:67d:b995:a5af with SMTP id 956f58d0204a3-67df44829aamr10746867d50.116.1796250994098; Wed, 02 Dec 2026 14:36:34 -0800 (PST) Received: from localhost (107-220-129-194.lightspeed.chrlnc.sbcglobal.net. [107.220.129.194]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-67df33e01e1sm18727116d50.23.2026.12.02.14.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 14:36:32 -0800 (PST) From: Matt Turner Date: Wed, 02 Dec 2026 17:36:17 -0500 Subject: [PATCH 11/14] drm/amdgpu: report dropped devcoredumps X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261202-amdgpu-devcoredump-v1-11-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=4663; i=mattst88@gmail.com; h=from:subject:message-id; bh=tXQiVEg37H8wGa+FuIFeMuzqmq9MIv/1g135oVZIB78=; b=owGbwMvMwCW25rVmCc8sv+mMp9WSGLIF5kYYyOv91PJ7cjtt6sonOr8mnba7yTGhVs1zjkZN0 gPfyb5XOj6yMIhxMcwUU2SJW6/IMqttx1Kf09K/YOawMoEMkRZpYAACFga+3MS8UiMdIz1TbUM9 QyBDxygeIqfHoJFZXFyaWqSbVlDkkJdfkliSmZ9XrJdfkJpXkF6gl5aZVpKRkV9UnAo0Qi8vtcT U1dHNyNDAxNLRwszJwtHUxNnZydDJzdHR2dXJyNLcxMDZ0tHE1dKcgYtTAOYae25GhtZg1ROcEU 2JDzqPtT0LD1Fcp33jssaNqZekWna/niqduIWRoTHfe124TNKNkvZ38zIC7p/MSDyv0mnlsNx0b /fMWt1udgA= 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 amdgpu_coredump() silently returns when the worker is still formatting the previous dump or when allocating the dump fails, and the worker silently frees the dump when allocating the formatted output fails. Someone looking at a dump, or waiting for one, has no way to tell that hangs were missed. Warn when amdgpu drops a dump, count the dropped dumps, and print the count in the header of each dump. It is a running total rather than the count since the previous dump: dev_coredumpm() discards a new dump while an earlier one for the device has not been read yet, without telling the driver, and a count carried in the discarded dump would be lost. Those discarded dumps are not counted, for the same reason. Suggested-by: Gregoire Pean Signed-off-by: Matt Turner --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c | 28 ++++++++++++++++++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.h | 1 + 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index c8ca96ce5bdc..f40b5f062fd9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -930,6 +930,8 @@ struct amdgpu_device { #ifdef CONFIG_DEV_COREDUMP struct amdgpu_coredump_info *coredump; struct work_struct coredump_work; + /* coredumps dropped since the device was initialized */ + atomic_t coredump_dropped; /* the IP state was dumped for the next coredump */ bool coredump_ip_state_valid; /* the last VM fault when the IP state was dumped */ diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c index 3cb1927b0f47..19e3a47ded79 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c @@ -672,6 +672,8 @@ amdgpu_devcoredump_format(char *buffer, size_t count, struct amdgpu_coredump_inf drm_printf(&p, "kernel: %s\n", init_utsname()->release); drm_printf(&p, "module: " KBUILD_MODNAME "\n"); drm_printf(&p, "time: %ptSp\n", &coredump->reset_time); + if (coredump->dropped) + drm_printf(&p, "dropped coredumps: %u\n", coredump->dropped); drm_printf(&p, "pasid: %u\n", coredump->pasid); drm_printf(&p, "vmid: %u\n", coredump->vmid); @@ -869,8 +871,13 @@ static void amdgpu_devcoredump_deferred_work(struct work_struct *work) */ coredump->formatted_size = amdgpu_devcoredump_format( NULL, AMDGPU_CORE_DUMP_SIZE_MAX, coredump); - coredump->formatted = kvzalloc(coredump->formatted_size, GFP_KERNEL); + coredump->formatted = kvzalloc(coredump->formatted_size, + GFP_KERNEL | __GFP_NOWARN); if (!coredump->formatted) { + atomic_inc(&adev->coredump_dropped); + drm_warn(adev_to_drm(adev), + "failed to allocate %zd bytes for coredump\n", + coredump->formatted_size); amdgpu_devcoredump_free(coredump); goto end; } @@ -943,15 +950,28 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool skip_vram_check, adev->coredump_ip_state_valid = false; /* No need to generate a new coredump if there's one in progress already. */ - if (work_busy(&adev->coredump_work)) + if (work_busy(&adev->coredump_work)) { + atomic_inc(&adev->coredump_dropped); + drm_warn_ratelimited(dev, + "previous coredump still being processed, dropping this one\n"); return; + } if (job && job->pasid) size += sizeof(struct amdgpu_coredump_ib_info) * job->num_ibs; - coredump = kvzalloc(size, GFP_NOWAIT); - if (!coredump) + coredump = kvzalloc(size, GFP_NOWAIT | __GFP_NOWARN); + if (!coredump) { + atomic_inc(&adev->coredump_dropped); + drm_warn_ratelimited(dev, "failed to allocate coredump\n"); return; + } + + /* + * A running total rather than the count since the previous dump, which + * would be lost if dev_coredumpm() discards this dump. + */ + coredump->dropped = atomic_read(&adev->coredump_dropped); coredump->skip_vram_check = skip_vram_check; coredump->reset_vram_lost = vram_lost; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.h index 6a51fbe357dc..97d5fbe8320e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.h @@ -94,6 +94,7 @@ struct amdgpu_coredump_info { ssize_t formatted_size; char *formatted; + unsigned int dropped; unsigned int pasid; unsigned int vmid; pid_t submit_tgid; -- 2.56.1