<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    Well that explanation doesn't seem to make much sense either.<br>
    <br>
    What do you mean with TLB flush is occurring prematurely?<br>
    <br>
    Regards,<br>
    Christian.<br>
    <br>
    <div class="moz-cite-prefix">Am 05.09.24 um 14:38 schrieb
      Andjelkovic, Dejan:<br>
    </div>
    <blockquote type="cite" cite="mid:CO6PR12MB54412BC4A08D1335062D28C4E79D2@CO6PR12MB5441.namprd12.prod.outlook.com">
      
      <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
      <p style="font-family:Calibri;font-size:10pt;color:#0000FF;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
        [AMD Official Use Only - AMD Internal Distribution Only]<br>
      </p>
      <br>
      <div>
        <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
          Hi there. We're running into a page fault issue that's very
          easily reproducible on a SRIOV environment when using SDMA for
          page table updates. Going through mapping logs and trace
          files, it seems TLB flush is occurring prematurely. Changing
          the usage to KERNEL completely stops the page fault from
          occurring with no performance impact, which was confirmed with
          extensive testing. Looking through amdgpu_vm_sdma.c, namely
          within amdgpu_vm_sdma_update when waiting for PD/PT moves to
          be completed, fences are iterated with KERNEL usage specified
          which are then added as a job dependency.</div>
        <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
          <br>
        </div>
        <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
          Best regards,</div>
        <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
          Dejan</div>
        <hr style="display:inline-block;width:98%" tabindex="-1">
        <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><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> Thursday, September 5, 2024 1:17 PM<br>
            <b>To:</b> Andjelkovic, Dejan
            <a class="moz-txt-link-rfc2396E" href="mailto:Dejan.Andjelkovic@amd.com"><Dejan.Andjelkovic@amd.com></a>;
            <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
            <a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx@lists.freedesktop.org"><amd-gfx@lists.freedesktop.org></a><br>
            <b>Cc:</b> Prica, Nikola <a class="moz-txt-link-rfc2396E" href="mailto:Nikola.Prica@amd.com"><Nikola.Prica@amd.com></a>;
            Kuehling, Felix <a class="moz-txt-link-rfc2396E" href="mailto:Felix.Kuehling@amd.com"><Felix.Kuehling@amd.com></a>; Deng, Emily
            <a class="moz-txt-link-rfc2396E" href="mailto:Emily.Deng@amd.com"><Emily.Deng@amd.com></a><br>
            <b>Subject:</b> Re: [PATCH] drm/amdgpu: Raise dma resv usage
            for created TLB fence</font>
          <div> </div>
        </div>
        <div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
              <div class="PlainText">Am 05.09.24 um 10:58 schrieb Dejan
                Andjelkovic:<br>
                > When using SDMA for PT updates, a TLB fence hooked
                to a buffer<br>
                > objects dma resv object with usage declared as
                BOOKKEEP leaves a<br>
                > chance for TLB flush to occur prematurely. This
                will lead to a page<br>
                > fault. Raising the usage from BOOKKEEP to KERNEL
                removes this<br>
                > possibility.<br>
                <br>
                Well that's complete nonsense. The usage model is for
                implicit syncing <br>
                and not even remotely related to TLB flushing.<br>
                <br>
                What exactly is the problem you run into?<br>
                <br>
                Regards,<br>
                Christian.<br>
                <br>
                ><br>
                > Signed-off-by: Dejan Andjelkovic
                <a class="moz-txt-link-rfc2396E" href="mailto:Dejan.Andjelkovic@amd.com"><Dejan.Andjelkovic@amd.com></a><br>
                > ---<br>
                >   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-<br>
                >   1 file changed, 1 insertion(+), 1 deletion(-)<br>
                ><br>
                > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
                b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
                > index f93804902fd3..8efc2cf9bbb0 100644<br>
                > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
                > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
                > @@ -928,7 +928,7 @@ amdgpu_vm_tlb_flush(struct
                amdgpu_vm_update_params *params,<br>
                >   <br>
                >                /* Makes sure no PD/PT is freed
                before the flush */<br>
                >               
                dma_resv_add_fence(vm->root.bo->tbo.base.resv,
                *fence,<br>
                > -                               
                DMA_RESV_USAGE_BOOKKEEP);<br>
                > +                               
                DMA_RESV_USAGE_KERNEL);<br>
                >        }<br>
                >   }<br>
                >   <br>
                <br>
              </div>
            </span></font></div>
      </div>
    </blockquote>
    <br>
  </body>
</html>