Skip to content

drm/vc4: tests: Patch up the vc4 kunit tests#6789

Merged
pelwell merged 1 commit intoraspberrypi:rpi-6.15.yfrom
pelwell:kunit615
Apr 15, 2025
Merged

drm/vc4: tests: Patch up the vc4 kunit tests#6789
pelwell merged 1 commit intoraspberrypi:rpi-6.15.yfrom
pelwell:kunit615

Conversation

@pelwell
Copy link
Copy Markdown
Contributor

@pelwell pelwell commented Apr 15, 2025

Commit [1] removed the dynamic allocation of drm_modeset_acquire_ctx structures, with clients expected to allocate them by other means, such as on the stack. This usage model works less well when tests are split into separate initialisation and run phases, because a ctx allocated on the stack in the init function will go out of scope and likely be overwritten by the run function(s).

As kunit tests seem to be single threaded, make ctx static to avoid the issue.

[1] commit 30188df ("drm/tests: Drop drm_kunit_helper_acquire_ctx_alloc()")

Commit [1] removed the dynamic allocation of drm_modeset_acquire_ctx
structures, with clients expected to allocate them by other means,
such as on the stack. This usage model works less well when tests
are split into separate initialisation and run phases, because
a ctx allocated on the stack in the init function will go out of
scope and likely be overwritten by the run function(s).

As kunit tests seem to be single threaded, make ctx static to avoid
the issue.

[1] commit 30188df ("drm/tests: Drop drm_kunit_helper_acquire_ctx_alloc()")

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
@pelwell
Copy link
Copy Markdown
Contributor Author

pelwell commented Apr 15, 2025

FYI, @mripard.

@pelwell pelwell merged commit 4d5d8bc into raspberrypi:rpi-6.15.y Apr 15, 2025
11 of 12 checks passed
@mripard
Copy link
Copy Markdown
Contributor

mripard commented Apr 28, 2025

That doesn't work either. kunit isn't single-threaded, and lockdep will complain about it. You really need to initialize the state and context in the test function itself, see torvalds/linux@7e0351a

@pelwell
Copy link
Copy Markdown
Contributor Author

pelwell commented Apr 28, 2025

It's nice of you to finally respond. This was sufficient to pass the tests, but we can adopt the more complex fix in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants