Re: [PATCH 26/59] drm/ttm: start allowing drivers to use new takedown path (v2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 4 Aug 2020 at 21:20, Christian König <christian.koenig@xxxxxxx> wrote:
>
> Am 04.08.20 um 04:55 schrieb Dave Airlie:
> > From: Dave Airlie <airlied@xxxxxxxxxx>
> >
> > Allow the takedown path callback to be optional as well.
> >
> > v2: use fini for range manager
> > Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx>
>
> Reviewed-by: Christian König <christian.koenig@xxxxxxx>
Reviewed-by: Ben Skeggs <bskeggs@xxxxxxxxxx>

>
> > ---
> >   drivers/gpu/drm/ttm/ttm_bo.c         | 12 +++++++-----
> >   drivers/gpu/drm/ttm/ttm_bo_manager.c | 21 +++++++++++++++++++--
> >   include/drm/ttm/ttm_bo_driver.h      | 24 ++++++++++++++++++++++++
> >   3 files changed, 50 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> > index 127a0b62bf98..a45038c74de6 100644
> > --- a/drivers/gpu/drm/ttm/ttm_bo.c
> > +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> > @@ -1407,8 +1407,8 @@ int ttm_bo_create(struct ttm_bo_device *bdev,
> >   }
> >   EXPORT_SYMBOL(ttm_bo_create);
> >
> > -static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
> > -                                struct ttm_mem_type_manager *man)
> > +int ttm_mem_type_manager_force_list_clean(struct ttm_bo_device *bdev,
> > +                                       struct ttm_mem_type_manager *man)
> >   {
> >       struct ttm_operation_ctx ctx = {
> >               .interruptible = false,
> > @@ -1450,6 +1450,7 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
> >
> >       return 0;
> >   }
> > +EXPORT_SYMBOL(ttm_mem_type_manager_force_list_clean);
> >
> >   int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type)
> >   {
> > @@ -1472,13 +1473,14 @@ int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type)
> >
> >       ret = 0;
> >       if (mem_type > 0) {
> > -             ret = ttm_bo_force_list_clean(bdev, man);
> > +             ret = ttm_mem_type_manager_force_list_clean(bdev, man);
> >               if (ret) {
> >                       pr_err("Cleanup eviction failed\n");
> >                       return ret;
> >               }
> >
> > -             ret = (*man->func->takedown)(man);
> > +             if (man->func->takedown)
> > +                     ret = (*man->func->takedown)(man);
> >       }
> >
> >       ttm_mem_type_manager_cleanup(man);
> > @@ -1501,7 +1503,7 @@ int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type)
> >               return 0;
> >       }
> >
> > -     return ttm_bo_force_list_clean(bdev, man);
> > +     return ttm_mem_type_manager_force_list_clean(bdev, man);
> >   }
> >   EXPORT_SYMBOL(ttm_bo_evict_mm);
> >
> > diff --git a/drivers/gpu/drm/ttm/ttm_bo_manager.c b/drivers/gpu/drm/ttm/ttm_bo_manager.c
> > index b56c6961b278..96da22be672b 100644
> > --- a/drivers/gpu/drm/ttm/ttm_bo_manager.c
> > +++ b/drivers/gpu/drm/ttm/ttm_bo_manager.c
> > @@ -129,7 +129,7 @@ int ttm_range_man_init(struct ttm_bo_device *bdev,
> >   }
> >   EXPORT_SYMBOL(ttm_range_man_init);
> >
> > -static int ttm_bo_man_takedown(struct ttm_mem_type_manager *man)
> > +static int ttm_bo_man_takedown_private(struct ttm_mem_type_manager *man)
> >   {
> >       struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv;
> >       struct drm_mm *mm = &rman->mm;
> > @@ -146,6 +146,23 @@ static int ttm_bo_man_takedown(struct ttm_mem_type_manager *man)
> >       return -EBUSY;
> >   }
> >
> > +int ttm_range_man_fini(struct ttm_bo_device *bdev,
> > +                    struct ttm_mem_type_manager *man)
> > +{
> > +     int ret;
> > +
> > +     ttm_mem_type_manager_disable(man);
> > +
> > +     ret = ttm_mem_type_manager_force_list_clean(bdev, man);
> > +     if (ret)
> > +             return ret;
> > +
> > +     ttm_bo_man_takedown_private(man);
> > +     ttm_mem_type_manager_cleanup(man);
> > +     return 0;
> > +}
> > +EXPORT_SYMBOL(ttm_range_man_fini);
> > +
> >   static void ttm_bo_man_debug(struct ttm_mem_type_manager *man,
> >                            struct drm_printer *printer)
> >   {
> > @@ -157,7 +174,7 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man,
> >   }
> >
> >   static const struct ttm_mem_type_manager_func ttm_bo_manager_func = {
> > -     .takedown = ttm_bo_man_takedown,
> > +     .takedown = ttm_bo_man_takedown_private,
> >       .get_node = ttm_bo_man_get_node,
> >       .put_node = ttm_bo_man_put_node,
> >       .debug = ttm_bo_man_debug
> > diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
> > index 41bfa514c29d..9b4c22abc22c 100644
> > --- a/include/drm/ttm/ttm_bo_driver.h
> > +++ b/include/drm/ttm/ttm_bo_driver.h
> > @@ -706,6 +706,18 @@ static inline void ttm_mem_type_manager_cleanup(struct ttm_mem_type_manager *man
> >       man->move = NULL;
> >   }
> >
> > +/*
> > + * ttm_mem_type_manager_force_list_clean
> > + *
> > + * @bdev - device to use
> > + * @man - manager to use
> > + *
> > + * Force all the objects out of a memory manager until clean.
> > + * Part of memory manager cleanup sequence.
> > + */
> > +int ttm_mem_type_manager_force_list_clean(struct ttm_bo_device *bdev,
> > +                                       struct ttm_mem_type_manager *man);
> > +
> >   /*
> >    * ttm_bo_util.c
> >    */
> > @@ -835,6 +847,17 @@ int ttm_range_man_init(struct ttm_bo_device *bdev,
> >                      struct ttm_mem_type_manager *man,
> >                      unsigned long p_size);
> >
> > +/**
> > + * ttm_range_man_fini
> > + *
> > + * @bdev: ttm device
> > + * @type: memory manager type
> > + *
> > + * Remove the generic range manager from a slot and tear it down.
> > + */
> > +int ttm_range_man_fini(struct ttm_bo_device *bdev,
> > +                    struct ttm_mem_type_manager *man);
> > +
> >   /**
> >    * ttm_mem_type_manager_debug
> >    *
> > @@ -843,4 +866,5 @@ int ttm_range_man_init(struct ttm_bo_device *bdev,
> >    */
> >   void ttm_mem_type_manager_debug(struct ttm_mem_type_manager *man,
> >                               struct drm_printer *p);
> > +
> >   #endif
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux