On Thu, 29 Feb 2024 at 03:45, Guenter Roeck linux@roeck-us.net wrote:
Hi,
when running the dev_addr_lists unit test with lock debugging enabled, I always get the following lockdep warning.
[ 7.031327] ==================================== [ 7.031393] WARNING: kunit_try_catch/1886 still has locks held! [ 7.031478] 6.8.0-rc6-00053-g0fec7343edb5-dirty #1 Tainted: G W N [ 7.031728] ------------------------------------ [ 7.031816] 1 lock held by kunit_try_catch/1886: [ 7.031896] #0: ffffffff8ed35008 (rtnl_mutex){+.+.}-{3:3}, at: dev_addr_test_init+0x6a/0x100
Instrumentation shows that dev_addr_test_exit() is called, but only after the warning fires.
Is this a problem with kunit tests or a problem with this specific test ?
A bit of both, I think. KUnit test cleanup is not guaranteed to run in the same thread as the test, so that definitely is triggering lockdep warnings.
On the other hand, we really should make this particular case work in KUnit. Ideally test cleanup will happen on the test thread first, and only fall back to another test if the test thread otherwise aborted.
So, this is probably something we won't be able to fix if the test fails, but it definitely shouldn't be happening here where it passes. I'll look into fixing that.
-- David