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 24005C61DA4 for ; Mon, 6 Feb 2023 08:59:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 926F910E330; Mon, 6 Feb 2023 08:59:50 +0000 (UTC) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9887910E330 for ; Mon, 6 Feb 2023 08:59:49 +0000 (UTC) Received: by mail-wm1-x32c.google.com with SMTP id q8so8102565wmo.5 for ; Mon, 06 Feb 2023 00:59:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=IlRcY0vEg10LAacQ5vEbfq+/ZiaS4GrhUrqlMg1biqc=; b=B5hvTnCvoZ9gnBJtG1AoiCLG22HjI0ZfOYQsDyqJZcaDLajG3mzgAywuwhfMOKa3O6 XNOgEqlRwAEnIqvs2H9XZO3VZmF3gV9yA7NkGyJ7zz4uXtX787nrqPZElHpQRMnYPgyY B5wUzcs7HoF4RZKS9vENwaR93qDRcCMmBHttUsXlpnzzLvkZdFGz20X3AIkssHD2AOvL CXxYLYrEAvTUdibaFcjrZrncFNSc2Hbkiv3gowi4seX9ohmuBelOG6NuPiTOGdn/ptxi 0rj59foBT0nlX1M2hhsNKtoWK5rH/Y5zIOlClhIow2fNoYIiKO9oHvY+MqdhfBJqrxD7 RJUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=IlRcY0vEg10LAacQ5vEbfq+/ZiaS4GrhUrqlMg1biqc=; b=QibIQjmUs0ImYRhxU7lVpSWDjJnXtf1WTmqQicHI+pcOVITEW50BEAmBF5cGKAJprK xVxFARWl6dWTjErajBOH8gnEoY9YwhMYuCm8LNHJ3hnHiQThYlSu/tCOrv41L2Fvc1kU 4Ev8rKO2W1MeWArJU6ef8Sf2Gt4NW29iXBe3Ti6rOpy16l42Ktd+gPoLmxEjuA/jscL1 ZftRpLX4EC6JcRf1I+rz6GNrpbqz9uZB+K8482OD/GFdWPYDTtBAkM+Ub0bW21kWyXEF 80gDiYFxzWIbVV2opPBcCLpzyZJG4ral+6Q+af1fnc6EOS/CD60mZh4iHMGReF+TlKjN RoNw== X-Gm-Message-State: AO0yUKVD9T/QCcqdbdPBopIX1oCZ9jCJNWSwojQqfWKFxPD/WQ109m6H 2OrTFWWvEYjePFVy6a6kAmskeDJt0Y4= X-Google-Smtp-Source: AK7set8Py4iZtDIEoHnoWfEKbHO17Zr2suRVmvn4Pc+w+/sHIl+WpF/31e2uASZgI+LE4Y/98HFHyg== X-Received: by 2002:a05:600c:3ca4:b0:3dc:f24:f2de with SMTP id bg36-20020a05600c3ca400b003dc0f24f2demr18108120wmb.12.1675673987999; Mon, 06 Feb 2023 00:59:47 -0800 (PST) Received: from [192.168.178.21] (p5b0ea2e7.dip0.t-ipconnect.de. [91.14.162.231]) by smtp.gmail.com with ESMTPSA id c7-20020a05600c0ac700b003d1d5a83b2esm15072940wmr.35.2023.02.06.00.59.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Feb 2023 00:59:47 -0800 (PST) Content-Type: multipart/alternative; boundary="------------s1ueuuzSI60Kp3MBSAigUUgj" Message-ID: <9cf6c24f-2b91-0431-6098-4ee2230ce57a@gmail.com> Date: Mon, 6 Feb 2023 09:59:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH] drm/amdgpu: only WARN freeing buffers when DMA is unavailable Content-Language: en-US To: "Xiao, Jack" , "Koenig, Christian" , "amd-gfx@lists.freedesktop.org" , "Deucher, Alexander" References: <20230202095416.4039818-1-Jack.Xiao@amd.com> <9ac594eb-9b59-02e1-fc7f-a745e28ff201@amd.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= In-Reply-To: X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" This is a multi-part message in MIME format. --------------s1ueuuzSI60Kp3MBSAigUUgj Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Am 06.02.23 um 09:28 schrieb Xiao, Jack: > > [AMD Official Use Only - General] > >                >> >> It's simply not allowed to free up resources > during suspend since those can't be acquired again during resume. > >                               >> The in_suspend flag is set at the > beginning of suspend and unset at the end of resume. It can’t filter > the case you mentioned. > > >                Why not? This is exactly what it should do. > > [Jack] If freeing up resources during resume, it should not hit the > issue you described. But only checking in_suspend flag would take > these cases as warning. > No, once more: Freeing up or allocating resources between suspend and resume is illegal! If you free up a resource during resume you should absolutely hit that, this is intentional! Regards, Christian. > Regards, > > Jack > > *From:* Koenig, Christian > *Sent:* Monday, February 6, 2023 4:06 PM > *To:* Xiao, Jack ; Christian König > ; amd-gfx@lists.freedesktop.org; > Deucher, Alexander > *Subject:* Re: [PATCH] drm/amdgpu: only WARN freeing buffers when DMA > is unavailable > > Am 06.02.23 um 08:23 schrieb Xiao, Jack: > > [AMD Official Use Only - General] > > >> Nope, that is not related to any hw state. > > can use other flag. > > >> It's simply not allowed to free up resources during suspend > since those can't be acquired again during resume. > > The in_suspend flag is set at the beginning of suspend and unset > at the end of resume. It can’t filter the case you mentioned. > > > Why not? This is exactly what it should do. > > Do you know the root cause of these cases hitting the issue? So > that we can get an exact point to warn the freeing up behavior. > > > Well the root cause are programming errors. See between suspending and > resuming you should not allocate nor free memory. > > Otherwise we can run into trouble. And this check here is one part of > that, we should probably add another warning during allocation of > memory. But this here is certainly correct. > > Regards, > Christian. > > Thanks, > > Jack > > *From:* Christian König > > *Sent:* Friday, February 3, 2023 9:20 PM > *To:* Xiao, Jack ; > Koenig, Christian > ; amd-gfx@lists.freedesktop.org; > Deucher, Alexander > > *Subject:* Re: [PATCH] drm/amdgpu: only WARN freeing buffers when > DMA is unavailable > > Nope, that is not related to any hw state. > > It's simply not allowed to free up resources during suspend since > those can't be acquired again during resume. > > We had a couple of cases now where this was wrong. If you get a > warning from that please fix the code which tried to free > something during suspend instead. > > Regards, > Christian. > > Am 03.02.23 um 07:04 schrieb Xiao, Jack: > > [AMD Official Use Only - General] > > >> It's simply illegal to free up memory during suspend. > > Why? In my understanding, the limit was caused by DMA shutdown. > > Regards, > > Jack > > *From:* Koenig, Christian > > *Sent:* Thursday, February 2, 2023 7:43 PM > *To:* Xiao, Jack > ; amd-gfx@lists.freedesktop.org; > Deucher, Alexander > > *Subject:* AW: [PATCH] drm/amdgpu: only WARN freeing buffers > when DMA is unavailable > > Big NAK to this! This warning is not related in any way to the > hw state. > > It's simply illegal to free up memory during suspend. > > Regards, > > Christian. > > ------------------------------------------------------------------------ > > *Von:*Xiao, Jack > *Gesendet:* Donnerstag, 2. Februar 2023 10:54 > *An:* amd-gfx@lists.freedesktop.org > ; Deucher, Alexander > ; Koenig, Christian > > *Cc:* Xiao, Jack > *Betreff:* [PATCH] drm/amdgpu: only WARN freeing buffers when > DMA is unavailable > > Reduce waringings, only warn when DMA is unavailable. > > Signed-off-by: Jack Xiao > --- >  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++- >  1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c > index 2d237f3d3a2e..e3e3764ea697 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c > @@ -422,7 +422,8 @@ void amdgpu_bo_free_kernel(struct > amdgpu_bo **bo, u64 *gpu_addr, >          if (*bo == NULL) >                  return; > > - WARN_ON(amdgpu_ttm_adev((*bo)->tbo.bdev)->in_suspend); > + WARN_ON(amdgpu_ttm_adev((*bo)->tbo.bdev)->in_suspend && > + > !amdgpu_ttm_adev((*bo)->tbo.bdev)->ip_blocks[AMD_IP_BLOCK_TYPE_SDMA].status.hw); > >          if (likely(amdgpu_bo_reserve(*bo, true) == 0)) { >                  if (cpu_addr) > -- > 2.37.3 > --------------s1ueuuzSI60Kp3MBSAigUUgj Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Am 06.02.23 um 09:28 schrieb Xiao, Jack:

[AMD Official Use Only - General]

 

                              >> >> It's simply not allowed to free up resources during suspend since those can't be acquired again during resume.

                              >> The in_suspend flag is set at the beginning of suspend and unset at the end of resume. It can’t filter the case you mentioned.


               Why not? This is exactly what it should do.

 

[Jack] If freeing up resources during resume, it should not hit the issue you described. But only checking in_suspend flag would take these cases as warning.


No, once more: Freeing up or allocating resources between suspend and resume is illegal!

If you free up a resource during resume you should absolutely hit that, this is intentional!

Regards,
Christian.

 

Regards,

Jack

 

From: Koenig, Christian <Christian.Koenig@amd.com>
Sent: Monday, February 6, 2023 4:06 PM
To: Xiao, Jack <Jack.Xiao@amd.com>; Christian König <ckoenig.leichtzumerken@gmail.com>; amd-gfx@lists.freedesktop.org; Deucher, Alexander <Alexander.Deucher@amd.com>
Subject: Re: [PATCH] drm/amdgpu: only WARN freeing buffers when DMA is unavailable

 

Am 06.02.23 um 08:23 schrieb Xiao, Jack:

[AMD Official Use Only - General]

 

>> Nope, that is not related to any hw state.

 

can use other flag.

 

>> It's simply not allowed to free up resources during suspend since those can't be acquired again during resume.

The in_suspend flag is set at the beginning of suspend and unset at the end of resume. It can’t filter the case you mentioned.


Why not? This is exactly what it should do.

Do you know the root cause of these cases hitting the issue? So that we can get an exact point to warn the freeing up behavior.


Well the root cause are programming errors. See between suspending and resuming you should not allocate nor free memory.

Otherwise we can run into trouble. And this check here is one part of that, we should probably add another warning during allocation of memory. But this here is certainly correct.

Regards,
Christian.

 

Thanks,

Jack

 

From: Christian König <ckoenig.leichtzumerken@gmail.com>
Sent: Friday, February 3, 2023 9:20 PM
To: Xiao, Jack <Jack.Xiao@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; amd-gfx@lists.freedesktop.org; Deucher, Alexander <Alexander.Deucher@amd.com>
Subject: Re: [PATCH] drm/amdgpu: only WARN freeing buffers when DMA is unavailable

 

Nope, that is not related to any hw state.

It's simply not allowed to free up resources during suspend since those can't be acquired again during resume.

We had a couple of cases now where this was wrong. If you get a warning from that please fix the code which tried to free something during suspend instead.

Regards,
Christian.

Am 03.02.23 um 07:04 schrieb Xiao, Jack:

[AMD Official Use Only - General]

 

>> It's simply illegal to free up memory during suspend.

Why? In my understanding, the limit was caused by DMA shutdown.

 

Regards,

Jack

 

From: Koenig, Christian <Christian.Koenig@amd.com>
Sent: Thursday, February 2, 2023 7:43 PM
To: Xiao, Jack <Jack.Xiao@amd.com>; amd-gfx@lists.freedesktop.org; Deucher, Alexander <Alexander.Deucher@amd.com>
Subject: AW: [PATCH] drm/amdgpu: only WARN freeing buffers when DMA is unavailable

 

Big NAK to this! This warning is not related in any way to the hw state.

 

It's simply illegal to free up memory during suspend.

 

Regards,

Christian.

 


Von: Xiao, Jack <Jack.Xiao@amd.com>
Gesendet: Donnerstag, 2. Februar 2023 10:54
An: amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>
Cc: Xiao, Jack <Jack.Xiao@amd.com>
Betreff: [PATCH] drm/amdgpu: only WARN freeing buffers when DMA is unavailable

 

Reduce waringings, only warn when DMA is unavailable.

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 2d237f3d3a2e..e3e3764ea697 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -422,7 +422,8 @@ void amdgpu_bo_free_kernel(struct amdgpu_bo **bo, u64 *gpu_addr,
         if (*bo == NULL)
                 return;
 
-       WARN_ON(amdgpu_ttm_adev((*bo)->tbo.bdev)->in_suspend);
+       WARN_ON(amdgpu_ttm_adev((*bo)->tbo.bdev)->in_suspend &&
+               !amdgpu_ttm_adev((*bo)->tbo.bdev)->ip_blocks[AMD_IP_BLOCK_TYPE_SDMA].status.hw);
 
         if (likely(amdgpu_bo_reserve(*bo, true) == 0)) {
                 if (cpu_addr)
--
2.37.3

 

 


--------------s1ueuuzSI60Kp3MBSAigUUgj--