From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
amd-gfx@lists.freedesktop.org
Cc: Harry.Wentland@amd.com
Subject: Re: [PATCH v5 2/7] drm/amd: Add concept of running prepare() sequence for IP blocks
Date: Mon, 9 Oct 2023 10:46:50 +0200 [thread overview]
Message-ID: <7cc4e389-7131-4763-9867-c1c8b9b96b2d@gmail.com> (raw)
In-Reply-To: <20231006185026.5536-3-mario.limonciello@amd.com>
Am 06.10.23 um 20:50 schrieb Mario Limonciello:
> If any IP blocks allocate memory during their sw_fini() sequence
hw_fini instead of sw_fini? sw_fini should only be called on driver unload.
> this can cause the suspend to fail under memory pressure. Introduce
> a new phase that IP blocks can use to allocate memory before suspend
> starts so that it can potentially be evicted into swap instead.
>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Apart from the commit message Reviewed-by: Christian König
<christian.koenig@amd.com>.
Regards,
Christian.
> ---
> v4->v5:
> * New patch
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 +++++++++++-
> drivers/gpu/drm/amd/include/amd_shared.h | 1 +
> 2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index cb334dc57c59..a362152cd0da 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -4348,7 +4348,7 @@ static int amdgpu_device_evict_resources(struct amdgpu_device *adev)
> int amdgpu_device_prepare(struct drm_device *dev)
> {
> struct amdgpu_device *adev = drm_to_adev(dev);
> - int r;
> + int i, r;
>
> if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
> return 0;
> @@ -4358,6 +4358,16 @@ int amdgpu_device_prepare(struct drm_device *dev)
> if (r)
> return r;
>
> + for (i = 0; i < adev->num_ip_blocks; i++) {
> + if (!adev->ip_blocks[i].status.valid)
> + continue;
> + if (!adev->ip_blocks[i].version->funcs->prepare)
> + continue;
> + r = adev->ip_blocks[i].version->funcs->prepare((void *)adev);
> + if (r)
> + return r;
> + }
> +
> return 0;
> }
>
> diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h
> index ce75351204bb..1f831cb747e0 100644
> --- a/drivers/gpu/drm/amd/include/amd_shared.h
> +++ b/drivers/gpu/drm/amd/include/amd_shared.h
> @@ -299,6 +299,7 @@ struct amd_ip_funcs {
> int (*hw_init)(void *handle);
> int (*hw_fini)(void *handle);
> void (*late_fini)(void *handle);
> + int (*prepare)(void *prepare);
> int (*suspend)(void *handle);
> int (*resume)(void *handle);
> bool (*is_idle)(void *handle);
next prev parent reply other threads:[~2023-10-09 8:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-06 18:50 [PATCH v5 0/7] Better handle memory pressure at suspend Mario Limonciello
2023-10-06 18:50 ` [PATCH v5 1/7] drm/amd: Evict resources during PM ops prepare() callback Mario Limonciello
2023-10-09 8:44 ` Christian König
2023-10-09 14:37 ` Alex Deucher
2023-10-06 18:50 ` [PATCH v5 2/7] drm/amd: Add concept of running prepare() sequence for IP blocks Mario Limonciello
2023-10-09 8:46 ` Christian König [this message]
2023-10-09 14:34 ` Alex Deucher
2023-10-06 18:50 ` [PATCH v5 3/7] drm/amd: Split up UVD suspend into prepare and suspend steps Mario Limonciello
2023-10-09 14:43 ` Alex Deucher
2023-10-06 18:50 ` [PATCH v5 4/7] drm/amd: Capture errors in amdgpu_switcheroo_set_state() Mario Limonciello
2023-10-09 9:06 ` Christian König
2023-10-06 18:50 ` [PATCH v5 5/7] drm/amd/display: Catch errors from drm_atomic_helper_suspend() Mario Limonciello
2023-10-09 9:06 ` Christian König
2023-10-09 14:44 ` Alex Deucher
2023-10-06 18:50 ` [PATCH v5 6/7] drm/amd/display: Destroy DC context while keeping DML and DML2 Mario Limonciello
2023-10-09 14:45 ` Alex Deucher
2023-10-06 18:50 ` [PATCH v5 7/7] drm/amd/display: make dc_set_power_state() return type `void` again Mario Limonciello
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=7cc4e389-7131-4763-9867-c1c8b9b96b2d@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=Harry.Wentland@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=mario.limonciello@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.