🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.freebsd.hackers
Article #118

Audio device underruns under load

#118
From: Fabian Keil
Date: Wed, 25 Nov 2026 07:28
64 lines
5798 bytes
On an ElectroBSD amd64 system based on FreeBSD stable/15
I reproducibly get "Audio device underrun detected." messages
from mpv when playing audio files with default priority while
"lots" of data in a short amount of time is written to a ZFS
pool on a geli-encrypted vdev.

When the messages occur, the sound briefly stops.

The system is a Lenovo T520 with an Intel(R) Core(TM)
i5-2520M CPU @ 2.50GHz, /dev/sndstat content is:

| Installed devices:
| pcm0: <Conexant CX20590 (Analog 2.0+HP/2.0)> (play/rec) default
| pcm1: <Intel Cougar Point (HDMI/DP 8ch)> (play)
| pcm2: <Intel Cougar Point (HDMI/DP 8ch)> (play)
| pcm3: <Intel Cougar Point (HDMI/DP 8ch)> (play)
| No devices installed from userspace.

The issue frequently occurs while running poudriere when
packages are installed during the lib-depends phase for
ports with lots of dependencies, even though poudriere is
started with "nice -n 20" and is configured with
PARALLEL_JOBS=3 while kern.smp.cpus is 4.

The issue can also be reproduced by running:
   dd if=/dev/random bs=1m count=1000 of=~/scratch/random.data
while mpv is running.

mplayer and vlc have similar sound issues under load but
don't seem to log anything obvious with default settings
when the problems occur.

Reducing vfs.zfs.zio.taskq_batch_pct to 25 helped a lot,
but did not completely solve the issue.

A more reliable workaround seems to be running:
   rtprio 16 -$(pgrep mpv)
before expecting a write load.

If mpv is started while the system is already loaded the underruns
often occur in the first seconds before the priority is raised, though.

In ElectroBSD, I therefore recently added a kern.boost_multimedia_players
sysctl. It can be set to let the kernel boost the priority for
recognised multimedia players automatically at execution time [0].

Having to boost the priority for multimedia players and having
to modify ZFS settings doesn't strike me as ideal, though, so I'm
still considering this a scheduling issue.

While I already tried various modifications below kern.sched using
both schedulers, I did not find combinations that obviously improved
things further.

Any recommendations?

Fabian

[0]: <https://www.fabiankeil.de/sourcecode/electrobsd/ElectroBSD-15-20261124-Add-a-sysctl-to-boost-the-priority-for-multimedia.diff>


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID: <20261125082851.0971118e.freebsd-listen@fabiankeil.de>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: Fabian Keil <freebsd-listen@fabiankeil.de>
Newsgroups: muc.lists.freebsd.hackers
Subject: Audio device underruns under load
Date: Wed, 25 Nov 2026 08:28:51 +0100
Organization: Newsgate at muc.de e.V.
Approved: news-admin@muc.de
Distribution: world
Message-ID: <20261125082851.0971118e.freebsd-listen@fabiankeil.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="62574"; mail-complaints-to="news-admin@muc.de"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1795591742;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:list-id:list-help:
	 list-owner:list-unsubscribe:list-subscribe:list-post;
	bh=v+BRB5Xwc6IcDfGbysWMk30U3O650fWOc6AMLjzv30o=;
	b=UQtwEruJZ08Sw41vZaaKyIR7AwVFgvu0l8xiUq/0OGddnI9CwR0b6Ne4nQ3bDEARkDLlV6
	9rikFxkLmY2jOZgMsH59F+RAffpkzJLElUcVBF3lSISxktrYSo6MZT9qt4mmgAkTU0y7Go
	RP3rGxUp/8tkVEe8hVS7WvqMecZRkRINil6vlMT0aDrvWyOi+inOyxzfh4WqdFRggbAcxp
	DqbONe+4fliF665lpIH8U4V+uBtATSG8ZkaKQXQvs807SLZ+3IsraxTHCWnBz04z+0sal4
	T1GhOjfIdLvr71SZzPp6tqna487jJwjrYruudO0bsiAT/T883aJ1LVQL/e6MIQ==
X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org
Authentication-Results: mx1.freebsd.org;
	dkim=pass header.d=fabiankeil.de header.s=blafasel header.b="UKk/tSo9";
	spf=pass (mx1.freebsd.org: domain of freebsd-listen@fabiankeil.de designates 95.211.138.7 as permitted sender) smtp.mailfrom=freebsd-listen@fabiankeil.de;
	dmarc=none
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fabiankeil.de;
	s=blafasel; t=1795591731;
	bh=71nIepBuiy9L31ZgjMAkW3l2TwwmcWBxjz3SEzyg5mA=;
	h=Date:From:To:Subject;
	b=UKk/tSo9OWumZ/TI6rsUd4lpdBJUknPc+mrUiLbOQq4pKnbiYuEmoG6e3DIlii2AA
	 7HTWwSfbRRxUK84fHi30g6Jgqm3N0tIQkoOleCdXF1BccsZzAQJf/tEavMEM8a68QF
	 zFOFb62ccLs0hWgFSCBNtwFHFDAwJTe7LztPSGPT9JncSGxDGJ1vP3lwWVKNgHsrSE
	 LA7u9zI6X8JGU2TC2GGNtUiNH7Yudqj5EOAb4AKJ0ViyR2yQxqBEvbZKHKK3EGBcJ9
	 ecVxsUJhceIJzfPk4durdTthitMQdnd4HA/MLkx+jvsfI1mNLS37+oinH25XnvBEmG
	 o/KOH2m12iVPg==
Precedence: list
X-Rspamd-Queue-Id: 4jZBBM61qPz4ty7
X-Spamd-Bar: /
X-Spamd-Result: default: False [0.70 / 15.00];
	MID_CONTAINS_FROM(1.00)[];
	R_DKIM_ALLOW(-0.20)[fabiankeil.de:s=blafasel];
	ONCE_RECEIVED(0.20)[];
	R_SPF_ALLOW(-0.20)[+ip4:95.211.138.7];
	MIME_GOOD(-0.10)[text/plain];
	RCPT_COUNT_ONE(0.00)[1];
	ASN(0.00)[asn:60781, ipnet:95.211.0.0/16, country:NL];
	MIME_TRACE(0.00)[0:+];
	RCVD_COUNT_ONE(0.00)[1];
	MISSING_XM_UA(0.00)[];
	FROM_HAS_DN(0.00)[];
	RCVD_TLS_LAST(0.00)[];
	ARC_NA(0.00)[];
	TO_MATCH_ENVRCPT_ALL(0.00)[];
	FROM_EQ_ENVFROM(0.00)[];
	DMARC_NA(0.00)[fabiankeil.de: no valid DMARC record];
	PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org];
	MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org];
	TO_DN_ALL(0.00)[];
	DKIM_TRACE(0.00)[fabiankeil.de:+]
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes