Skip to content

RFC Better handle video driver unload logic

Mauro Carvalho Chehab igt-dev 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest1 patch 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1tests/core_hotunplug: properly finish processes using audio deviceslib/igt_aux.c lib/igt_aux.h lib/igt_kmod.c +2 more+173 -210 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [igt-dev] [PATCH RFC 0/1] Better handle video driver unload logic

From: Mauro Carvalho Chehab <[email protected]>

Audio device drivers can be hooking into the video drivers, in order to handle audio from HDMI. On such cases, the video driver usage count will be incremented.

Before unloading or unbinding such drivers, it is needed first to ensure that no processes are using the audio devices and that the audio modules are either unbind or unloaded.

Currently, the logic handles alsactl in daemon mode, but it doesn't touch pulseaudio nor any other processes that could also be using it.

Make the logic more generic, in order to cover all audio-related processes and add an special case for pulseaudio, which requires an special request to stop using audio devices.

With that, tests like core_hotunplug will now do the right thing, even if pulseaudio is loaded:

	$ sudo ./build/tests/core_hotunplug --run unbind-rebind
	IGT-Version: 1.26-g776e034e (x86_64) (Linux: 5.18.0-rc2-drm-0fd740aed3bb+ x86_64)
	Starting subtest: unbind-rebind
	Ask pulseaudio to stop using audio device
	process 12919 (alsactl) is using audio device. Should be terminated.
	Preventively unloaded audio driver
	Subtest unbind-rebind: SUCCESS (2.146s)

I'm sending this as a RFC, as there are other cases that also need to be covered there:

1. pipewire-pulse. This requires a new feature that was added at version 0.3.50, released last week;
2. the current code covers only snd-hda-intel and snd-hdmi-lpe-audio. Other audio modules may also need to be handled - like soc/sof audio drivers.

Mauro Carvalho Chehab (1):
tests/core_hotunplug: properly finish processes using audio devices

 lib/igt_aux.c          | 141 +++++++++++++++++++++++++++++++++++++++++
 lib/igt_aux.h          |   1 +
 lib/igt_kmod.c         |  39 ++++++++----
 lib/igt_kmod.h         |   2 +
 tests/core_hotunplug.c |  11 +---
 5 files changed, 173 insertions(+), 21 deletions(-)
Signature · 1 line
2.35.1