[PATCH v10 0/9] Improve test coverage of TTM
Somalapuram, Amaranath
asomalap at amd.com
Tue Apr 2 13:35:46 UTC 2024
some issue with the latest drm-misc: (commit
4c4f33be7e4d476566246e7166c54ef175287e00 (origin/for-linux-next,
origin/drm-misc-next, origin/HEAD))
Regards,
S.Amarnath
$ make ARCH=um O=.kunit --jobs=16
ERROR:root:../arch/x86/um/user-offsets.c:17:6: warning: no previous
prototype for ‘foo’ [-Wmissing-prototypes]
17 | void foo(void)
| ^~~
In file included from ../arch/um/kernel/asm-offsets.c:1:
../arch/x86/um/shared/sysdep/kernel-offsets.h:9:6: warning: no previous
prototype for ‘foo’ [-Wmissing-prototypes]
9 | void foo(void)
| ^~~
../arch/x86/um/os-Linux/registers.c:146:15: warning: no previous
prototype for ‘get_thread_reg’ [-Wmissing-prototypes]
146 | unsigned long get_thread_reg(int reg, jmp_buf *buf)
| ^~~~~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:16:5: warning: no previous prototype for
‘__vdso_clock_gettime’ [-Wmissing-prototypes]
16 | int __vdso_clock_gettime(clockid_t clock, struct
__kernel_old_timespec *ts)
| ^~~~~~~~~~~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:30:5: warning: no previous prototype for
‘__vdso_gettimeofday’ [-Wmissing-prototypes]
30 | int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct
timezone *tz)
| ^~~~~~~~~~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:44:21: warning: no previous prototype for
‘__vdso_time’ [-Wmissing-prototypes]
44 | __kernel_old_time_t __vdso_time(__kernel_old_time_t *t)
| ^~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:57:1: warning: no previous prototype for
‘__vdso_getcpu’ [-Wmissing-prototypes]
57 | __vdso_getcpu(unsigned *cpu, unsigned *node, struct
getcpu_cache *unused)
| ^~~~~~~~~~~~~
../arch/x86/um/bugs_64.c:9:6: warning: no previous prototype for
‘arch_check_bugs’ [-Wmissing-prototypes]
9 | void arch_check_bugs(void)
| ^~~~~~~~~~~~~~~
../arch/x86/um/bugs_64.c:13:6: warning: no previous prototype for
‘arch_examine_signal’ [-Wmissing-prototypes]
13 | void arch_examine_signal(int sig, struct uml_pt_regs *regs)
| ^~~~~~~~~~~~~~~~~~~
../arch/x86/um/os-Linux/mcontext.c:7:6: warning: no previous prototype
for ‘get_regs_from_mc’ [-Wmissing-prototypes]
7 | void get_regs_from_mc(struct uml_pt_regs *regs, mcontext_t *mc)
| ^~~~~~~~~~~~~~~~
../arch/um/os-Linux/skas/process.c:107:6: warning: no previous prototype
for ‘wait_stub_done’ [-Wmissing-prototypes]
107 | void wait_stub_done(int pid)
| ^~~~~~~~~~~~~~
../arch/um/os-Linux/skas/process.c:683:6: warning: no previous prototype
for ‘__switch_mm’ [-Wmissing-prototypes]
683 | void __switch_mm(struct mm_id *mm_idp)
| ^~~~~~~~~~~
../arch/um/kernel/skas/mmu.c:17:5: warning: no previous prototype for
‘init_new_context’ [-Wmissing-prototypes]
17 | int init_new_context(struct task_struct *task, struct mm_struct
*mm)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/skas/mmu.c:60:6: warning: no previous prototype for
‘destroy_context’ [-Wmissing-prototypes]
60 | void destroy_context(struct mm_struct *mm)
| ^~~~~~~~~~~~~~~
../arch/x86/um/fault.c:18:5: warning: no previous prototype for
‘arch_fixup’ [-Wmissing-prototypes]
18 | int arch_fixup(unsigned long address, struct uml_pt_regs *regs)
| ^~~~~~~~~~
../arch/um/kernel/skas/process.c:36:12: warning: no previous prototype
for ‘start_uml’ [-Wmissing-prototypes]
36 | int __init start_uml(void)
| ^~~~~~~~~
../arch/um/os-Linux/main.c:187:7: warning: no previous prototype for
‘__wrap_malloc’ [-Wmissing-prototypes]
187 | void *__wrap_malloc(int size)
| ^~~~~~~~~~~~~
../arch/um/os-Linux/main.c:208:7: warning: no previous prototype for
‘__wrap_calloc’ [-Wmissing-prototypes]
208 | void *__wrap_calloc(int n, int size)
| ^~~~~~~~~~~~~
../arch/um/os-Linux/main.c:222:6: warning: no previous prototype for
‘__wrap_free’ [-Wmissing-prototypes]
222 | void __wrap_free(void *ptr)
| ^~~~~~~~~~~
../arch/um/os-Linux/mem.c:28:6: warning: no previous prototype for
‘kasan_map_memory’ [-Wmissing-prototypes]
28 | void kasan_map_memory(void *start, size_t len)
| ^~~~~~~~~~~~~~~~
../arch/um/os-Linux/mem.c:212:13: warning: no previous prototype for
‘check_tmpexec’ [-Wmissing-prototypes]
212 | void __init check_tmpexec(void)
| ^~~~~~~~~~~~~
../arch/um/os-Linux/signal.c:75:6: warning: no previous prototype for
‘sig_handler’ [-Wmissing-prototypes]
75 | void sig_handler(int sig, struct siginfo *si, mcontext_t *mc)
| ^~~~~~~~~~~
../arch/um/os-Linux/signal.c:111:6: warning: no previous prototype for
‘timer_alarm_handler’ [-Wmissing-prototypes]
111 | void timer_alarm_handler(int sig, struct siginfo *unused_si,
mcontext_t *mc)
| ^~~~~~~~~~~~~~~~~~~
../arch/x86/um/ptrace_64.c:111:5: warning: no previous prototype for
‘poke_user’ [-Wmissing-prototypes]
111 | int poke_user(struct task_struct *child, long addr, long data)
| ^~~~~~~~~
../arch/x86/um/ptrace_64.c:171:5: warning: no previous prototype for
‘peek_user’ [-Wmissing-prototypes]
171 | int peek_user(struct task_struct *child, long addr, long data)
| ^~~~~~~~~
../arch/um/os-Linux/start_up.c:301:12: warning: no previous prototype
for ‘parse_iomem’ [-Wmissing-prototypes]
301 | int __init parse_iomem(char *str, int *add)
| ^~~~~~~~~~~
../arch/x86/um/signal.c:560:6: warning: no previous prototype for
‘sys_rt_sigreturn’ [-Wmissing-prototypes]
560 | long sys_rt_sigreturn(void)
| ^~~~~~~~~~~~~~~~
../arch/x86/um/syscalls_64.c:48:6: warning: no previous prototype for
‘arch_switch_to’ [-Wmissing-prototypes]
48 | void arch_switch_to(struct task_struct *to)
| ^~~~~~~~~~~~~~
../arch/um/kernel/mem.c:202:8: warning: no previous prototype for
‘pgd_alloc’ [-Wmissing-prototypes]
202 | pgd_t *pgd_alloc(struct mm_struct *mm)
| ^~~~~~~~~
../arch/um/kernel/mem.c:215:7: warning: no previous prototype for
‘uml_kmalloc’ [-Wmissing-prototypes]
215 | void *uml_kmalloc(int size, int flags)
| ^~~~~~~~~~~
../arch/um/kernel/process.c:51:5: warning: no previous prototype for
‘pid_to_processor_id’ [-Wmissing-prototypes]
51 | int pid_to_processor_id(int pid)
| ^~~~~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:87:7: warning: no previous prototype for
‘__switch_to’ [-Wmissing-prototypes]
87 | void *__switch_to(struct task_struct *from, struct task_struct *to)
| ^~~~~~~~~~~
../arch/um/kernel/process.c:140:6: warning: no previous prototype for
‘fork_handler’ [-Wmissing-prototypes]
140 | void fork_handler(void)
| ^~~~~~~~~~~~
../arch/um/kernel/process.c:217:6: warning: no previous prototype for
‘arch_cpu_idle’ [-Wmissing-prototypes]
217 | void arch_cpu_idle(void)
| ^~~~~~~~~~~~~
../arch/um/kernel/process.c:253:5: warning: no previous prototype for
‘copy_to_user_proc’ [-Wmissing-prototypes]
253 | int copy_to_user_proc(void __user *to, void *from, int size)
| ^~~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:263:5: warning: no previous prototype for
‘clear_user_proc’ [-Wmissing-prototypes]
263 | int clear_user_proc(void __user *buf, int size)
| ^~~~~~~~~~~~~~~
../arch/um/kernel/process.c:271:6: warning: no previous prototype for
‘set_using_sysemu’ [-Wmissing-prototypes]
271 | void set_using_sysemu(int value)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:278:5: warning: no previous prototype for
‘get_using_sysemu’ [-Wmissing-prototypes]
278 | int get_using_sysemu(void)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:316:12: warning: no previous prototype for
‘make_proc_sysemu’ [-Wmissing-prototypes]
316 | int __init make_proc_sysemu(void)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:348:15: warning: no previous prototype for
‘arch_align_stack’ [-Wmissing-prototypes]
348 | unsigned long arch_align_stack(unsigned long sp)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:45:6: warning: no previous prototype for
‘machine_restart’ [-Wmissing-prototypes]
45 | void machine_restart(char * __unused)
| ^~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:51:6: warning: no previous prototype for
‘machine_power_off’ [-Wmissing-prototypes]
51 | void machine_power_off(void)
| ^~~~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:57:6: warning: no previous prototype for
‘machine_halt’ [-Wmissing-prototypes]
57 | void machine_halt(void)
| ^~~~~~~~~~~~
../arch/um/kernel/tlb.c:579:6: warning: no previous prototype for
‘flush_tlb_mm_range’ [-Wmissing-prototypes]
579 | void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
| ^~~~~~~~~~~~~~~~~~
../arch/um/kernel/tlb.c:594:6: warning: no previous prototype for
‘force_flush_all’ [-Wmissing-prototypes]
594 | void force_flush_all(void)
| ^~~~~~~~~~~~~~~
../arch/um/kernel/um_arch.c:408:19: warning: no previous prototype for
‘read_initrd’ [-Wmissing-prototypes]
408 | int __init __weak read_initrd(void)
| ^~~~~~~~~~~
../arch/um/kernel/um_arch.c:461:7: warning: no previous prototype for
‘text_poke’ [-Wmissing-prototypes]
461 | void *text_poke(void *addr, const void *opcode, size_t len)
| ^~~~~~~~~
../arch/um/kernel/um_arch.c:473:6: warning: no previous prototype for
‘text_poke_sync’ [-Wmissing-prototypes]
473 | void text_poke_sync(void)
| ^~~~~~~~~~~~~~
../arch/um/kernel/kmsg_dump.c:60:12: warning: no previous prototype for
‘kmsg_dumper_stdout_init’ [-Wmissing-prototypes]
60 | int __init kmsg_dumper_stdout_init(void)
| ^~~~~~~~~~~~~~~~~~~~~~~
../lib/iomap.c:156:5: warning: no previous prototype for
‘ioread64_lo_hi’ [-Wmissing-prototypes]
156 | u64 ioread64_lo_hi(const void __iomem *addr)
| ^~~~~~~~~~~~~~
../lib/iomap.c:163:5: warning: no previous prototype for
‘ioread64_hi_lo’ [-Wmissing-prototypes]
163 | u64 ioread64_hi_lo(const void __iomem *addr)
| ^~~~~~~~~~~~~~
../lib/iomap.c:170:5: warning: no previous prototype for
‘ioread64be_lo_hi’ [-Wmissing-prototypes]
170 | u64 ioread64be_lo_hi(const void __iomem *addr)
| ^~~~~~~~~~~~~~~~
../lib/iomap.c:178:5: warning: no previous prototype for
‘ioread64be_hi_lo’ [-Wmissing-prototypes]
178 | u64 ioread64be_hi_lo(const void __iomem *addr)
| ^~~~~~~~~~~~~~~~
../lib/iomap.c:264:6: warning: no previous prototype for
‘iowrite64_lo_hi’ [-Wmissing-prototypes]
264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~
../lib/iomap.c:272:6: warning: no previous prototype for
‘iowrite64_hi_lo’ [-Wmissing-prototypes]
272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~
../lib/iomap.c:280:6: warning: no previous prototype for
‘iowrite64be_lo_hi’ [-Wmissing-prototypes]
280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~~~
../lib/iomap.c:288:6: warning: no previous prototype for
‘iowrite64be_hi_lo’ [-Wmissing-prototypes]
288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~~~
/usr/bin/ld: drivers/gpu/drm/tests/drm_kunit_helpers.o:(.rodata+0xa0):
undefined reference to `drm_atomic_helper_crtc_reset'
/usr/bin/ld: drivers/gpu/drm/tests/drm_kunit_helpers.o:(.rodata+0xf0):
undefined reference to `drm_atomic_helper_crtc_duplicate_state'
/usr/bin/ld: drivers/gpu/drm/tests/drm_kunit_helpers.o:(.rodata+0xf8):
undefined reference to `drm_atomic_helper_crtc_destroy_state'
/usr/bin/ld: drivers/gpu/drm/tests/drm_kunit_helpers.o:(.rodata+0x1f8):
undefined reference to `drm_atomic_helper_plane_reset'
/usr/bin/ld: drivers/gpu/drm/tests/drm_kunit_helpers.o:(.rodata+0x208):
undefined reference to `drm_atomic_helper_plane_duplicate_state'
/usr/bin/ld: drivers/gpu/drm/tests/drm_kunit_helpers.o:(.rodata+0x210):
undefined reference to `drm_atomic_helper_plane_destroy_state'
/usr/bin/ld: drivers/gpu/drm/tests/drm_kunit_helpers.o:(.rodata+0x300):
undefined reference to `drm_atomic_helper_check'
/usr/bin/ld: drivers/gpu/drm/tests/drm_kunit_helpers.o:(.rodata+0x308):
undefined reference to `drm_atomic_helper_commit'
/usr/bin/ld: drivers/gpu/drm/display/drm_dp_mst_topology.o: in function
`drm_dp_mst_duplicate_state':
drm_dp_mst_topology.c:(.text+0x3164): undefined reference to
`__drm_atomic_helper_private_obj_duplicate_state'
/usr/bin/ld: drivers/gpu/drm/display/drm_dp_mst_topology.o: in function
`drm_dp_delayed_destroy_work':
drm_dp_mst_topology.c:(.text+0x39d6): undefined reference to
`drm_kms_helper_hotplug_event'
/usr/bin/ld: drivers/gpu/drm/display/drm_dp_mst_topology.o: in function
`drm_dp_mst_up_req_work':
drm_dp_mst_topology.c:(.text+0x930d): undefined reference to
`drm_kms_helper_hotplug_event'
/usr/bin/ld: drivers/gpu/drm/display/drm_dp_mst_topology.o: in function
`drm_dp_mst_link_probe_work':
drm_dp_mst_topology.c:(.text+0xacda): undefined reference to
`drm_kms_helper_hotplug_event'
collect2: error: ld returned 1 exit status
make[3]: *** [../scripts/Makefile.vmlinux:37: vmlinux] Error 1
make[2]: *** [/home/rtg/amar/git/drm-misc/Makefile:1162: vmlinux] Error 2
make[1]: *** [/home/rtg/amar/git/drm-misc/Makefile:240: __sub-make] Error 2
make: *** [Makefile:240: __sub-make] Error 2
rtg at rtg-prash-navi22:~/amar/git/drm-misc$
On 3/22/2024 7:59 PM, Karolina Stolarek wrote:
> Introduce tests for ttm_bo_validate()/ttm_bo_init_validate() that exercise
> simple BO placement as well as eviction (including the case where the evict
> domain also requires eviction to fit the incoming buffer). Prepare KUnit
> helpers to handle such scenarios and add a mock VRAM manager. This series also
> includes some updates to the helpers and more definitions used to define
> "special" memory domains (e.g., one that can't allocate resources or is busy),
> as well as drive-by fixes for the tests.
>
> There are a couple of areas in which this test suite can be improved.
> Suggestions for future work can be found in the TODO file.
>
> 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, use a UML configuration,
> enable CONFIG_KUNIT, and then select CONFIG_DRM_TTM_KUNIT_TEST.
>
> Many thanks,
> Karolina
>
> v10:
> Many things have happened over the course of three months, so the series
> had to be slightly reworked and expanded to accommodate these changes:
> - Set DMA coherent mapping mask in the KUnit device so ttm_pool_alloc
> tests can be executed
> - Update ttm_bo_validate_invalid_placement() test case to check against
> the right return error. It's no longer -EINVAL (which only is returned
> for pinned buffers), but -ENOMEM. The behaviour has changed in
> commit cc941c70df39 ("drm/ttm: improve idle/busy handling v5")
> - Rework ttm_placement_kunit_init() to accept only one array of places
> and update the tests that use that helper
> - Set fallback flags in eviction domains defined in TTM KUnit helpers
> - Fix a warning raised by ttm_bo_unreserve_bulk() test case
> - Scrap all r-bs and tested-by, as many things were updated and should
> be checked again
>
> v9:
> - Drop tests with basic test cases, they are merged now
> - Add three final patches -- tests for ttm_tt_(un)populate, eviction testing
> and a TODO file, with suggestions on how to improve these tests
> - Delete the initialization of spinlock in
> ttm_bo_validate_move_fence_signaled(), it not used at all (Andi)
> - Just return the error code threaded_fence_signal(), don't save it to a
> local variable (Andi)
> - Use ttm_bo_unreserve() in tests checking different move fence states (Andi)
>
> v8:
> - Add Tested-by tags to commits that introduce tests
> - Improve the comment for ttm_bo_reserve_deadlock() subtest (Andi)
> - Actually clean up the resource when "error_free_blocks" is hit in
> ttm_mock_manager_alloc(). Without that change, we hit
> DEBUG_LOCKS_WARN_ON(lock->magic != lock) warning when cleaning up
> the resource manager because we try clean up an incomplete, orphaned
> resource. That's not good, and this could bite us back in the future.
>
> Karolina Stolarek (9):
> drm/ttm/tests: Set DMA mask in KUnit device
> drm/ttm/tests: Use an init function from the helpers lib
> drm/ttm/tests: Test simple BO creation and validation
> drm/ttm/tests: Add tests with mock resource managers
> drm/ttm/tests: Add test cases dependent on fence signaling
> drm/ttm/tests: Add eviction testing
> drm/ttm/tests: Add tests for ttm_tt_populate
> drm/ttm/tests: Add TODO file
> drm/ttm/tests: Fix a warning in ttm_bo_unreserve_bulk
>
> drivers/gpu/drm/Kconfig | 1 +
> drivers/gpu/drm/ttm/tests/.kunitconfig | 1 +
> drivers/gpu/drm/ttm/tests/Makefile | 2 +
> drivers/gpu/drm/ttm/tests/TODO | 24 +
> drivers/gpu/drm/ttm/tests/ttm_bo_test.c | 3 +
> .../gpu/drm/ttm/tests/ttm_bo_validate_test.c | 1213 +++++++++++++++++
> drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c | 173 ++-
> drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h | 11 +
> drivers/gpu/drm/ttm/tests/ttm_mock_manager.c | 235 ++++
> drivers/gpu/drm/ttm/tests/ttm_mock_manager.h | 33 +
> drivers/gpu/drm/ttm/tests/ttm_tt_test.c | 134 +-
> drivers/gpu/drm/ttm/ttm_tt.c | 3 +
> 12 files changed, 1810 insertions(+), 23 deletions(-)
> create mode 100644 drivers/gpu/drm/ttm/tests/TODO
> create mode 100644 drivers/gpu/drm/ttm/tests/ttm_bo_validate_test.c
> create mode 100644 drivers/gpu/drm/ttm/tests/ttm_mock_manager.c
> create mode 100644 drivers/gpu/drm/ttm/tests/ttm_mock_manager.h
>
More information about the dri-devel
mailing list