All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Jesse Zhang <Jesse.Zhang@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alexander.Deucher@amd.com, Christian Koenig <christian.koenig@amd.com>
Subject: Re: [PATCH 2/2] drm/amdgpu: flush coredump work before HW teardown
Date: Tue, 24 Mar 2026 14:13:22 +0530	[thread overview]
Message-ID: <012104f3-ed70-41e8-aaae-5ce1979b9b11@amd.com> (raw)
In-Reply-To: <20260324073817.662295-2-Jesse.Zhang@amd.com>



On 24-Mar-26 1:07 PM, Jesse Zhang wrote:
> In amdgpu_device_fini_hw(), deferred coredump formatting work may still
> be pending when hardware and IP components are being torn down. Since
> the work may access device registers and memory that will be freed or
> powered off, it must be completed before proceeding.
> 
> Add a flush_work() call for adev->coredump_work, guarded by
> CONFIG_DEV_COREDUMP, to ensure any pending coredump work finishes
> before the device enters the early IP fini stage.
> 
> This avoids potential use-after-free or accessing hardware resources
> that are no longer available.
> 
> Suggested-by: Lijo Lazar <lijo.lazar@amd.com>
> Signed-off-by: Jesse Zhang <jesse.zhang@amd.com>

One minor comment below, regardless -

Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>


> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index fbe553c38583..2a7c5a233673 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -4225,6 +4225,11 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
>   	if (pci_dev_is_disconnected(adev->pdev))
>   		amdgpu_amdkfd_device_fini_sw(adev);
>   
> +#ifdef CONFIG_DEV_COREDUMP
> +	/* Finish deferred coredump formatting before HW/IP teardown. */
> +	flush_work(&adev->coredump_work);
> +#endif
> +

This may be wrapped inside amdgpu_coredump_fini() corresponding to 
init() and thus it stays within amdgpu_dev_coredump.h/c file.

Thanks,
Lijo
>   	amdgpu_device_ip_fini_early(adev);
>   
>   	amdgpu_irq_fini_hw(adev);


  reply	other threads:[~2026-03-24  8:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24  7:37 [PATCH 1/2] drm/amdgpu: guard atom_context in devcoredump VBIOS dump Jesse Zhang
2026-03-24  7:37 ` [PATCH 2/2] drm/amdgpu: flush coredump work before HW teardown Jesse Zhang
2026-03-24  8:43   ` Lazar, Lijo [this message]
2026-03-24  8:39 ` [PATCH 1/2] drm/amdgpu: guard atom_context in devcoredump VBIOS dump Lazar, Lijo

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=012104f3-ed70-41e8-aaae-5ce1979b9b11@amd.com \
    --to=lijo.lazar@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Jesse.Zhang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    /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.