Message ID | 20230329-kunit-devm-inconsistencies-test-v1-0-c33127048375@cerno.tech (mailing list archive) |
---|---|
Headers | show |
Series | drivers: base: Add tests showing devm handling inconsistencies | expand |
Hi, On Wed, Mar 29, 2023 at 08:38:30PM +0100, Maxime Ripard wrote: > Hi, > > This follows the discussion here: > https://lore.kernel.org/linux-kselftest/20230324123157.bbwvfq4gsxnlnfwb@houat/ > > This shows a couple of inconsistencies with regard to how device-managed > resources are cleaned up. Basically, devm resources will only be cleaned up > if the device is attached to a bus and bound to a driver. Failing any of > these cases, a call to device_unregister will not end up in the devm > resources being released. > > We had to work around it in DRM to provide helpers to create a device for > kunit tests, but the current discussion around creating similar, generic, > helpers for kunit resumed interest in fixing this. > > This can be tested using the command: > ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/base/test/ > > Let me know what you think, > Maxime > > Signed-off-by: Maxime Ripard <maxime@cerno.tech> Is there any news on this? Maxime
On Wed, Mar 29, 2023 at 08:38:30PM +0100, Maxime Ripard wrote: > Hi, > > This follows the discussion here: > https://lore.kernel.org/linux-kselftest/20230324123157.bbwvfq4gsxnlnfwb@houat/ > > This shows a couple of inconsistencies with regard to how device-managed > resources are cleaned up. Basically, devm resources will only be cleaned up > if the device is attached to a bus and bound to a driver. Failing any of > these cases, a call to device_unregister will not end up in the devm > resources being released. > > We had to work around it in DRM to provide helpers to create a device for > kunit tests, but the current discussion around creating similar, generic, > helpers for kunit resumed interest in fixing this. > > This can be tested using the command: > ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/base/test/ > > Let me know what you think, > Maxime > > Signed-off-by: Maxime Ripard <maxime@cerno.tech> Ping? How can we move this forward? Maxime
On Wed, May 31, 2023 at 08:20:13PM +0100, Greg Kroah-Hartman wrote: > On Mon, Apr 17, 2023 at 06:12:26PM +0200, Maxime Ripard wrote: > > Hi, > > > > On Wed, Mar 29, 2023 at 08:38:30PM +0100, Maxime Ripard wrote: > > > Hi, > > > > > > This follows the discussion here: > > > https://lore.kernel.org/linux-kselftest/20230324123157.bbwvfq4gsxnlnfwb@houat/ > > > > > > This shows a couple of inconsistencies with regard to how device-managed > > > resources are cleaned up. Basically, devm resources will only be cleaned up > > > if the device is attached to a bus and bound to a driver. Failing any of > > > these cases, a call to device_unregister will not end up in the devm > > > resources being released. > > > > > > We had to work around it in DRM to provide helpers to create a device for > > > kunit tests, but the current discussion around creating similar, generic, > > > helpers for kunit resumed interest in fixing this. > > > > > > This can be tested using the command: > > > ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/base/test/ > > > > > > Let me know what you think, > > > Maxime > > > > > > Signed-off-by: Maxime Ripard <maxime@cerno.tech> > > > > Is there any news on this? > > Can you resend, last I saw the kernel test robot had a problem, which > causes any patch series like that to be ignored by me. Yeah, this was due to .kunitconfig being ignored by .gitignore, which triggers a warning for the bot. It's now fixed (at least in next), and I just resent the patches Thanks! Maxime
On Fri, Jun 02, 2023 at 05:27:05PM +0200, Maxime Ripard wrote: > On Wed, May 31, 2023 at 08:20:13PM +0100, Greg Kroah-Hartman wrote: > > On Mon, Apr 17, 2023 at 06:12:26PM +0200, Maxime Ripard wrote: > > > Hi, > > > > > > On Wed, Mar 29, 2023 at 08:38:30PM +0100, Maxime Ripard wrote: > > > > Hi, > > > > > > > > This follows the discussion here: > > > > https://lore.kernel.org/linux-kselftest/20230324123157.bbwvfq4gsxnlnfwb@houat/ > > > > > > > > This shows a couple of inconsistencies with regard to how device-managed > > > > resources are cleaned up. Basically, devm resources will only be cleaned up > > > > if the device is attached to a bus and bound to a driver. Failing any of > > > > these cases, a call to device_unregister will not end up in the devm > > > > resources being released. > > > > > > > > We had to work around it in DRM to provide helpers to create a device for > > > > kunit tests, but the current discussion around creating similar, generic, > > > > helpers for kunit resumed interest in fixing this. > > > > > > > > This can be tested using the command: > > > > ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/base/test/ > > > > > > > > Let me know what you think, > > > > Maxime > > > > > > > > Signed-off-by: Maxime Ripard <maxime@cerno.tech> > > > > > > Is there any news on this? > > > > Can you resend, last I saw the kernel test robot had a problem, which > > causes any patch series like that to be ignored by me. > > Yeah, this was due to .kunitconfig being ignored by .gitignore, which > triggers a warning for the bot. > > It's now fixed (at least in next), and I just resent the patches Still triggered the bot :(
Hi, This follows the discussion here: https://lore.kernel.org/linux-kselftest/20230324123157.bbwvfq4gsxnlnfwb@houat/ This shows a couple of inconsistencies with regard to how device-managed resources are cleaned up. Basically, devm resources will only be cleaned up if the device is attached to a bus and bound to a driver. Failing any of these cases, a call to device_unregister will not end up in the devm resources being released. We had to work around it in DRM to provide helpers to create a device for kunit tests, but the current discussion around creating similar, generic, helpers for kunit resumed interest in fixing this. This can be tested using the command: ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/base/test/ Let me know what you think, Maxime Signed-off-by: Maxime Ripard <maxime@cerno.tech> --- Maxime Ripard (2): drivers: base: Add basic devm tests for root devices drivers: base: Add basic devm tests for platform devices drivers/base/test/.kunitconfig | 2 + drivers/base/test/Kconfig | 4 + drivers/base/test/Makefile | 3 + drivers/base/test/platform-device-test.c | 278 +++++++++++++++++++++++++++++++ drivers/base/test/root-device-test.c | 120 +++++++++++++ 5 files changed, 407 insertions(+) --- base-commit: a6faf7ea9fcb7267d06116d4188947f26e00e57e change-id: 20230329-kunit-devm-inconsistencies-test-5e5a7d01e60d Best regards,