<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
Am 10.02.23 um 12:30 schrieb Xiao, Jack:<br>
<blockquote type="cite" cite="mid:MW3PR12MB44582E9B0204ADEA3FA128AFEFDE9@MW3PR12MB4458.namprd12.prod.outlook.com">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
{font-family:"\@DengXian";
panose-1:2 1 6 0 3 1 1 1 1 1;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}p.msipheaderdf3d92d6, li.msipheaderdf3d92d6, div.msipheaderdf3d92d6
{mso-style-name:msipheaderdf3d92d6;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="msipheaderdf3d92d6" style="margin:0in"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:blue">[AMD
Official Use Only - General]</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">>> The driver are resumed before the
core Linux memory management is ready to serve allocations.
E.g. swap for example isn't turned on yet.<br>
<br>
>> This means that this stuff only worked because we
were able to allocate memory from the pool which isn't
guaranteed in any way.
<br>
<br>
Memory allocation failure can happen at any time, every
programmer should correctly handle it.</p>
</div>
</blockquote>
<br>
We are not talking about memory allocation failure, we are talking
about the kernel calling panic() because it can't properly resume.<br>
<br>
Regards,<br>
Christian.<br>
<br>
<blockquote type="cite" cite="mid:MW3PR12MB44582E9B0204ADEA3FA128AFEFDE9@MW3PR12MB4458.namprd12.prod.outlook.com">
<div class="WordSection1">
<p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal">If memory allocation failure is not
critical error and can gracefully continue to run, it should
be acceptable.
<o:p></o:p></p>
<p class="MsoNormal">The memory allocation failure during mes
self test should be the acceptable one. It will not make
system hang up and<o:p></o:p></p>
<p class="MsoNormal">driver can gracefully continue to run.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Jack<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Koenig, Christian
<a class="moz-txt-link-rfc2396E" href="mailto:Christian.Koenig@amd.com"><Christian.Koenig@amd.com></a> <br>
<b>Sent:</b> Friday, February 10, 2023 6:25 PM<br>
<b>To:</b> Xiao, Jack <a class="moz-txt-link-rfc2396E" href="mailto:Jack.Xiao@amd.com"><Jack.Xiao@amd.com></a>; Quan,
Evan <a class="moz-txt-link-rfc2396E" href="mailto:Evan.Quan@amd.com"><Evan.Quan@amd.com></a>; Christian König
<a class="moz-txt-link-rfc2396E" href="mailto:ckoenig.leichtzumerken@gmail.com"><ckoenig.leichtzumerken@gmail.com></a>;
<a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>; Deucher, Alexander
<a class="moz-txt-link-rfc2396E" href="mailto:Alexander.Deucher@amd.com"><Alexander.Deucher@amd.com></a><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: only WARN freeing
buffers when DMA is unavailable<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi Jack,<br>
<br>
Am 10.02.23 um 10:51 schrieb Xiao, Jack:<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="msipheaderdf3d92d6" style="margin:0in"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:blue">[AMD
Official Use Only - General]</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi Christian,<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">>> Allocating buffers temporary for
stuff like that is illegal during resume.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Can you *<b>deeply</b>* explain why it is
illegal during ip late_init stage which is a part stage of
resume?<o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><br>
Well no, I don't have the time to explain this to everybody
individually.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">[Jack] …<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">In my understanding, after gmc ready,
driver can allocate/free kernel bo, and after SDMA ready,
<o:p></o:p></p>
<p class="MsoNormal">the eviction should be ready. What else
prevent driver doing that during resume?<o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><br>
The driver are resumed before the core Linux memory management
is ready to serve allocations. E.g. swap for example isn't
turned on yet.<br>
<br>
This means that this stuff only worked because we were able to
allocate memory from the pool which isn't guaranteed in any
way.
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">>> I strongly suggest to just
remove the MES test. It's abusing the kernel ring interface
in a way we didn't want anyway and is currently replaced by
Shahanks work.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">The kernel mes unit test is very
meaningful and important to catch MES firmware issue at
first time before
<o:p></o:p></p>
<p class="MsoNormal">issue went spread to other components
like kfd/umd to avoid the problem complicated, Otherwise,
the issue
<o:p></o:p></p>
<p class="MsoNormal">would become hard to catch and debug. <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Secondly, for mes unit test is
self-containing and no dependency, it is a part of milestone
to qualify MES ready,<o:p></o:p></p>
<p class="MsoNormal">indicating that it can deliver to other
component especially during brinup. It is likely ring test
and ib test indicating
<o:p></o:p></p>
<p class="MsoNormal">gfx is ready to go. After totally
transitioning to gfx user queue, mes unit test may be the
only one unit test which<o:p></o:p></p>
<p class="MsoNormal">can indicate gfx is ready at the very
early stage of bringup when UMD is not ready.<o:p></o:p></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
Alex and I are the maintainers of the driver who are deciding
stuff like that and at least I don't really buy that argument.
The ring, IB and benchmark tests are in the kernel module
because they are simple.<br>
<br>
If we have a complicated unit test like simulating creating an
MES user queue to test the firmware functionality than that's
really overkill. Especially when you need to allocate memory
for it.<br>
<br>
We previously had people requesting to add shader code and
other complicated testing and rejected that as well because it
just bloat up the kernel driver unnecessarily.<br>
<br>
If we can modify the MES test to not abuse the amdgpu_ring
structure only work with memory from the SA for example we
could keep this, but not really in the current state.<br>
<br>
Regards,<br>
Christian.<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Jack<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Koenig, Christian <a href="mailto:Christian.Koenig@amd.com" moz-do-not-send="true">
<Christian.Koenig@amd.com></a> <br>
<b>Sent:</b> Friday, February 10, 2023 4:08 PM<br>
<b>To:</b> Quan, Evan <a href="mailto:Evan.Quan@amd.com" moz-do-not-send="true"><Evan.Quan@amd.com></a>;
Christian König
<a href="mailto:ckoenig.leichtzumerken@gmail.com" moz-do-not-send="true"><ckoenig.leichtzumerken@gmail.com></a>;
Xiao, Jack
<a href="mailto:Jack.Xiao@amd.com" moz-do-not-send="true"><Jack.Xiao@amd.com></a>;
<a href="mailto:amd-gfx@lists.freedesktop.org" moz-do-not-send="true" class="moz-txt-link-freetext">
amd-gfx@lists.freedesktop.org</a>; Deucher, Alexander
<a href="mailto:Alexander.Deucher@amd.com" moz-do-not-send="true">
<Alexander.Deucher@amd.com></a><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: only WARN
freeing buffers when DMA is unavailable<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi Evan,<br>
<br>
yeah, exactly that's what this warning should prevent.
Allocating buffers temporary for stuff like that is illegal
during resume.<br>
<br>
I strongly suggest to just remove the MES test. It's abusing
the kernel ring interface in a way we didn't want anyway and
is currently replaced by Shahanks work.<br>
<br>
Regards,<br>
Christian.<o:p></o:p></p>
<div>
<p class="MsoNormal">Am 10.02.23 um 05:12 schrieb Quan,
Evan:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="msipheaderdf3d92d6" style="margin:0in"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:blue">[AMD
Official Use Only - General]</span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Hi Jack,<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Are you trying to fix the call trace
popped up on resuming below?<o:p></o:p></p>
<p class="MsoNormal">It seems mes created some bo for its
self test and freed it up later at the final stage of the
resuming process.
<o:p></o:p></p>
<p class="MsoNormal">All these happened before the
in_suspend flag cleared. And that triggered the call
trace.<o:p></o:p></p>
<p class="MsoNormal">Is my understanding correct?<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">[74084.799260] WARNING: CPU: 2 PID:
2891 at drivers/gpu/drm/amd/amdgpu/amdgpu_object.c:425
amdgpu_bo_free_kernel+0xfc/0x110 [amdgpu]<o:p></o:p></p>
<p class="MsoNormal">[74084.811019] Modules linked in:
nls_iso8859_1 amdgpu(OE) iommu_v2 gpu_sched drm_buddy
drm_ttm_helper ttm drm_display_helper drm_kms_helper
i2c_algo_bit fb_sys_fops syscopyarea sysfillrect sysimgblt
snd_sm<o:p></o:p></p>
<p class="MsoNormal">[74084.811042] ip_tables x_tables
autofs4 hid_logitech_hidpp hid_logitech_dj hid_generic
e1000e usbhid ptp uas hid video i2c_i801 ahci pps_core
crc32_pclmul i2c_smbus usb_storage libahci wmi<o:p></o:p></p>
<p class="MsoNormal">[74084.914519] CPU: 2 PID: 2891 Comm:
kworker/u16:38 Tainted: G W IOE 6.0.0-custom
#1<o:p></o:p></p>
<p class="MsoNormal">[74084.923146] Hardware name: ASUS
System Product Name/PRIME Z390-A, BIOS 2004 11/02/2021<o:p></o:p></p>
<p class="MsoNormal">[74084.931074] Workqueue:
events_unbound async_run_entry_fn<o:p></o:p></p>
<p class="MsoNormal">[74084.936393] RIP:
0010:amdgpu_bo_free_kernel+0xfc/0x110 [amdgpu]<o:p></o:p></p>
<p class="MsoNormal">[74084.942422] Code: 00 4d 85 ed 74 08
49 c7 45 00 00 00 00 00 4d 85 e4 74 08 49 c7 04 24 00 00
00 00 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc
<0f> 0b e9 39 ff ff ff 3d 00 fe ff ff 0f 85 75 96 47
00 ebf<o:p></o:p></p>
<p class="MsoNormal">[74084.961199] RSP:
0000:ffffbed6812ebb90 EFLAGS: 00010202<o:p></o:p></p>
<p class="MsoNormal">[74084.966435] RAX: 0000000000000000
RBX: ffffbed6812ebc50 RCX: 0000000000000000<o:p></o:p></p>
<p class="MsoNormal">[74084.973578] RDX: ffffbed6812ebc70
RSI: ffffbed6812ebc60 RDI: ffffbed6812ebc50<o:p></o:p></p>
<p class="MsoNormal">[74084.980725] RBP: ffffbed6812ebbb8
R08: 0000000000000000 R09: 00000000000001ff<o:p></o:p></p>
<p class="MsoNormal">[74084.987869] R10: ffffbed6812ebb40
R11: 0000000000000000 R12: ffffbed6812ebc70<o:p></o:p></p>
<p class="MsoNormal">[74084.995015] R13: ffffbed6812ebc60
R14: ffff963a2945cc00 R15: ffff9639c7da5630<o:p></o:p></p>
<p class="MsoNormal">[74085.002160] FS:
0000000000000000(0000) GS:ffff963d1dc80000(0000)
knlGS:0000000000000000<o:p></o:p></p>
<p class="MsoNormal">[74085.010262] CS: 0010 DS: 0000 ES:
0000 CR0: 0000000080050033<o:p></o:p></p>
<p class="MsoNormal">[74085.016016] CR2: 0000000000000000
CR3: 0000000377c0a001 CR4: 00000000003706e0<o:p></o:p></p>
<p class="MsoNormal">[74085.023164] DR0: 0000000000000000
DR1: 0000000000000000 DR2: 0000000000000000<o:p></o:p></p>
<p class="MsoNormal">[74085.030307] DR3: 0000000000000000
DR6: 00000000fffe0ff0 DR7: 0000000000000400<o:p></o:p></p>
<p class="MsoNormal">[74085.037453] Call Trace:<o:p></o:p></p>
<p class="MsoNormal">[74085.039911] <TASK><o:p></o:p></p>
<p class="MsoNormal">[74085.042023]
amdgpu_mes_self_test+0x385/0x460 [amdgpu]<o:p></o:p></p>
<p class="MsoNormal">[74085.047293]
mes_v11_0_late_init+0x44/0x50 [amdgpu]<o:p></o:p></p>
<p class="MsoNormal">[74085.052291]
amdgpu_device_ip_late_init+0x50/0x270 [amdgpu]<o:p></o:p></p>
<p class="MsoNormal">[74085.058032]
amdgpu_device_resume+0xb0/0x2d0 [amdgpu]<o:p></o:p></p>
<p class="MsoNormal">[74085.063187]
amdgpu_pmops_resume+0x37/0x70 [amdgpu]<o:p></o:p></p>
<p class="MsoNormal">[74085.068162]
pci_pm_resume+0x68/0x100<o:p></o:p></p>
<p class="MsoNormal">[74085.071836] ?
pci_legacy_resume+0x80/0x80<o:p></o:p></p>
<p class="MsoNormal">[74085.075943]
dpm_run_callback+0x4c/0x160<o:p></o:p></p>
<p class="MsoNormal">[74085.079873]
device_resume+0xad/0x210<o:p></o:p></p>
<p class="MsoNormal">[74085.083546] async_resume+0x1e/0x40<o:p></o:p></p>
<p class="MsoNormal">[74085.087046]
async_run_entry_fn+0x30/0x120<o:p></o:p></p>
<p class="MsoNormal">[74085.091152]
process_one_work+0x21a/0x3f0<o:p></o:p></p>
<p class="MsoNormal">[74085.095173]
worker_thread+0x50/0x3e0<o:p></o:p></p>
<p class="MsoNormal">[74085.098845] ?
process_one_work+0x3f0/0x3f0<o:p></o:p></p>
<p class="MsoNormal">[74085.103039] kthread+0xfa/0x130<o:p></o:p></p>
<p class="MsoNormal">[74085.106189] ?
kthread_complete_and_exit+0x20/0x20<o:p></o:p></p>
<p class="MsoNormal">[74085.110993] ret_from_fork+0x1f/0x30<o:p></o:p></p>
<p class="MsoNormal">[74085.114576] </TASK><o:p></o:p></p>
<p class="MsoNormal">[74085.116773] ---[ end trace
0000000000000000 ]---<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">BR<o:p></o:p></p>
<p class="MsoNormal">Evan<o:p></o:p></p>
<div style="border:none;border-left:solid blue
1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> amd-gfx <a href="mailto:amd-gfx-bounces@lists.freedesktop.org" moz-do-not-send="true">
<amd-gfx-bounces@lists.freedesktop.org></a>
<b>On Behalf Of </b>Christian König<br>
<b>Sent:</b> Monday, February 6, 2023 5:00 PM<br>
<b>To:</b> Xiao, Jack <a href="mailto:Jack.Xiao@amd.com" moz-do-not-send="true"><Jack.Xiao@amd.com></a>;
Koenig, Christian
<a href="mailto:Christian.Koenig@amd.com" moz-do-not-send="true"><Christian.Koenig@amd.com></a>;
<a href="mailto:amd-gfx@lists.freedesktop.org" moz-do-not-send="true" class="moz-txt-link-freetext">
amd-gfx@lists.freedesktop.org</a>; Deucher,
Alexander <a href="mailto:Alexander.Deucher@amd.com" moz-do-not-send="true">
<Alexander.Deucher@amd.com></a><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: only WARN
freeing buffers when DMA is unavailable<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">Am
06.02.23 um 09:28 schrieb Xiao, Jack:<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="msipheaderdf3d92d6" style="margin:0in"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:blue">[AMD
Official Use Only - General]</span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">
>> >> It's simply not
allowed to free up resources during suspend since
those can't be acquired again during resume.<o:p></o:p></p>
<p class="MsoNormal">
>> 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.<o:p></o:p></p>
<p class="MsoNormal"><br>
Why not? This is exactly what it should
do.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">[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.<o:p></o:p></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
No, once more: Freeing up or allocating resources
between suspend and resume is illegal!<br>
<br>
If you free up a resource during resume you should
absolutely hit that, this is intentional!<br>
<br>
Regards,<br>
Christian.<br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Jack<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Koenig, Christian
<a href="mailto:Christian.Koenig@amd.com" moz-do-not-send="true">
<Christian.Koenig@amd.com></a> <br>
<b>Sent:</b> Monday, February 6, 2023 4:06 PM<br>
<b>To:</b> Xiao, Jack <a href="mailto:Jack.Xiao@amd.com" moz-do-not-send="true"><Jack.Xiao@amd.com></a>;
Christian König
<a href="mailto:ckoenig.leichtzumerken@gmail.com" moz-do-not-send="true"><ckoenig.leichtzumerken@gmail.com></a>;
<a href="mailto:amd-gfx@lists.freedesktop.org" moz-do-not-send="true" class="moz-txt-link-freetext">amd-gfx@lists.freedesktop.org</a>;
Deucher, Alexander
<a href="mailto:Alexander.Deucher@amd.com" moz-do-not-send="true"><Alexander.Deucher@amd.com></a><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: only WARN
freeing buffers when DMA is unavailable<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">Am
06.02.23 um 08:23 schrieb Xiao, Jack:<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="msipheaderdf3d92d6" style="margin:0in"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:blue">[AMD
Official Use Only - General]</span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">>> Nope, that is not
related to any hw state.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">can use other flag.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">>>
It's simply not allowed to free up resources during
suspend since those can't be acquired again during
resume.<o:p></o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
Why not? This is exactly what it should do.<br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">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.<o:p></o:p></p>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
Well the root cause are programming errors. See
between suspending and resuming you should not
allocate nor free memory.<br>
<br>
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.<br>
<br>
Regards,<br>
Christian.<br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Jack<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Christian König
<a href="mailto:ckoenig.leichtzumerken@gmail.com" moz-do-not-send="true">
<ckoenig.leichtzumerken@gmail.com></a> <br>
<b>Sent:</b> Friday, February 3, 2023 9:20 PM<br>
<b>To:</b> Xiao, Jack <a href="mailto:Jack.Xiao@amd.com" moz-do-not-send="true"><Jack.Xiao@amd.com></a>;
Koenig, Christian
<a href="mailto:Christian.Koenig@amd.com" moz-do-not-send="true"><Christian.Koenig@amd.com></a>;
<a href="mailto:amd-gfx@lists.freedesktop.org" moz-do-not-send="true" class="moz-txt-link-freetext">
amd-gfx@lists.freedesktop.org</a>; Deucher,
Alexander <a href="mailto:Alexander.Deucher@amd.com" moz-do-not-send="true">
<Alexander.Deucher@amd.com></a><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: only
WARN freeing buffers when DMA is unavailable<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">Nope,
that is not related to any hw state.<br>
<br>
It's simply not allowed to free up resources during
suspend since those can't be acquired again during
resume.<br>
<br>
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.<br>
<br>
Regards,<br>
Christian.<o:p></o:p></p>
<div>
<p class="MsoNormal">Am 03.02.23 um 07:04 schrieb
Xiao, Jack:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="msipheaderdf3d92d6" style="margin:0in"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:blue">[AMD
Official Use Only - General]</span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">>> It's simply illegal to
free up memory during suspend.<o:p></o:p></p>
<p class="MsoNormal">Why? In my understanding, the
limit was caused by DMA shutdown.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Jack<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Koenig,
Christian <a href="mailto:Christian.Koenig@amd.com" moz-do-not-send="true">
<Christian.Koenig@amd.com></a> <br>
<b>Sent:</b> Thursday, February 2, 2023 7:43
PM<br>
<b>To:</b> Xiao, Jack <a href="mailto:Jack.Xiao@amd.com" moz-do-not-send="true"><Jack.Xiao@amd.com></a>;
<a href="mailto:amd-gfx@lists.freedesktop.org" moz-do-not-send="true" class="moz-txt-link-freetext">amd-gfx@lists.freedesktop.org</a>;
Deucher, Alexander
<a href="mailto:Alexander.Deucher@amd.com" moz-do-not-send="true"><Alexander.Deucher@amd.com></a><br>
<b>Subject:</b> AW: [PATCH] drm/amdgpu: only
WARN freeing buffers when DMA is unavailable<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<p class="MsoNormal">Big NAK to this! This warning
is not related in any way to the hw state.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">It's simply illegal to free
up memory during suspend.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Christian.<o:p></o:p></p>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<div class="MsoNormal" style="text-align:center" align="center">
<hr width="98%" size="2" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">Von:</span></b><span style="color:black"> Xiao, Jack <</span><a href="mailto:Jack.Xiao@amd.com" moz-do-not-send="true" class="moz-txt-link-freetext">Jack.Xiao@amd.com</a><span style="color:black">><br>
<b>Gesendet:</b> Donnerstag, 2. Februar 2023
10:54<br>
<b>An:</b> </span><a href="mailto:amd-gfx@lists.freedesktop.org" moz-do-not-send="true" class="moz-txt-link-freetext">amd-gfx@lists.freedesktop.org</a><span style="color:black"> <</span><a href="mailto:amd-gfx@lists.freedesktop.org" moz-do-not-send="true" class="moz-txt-link-freetext">amd-gfx@lists.freedesktop.org</a><span style="color:black">>; Deucher, Alexander
<</span><a href="mailto:Alexander.Deucher@amd.com" moz-do-not-send="true" class="moz-txt-link-freetext">Alexander.Deucher@amd.com</a><span style="color:black">>; Koenig, Christian
<</span><a href="mailto:Christian.Koenig@amd.com" moz-do-not-send="true" class="moz-txt-link-freetext">Christian.Koenig@amd.com</a><span style="color:black">><br>
<b>Cc:</b> Xiao, Jack <</span><a href="mailto:Jack.Xiao@amd.com" moz-do-not-send="true" class="moz-txt-link-freetext">Jack.Xiao@amd.com</a><span style="color:black">><br>
<b>Betreff:</b> [PATCH] drm/amdgpu: only WARN
freeing buffers when DMA is unavailable</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Reduce
waringings, only warn when DMA is unavailable.<br>
<br>
Signed-off-by: Jack Xiao <<a href="mailto:Jack.Xiao@amd.com" moz-do-not-send="true" class="moz-txt-link-freetext">Jack.Xiao@amd.com</a>><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
3 ++-<br>
1 file changed, 2 insertions(+), 1
deletion(-)<br>
<br>
diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
index 2d237f3d3a2e..e3e3764ea697 100644<br>
---
a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
+++
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
@@ -422,7 +422,8 @@ void
amdgpu_bo_free_kernel(struct amdgpu_bo **bo,
u64 *gpu_addr,<br>
if (*bo == NULL)<br>
return;<br>
<br>
-
WARN_ON(amdgpu_ttm_adev((*bo)->tbo.bdev)->in_suspend);<br>
+
WARN_ON(amdgpu_ttm_adev((*bo)->tbo.bdev)->in_suspend
&&<br>
+
!amdgpu_ttm_adev((*bo)->tbo.bdev)->ip_blocks[AMD_IP_BLOCK_TYPE_SDMA].status.hw);<br>
<br>
if (likely(amdgpu_bo_reserve(*bo,
true) == 0)) {<br>
if (cpu_addr)<br>
-- <br>
2.37.3<o:p></o:p></p>
</div>
</div>
</blockquote>
<p class="MsoNormal"> <o:p></o:p></p>
</blockquote>
<p class="MsoNormal"> <o:p></o:p></p>
</blockquote>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</blockquote>
<p class="MsoNormal"> <o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</blockquote>
<br>
</body>
</html>