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

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Thu Apr 14 08:34:52 UTC 2022


From: Mauro Carvalho Chehab <mchehab at kernel.org>

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(-)

-- 
2.35.1




More information about the igt-dev mailing list