Improve test coverage of TTM
Subsystems (3)
v2 cover Improve test coverage of TTM
Add tests for building blocks of the TTM subsystem, such as ttm_resource, ttm_resource_manager, ttm_tt and ttm_buffer_object. This series covers basic functions such as initialization, allocation and clean-up of each struct. Testing of ttm_buffer_object also includes locking and unlocking the object for validation, with special scenarios such as an interrupted wait or deadlock.
Some of the test cases check the bulk move mechanism and how it interacts with pinned buffers. This is to be seen if we want to add dedicated testing for bulk move or not. The resource allocation subtests use ttm_sys_manager for now. Resources that don't use system memory will be indirectly tested via tests for ttm_bo_validate()/ttm_bo_init_validate(), using a mock resource manager.
Use kunit_tool script to manually run all the tests:
$ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/gpu/drm/ttm/tests
To build a kernel with TTM KUnit tests, first enable CONFIG_KUNIT, and then CONFIG_DRM_TTM_KUNIT_TEST.
Many thanks,
Karolina
v2:
- Remove Makefile for KUnit tests and move the definitions to the TTM's one
- Switch on CONFIG_DRM_TTM_KUNIT_TEST=m so the tests and TTM module are built as one. This allows building the tests as a module, even if it uses functions that are not exported
- Fix ttm_pool_pre_populated(); a wrong flag was passed to ttm_tt_kunit_init() function
Karolina Stolarek (5):
drm/ttm: Update Makefile for KUnit drm/ttm/tests: Add tests for ttm_resource and ttm_sys_man drm/ttm/tests: Add tests for ttm_tt drm/ttm/tests: Add tests for ttm_bo functions drm/ttm/tests: Don't pass order as page flags
drivers/gpu/drm/ttm/Makefile | 19 +- drivers/gpu/drm/ttm/tests/Makefile | 6 - drivers/gpu/drm/ttm/tests/ttm_bo_test.c | 620 ++++++++++++++++++ drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c | 48 ++ drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h | 4 + drivers/gpu/drm/ttm/tests/ttm_pool_test.c | 3 +- drivers/gpu/drm/ttm/tests/ttm_resource_test.c | 335 ++++++++++ drivers/gpu/drm/ttm/tests/ttm_tt_test.c | 277 ++++++++ 8 files changed, 1299 insertions(+), 13 deletions(-) delete mode 100644 drivers/gpu/drm/ttm/tests/Makefile create mode 100644 drivers/gpu/drm/ttm/tests/ttm_bo_test.c create mode 100644 drivers/gpu/drm/ttm/tests/ttm_resource_test.c create mode 100644 drivers/gpu/drm/ttm/tests/ttm_tt_test.c
Signature · 1 line
2.25.1
PATCH v2 1/5 drm/ttm: Update Makefile for KUnit
Update Makefile so it can produce a module that consists of TTM tests. This will allow us to test non-exported functions when KUnit tests are built as a module. Remove the tests' Makefile.
--- drivers/gpu/drm/ttm/Makefile | 18 +++++++++++++----- drivers/gpu/drm/ttm/tests/Makefile | 6 ------ 2 files changed, 13 insertions(+), 11 deletions(-) delete mode 100644 drivers/gpu/drm/ttm/tests/Makefile
drivers/gpu/drm/ttm/Makefile +13 -5
@@ -2,10 +2,18 @@ # # Makefile for the drm device driver. This driver provides support for the -ttm-y := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ - ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \ - ttm_device.o ttm_sys_manager.o +ttm := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ + ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \ + ttm_device.o ttm_sys_manager.o +obj-$(CONFIG_DRM_TTM) += $(ttm) ttm-$(CONFIG_AGP) += ttm_agp_backend.o -obj-$(CONFIG_DRM_TTM) += ttm.o -obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += tests/ +ttm-tests := tests/ttm_kunit_helpers.o tests/ttm_device_test.o \ + tests/ttm_pool_test.o + +ifeq ($(CONFIG_DRM_TTM_KUNIT_TEST),m) + ttm-test-objs := $(ttm) $(ttm-tests) + obj-m := ttm-test.o +else + obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += $(ttm-tests) +endif
drivers/gpu/drm/ttm/tests/Makefile deleted +0 -6
@@ -1,6 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 AND MIT - -obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += \ - ttm_device_test.o \ - ttm_pool_test.o \ - ttm_kunit_helpers.o
Signature · 1 line
2.25.1
Re: [PATCH v2 1/5] drm/ttm: Update Makefile for KUnit
Quoted 3 lines · Karolina Stolarek
Update
Makefileso it can produce a module that consists of TTM tests. This will allow us to test non-exported functions when KUnit tests are built as a module. Remove the tests'Makefile.
I'm asking questions instead of making assertions, because I'm not 100% confident, but I don't feel like this Makefile could work right.
Quoted 17 lines
Signed-off-by Karolina Stolarek <[email protected]>Reported-by kernel test robot <[email protected]>--- drivers/gpu/drm/ttm/Makefile | 18 +++++++++++++----- drivers/gpu/drm/ttm/tests/Makefile | 6 ------ 2 files changed, 13 insertions(+), 11 deletions(-) delete mode 100644 drivers/gpu/drm/ttm/tests/Makefiledrivers/gpu/drm/ttm/Makefile +0
-0
drivers/gpu/drm/ttm/Makefile line 8
Quoted 10 lines
drivers/gpu/drm/ttm/Makefile +4
-3@@ -2,10 +2,18 @@ # # Makefile for the drm device driver. This driver provides support for the -ttm-y := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ - ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \ - ttm_device.o ttm_sys_manager.o +ttm := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ + ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \ + ttm_device.o ttm_sys_manager.o +obj-$(CONFIG_DRM_TTM) += $(ttm)
Does that not lead to each object in $(ttm) becoming its own module?
drivers/gpu/drm/ttm/Makefile line 9
Quoted 1 line
drivers/gpu/drm/ttm/Makefile +0
-0ttm-$(CONFIG_AGP) += ttm_agp_backend.o
Does this not create a ttm.o with just one object, depending on CONFIG_AGP?
drivers/gpu/drm/ttm/Makefile line 12
Quoted 5 lines
drivers/gpu/drm/ttm/Makefile +2
-2-obj-$(CONFIG_DRM_TTM) += ttm.o -obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += tests/ +ttm-tests := tests/ttm_kunit_helpers.o tests/ttm_device_test.o \ + tests/ttm_pool_test.o
I'd preserve the one object per line syntax. It's nicer for the diffs in subsequent updates.
drivers/gpu/drm/ttm/Makefile line 15
Quoted 3 lines
drivers/gpu/drm/ttm/Makefile +3
-0+ +ifeq ($(CONFIG_DRM_TTM_KUNIT_TEST),m) + ttm-test-objs := $(ttm) $(ttm-tests)
Isn't the -objs syntax for host/userspace programs? And if not, doesn't it lead to objects with exported symbols being present in two places?
Confused.
BR,
Jani.
Quoted 16 lines
drivers/gpu/drm/ttm/Makefile +4
-0+ obj-m := ttm-test.o +else + obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += $(ttm-tests) +endifdrivers/gpu/drm/ttm/tests/Makefile deleted +0
-6@@ -1,6 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 AND MIT - -obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += \ - ttm_device_test.o \ - ttm_pool_test.o \ - ttm_kunit_helpers.o
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Re: [PATCH v2 1/5] drm/ttm: Update Makefile for KUnit
Quoted 7 lines · Jani Nikula
Quoted 3 lines · Karolina Stolarek
Update
Makefileso it can produce a module that consists of TTM tests. This will allow us to test non-exported functions when KUnit tests are built as a module. Remove the tests'Makefile.I'm asking questions instead of making assertions, because I'm not 100% confident, but I don't feel like this
Makefilecould work right.
Questions, assertions and comments are fine, I'm glad you're taking a look at the patch :) I'm not 100% confident either, so I welcome suggestions on how to improve it.
The problem is that TTM tests try to test symbols that are not exported, so I have to compile all the files together into one module if I choose to build KUnit tests as a module. The other option that I'm considering is to make the tests are builtin only. I'm tempted to go with it (for the sake of simplicity), but I'm trying to get the module option to work first.
Quoted 21 lines
Quoted 21 lines
Signed-off-by Karolina Stolarek <[email protected]>Reported-by kernel test robot <[email protected]>--- drivers/gpu/drm/ttm/Makefile | 18 +++++++++++++----- drivers/gpu/drm/ttm/tests/Makefile | 6 ------ 2 files changed, 13 insertions(+), 11 deletions(-)delete mode 100644
drivers/gpu/drm/ttm/tests/Makefiledrivers/gpu/drm/ttm/Makefile +0
-0@@ -2,10 +2,18 @@ # # Makefile for the drm device driver. This driver provides support for the
Quoted 9 lines
drivers/gpu/drm/ttm/Makefile line 8
Quoted 7 lines
drivers/gpu/drm/ttm/Makefile +4
-3-ttm-y := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ - ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \ - ttm_device.o ttm_sys_manager.o +ttm := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ + ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \ + ttm_device.o ttm_sys_manager.o +obj-$(CONFIG_DRM_TTM) += $(ttm)Does that not lead to each object in $(ttm) becoming its own module?
Huh, yes, that is what would happen here. Not good...
Quoted 5 lines
drivers/gpu/drm/ttm/Makefile line 9
Quoted 2 lines
drivers/gpu/drm/ttm/Makefile +0
-0ttm-$(CONFIG_AGP) += ttm_agp_backend.oDoes this not create a ttm.o with just one object, depending on
CONFIG_AGP?
I just left it as it was before my changes.
Quoted 9 lines
drivers/gpu/drm/ttm/Makefile line 12
Quoted 6 lines
drivers/gpu/drm/ttm/Makefile +2
-2-obj-$(CONFIG_DRM_TTM) += ttm.o -obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += tests/ +ttm-tests := tests/ttm_kunit_helpers.o tests/ttm_device_test.o \ + tests/ttm_pool_test.oI'd preserve the one object per line syntax. It's nicer for the diffs in subsequent updates.
OK, will update it in the next version (if such comes). I just followed the style of "ttm-y".
Quoted 7 lines
drivers/gpu/drm/ttm/Makefile line 15
Quoted 4 lines
drivers/gpu/drm/ttm/Makefile +3
-0+ +ifeq ($(CONFIG_DRM_TTM_KUNIT_TEST),m) + ttm-test-objs := $(ttm) $(ttm-tests)Isn't the -objs syntax for host/userspace programs? And if not, doesn't it lead to objects with exported symbols being present in two places?
I saw it in use in other Makefiles, so I followed it. As for the exported symbols, I tested both builtin and module configs, and it was fine, but it's possible I missed something. I suspect that the variables are first expanded, and then processed by the Makefile.
Many thanks,
Karolina
Quoted 23 lines
Confused.
BR,
Jani.Quoted 16 lines
drivers/gpu/drm/ttm/Makefile +4
-0+ obj-m := ttm-test.o +else + obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += $(ttm-tests) +endifdrivers/gpu/drm/ttm/tests/Makefile deleted +0
-6@@ -1,6 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 AND MIT - -obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += \ - ttm_device_test.o \ - ttm_pool_test.o \ - ttm_kunit_helpers.o
Re: [PATCH v2 1/5] drm/ttm: Update Makefile for KUnit
Am 11.09.23 um 13:47 schrieb Karolina Stolarek:
Quoted 6 lines · Jani Nikula
Quoted 5 lines · Karolina Stolarek
Quoted 3 lines
Update
Makefileso it can produce a module that consists of TTM tests. This will allow us to test non-exported functions when KUnit tests are built as a module. Remove the tests'Makefile.
Quoted 6 lines
Quoted 2 lines
I'm asking questions instead of making assertions, because I'm not 100% confident, but I don't feel like this
Makefilecould work right.Questions, assertions and comments are fine, I'm glad you're taking a look at the patch :) I'm not 100% confident either, so I welcome suggestions on how to improve it.
The problem is that TTM tests try to test symbols that are not exported, so I have to compile all the files together into one module if I choose to build KUnit tests as a module. The other option that I'm considering is to make the tests are builtin only. I'm tempted to go with it (for the sake of simplicity), but I'm trying to get the module option to work first.
I have to admit that this looks pretty awkward, but I'm not an expert on the Linux build system in the first place.
Would it be an option to build the unit tests into the standard ttm.ko module and let them run whenever that module loads?
On the other hand if this solution here works, why not?
Regards,
Christian.
Quoted 89 lines
Quoted 23 lines
Quoted 23 lines
Signed-off-by Karolina Stolarek <[email protected]>Reported-by kernel test robot <[email protected]>---
drivers/gpu/drm/ttm/Makefile | 18 +++++++++++++-----drivers/gpu/drm/ttm/tests/Makefile| 6 ------2 files changed, 13 insertions(+), 11 deletions(-)delete mode 100644
drivers/gpu/drm/ttm/tests/Makefiledrivers/gpu/drm/ttm/Makefile +0
-1@@ -2,10 +2,18 @@ # # Makefile for the drm device driver. This driver provides support for the -ttm-y := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ - ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \Quoted 8 lines
drivers/gpu/drm/ttm/Makefile line 8
Quoted 6 lines
drivers/gpu/drm/ttm/Makefile +4
-1- ttm_device.o ttm_sys_manager.o +ttm := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ + ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \ + ttm_device.o ttm_sys_manager.o +obj-$(CONFIG_DRM_TTM) += $(ttm)Does that not lead to each object in $(ttm) becoming its own module?
Huh, yes, that is what would happen here. Not good...
Quoted 5 lines
Quoted 2 lines
ttm-$(CONFIG_AGP) += ttm_agp_backend.o
Does this not create a ttm.o with just one object, depending on
CONFIG_AGP?I just left it as it was before my changes.
Quoted 8 lines
drivers/gpu/drm/ttm/Makefile line 12
Quoted 5 lines
-obj-$(CONFIG_DRM_TTM) += ttm.o
drivers/gpu/drm/ttm/Makefile +2
-1-obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += tests/ +ttm-tests := tests/ttm_kunit_helpers.o tests/ttm_device_test.o \ + tests/ttm_pool_test.oI'd preserve the one object per line syntax. It's nicer for the diffs in subsequent updates.
OK, will update it in the next version (if such comes). I just followed the style of "ttm-y".
Quoted 7 lines
drivers/gpu/drm/ttm/Makefile line 15
Quoted 4 lines
drivers/gpu/drm/ttm/Makefile +3
-0+ +ifeq ($(CONFIG_DRM_TTM_KUNIT_TEST),m) + ttm-test-objs := $(ttm) $(ttm-tests)Isn't the -objs syntax for host/userspace programs? And if not, doesn't it lead to objects with exported symbols being present in two places?
I saw it in use in other Makefiles, so I followed it. As for the exported symbols, I tested both builtin and module configs, and it was fine, but it's possible I missed something. I suspect that the variables are first expanded, and then processed by the
Makefile.Many thanks,
KarolinaQuoted 23 lines
Confused.
BR,
Jani.Quoted 16 lines
+ obj-m := ttm-test.o
drivers/gpu/drm/ttm/Makefile +3
-0+else + obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += $(ttm-tests) +endifdrivers/gpu/drm/ttm/tests/Makefile deleted +0
-6@@ -1,6 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 AND MIT - -obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += \ - ttm_device_test.o \ - ttm_pool_test.o \ - ttm_kunit_helpers.o
Re: [PATCH v2 1/5] drm/ttm: Update Makefile for KUnit
Quoted 7 lines · Christian König
Am 11.09.23 um 13:47 schrieb Karolina Stolarek:
Quoted 6 lines · Jani Nikula
Quoted 5 lines · Karolina Stolarek
Quoted 3 lines
Update
Makefileso it can produce a module that consists of TTM tests. This will allow us to test non-exported functions when KUnit tests are built as a module. Remove the tests'Makefile.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I'm asking questions instead of making assertions, because I'm not 100% confident, but I don't feel like this
Makefilecould work right.Questions, assertions and comments are fine, I'm glad you're taking a look at the patch :) I'm not 100% confident either, so I welcome suggestions on how to improve it.
The problem is that TTM tests try to test symbols that are not exported, so I have to compile all the files together into one module if I choose to build KUnit tests as a module. The other option that I'm considering is to make the tests are builtin only. I'm tempted to go with it (for the sake of simplicity), but I'm trying to get the module option to work first.
I have to admit that this looks pretty awkward, but I'm not an expert on the Linux build system in the first place.
Neither am I, and it shows :)
Quoted 1 line
Would it be an option to build the unit tests into the standard ttm.ko module and let them run whenever that module loads?
You mean appending the list of tests to ttm-y, depending on $(CONFIG_DRM_TTM_KUNIT_TEST)? I _think_ I tried something similar, and couldn't get it to work, got a bunch of "twice exported" warnings.
Quoted 1 line
On the other hand if this solution here works, why not?
Because it's complicated and, well, awkward. I'm still thinking about a use case where we would prefer to have KUnit tests defined as a module. IIRC, in CI we enable KUnit tests as bultins and run them during the boot. kunit.py helper also defines the tests as builtins.
All the best,
Karolina
Quoted 94 lines
Regards,
Christian.Quoted 89 lines
Quoted 23 lines
Quoted 23 lines
Signed-off-by Karolina Stolarek <[email protected]>Reported-by kernel test robot <[email protected]>---
drivers/gpu/drm/ttm/Makefile | 18 +++++++++++++-----drivers/gpu/drm/ttm/tests/Makefile| 6 ------2 files changed, 13 insertions(+), 11 deletions(-)delete mode 100644
drivers/gpu/drm/ttm/tests/Makefiledrivers/gpu/drm/ttm/Makefile +0
-1@@ -2,10 +2,18 @@ # # Makefile for the drm device driver. This driver provides support for the -ttm-y := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ - ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \Quoted 8 lines
drivers/gpu/drm/ttm/Makefile line 8
Quoted 6 lines
drivers/gpu/drm/ttm/Makefile +4
-1- ttm_device.o ttm_sys_manager.o +ttm := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ + ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \ + ttm_device.o ttm_sys_manager.o +obj-$(CONFIG_DRM_TTM) += $(ttm)Does that not lead to each object in $(ttm) becoming its own module?
Huh, yes, that is what would happen here. Not good...
Quoted 5 lines
Quoted 2 lines
ttm-$(CONFIG_AGP) += ttm_agp_backend.o
Does this not create a ttm.o with just one object, depending on
CONFIG_AGP?I just left it as it was before my changes.
Quoted 8 lines
drivers/gpu/drm/ttm/Makefile line 12
Quoted 5 lines
-obj-$(CONFIG_DRM_TTM) += ttm.o
drivers/gpu/drm/ttm/Makefile +2
-1-obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += tests/ +ttm-tests := tests/ttm_kunit_helpers.o tests/ttm_device_test.o \ + tests/ttm_pool_test.oI'd preserve the one object per line syntax. It's nicer for the diffs in subsequent updates.
OK, will update it in the next version (if such comes). I just followed the style of "ttm-y".
Quoted 7 lines
drivers/gpu/drm/ttm/Makefile line 15
Quoted 4 lines
drivers/gpu/drm/ttm/Makefile +3
-0+ +ifeq ($(CONFIG_DRM_TTM_KUNIT_TEST),m) + ttm-test-objs := $(ttm) $(ttm-tests)Isn't the -objs syntax for host/userspace programs? And if not, doesn't it lead to objects with exported symbols being present in two places?
I saw it in use in other Makefiles, so I followed it. As for the exported symbols, I tested both builtin and module configs, and it was fine, but it's possible I missed something. I suspect that the variables are first expanded, and then processed by the
Makefile.Many thanks,
KarolinaQuoted 23 lines
Confused.
BR,
Jani.Quoted 16 lines
+ obj-m := ttm-test.o
drivers/gpu/drm/ttm/Makefile +3
-0+else + obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += $(ttm-tests) +endifdrivers/gpu/drm/ttm/tests/Makefile deleted +0
-6@@ -1,6 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 AND MIT - -obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += \ - ttm_device_test.o \ - ttm_pool_test.o \ - ttm_kunit_helpers.o
Re: [PATCH v2 1/5] drm/ttm: Update Makefile for KUnit
Am 11.09.23 um 15:33 schrieb Karolina Stolarek:
Quoted 15 lines · Christian König
Quoted 14 lines
Am 11.09.23 um 13:47 schrieb Karolina Stolarek:
Quoted 12 lines · Jani Nikula
Quoted 7 lines · Karolina Stolarek
Quoted 3 lines
Update
Makefileso it can produce a module that consists of TTM tests. This will allow us to test non-exported functions when KUnit tests are built as a module. Remove the tests'Makefile.I'm asking questions instead of making assertions, because I'm not 100% confident, but I don't feel like this
Makefilecould work right.Questions, assertions and comments are fine, I'm glad you're taking a look at the patch :) I'm not 100% confident either, so I welcome suggestions on how to improve it.
The problem is that TTM tests try to test symbols that are not exported, so I have to compile all the files together into one module if I choose to build KUnit tests as a module. The other option that I'm considering is to make the tests are builtin only. I'm tempted to go with it (for the sake of simplicity), but I'm trying to get the module option to work first.
Quoted 7 lines
Quoted 1 line
I have to admit that this looks pretty awkward, but I'm not an expert on the Linux build system in the first place.
Neither am I, and it shows :)
Quoted 1 line
Would it be an option to build the unit tests into the standard ttm.ko module and let them run whenever that module loads?
You mean appending the list of tests to ttm-y, depending on $(CONFIG_DRM_TTM_KUNIT_TEST)?
Yes.
Quoted 1 line
I _think_ I tried something similar, and couldn't get it to work, got a bunch of "twice exported" warnings.
You might need to adjust module_init, and things like MODULE_VERSION etc..., but I would give it a try.
Thanks for looking into this,
Christian.
Quoted 103 lines
Quoted 2 lines
On the other hand if this solution here works, why not?
Because it's complicated and, well, awkward. I'm still thinking about a use case where we would prefer to have KUnit tests defined as a module. IIRC, in CI we enable KUnit tests as bultins and run them during the boot.
kunit.pyhelper also defines the tests as builtins.All the best,
KarolinaQuoted 95 lines
Regards,
Christian.Quoted 90 lines
Quoted 24 lines
Quoted 24 lines
Signed-off-by Karolina Stolarek <[email protected]>Reported-by kernel test robot <[email protected]>---
drivers/gpu/drm/ttm/Makefile | 18 +++++++++++++-----drivers/gpu/drm/ttm/tests/Makefile| 6 ------2 files changed, 13 insertions(+), 11 deletions(-)delete mode 100644
drivers/gpu/drm/ttm/tests/Makefiledrivers/gpu/drm/ttm/Makefile +0
-1@@ -2,10 +2,18 @@ # # Makefile for the drm device driver. This driver provides support for the -ttm-y := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ - ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \Quoted 8 lines
drivers/gpu/drm/ttm/Makefile line 8
Quoted 6 lines
drivers/gpu/drm/ttm/Makefile +4
-1- ttm_device.o ttm_sys_manager.o +ttm := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ + ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \ + ttm_device.o ttm_sys_manager.o +obj-$(CONFIG_DRM_TTM) += $(ttm)Does that not lead to each object in $(ttm) becoming its own module?
Huh, yes, that is what would happen here. Not good...
Quoted 5 lines
Quoted 2 lines
ttm-$(CONFIG_AGP) += ttm_agp_backend.o
Does this not create a ttm.o with just one object, depending on
CONFIG_AGP?I just left it as it was before my changes.
Quoted 8 lines
drivers/gpu/drm/ttm/Makefile line 12
Quoted 5 lines
-obj-$(CONFIG_DRM_TTM) += ttm.o
drivers/gpu/drm/ttm/Makefile +2
-1-obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += tests/ +ttm-tests := tests/ttm_kunit_helpers.o tests/ttm_device_test.o \ + tests/ttm_pool_test.oI'd preserve the one object per line syntax. It's nicer for the diffs in subsequent updates.
OK, will update it in the next version (if such comes). I just followed the style of "ttm-y".
Quoted 7 lines
drivers/gpu/drm/ttm/Makefile line 15
Quoted 4 lines
drivers/gpu/drm/ttm/Makefile +3
-0+ +ifeq ($(CONFIG_DRM_TTM_KUNIT_TEST),m) + ttm-test-objs := $(ttm) $(ttm-tests)Isn't the -objs syntax for host/userspace programs? And if not, doesn't it lead to objects with exported symbols being present in two places?
I saw it in use in other Makefiles, so I followed it. As for the exported symbols, I tested both builtin and module configs, and it was fine, but it's possible I missed something. I suspect that the variables are first expanded, and then processed by the
Makefile.Many thanks,
KarolinaQuoted 23 lines
Confused.
BR,
Jani.Quoted 16 lines
+ obj-m := ttm-test.o
drivers/gpu/drm/ttm/Makefile +3
-0+else + obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += $(ttm-tests) +endifdrivers/gpu/drm/ttm/tests/Makefile deleted +0
-6@@ -1,6 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 AND MIT - -obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += \ - ttm_device_test.o \ - ttm_pool_test.o \ - ttm_kunit_helpers.o
Re: [PATCH v2 1/5] drm/ttm: Update Makefile for KUnit
Quoted 24 lines · Christian König
Am 11.09.23 um 15:33 schrieb Karolina Stolarek:
Quoted 21 lines · Christian König
Quoted 7 lines
Am 11.09.23 um 13:47 schrieb Karolina Stolarek:
Quoted 6 lines · Jani Nikula
Quoted 5 lines · Karolina Stolarek
Quoted 3 lines
Update
Makefileso it can produce a module that consists of TTM tests. This will allow us to test non-exported functions when KUnit tests are built as a module. Remove the tests'Makefile.Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I'm asking questions instead of making assertions, because I'm not 100% confident, but I don't feel like this
Makefilecould work right.Questions, assertions and comments are fine, I'm glad you're taking a look at the patch :) I'm not 100% confident either, so I welcome suggestions on how to improve it.
The problem is that TTM tests try to test symbols that are not exported, so I have to compile all the files together into one module if I choose to build KUnit tests as a module. The other option that I'm considering is to make the tests are builtin only. I'm tempted to go with it (for the sake of simplicity), but I'm trying to get the module option to work first.
I have to admit that this looks pretty awkward, but I'm not an expert on the Linux build system in the first place.
Neither am I, and it shows :)
Quoted 1 line
Would it be an option to build the unit tests into the standard ttm.ko module and let them run whenever that module loads?
Quoted 7 lines
Quoted 1 line
You mean appending the list of tests to ttm-y, depending on $(CONFIG_DRM_TTM_KUNIT_TEST)?
Yes.
Quoted 1 line
I _think_ I tried something similar, and couldn't get it to work, got a bunch of "twice exported" warnings.
You might need to adjust
module_init, and things likeMODULE_VERSIONetc..., but I would give it a try.
I just learnt about the existence of EXPORT_SYMBOL_FOR_TESTS_ONLY() macro. It's defined as a part of drm_util.h and used by DRM selftests. Thankfully, the TTM KUnit KConfig already selects CONFIG_DRM_EXPORT_FOR_TESTS, so we could use that macro (almost) for free. Only 2-3 line additions to ttm_tt and ttm_resource files, no significant changes to the Makefile.
What do you think?
Many thanks,
Karolina
Quoted 108 lines
Thanks for looking into this,
Christian.Quoted 103 lines
Quoted 2 lines
On the other hand if this solution here works, why not?
Because it's complicated and, well, awkward. I'm still thinking about a use case where we would prefer to have KUnit tests defined as a module. IIRC, in CI we enable KUnit tests as bultins and run them during the boot.
kunit.pyhelper also defines the tests as builtins.All the best,
KarolinaQuoted 95 lines
Regards,
Christian.Quoted 90 lines
Quoted 24 lines
Quoted 24 lines
Signed-off-by Karolina Stolarek <[email protected]>Reported-by kernel test robot <[email protected]>---
drivers/gpu/drm/ttm/Makefile | 18 +++++++++++++-----drivers/gpu/drm/ttm/tests/Makefile| 6 ------2 files changed, 13 insertions(+), 11 deletions(-)delete mode 100644
drivers/gpu/drm/ttm/tests/Makefiledrivers/gpu/drm/ttm/Makefile +0
-1@@ -2,10 +2,18 @@ # # Makefile for the drm device driver. This driver provides support for the -ttm-y := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ - ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \Quoted 8 lines
drivers/gpu/drm/ttm/Makefile line 8
Quoted 6 lines
drivers/gpu/drm/ttm/Makefile +4
-1- ttm_device.o ttm_sys_manager.o +ttm := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ + ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \ + ttm_device.o ttm_sys_manager.o +obj-$(CONFIG_DRM_TTM) += $(ttm)Does that not lead to each object in $(ttm) becoming its own module?
Huh, yes, that is what would happen here. Not good...
Quoted 5 lines
Quoted 2 lines
ttm-$(CONFIG_AGP) += ttm_agp_backend.o
Does this not create a ttm.o with just one object, depending on
CONFIG_AGP?I just left it as it was before my changes.
Quoted 8 lines
drivers/gpu/drm/ttm/Makefile line 12
Quoted 5 lines
-obj-$(CONFIG_DRM_TTM) += ttm.o
drivers/gpu/drm/ttm/Makefile +2
-1-obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += tests/ +ttm-tests := tests/ttm_kunit_helpers.o tests/ttm_device_test.o \ + tests/ttm_pool_test.oI'd preserve the one object per line syntax. It's nicer for the diffs in subsequent updates.
OK, will update it in the next version (if such comes). I just followed the style of "ttm-y".
Quoted 7 lines
drivers/gpu/drm/ttm/Makefile line 15
Quoted 4 lines
drivers/gpu/drm/ttm/Makefile +3
-0+ +ifeq ($(CONFIG_DRM_TTM_KUNIT_TEST),m) + ttm-test-objs := $(ttm) $(ttm-tests)Isn't the -objs syntax for host/userspace programs? And if not, doesn't it lead to objects with exported symbols being present in two places?
I saw it in use in other Makefiles, so I followed it. As for the exported symbols, I tested both builtin and module configs, and it was fine, but it's possible I missed something. I suspect that the variables are first expanded, and then processed by the
Makefile.Many thanks,
KarolinaQuoted 23 lines
Confused.
BR,
Jani.Quoted 16 lines
+ obj-m := ttm-test.o
drivers/gpu/drm/ttm/Makefile +3
-0+else + obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += $(ttm-tests) +endifdrivers/gpu/drm/ttm/tests/Makefile deleted +0
-6@@ -1,6 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 AND MIT - -obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += \ - ttm_device_test.o \ - ttm_pool_test.o \ - ttm_kunit_helpers.o
Re: [PATCH v2 1/5] drm/ttm: Update Makefile for KUnit
Am 12.09.23 um 11:51 schrieb Karolina Stolarek:
Quoted 29 lines · Christian König
Quoted 28 lines
Am 11.09.23 um 15:33 schrieb Karolina Stolarek:
Quoted 15 lines · Christian König
Quoted 14 lines
Am 11.09.23 um 13:47 schrieb Karolina Stolarek:
Quoted 12 lines · Jani Nikula
Quoted 7 lines · Karolina Stolarek
Quoted 3 lines
Update
Makefileso it can produce a module that consists of TTM tests. This will allow us to test non-exported functions when KUnit tests are built as a module. Remove the tests'Makefile.I'm asking questions instead of making assertions, because I'm not 100% confident, but I don't feel like this
Makefilecould work right.Questions, assertions and comments are fine, I'm glad you're taking a look at the patch :) I'm not 100% confident either, so I welcome suggestions on how to improve it.
The problem is that TTM tests try to test symbols that are not exported, so I have to compile all the files together into one module if I choose to build KUnit tests as a module. The other option that I'm considering is to make the tests are builtin only. I'm tempted to go with it (for the sake of simplicity), but I'm trying to get the module option to work first.
Quoted 7 lines
Quoted 1 line
I have to admit that this looks pretty awkward, but I'm not an expert on the Linux build system in the first place.
Neither am I, and it shows :)
Quoted 1 line
Would it be an option to build the unit tests into the standard ttm.ko module and let them run whenever that module loads?
You mean appending the list of tests to ttm-y, depending on $(CONFIG_DRM_TTM_KUNIT_TEST)?
Yes.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
I _think_ I tried something similar, and couldn't get it to work, got a bunch of "twice exported" warnings.
You might need to adjust
module_init, and things likeMODULE_VERSIONetc..., but I would give it a try.I just learnt about the existence of
EXPORT_SYMBOL_FOR_TESTS_ONLY()macro. It's defined as a part ofdrm_util.hand used by DRM selftests. Thankfully, the TTM KUnit KConfig already selectsCONFIG_DRM_EXPORT_FOR_TESTS, so we could use that macro (almost) for free. Only 2-3 line additions tottm_ttandttm_resourcefiles, no significant changes to theMakefile.What do you think?
Perfect, that's exactly what's needed here.
Thanks,
Christian.
Quoted 112 lines
Many thanks,
KarolinaQuoted 108 lines
Thanks for looking into this,
Christian.Quoted 103 lines
Quoted 2 lines
On the other hand if this solution here works, why not?
Because it's complicated and, well, awkward. I'm still thinking about a use case where we would prefer to have KUnit tests defined as a module. IIRC, in CI we enable KUnit tests as bultins and run them during the boot.
kunit.pyhelper also defines the tests as builtins.All the best,
KarolinaQuoted 95 lines
Regards,
Christian.Quoted 90 lines
Quoted 24 lines
Quoted 24 lines
Signed-off-by Karolina Stolarek <[email protected]>Reported-by kernel test robot <[email protected]>---
drivers/gpu/drm/ttm/Makefile | 18 +++++++++++++-----drivers/gpu/drm/ttm/tests/Makefile| 6 ------2 files changed, 13 insertions(+), 11 deletions(-)delete mode 100644
drivers/gpu/drm/ttm/tests/Makefiledrivers/gpu/drm/ttm/Makefile +0
-1@@ -2,10 +2,18 @@ # # Makefile for the drm device driver. This driver provides support for the -ttm-y := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ - ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \Quoted 8 lines
drivers/gpu/drm/ttm/Makefile line 10
Quoted 6 lines
drivers/gpu/drm/ttm/Makefile +4
-1- ttm_device.o ttm_sys_manager.o +ttm := ttm_tt.o ttm_bo.o ttm_bo_util.o ttm_bo_vm.o ttm_module.o \ + ttm_execbuf_util.o ttm_range_manager.o ttm_resource.o ttm_pool.o \ + ttm_device.o ttm_sys_manager.o +obj-$(CONFIG_DRM_TTM) += $(ttm)Does that not lead to each object in $(ttm) becoming its own module?
Huh, yes, that is what would happen here. Not good...
Quoted 5 lines
Quoted 2 lines
ttm-$(CONFIG_AGP) += ttm_agp_backend.o
Does this not create a ttm.o with just one object, depending on
CONFIG_AGP?I just left it as it was before my changes.
Quoted 8 lines
drivers/gpu/drm/ttm/Makefile
Quoted 5 lines
-obj-$(CONFIG_DRM_TTM) += ttm.o
drivers/gpu/drm/ttm/Makefile +2
-1-obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += tests/ +ttm-tests := tests/ttm_kunit_helpers.o tests/ttm_device_test.o \ + tests/ttm_pool_test.oI'd preserve the one object per line syntax. It's nicer for the diffs in subsequent updates.
OK, will update it in the next version (if such comes). I just followed the style of "ttm-y".
Quoted 7 lines
drivers/gpu/drm/ttm/Makefile
Quoted 4 lines
drivers/gpu/drm/ttm/Makefile +3
-0+ +ifeq ($(CONFIG_DRM_TTM_KUNIT_TEST),m) + ttm-test-objs := $(ttm) $(ttm-tests)Isn't the -objs syntax for host/userspace programs? And if not, doesn't it lead to objects with exported symbols being present in two places?
I saw it in use in other Makefiles, so I followed it. As for the exported symbols, I tested both builtin and module configs, and it was fine, but it's possible I missed something. I suspect that the variables are first expanded, and then processed by the
Makefile.Many thanks,
KarolinaQuoted 23 lines
Confused.
BR,
Jani.Quoted 16 lines
+ obj-m := ttm-test.o
drivers/gpu/drm/ttm/Makefile +3
-0+else + obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += $(ttm-tests) +endifdrivers/gpu/drm/ttm/tests/Makefile deleted +0
-6@@ -1,6 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 AND MIT - -obj-$(CONFIG_DRM_TTM_KUNIT_TEST) += \ - ttm_device_test.o \ - ttm_pool_test.o \ - ttm_kunit_helpers.o
PATCH v2 2/5 drm/ttm/tests: Add tests for ttm_resource and ttm_sys_man
In reply to Karolina StolarekTest initialization of ttm_resource using different memory domains. Add tests for a system memory manager and functions that can be tested without a fully-featured resource manager. Update ttm_bo_kunit_init() to initialize BO's kref and reservation object.
--- drivers/gpu/drm/ttm/Makefile | 2 +- drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c | 23 ++ drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h | 4 + drivers/gpu/drm/ttm/tests/ttm_resource_test.c | 335 ++++++++++++++++++ 4 files changed, 363 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/ttm/tests/ttm_resource_test.c
drivers/gpu/drm/ttm/Makefile +1 -1
@@ -9,7 +9,7 @@ obj-$(CONFIG_DRM_TTM) += $(ttm) ttm-$(CONFIG_AGP) += ttm_agp_backend.o ttm-tests := tests/ttm_kunit_helpers.o tests/ttm_device_test.o \ - tests/ttm_pool_test.o + tests/ttm_pool_test.o tests/ttm_resource_test.o ifeq ($(CONFIG_DRM_TTM_KUNIT_TEST),m) ttm-test-objs := $(ttm) $(ttm-tests)
drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c +23 -0
@@ -38,10 +38,33 @@ struct ttm_buffer_object *ttm_bo_kunit_init(struct kunit *test, bo->base = gem_obj; bo->bdev = devs->ttm_dev; +kref_init (&bo->kref); + +dma_resv_init (&bo->base._resv); + bo->base.resv = &bo->base._resv; +return bo; }EXPORT_SYMBOL_GPL (ttm_bo_kunit_init); +struct ttm_place *ttm_place_kunit_init (struct kunit *test, +uint32_t mem_type,uint32_t flags, +size_t size) +{ +struct ttm_place *place; + + place =kunit_kzalloc (test,sizeof (*place),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, place); + + place->mem_type = mem_type; + place->flags = flags; + place->fpfn = size >>PAGE_SHIFT ; + place->lpfn = place->fpfn + (size >>PAGE_SHIFT ); + +return place; +} +EXPORT_SYMBOL_GPL (ttm_place_kunit_init); +struct ttm_test_devices *ttm_test_devices_basic (struct kunit *test) {struct ttm_test_devices *devs;
drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h +4 -0
@@ -8,6 +8,7 @@#include <drm/drm_drv.h> #include <drm/ttm/ttm_device.h> #include <drm/ttm/ttm_bo.h> +#include <drm/ttm/ttm_placement.h> #include <drm/drm_kunit_helpers.h> #include <kunit/test.h>
@@ -28,6 +29,9 @@ int ttm_device_kunit_init(struct ttm_test_devices *priv,struct ttm_buffer_object *ttm_bo_kunit_init (struct kunit *test,struct ttm_test_devices *devs,size_t size); +struct ttm_place *ttm_place_kunit_init (struct kunit *test, +uint32_t mem_type,uint32_t flags, +size_t size);struct ttm_test_devices *ttm_test_devices_basic (struct kunit *test);struct ttm_test_devices *ttm_test_devices_all (struct kunit *test);
drivers/gpu/drm/ttm/tests/ttm_resource_test.c new file +335 -0
335 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 3/5 drm/ttm/tests: Add tests for ttm_tt
In reply to Karolina StolarekTest initialization, creation and destruction of ttm_tt instances.
--- drivers/gpu/drm/ttm/Makefile | 3 +- drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c | 20 ++ drivers/gpu/drm/ttm/tests/ttm_tt_test.c | 277 ++++++++++++++++++ 3 files changed, 299 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/ttm/tests/ttm_tt_test.c
drivers/gpu/drm/ttm/Makefile +2 -1
@@ -9,7 +9,8 @@ obj-$(CONFIG_DRM_TTM) += $(ttm) ttm-$(CONFIG_AGP) += ttm_agp_backend.o ttm-tests := tests/ttm_kunit_helpers.o tests/ttm_device_test.o \ - tests/ttm_pool_test.o tests/ttm_resource_test.o + tests/ttm_pool_test.o tests/ttm_resource_test.o \ + tests/ttm_tt_test.o ifeq ($(CONFIG_DRM_TTM_KUNIT_TEST),m) ttm-test-objs := $(ttm) $(ttm-tests)
drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c +20 -0
@@ -2,9 +2,29 @@/* * Copyright © 2023 Intel Corporation */ +#include <drm/ttm/ttm_tt.h> +#include "ttm_kunit_helpers.h" +static struct ttm_tt *ttm_tt_simple_create (struct ttm_buffer_object *bo, +uint32_t page_flags) +{ +struct ttm_tt *tt; + + tt =kzalloc (sizeof (*tt),GFP_KERNEL ); +ttm_tt_init (tt, bo,0 , ttm_cached,0 ); + +return tt; +} + +static void ttm_tt_simple_destroy (struct ttm_device *bdev,struct ttm_tt *ttm) +{ +kfree (ttm); +} +struct ttm_device_funcs ttm_dev_funcs = { + .ttm_tt_create = ttm_tt_simple_create, + .ttm_tt_destroy = ttm_tt_simple_destroy, };EXPORT_SYMBOL_GPL (ttm_dev_funcs);
drivers/gpu/drm/ttm/tests/ttm_tt_test.c new file +277 -0
277 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 4/5 drm/ttm/tests: Add tests for ttm_bo functions
In reply to Karolina StolarekTest reservation and release of TTM buffer objects. Add tests to check pin and unpin operations.
--- drivers/gpu/drm/ttm/Makefile | 2 +- drivers/gpu/drm/ttm/tests/ttm_bo_test.c | 620 ++++++++++++++++++ drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c | 5 + 3 files changed, 626 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/ttm/tests/ttm_bo_test.c
drivers/gpu/drm/ttm/Makefile +1 -1
@@ -10,7 +10,7 @@ ttm-$(CONFIG_AGP) += ttm_agp_backend.o ttm-tests := tests/ttm_kunit_helpers.o tests/ttm_device_test.o \ tests/ttm_pool_test.o tests/ttm_resource_test.o \ - tests/ttm_tt_test.o + tests/ttm_tt_test.o tests/ttm_bo_test.o ifeq ($(CONFIG_DRM_TTM_KUNIT_TEST),m) ttm-test-objs := $(ttm) $(ttm-tests)
drivers/gpu/drm/ttm/tests/ttm_bo_test.c new file +620 -0
620 lines not on this page · raw message
drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c +5 -0
@@ -22,6 +22,10 @@ static void ttm_tt_simple_destroy(struct ttm_device *bdev, struct ttm_tt *ttm)kfree (ttm); } +static void dummy_ttm_bo_destroy (struct ttm_buffer_object *bo) +{ +} +struct ttm_device_funcs ttm_dev_funcs = { .ttm_tt_create = ttm_tt_simple_create, .ttm_tt_destroy = ttm_tt_simple_destroy,
@@ -57,6 +61,7 @@ struct ttm_buffer_object *ttm_bo_kunit_init(struct kunit *test, bo->base = gem_obj; bo->bdev = devs->ttm_dev; + bo->destroy = dummy_ttm_bo_destroy;kref_init (&bo->kref);
Signature · 1 line
2.25.1
PATCH v2 5/5 drm/ttm/tests: Don't pass order as page flags
In reply to Karolina StolarekDelete a leftover order definition from ttm_pool_pre_populated() helper. Pass an empty page flag to ttm_tt_kunit_init().
--- drivers/gpu/drm/ttm/tests/ttm_pool_test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/ttm/tests/ttm_pool_test.c +1 -2
@@ -78,10 +78,9 @@ static struct ttm_pool *ttm_pool_pre_populated(struct kunit *test,struct ttm_test_devices *devs = priv->devs;struct ttm_pool *pool;struct ttm_tt *tt; -unsigned long order =__fls (size /PAGE_SIZE );int err; - tt =ttm_tt_kunit_init (test, order, caching, size); + tt =ttm_tt_kunit_init (test,0 , caching, size);KUNIT_ASSERT_NOT_NULL (test, tt); pool =kunit_kzalloc (test,sizeof (*pool),GFP_KERNEL );
Signature · 1 line
2.25.1