<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[AMD Official Use Only - General]<br>
</p>
<br>
<div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Hey Alex, </div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Sure, I will pick it up and push it to staging. </div>
<div id="appendonsend" style="color: inherit; background-color: inherit;"></div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Regards</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Shashank</div>
<hr style="display: inline-block; width: 98%;">
<div dir="ltr" id="divRplyFwdMsg" style="color: inherit; background-color: inherit;">
<span style="font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><b>From:</b> Alex Deucher <alexdeucher@gmail.com><br>
<b>Sent:</b> Monday, March 25, 2024 12:23 AM<br>
<b>To:</b> Sharma, Shashank <Shashank.Sharma@amd.com><br>
<b>Cc:</b> Johannes Weiner <hannes@cmpxchg.org>; Christian König <ckoenig.leichtzumerken@gmail.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>;
dri-devel@lists.freedesktop.org <dri-devel@lists.freedesktop.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: fix deadlock while reading mqd from debugfs</span>
<div> </div>
</div>
<div style="font-size: 11pt;">On Sat, Mar 23, 2024 at 4:47 PM Sharma, Shashank<br>
<shashank.sharma@amd.com> wrote:<br>
><br>
><br>
> On 23/03/2024 15:52, Johannes Weiner wrote:<br>
> > On Thu, Mar 14, 2024 at 01:09:57PM -0400, Johannes Weiner wrote:<br>
> >> Hello,<br>
> >><br>
> >> On Fri, Mar 08, 2024 at 12:32:33PM +0100, Christian König wrote:<br>
> >>> Am 07.03.24 um 23:07 schrieb Johannes Weiner:<br>
> >>>> Lastly I went with an open loop instead of a memcpy() as I wasn't<br>
> >>>> sure if that memory is safe to address a byte at at time.<br>
> >> Shashank pointed out to me in private that byte access would indeed be<br>
> >> safe. However, after actually trying it it won't work because memcpy()<br>
> >> doesn't play nice with mqd being volatile:<br>
> >><br>
> >> /home/hannes/src/linux/linux/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c: In function 'amdgpu_debugfs_mqd_read':<br>
> >> /home/hannes/src/linux/linux/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:550:22: warning: passing argument 1 of '__builtin_dynamic_object_size' discards 'volatil' qualifier from pointer target type [-Wdiscarded-qualifiers]<br>
> >> 550 | memcpy(kbuf, mqd, ring->mqd_size);<br>
> >><br>
> >> So I would propose leaving the patch as-is. Shashank, does that sound<br>
> >> good to you?<br>
> > Friendly ping :)<br>
> ><br>
> > Shashank, is your Reviewed-by still good for this patch, given the<br>
> > above?<br>
><br>
> Ah, sorry I missed this due to some parallel work, and just realized the<br>
> memcpy/volatile limitation.<br>
><br>
> I also feel the need of protecting MQD read under a lock to avoid<br>
> parallel change in MQD while we do byte-by-byte copy, but I will add<br>
> that in my to-do list.<br>
><br>
> Please feel free to use my R-b.<br>
<br>
Shashank, if the patch looks good, can you pick it up and apply it?<br>
<br>
Alex<br>
<br>
<br>
><br>
> - Shashank<br>
><br>
> > Thanks</div>
</div>
</body>
</html>