mbox series

[00/49] ttm mem manager refactoring.

Message ID 20200731040520.3701599-1-airlied@gmail.com (mailing list archive)
Headers show
Series ttm mem manager refactoring. | expand

Message

Dave Airlie July 31, 2020, 4:04 a.m. UTC
I started pulling on a thread, and it led me down a hole.

This series refactors the ttm ttm_mem_type_manager object into
a driver owned, allocated, subclassaed object.

It starts with two minor fixes for some bad assumptions in two drivers.

Enables a new init path, ports all the drivers to the new init
path, and cleans up the old init path.
Enables a new takedown path, ports all the drivers to the new takedown
path, and cleans up the old takedown path
Wraps all access to the memory managers in the bo_device in a wrapper
across all drivers.
Make debug callback optional
Enables driver to provide their own mem manager objects
Subclasses the objects in all drivers and makes them into driver owned object
Drops the bo_device arrays of pointers, and some unneeded links and
struct members
Cleans up one api.

I think I'd probably want to merge all this via drm-misc, so if I can collect
acks/r-b from driver maintainers that would be good.

This is also based on Chrisitan's work to remove init_mem_type, so it won't
apply until he's finished getting all of that into drm-misc.

https://cgit.freedesktop.org/~airlied/linux/log/?h=ttm-refactor-mem-manager
is the tree I've built this on top off, so it's probably going to get rebased
but the code should stay mostly the same.

I've done some boot testing on nouveau, and I hope to test it on vmwgfx and
amdgpu soon.

Dave.

Comments

Christian König July 31, 2020, 9:17 a.m. UTC | #1
Am 31.07.20 um 06:04 schrieb Dave Airlie:
> I started pulling on a thread, and it led me down a hole.

We might want to make that hole even bigger :)

How about we rename the ttm_mem_reg into ttm_resource and 
ttm_mem_type_manager into ttm_resource_manager.

Neither amdgpu's OA/GWS resources nor the IDs in VMGFX are really memory.

In the long term I also want to move the whole address handling into 
each backend.

Going to send comments on the individual patches as well.

> This series refactors the ttm ttm_mem_type_manager object into
> a driver owned, allocated, subclassaed object.
>
> It starts with two minor fixes for some bad assumptions in two drivers.
>
> Enables a new init path, ports all the drivers to the new init
> path, and cleans up the old init path.
> Enables a new takedown path, ports all the drivers to the new takedown
> path, and cleans up the old takedown path
> Wraps all access to the memory managers in the bo_device in a wrapper
> across all drivers.
> Make debug callback optional
> Enables driver to provide their own mem manager objects
> Subclasses the objects in all drivers and makes them into driver owned object
> Drops the bo_device arrays of pointers, and some unneeded links and
> struct members
> Cleans up one api.
>
> I think I'd probably want to merge all this via drm-misc, so if I can collect
> acks/r-b from driver maintainers that would be good.
>
> This is also based on Chrisitan's work to remove init_mem_type, so it won't
> apply until he's finished getting all of that into drm-misc.

Preparing to push that to drm-misc-next just now.

Regards,
Christian.

>
> https://nam11.safelinks.protection.outlook.com/?url=https:%2F%2Fcgit.freedesktop.org%2F~airlied%2Flinux%2Flog%2F%3Fh%3Dttm-refactor-mem-manager&data=02%7C01%7Cchristian.koenig%40amd.com%7Caa32512acf9f4bf455ef08d83506f9d2%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637317651361302583&sdata=2sQt4A48ODl0Nq4P21YG3vRNdhkDZcZp0XHkQ930SAI%3D&reserved=0
> is the tree I've built this on top off, so it's probably going to get rebased
> but the code should stay mostly the same.
>
> I've done some boot testing on nouveau, and I hope to test it on vmwgfx and
> amdgpu soon.
>
> Dave.
>
>
Daniel Vetter July 31, 2020, 9:29 a.m. UTC | #2
On Fri, Jul 31, 2020 at 11:17:26AM +0200, Christian König wrote:
> Am 31.07.20 um 06:04 schrieb Dave Airlie:
> > I started pulling on a thread, and it led me down a hole.
> 
> We might want to make that hole even bigger :)
> 
> How about we rename the ttm_mem_reg into ttm_resource and
> ttm_mem_type_manager into ttm_resource_manager.

+1 on names I can understand, I alwas get confused about what exactly ttm
means with mem_reg and mem_type_manager.
-Daniel

> 
> Neither amdgpu's OA/GWS resources nor the IDs in VMGFX are really memory.
> 
> In the long term I also want to move the whole address handling into each
> backend.
> 
> Going to send comments on the individual patches as well.
> 
> > This series refactors the ttm ttm_mem_type_manager object into
> > a driver owned, allocated, subclassaed object.
> > 
> > It starts with two minor fixes for some bad assumptions in two drivers.
> > 
> > Enables a new init path, ports all the drivers to the new init
> > path, and cleans up the old init path.
> > Enables a new takedown path, ports all the drivers to the new takedown
> > path, and cleans up the old takedown path
> > Wraps all access to the memory managers in the bo_device in a wrapper
> > across all drivers.
> > Make debug callback optional
> > Enables driver to provide their own mem manager objects
> > Subclasses the objects in all drivers and makes them into driver owned object
> > Drops the bo_device arrays of pointers, and some unneeded links and
> > struct members
> > Cleans up one api.
> > 
> > I think I'd probably want to merge all this via drm-misc, so if I can collect
> > acks/r-b from driver maintainers that would be good.
> > 
> > This is also based on Chrisitan's work to remove init_mem_type, so it won't
> > apply until he's finished getting all of that into drm-misc.
> 
> Preparing to push that to drm-misc-next just now.
> 
> Regards,
> Christian.
> 
> > 
> > https://nam11.safelinks.protection.outlook.com/?url=https:%2F%2Fcgit.freedesktop.org%2F~airlied%2Flinux%2Flog%2F%3Fh%3Dttm-refactor-mem-manager&data=02%7C01%7Cchristian.koenig%40amd.com%7Caa32512acf9f4bf455ef08d83506f9d2%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637317651361302583&sdata=2sQt4A48ODl0Nq4P21YG3vRNdhkDZcZp0XHkQ930SAI%3D&reserved=0
> > is the tree I've built this on top off, so it's probably going to get rebased
> > but the code should stay mostly the same.
> > 
> > I've done some boot testing on nouveau, and I hope to test it on vmwgfx and
> > amdgpu soon.
> > 
> > Dave.
> > 
> > 
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Christian König July 31, 2020, 1:01 p.m. UTC | #3
Am 31.07.20 um 11:29 schrieb daniel@ffwll.ch:
> On Fri, Jul 31, 2020 at 11:17:26AM +0200, Christian König wrote:
>> Am 31.07.20 um 06:04 schrieb Dave Airlie:
>>> I started pulling on a thread, and it led me down a hole.
>> We might want to make that hole even bigger :)
>>
>> How about we rename the ttm_mem_reg into ttm_resource and
>> ttm_mem_type_manager into ttm_resource_manager.
> +1 on names I can understand, I alwas get confused about what exactly ttm
> means with mem_reg and mem_type_manager.

Well mem_type_manager was obvious, but to be honest I never figured out 
what _reg meant either :)

Christian.

> -Daniel
>
>> Neither amdgpu's OA/GWS resources nor the IDs in VMGFX are really memory.
>>
>> In the long term I also want to move the whole address handling into each
>> backend.
>>
>> Going to send comments on the individual patches as well.
>>
>>> This series refactors the ttm ttm_mem_type_manager object into
>>> a driver owned, allocated, subclassaed object.
>>>
>>> It starts with two minor fixes for some bad assumptions in two drivers.
>>>
>>> Enables a new init path, ports all the drivers to the new init
>>> path, and cleans up the old init path.
>>> Enables a new takedown path, ports all the drivers to the new takedown
>>> path, and cleans up the old takedown path
>>> Wraps all access to the memory managers in the bo_device in a wrapper
>>> across all drivers.
>>> Make debug callback optional
>>> Enables driver to provide their own mem manager objects
>>> Subclasses the objects in all drivers and makes them into driver owned object
>>> Drops the bo_device arrays of pointers, and some unneeded links and
>>> struct members
>>> Cleans up one api.
>>>
>>> I think I'd probably want to merge all this via drm-misc, so if I can collect
>>> acks/r-b from driver maintainers that would be good.
>>>
>>> This is also based on Chrisitan's work to remove init_mem_type, so it won't
>>> apply until he's finished getting all of that into drm-misc.
>> Preparing to push that to drm-misc-next just now.
>>
>> Regards,
>> Christian.
>>
>>> https://nam11.safelinks.protection.outlook.com/?url=https:%2F%2Fcgit.freedesktop.org%2F~airlied%2Flinux%2Flog%2F%3Fh%3Dttm-refactor-mem-manager&data=02%7C01%7Cchristian.koenig%40amd.com%7C7966b55d1dfd4ffd393908d835343faf%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637317846121673630&sdata=mqjdwhu9o3LfYSa%2FgW3GDDv2AABddmIPMZiAXoaNv6M%3D&reserved=0
>>> is the tree I've built this on top off, so it's probably going to get rebased
>>> but the code should stay mostly the same.
>>>
>>> I've done some boot testing on nouveau, and I hope to test it on vmwgfx and
>>> amdgpu soon.
>>>
>>> Dave.
>>>
>>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&data=02%7C01%7Cchristian.koenig%40amd.com%7C7966b55d1dfd4ffd393908d835343faf%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637317846121673630&sdata=%2BiZVquH6tc7FwEubwDmqkU6PcwdsdCCzDm1leuwOIa4%3D&reserved=0
Dave Airlie Aug. 3, 2020, 7:12 a.m. UTC | #4
On Fri, 31 Jul 2020 at 19:17, Christian König <christian.koenig@amd.com> wrote:
>
> Am 31.07.20 um 06:04 schrieb Dave Airlie:
> > I started pulling on a thread, and it led me down a hole.
>
> We might want to make that hole even bigger :)
>
> How about we rename the ttm_mem_reg into ttm_resource and
> ttm_mem_type_manager into ttm_resource_manager.
>

https://cgit.freedesktop.org/~airlied/linux/log/?h=ttm-refactor-mem-manager-rename

has the series with some stuff moved around but 3 added rename patches
at the end.

ttm_bo_manager -> ttm_range_manager
ttm_mem_type_manager -> ttm_resource_manager
ttm_mem_reg -> ttm_resource.

The one slightly messy one is we have a lot of ttm_mem_reg *mem
(*old_mem or *new_mem).
 I didn't try and rename those, but I could probably do it if we
decided it was really necessary.

I've got to go back and fold in some review comments from people yet
and add r-bs I'll try and get to that tomorrow.

Dave.

> Neither amdgpu's OA/GWS resources nor the IDs in VMGFX are really memory.
>
> In the long term I also want to move the whole address handling into
> each backend.
>
> Going to send comments on the individual patches as well.
>
> > This series refactors the ttm ttm_mem_type_manager object into
> > a driver owned, allocated, subclassaed object.
> >
> > It starts with two minor fixes for some bad assumptions in two drivers.
> >
> > Enables a new init path, ports all the drivers to the new init
> > path, and cleans up the old init path.
> > Enables a new takedown path, ports all the drivers to the new takedown
> > path, and cleans up the old takedown path
> > Wraps all access to the memory managers in the bo_device in a wrapper
> > across all drivers.
> > Make debug callback optional
> > Enables driver to provide their own mem manager objects
> > Subclasses the objects in all drivers and makes them into driver owned object
> > Drops the bo_device arrays of pointers, and some unneeded links and
> > struct members
> > Cleans up one api.
> >
> > I think I'd probably want to merge all this via drm-misc, so if I can collect
> > acks/r-b from driver maintainers that would be good.
> >
> > This is also based on Chrisitan's work to remove init_mem_type, so it won't
> > apply until he's finished getting all of that into drm-misc.
>
> Preparing to push that to drm-misc-next just now.
>
> Regards,
> Christian.
>
> >
> > https://nam11.safelinks.protection.outlook.com/?url=https:%2F%2Fcgit.freedesktop.org%2F~airlied%2Flinux%2Flog%2F%3Fh%3Dttm-refactor-mem-manager&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7Caa32512acf9f4bf455ef08d83506f9d2%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637317651361302583&amp;sdata=2sQt4A48ODl0Nq4P21YG3vRNdhkDZcZp0XHkQ930SAI%3D&amp;reserved=0
> > is the tree I've built this on top off, so it's probably going to get rebased
> > but the code should stay mostly the same.
> >
> > I've done some boot testing on nouveau, and I hope to test it on vmwgfx and
> > amdgpu soon.
> >
> > Dave.
> >
> >
>
Christian König Aug. 3, 2020, 11:13 a.m. UTC | #5
Am 03.08.20 um 09:12 schrieb Dave Airlie:
> On Fri, 31 Jul 2020 at 19:17, Christian König <christian.koenig@amd.com> wrote:
>> Am 31.07.20 um 06:04 schrieb Dave Airlie:
>>> I started pulling on a thread, and it led me down a hole.
>> We might want to make that hole even bigger :)
>>
>> How about we rename the ttm_mem_reg into ttm_resource and
>> ttm_mem_type_manager into ttm_resource_manager.
>>
> https://nam11.safelinks.protection.outlook.com/?url=https:%2F%2Fcgit.freedesktop.org%2F~airlied%2Flinux%2Flog%2F%3Fh%3Dttm-refactor-mem-manager-rename&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7Cc1498ce352be4c56b30908d8377cae61%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637320355926010223&amp;sdata=qXhKP8gmv6QsJiS%2BPprtM%2BVn8uE1XAFbZC0DI00zol8%3D&amp;reserved=0
>
> has the series with some stuff moved around but 3 added rename patches
> at the end.
>
> ttm_bo_manager -> ttm_range_manager
> ttm_mem_type_manager -> ttm_resource_manager
> ttm_mem_reg -> ttm_resource.
>
> The one slightly messy one is we have a lot of ttm_mem_reg *mem
> (*old_mem or *new_mem).
>   I didn't try and rename those, but I could probably do it if we
> decided it was really necessary.

I really want to reduce the usage of those in the long term from the 
driver anyway.

> I've got to go back and fold in some review comments from people yet
> and add r-bs I'll try and get to that tomorrow.

Feel free to add my Acked-by to the ones where I haven't given an 
explicit rb so for.

Going to prepare more cleanups on top of this series.

Christian.

>
> Dave.
>
>> Neither amdgpu's OA/GWS resources nor the IDs in VMGFX are really memory.
>>
>> In the long term I also want to move the whole address handling into
>> each backend.
>>
>> Going to send comments on the individual patches as well.
>>
>>> This series refactors the ttm ttm_mem_type_manager object into
>>> a driver owned, allocated, subclassaed object.
>>>
>>> It starts with two minor fixes for some bad assumptions in two drivers.
>>>
>>> Enables a new init path, ports all the drivers to the new init
>>> path, and cleans up the old init path.
>>> Enables a new takedown path, ports all the drivers to the new takedown
>>> path, and cleans up the old takedown path
>>> Wraps all access to the memory managers in the bo_device in a wrapper
>>> across all drivers.
>>> Make debug callback optional
>>> Enables driver to provide their own mem manager objects
>>> Subclasses the objects in all drivers and makes them into driver owned object
>>> Drops the bo_device arrays of pointers, and some unneeded links and
>>> struct members
>>> Cleans up one api.
>>>
>>> I think I'd probably want to merge all this via drm-misc, so if I can collect
>>> acks/r-b from driver maintainers that would be good.
>>>
>>> This is also based on Chrisitan's work to remove init_mem_type, so it won't
>>> apply until he's finished getting all of that into drm-misc.
>> Preparing to push that to drm-misc-next just now.
>>
>> Regards,
>> Christian.
>>
>>> https://nam11.safelinks.protection.outlook.com/?url=https:%2F%2Fcgit.freedesktop.org%2F~airlied%2Flinux%2Flog%2F%3Fh%3Dttm-refactor-mem-manager&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7Cc1498ce352be4c56b30908d8377cae61%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637320355926010223&amp;sdata=zrVYgyObEI8auSZ4AS7dDO%2BJ6WHYMITmuDQ%2F0lCxt1I%3D&amp;reserved=0
>>> is the tree I've built this on top off, so it's probably going to get rebased
>>> but the code should stay mostly the same.
>>>
>>> I've done some boot testing on nouveau, and I hope to test it on vmwgfx and
>>> amdgpu soon.
>>>
>>> Dave.
>>>
>>>