<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    Am 16.02.24 um 15:20 schrieb Thomas Hellström:<br>
    [SNIP]<br>
    <blockquote type="cite" cite="mid:47fc8e42dcfd868341ffc32754c302e58ac49484.camel@linux.intel.com"><span style="white-space: pre-wrap">
</span>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">My approach was basically to not only lock the current BO, but also
the 
next one. Since only a locked BO can move on the LRU we effectively 
created an anchor.

Before I dig into the code a couple of questions:
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">These are described in the patches but brief comments inline.

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">1. How do you distinct BOs and iteration anchors on the LRU?
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">Using a struct ttm_lru_item, containing a struct list_head and the
type. List nodes embeds this instead of a struct list_head. This is
larger than the list head but makes it explicit what we're doing.</pre>
    </blockquote>
    <br>
    Need to look deeper into the code of this, but it would be nice if
    we could abstract that better somehow.<br>
    <br>
    <span style="white-space: pre-wrap">
</span>
    <blockquote type="cite" cite="mid:47fc8e42dcfd868341ffc32754c302e58ac49484.camel@linux.intel.com">
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">2. How do you detect that a bulk list moved on the LRU?
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">An age u64 counter on the bulk move that we're comparing against. It's
updated each time it moves.


</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">3. How do you remove the iteration anchors from the bulk list?
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">A function call at the end of iteration, that the function iterating is
requried to call.</pre>
    </blockquote>
    <br>
    Thinking quite a bit about that in the last week and I came to the
    conclusion that this might be overkill.<br>
    <br>
    All BOs in a bulk share the same reservation object. So when you
    acquired one you can just keep the dma-resv locked even after
    evicting the BO.<br>
    <br>
    Since moving BOs requires locking the dma-resv object the whole
    problem then just boils down to a list_for_each_element_safe().<br>
    <br>
    That's probably a bit simpler than doing the add/remove dance.<br>
    <br>
    Regards,<br>
    Christian.<br>
    <br>
    <blockquote type="cite" cite="mid:47fc8e42dcfd868341ffc32754c302e58ac49484.camel@linux.intel.com">
      <pre class="moz-quote-pre" wrap="">


/Thomas

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
Regards,
Christian.

</pre>
        <blockquote type="cite">
          <pre class="moz-quote-pre" wrap="">
The restartable property is used in patch 4 to restart swapout if
needed, but the main purpose is this paves the way for
shrinker- and exhaustive eviction.

Cc: Christian König <a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a>
Cc: <a class="moz-txt-link-rfc2396E" href="mailto:dri-devel@lists.freedesktop.org"><dri-devel@lists.freedesktop.org></a>

Thomas Hellström (4):
   drm/ttm: Allow TTM LRU list nodes of different types
   drm/ttm: Use LRU hitches
   drm/ttm: Consider hitch moves within bulk sublist moves
   drm/ttm: Allow continued swapout after -ENOSPC falure

  drivers/gpu/drm/ttm/ttm_bo.c       |   1 +
  drivers/gpu/drm/ttm/ttm_device.c   |  33 +++--
  drivers/gpu/drm/ttm/ttm_resource.c | 202 +++++++++++++++++++++++-
-----
  include/drm/ttm/ttm_resource.h     |  91 +++++++++++--
  4 files changed, 267 insertions(+), 60 deletions(-)

</pre>
        </blockquote>
        <pre class="moz-quote-pre" wrap="">
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
</pre>
    </blockquote>
    <br>
  </body>
</html>