dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Matthew Auld <matthew.william.auld@gmail.com>
Cc: ray.huang@amd.com, ML dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 2/3] drm/ttm: remove swap LRU v2
Date: Mon, 15 Mar 2021 20:27:38 +0100	[thread overview]
Message-ID: <b9ad5546-da53-7a32-8f4d-030e8e4b8c25@gmail.com> (raw)
In-Reply-To: <CAM0jSHO6L+t8fK_2Ww94vhc0+AZ9KA-9j7razmo92UZKoa1_Lg@mail.gmail.com>

Am 15.03.21 um 19:54 schrieb Matthew Auld:
> On Mon, 15 Mar 2021 at 16:04, Christian König
> <ckoenig.leichtzumerken@gmail.com> wrote:
>> [SNIP]
>> @@ -1193,6 +1164,10 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,
>>          bool locked;
>>          int ret;
>>
>> +       if (!bo->ttm || bo->ttm->page_flags & (TTM_PAGE_FLAG_SG |
>> +                                              TTM_PAGE_FLAG_SWAPPED))
>> +               return false;
>> +
> return 0; ?
>
> Seems inconsistent to return zero here and not drop the lru lock? Or
> maybe turn this into a programmer error, since the current caller
> already checks for the above?

Thanks, that is just an artifact from rebasing and should be removed.

>> [SNIP]
>>
>> @@ -109,27 +106,60 @@ static int ttm_global_init(void)
>>   long ttm_global_swapout(struct ttm_operation_ctx *ctx, gfp_t gfp_flags)
>>   {
>>          struct ttm_global *glob = &ttm_glob;
>> +       struct ttm_device *bdev;
>> +       int ret = -EBUSY;
>> +
>> +       mutex_lock(&ttm_global_mutex);
>> +       list_for_each_entry(bdev, &glob->device_list, device_list) {
>> +               ret = ttm_device_swapout(bdev, ctx, gfp_flags);
> Mixing int and long for num_pages.
>
> Does ttm enforce a maximum page count somewhere for object sizes?

We should use 32 bit values for the number of pages in TTM, even signed 
values allow for 8TB large BOs.

And I really hope that we can get rid of the BO approach in general 
before we ever come close to that limit.

> Something like INT_MAX, since it doesn't look like ttm is consistently
> using the same type(unsigned long?) when representing the number of
> pages for an object?

I should probably add a check for that in the tt code, yes.

> [SNIP]
>   static void ttm_init_sysman(struct ttm_device *bdev)
>   {
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> index b991422e156c..0e82b0662d9e 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> @@ -1371,7 +1371,7 @@ static int vmw_pm_freeze(struct device *kdev)
>          vmw_execbuf_release_pinned_bo(dev_priv);
>          vmw_resource_evict_all(dev_priv);
>          vmw_release_device_early(dev_priv);
> -       while (ttm_global_swapout(&ctx, GFP_KERNEL) > 0);
> +       while (ttm_device_swapout(&dev_priv->bdev, &ctx, GFP_KERNEL) == 0);
> Is this the intended behaviour? ttm_device_swapout() still just
> returns num_pages if it swapped something out. I assume this wants to
> keep swapping stuff out, until it can't anymore. Or am I missing
> something?

Indeed that's a mix up. Thanks for pointing that out.

Christian.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2021-03-15 19:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15 16:04 [PATCH 1/3] drm/ttm: move swapout logic around Christian König
2021-03-15 16:04 ` [PATCH 2/3] drm/ttm: remove swap LRU v2 Christian König
2021-03-15 18:54   ` kernel test robot
2021-03-15 18:54   ` Matthew Auld
2021-03-15 19:27     ` Christian König [this message]
2021-03-15 16:04 ` [PATCH 3/3] drm/ttm: switch to per device LRU lock Christian König
2021-03-15 20:17   ` kernel test robot
2021-03-16  9:35   ` Daniel Vetter
2021-03-16 12:03     ` Christian König
2021-03-16 12:05       ` Daniel Vetter
2021-03-16 15:13         ` Christian König
2021-03-15 18:47 ` [PATCH 1/3] drm/ttm: move swapout logic around kernel test robot
2021-03-19  9:41 ` kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-02-11 13:29 Christian König
2021-02-11 13:29 ` [PATCH 2/3] drm/ttm: remove swap LRU v2 Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b9ad5546-da53-7a32-8f4d-030e8e4b8c25@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=matthew.william.auld@gmail.com \
    --cc=ray.huang@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox