All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH RFC 0/1] Better handle video driver unload logic
@ 2022-04-14  8:34 Mauro Carvalho Chehab
  2022-04-14  8:34 ` [igt-dev] [PATCH RFC 1/1] tests/core_hotunplug: properly finish processes using audio devices Mauro Carvalho Chehab
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2022-04-14  8:34 UTC (permalink / raw)
  To: igt-dev, Petri Latvala; +Cc: Ch Sai Gowtham, Andrzej Hajda

From: Mauro Carvalho Chehab <mchehab@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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-14 12:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14  8:34 [igt-dev] [PATCH RFC 0/1] Better handle video driver unload logic Mauro Carvalho Chehab
2022-04-14  8:34 ` [igt-dev] [PATCH RFC 1/1] tests/core_hotunplug: properly finish processes using audio devices Mauro Carvalho Chehab
2022-04-14 10:08 ` [igt-dev] ✓ Fi.CI.BAT: success for Better handle video driver unload logic Patchwork
2022-04-14 12:00 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.