From nobody Wed Nov 18 10:24:38 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jTyQH5wLMz71JBh for ; Wed, 18 Nov 2026 10:24:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jTyQH0q5bz4fdk for ; Wed, 18 Nov 2026 10:24:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794997479; 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; bh=7K/mVUMj1WYLAuGDbT/3h/tu/Y7ZCMLfpU8QkrXyiTU=; b=rGPPmjKNWxTWy36KS7aXRtF6M1U/7/exHaVU+TDrS5n9GDwo7pbfWuDcMb6+5mObQHuwiq fjBk6Saw3kAEyc6ppv/V3gN+rPci1zf/G2fc1mr/P38SuJdiTw2XZyjAcMYYIRHOZBaNWr YkgKj0BWX1irhbnUWJPywtm1DQiyZYnEFzGT49FUN6tbRj/88yIVpSAAjDxbdBUJ624fQS WUi9ed995k6X01we2GkEFBFgrWKs7vPkrlXqDEnbnay1la4x5It2+0g1kZeKVF17KEuk6S HAP+sekGsDiiUAeWPKd+bOTCr+Q1euexoDwG+mIFHkAE6YFLWo7QVG+CM8jSOA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794997479; b=d9AfBKXQ10Bq9bUgPEnzLz4JDD5ern6I1friYDaiHFuqJ0OY456xfxpNpSLcrTCpRMbNrj 8EtOjNwPuNXgE5SDRUtnfzZLh7oe5VgNQEFUjLn9PoM2gWpgxFy9Dzhs2FsYuh4mNA6ehw mmtq/8yQtOnxYCFsFNp1i9Of1FIwn/hC6N3qzGQL92MJ7+uhUHXRHzLjS/nOO4a8Z3/fvq 1Y0J/8jj11o/KtDCnzARqihybPblR/G775RwnYNEyZxTK/kgYfoIsmMWUa4Ek6nzL2ZByG zb/m3Q5ckvZj6wJB0kcq2DfXjSPChIahwYuehrSZFgY4SSiHCk3o3Zhwl7vxxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794997479; 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; bh=7K/mVUMj1WYLAuGDbT/3h/tu/Y7ZCMLfpU8QkrXyiTU=; b=VeFBHMGVLuL3ON5/5+t9+3CwjYdWlPUFFOzDSI5oYrPdaV+3P/8fVCmptqSQLXh+A2imdi 0/gO0JC1qeeQQ3BWbKx75h4lJ0rJ1alhtduRcES+FmTzII+bKs0fF5JCwNJYT35zdRo3TG vDLcxjCokUpzmlDe/H2w9CAIJGgGdmvaxIpT5Vv9cccZMJbs1InB96oa/5WkpESyxaWq7R cCZWWGpuPTbVzIrIpe6RvaoMgzgF3Z4tQaDYBfa1yLdpVmAq9NGPQeVfNDhTyGXNTSYFqv M+0XnCzMp7mtHVsrS7IvQbox78hvWH4w5jT0xl0wGQCau4r6iFm3GEtcOchmfg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jTyQG6z0Kz1Nny for ; Wed, 18 Nov 2026 10:24:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 53a3 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 18 Nov 2026 10:24:38 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 39c51e9684f4 - main - sound: Stop taking PCM_LOCK to create and destroy channels List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 39c51e9684f47005f116d5ec995f8b7337dae46b Auto-Submitted: auto-generated Date: Wed, 18 Nov 2026 10:24:38 +0000 Message-Id: <6afd7ce6.53a3.2eead26e@gitrepo.freebsd.org> The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=39c51e9684f47005f116d5ec995f8b7337dae46b commit 39c51e9684f47005f116d5ec995f8b7337dae46b Author: Christos Margiolis AuthorDate: 2026-11-18 10:19:44 +0000 Commit: Christos Margiolis CommitDate: 2026-11-18 10:19:44 +0000 sound: Stop taking PCM_LOCK to create and destroy channels chn_init() and chn_kill() took PCM_LOCK around the channel lists and the per-direction counts, so that readers which cannot sleep could inspect them. There are none left anymore, so drop it. The few remaining unlocked readers never took the mutex in the first place. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D60512 --- sys/dev/sound/pcm/channel.c | 6 ------ sys/dev/sound/pcm/sound.c | 2 -- sys/dev/sound/pcm/vchan.c | 4 ---- 3 files changed, 12 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 8e2de264bdd6..49c6908fc594 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1151,7 +1151,6 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, int err, i, direction, *vchanrate, *vchanformat; PCM_BUSYASSERT(d); - PCM_LOCKASSERT(d); switch (dir) { case PCMDIR_PLAY: @@ -1181,7 +1180,6 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, return (NULL); } - PCM_UNLOCK(d); b = NULL; bs = NULL; @@ -1261,7 +1259,6 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, goto fail; } - PCM_LOCK(d); CHN_INSERT_SORT_ASCEND(d, c, channels.pcm); if ((c->flags & CHN_F_VIRTUAL) == 0) { CHN_INSERT_SORT_ASCEND(d, c, channels.pcm.primary); @@ -1274,7 +1271,6 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, fail: chn_kill(c); - PCM_LOCK(d); return (NULL); } @@ -1288,7 +1284,6 @@ chn_kill(struct pcm_channel *c) PCM_BUSYASSERT(c->parentsnddev); - PCM_LOCK(d); CHN_REMOVE(d, c, channels.pcm); if ((c->flags & CHN_F_VIRTUAL) == 0) CHN_REMOVE(d, c, channels.pcm.primary); @@ -1309,7 +1304,6 @@ chn_kill(struct pcm_channel *c) default: __assert_unreachable(); } - PCM_UNLOCK(d); if (CHN_STARTED(c)) { CHN_LOCK(c); diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 22a9c25436ff..267d48f79ad9 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -133,14 +133,12 @@ pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo) int err = 0; PCM_ACQUIRE(d); - PCM_LOCK(d); ch = chn_init(d, NULL, cls, dir, devinfo); if (!ch) { device_printf(d->dev, "chn_init(%s, %d, %p) failed\n", cls->name, dir, devinfo); err = ENODEV; } - PCM_UNLOCK(d); PCM_RELEASE(d); return (err); diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index 31fedac458a8..43410d19d868 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -605,14 +605,12 @@ vchan_create(struct pcm_channel *parent, struct pcm_channel **child) return (EINVAL); CHN_UNLOCK(parent); - PCM_LOCK(d); /* * This is the only place where channels are created at runtime, so do * not create any if we are tearing down. */ if (!PCM_REGISTERED(d)) { - PCM_UNLOCK(d); CHN_LOCK(parent); return (ENODEV); } @@ -630,11 +628,9 @@ vchan_create(struct pcm_channel *parent, struct pcm_channel **child) /* create a new playback channel */ ch = chn_init(d, parent, &vchan_class, direction, parent); if (ch == NULL) { - PCM_UNLOCK(d); CHN_LOCK(parent); return (ENODEV); } - PCM_UNLOCK(d); CHN_LOCK(parent); CHN_INSERT_SORT_ASCEND(parent, ch, children);