From patchwork Wed Feb 19 21:35:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 13983033 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 978FEC021AA for ; Wed, 19 Feb 2025 21:35:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 48B8D10E89D; Wed, 19 Feb 2025 21:35:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="FMdKruiw"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by gabe.freedesktop.org (Postfix) with ESMTPS id D12B310E06B; Wed, 19 Feb 2025 21:35:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=w5g9otFiJkeNvBm1eGPsPJCmTn9xUTThN+I9+NmpxrY=; b=FMdKruiwht0LyTiwr7WdOr8gv/ 7AOuzoKTijGIy/YVuUvrjjZ8eQsTlJHrDd3Ec7Atc0xIycYibdnZLbh/ToyhIAZtCmL3U8V3bgQIz bTFvT1cGPpaWo/3y+ZHyOprWF/lUhbRw54oE1nyLpwUatPykgXxVo/t2LkVvpsJb+qU6gOiXKxRVM Yml1ibP3v3au5OmHYKENLQfLNTJ4YpRPpSby44LAa+MXXGfOAOchp9KobXYhVZXlAWttqOK7iQGWN R1GDJH5ngPEcou5wuyDoAmHh0GytFLY0EKCoP++47DBZIfus5YaesGstXgcPusvG0gAm73YDSLVa4 iZ6mXwfg==; Received: from [191.204.194.148] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1tkrj3-00F1SN-Rf; Wed, 19 Feb 2025 22:35:32 +0100 From: =?utf-8?q?Andr=C3=A9_Almeida?= To: Alex Deucher , =?utf-8?b?J0NocmlzdGlhbiBLw7Zu?= =?utf-8?b?aWcn?= , Xinhui Pan , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-dev@igalia.com, siqueira@igalia.com Cc: =?utf-8?q?Andr=C3=A9_Almeida?= Subject: [PATCH 1/3] drm/amdgpu: Log the creation of a coredump file Date: Wed, 19 Feb 2025 18:35:15 -0300 Message-ID: <20250219213517.281556-2-andrealmeid@igalia.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250219213517.281556-1-andrealmeid@igalia.com> References: <20250219213517.281556-1-andrealmeid@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" After a GPU reset happens, the driver creates a coredump file. However, the user might not be aware of it. Log the file creation the user can find more information about the device and add the file to bug reports. This is similar to what the xe driver does. Signed-off-by: André Almeida --- drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c index 824f9da5b6ce..7b50741dc097 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c @@ -364,5 +364,9 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool skip_vram_check, dev_coredumpm(dev->dev, THIS_MODULE, coredump, 0, GFP_NOWAIT, amdgpu_devcoredump_read, amdgpu_devcoredump_free); + + drm_info(dev, "AMDGPU device coredump file has been created\n"); + drm_info(dev, "Check your /sys/class/drm/card%d/device/devcoredump/data\n", + dev->primary->index); } #endif From patchwork Wed Feb 19 21:35:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 13983032 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E2D92C021B1 for ; Wed, 19 Feb 2025 21:35:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2C3F210E06B; Wed, 19 Feb 2025 21:35:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="Nuw0LJRZ"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by gabe.freedesktop.org (Postfix) with ESMTPS id A280B10E069; Wed, 19 Feb 2025 21:35:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=iwq57pgU5eH9DcXYUU5567uzianHf1TSEbwFS1hNRQo=; b=Nuw0LJRZXEWbexoRiCAkFfNA6y 3J5+7kNAbe7oTczEBF19sv3aQApDEWnZ/BpE0KHaY5iKnp3ejBdoz9zCMx8HPWJM5q/OzxHiBM4ZC WCWmuNnHs4btWDc+HdJXR2+sD7JEUq7YEopM82i9Rbkdj6nzk9p72cDwGmM1PLtahf3ZTA3d8qKKv 02fsGlfzG0W5uxzOONEqwomkY9hbzEeO3TCWSnciHQuBHfhM0xXslznFhMJbTW9saiBSemf6awjbR ENjfCU+KS41Xj3uDj0PXUUxej2s7d3WP5RgUUpiMc1O1v1HSVky7iXOrsFPa7jS724QXbGRk5/MoA YN2b/DQA==; Received: from [191.204.194.148] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1tkrj6-00F1SN-MV; Wed, 19 Feb 2025 22:35:34 +0100 From: =?utf-8?q?Andr=C3=A9_Almeida?= To: Alex Deucher , =?utf-8?b?J0NocmlzdGlhbiBLw7Zu?= =?utf-8?b?aWcn?= , Xinhui Pan , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-dev@igalia.com, siqueira@igalia.com Cc: =?utf-8?q?Andr=C3=A9_Almeida?= Subject: [PATCH 2/3] drm/amdgpu: Log after a successful ring reset Date: Wed, 19 Feb 2025 18:35:16 -0300 Message-ID: <20250219213517.281556-3-andrealmeid@igalia.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250219213517.281556-1-andrealmeid@igalia.com> References: <20250219213517.281556-1-andrealmeid@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When a ring reset happens, the kernel log shows only "amdgpu: Starting ring reset", but when it finishes nothing appears in the log. Explicitly write in the log that the reset has finished correctly. Signed-off-by: André Almeida --- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c index 100f04475943..698e5799e542 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c @@ -149,6 +149,7 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) amdgpu_fence_driver_force_completion(ring); if (amdgpu_ring_sched_ready(ring)) drm_sched_start(&ring->sched, 0); + dev_err(adev->dev, "Ring %s reset succeeded\n", ring->sched.name); goto exit; } dev_err(adev->dev, "Ring %s reset failure\n", ring->sched.name); From patchwork Wed Feb 19 21:35:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 13983034 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2B837C021AA for ; Wed, 19 Feb 2025 21:35:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6C1C10E89E; Wed, 19 Feb 2025 21:35:45 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="rIr77q9B"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7AB0C10E89E; Wed, 19 Feb 2025 21:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=aMp0X/kKH/xLP0BxZclKAhaRvsa7RWoi/0q4q55kxFc=; b=rIr77q9B5LxPxJh7jMvZAl/XZX UviseiwzgTaV41nYBP7AVP7cQ7PeQiAm1ocoZmibLfvV+/wWgKmKKvQq/pHx3jkKTWePT8XLAPA5y QU2b5+tKsqEAdJiI0ZOCsBCuUpV+pczr6EpuWQzJOcMtuuy+RUUI+K6DR2MK/2nixKtA2KFVmwlCB HzkbdiOCoK/lEQmTZrQb0vmtkSYJjqw3kZnhJnpEvQNcYEqQn8sL8Nko37X3HX2CPLwIbRl7CiQhw Mx3L38qYYFWgKQyACSB3MUjkNowrxUhXNxgdRHQN3x6kg9uUurOzehZu86LI1cigsFnrKFscTGxeX WSdL6PEQ==; Received: from [191.204.194.148] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1tkrj9-00F1SN-HI; Wed, 19 Feb 2025 22:35:37 +0100 From: =?utf-8?q?Andr=C3=A9_Almeida?= To: Alex Deucher , =?utf-8?b?J0NocmlzdGlhbiBLw7Zu?= =?utf-8?b?aWcn?= , Xinhui Pan , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-dev@igalia.com, siqueira@igalia.com Cc: =?utf-8?q?Andr=C3=A9_Almeida?= Subject: [PATCH 3/3] drm/amdgpu: Trigger a wedged event for every type of reset Date: Wed, 19 Feb 2025 18:35:17 -0300 Message-ID: <20250219213517.281556-4-andrealmeid@igalia.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250219213517.281556-1-andrealmeid@igalia.com> References: <20250219213517.281556-1-andrealmeid@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Instead of only triggering a wedged event for complete GPU resets, trigger for all types, like soft resets and ring resets. Regardless of the reset, it's useful for userspace to know that it happened because the kernel will reject further submissions from that app. Signed-off-by: André Almeida --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 --- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 16 +++++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 24ba52d76045..36738c1a5b59 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -6123,9 +6123,6 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, atomic_set(&adev->reset_domain->reset_res, r); - if (!r) - drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE); - return r; } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c index 698e5799e542..1082b957e7b1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c @@ -91,8 +91,7 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) struct amdgpu_job *job = to_amdgpu_job(s_job); struct amdgpu_task_info *ti; struct amdgpu_device *adev = ring->adev; - int idx; - int r; + int idx, ret = 0; if (!drm_dev_enter(adev_to_drm(adev), &idx)) { dev_info(adev->dev, "%s - device unplugged skipping recovery on scheduler:%s", @@ -141,8 +140,8 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) * we'll fall back to full GPU reset. */ drm_sched_wqueue_stop(&ring->sched); - r = amdgpu_ring_reset(ring, job->vmid); - if (!r) { + ret = amdgpu_ring_reset(ring, job->vmid); + if (!ret) { if (amdgpu_ring_sched_ready(ring)) drm_sched_stop(&ring->sched, s_job); atomic_inc(&ring->adev->gpu_reset_counter); @@ -170,9 +169,9 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) */ set_bit(AMDGPU_SKIP_COREDUMP, &reset_context.flags); - r = amdgpu_device_gpu_recover(ring->adev, job, &reset_context); - if (r) - dev_err(adev->dev, "GPU Recovery Failed: %d\n", r); + ret = amdgpu_device_gpu_recover(ring->adev, job, &reset_context); + if (ret) + dev_err(adev->dev, "GPU Recovery Failed: %d\n", ret); } else { drm_sched_suspend_timeout(&ring->sched); if (amdgpu_sriov_vf(adev)) @@ -180,6 +179,9 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) } exit: + if (!ret) + drm_dev_wedged_event(adev_to_drm(adev), DRM_WEDGE_RECOVERY_NONE); + drm_dev_exit(idx); return DRM_GPU_SCHED_STAT_NOMINAL; }