git: 538df10f545e - stable/15 - sound: Retire SND_DIAGNOSTIC PCM locking macros
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 20 Nov 2025 13:31:45 UTC
The branch stable/15 has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=538df10f545e8e658a7010f7ec6eb9834f1aaf1c
commit 538df10f545e8e658a7010f7ec6eb9834f1aaf1c
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-11-13 14:35:58 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-11-20 13:28:15 +0000
sound: Retire SND_DIAGNOSTIC PCM locking macros
Disabled by default, but also redundant, since most of the errors they
catch will be caught anyway by WITNESS and the locking subsystem.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D53735
(cherry picked from commit b19e61f223a1982cce103b9716568391a071892a)
---
sys/dev/sound/pcm/sound.h | 103 ----------------------------------------------
1 file changed, 103 deletions(-)
diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h
index c5107d5fba1c..8542a96ccb14 100644
--- a/sys/dev/sound/pcm/sound.h
+++ b/sys/dev/sound/pcm/sound.h
@@ -251,108 +251,6 @@ int sound_oss_card_info(oss_card_info *);
* For PCM_[WAIT | ACQUIRE | RELEASE], be sure to surround these
* with PCM_LOCK/UNLOCK() sequence, or I'll come to gnaw upon you!
*/
-#ifdef SND_DIAGNOSTIC
-#define PCM_WAIT(x) do { \
- if (!PCM_LOCKOWNED(x)) \
- panic("%s(%d): [PCM WAIT] Mutex not owned!", \
- __func__, __LINE__); \
- while ((x)->flags & SD_F_BUSY) { \
- if (snd_verbose > 3) \
- device_printf((x)->dev, \
- "%s(%d): [PCM WAIT] calling cv_wait().\n", \
- __func__, __LINE__); \
- cv_wait(&(x)->cv, (x)->lock); \
- } \
-} while (0)
-
-#define PCM_ACQUIRE(x) do { \
- if (!PCM_LOCKOWNED(x)) \
- panic("%s(%d): [PCM ACQUIRE] Mutex not owned!", \
- __func__, __LINE__); \
- if ((x)->flags & SD_F_BUSY) \
- panic("%s(%d): [PCM ACQUIRE] " \
- "Trying to acquire BUSY cv!", __func__, __LINE__); \
- (x)->flags |= SD_F_BUSY; \
-} while (0)
-
-#define PCM_RELEASE(x) do { \
- if (!PCM_LOCKOWNED(x)) \
- panic("%s(%d): [PCM RELEASE] Mutex not owned!", \
- __func__, __LINE__); \
- if ((x)->flags & SD_F_BUSY) { \
- (x)->flags &= ~SD_F_BUSY; \
- cv_broadcast(&(x)->cv); \
- } else \
- panic("%s(%d): [PCM RELEASE] Releasing non-BUSY cv!", \
- __func__, __LINE__); \
-} while (0)
-
-/* Quick version, for shorter path. */
-#define PCM_ACQUIRE_QUICK(x) do { \
- if (PCM_LOCKOWNED(x)) \
- panic("%s(%d): [PCM ACQUIRE QUICK] Mutex owned!", \
- __func__, __LINE__); \
- PCM_LOCK(x); \
- PCM_WAIT(x); \
- PCM_ACQUIRE(x); \
- PCM_UNLOCK(x); \
-} while (0)
-
-#define PCM_RELEASE_QUICK(x) do { \
- if (PCM_LOCKOWNED(x)) \
- panic("%s(%d): [PCM RELEASE QUICK] Mutex owned!", \
- __func__, __LINE__); \
- PCM_LOCK(x); \
- PCM_RELEASE(x); \
- PCM_UNLOCK(x); \
-} while (0)
-
-#define PCM_BUSYASSERT(x) do { \
- if (!((x) != NULL && ((x)->flags & SD_F_BUSY))) \
- panic("%s(%d): [PCM BUSYASSERT] " \
- "Failed, snddev_info=%p", __func__, __LINE__, x); \
-} while (0)
-
-#define PCM_GIANT_ENTER(x) do { \
- int _pcm_giant = 0; \
- if (PCM_LOCKOWNED(x)) \
- panic("%s(%d): [GIANT ENTER] PCM lock owned!", \
- __func__, __LINE__); \
- if (mtx_owned(&Giant) != 0 && snd_verbose > 3) \
- device_printf((x)->dev, \
- "%s(%d): [GIANT ENTER] Giant owned!\n", \
- __func__, __LINE__); \
- if (!((x)->flags & SD_F_MPSAFE) && mtx_owned(&Giant) == 0) \
- do { \
- mtx_lock(&Giant); \
- _pcm_giant = 1; \
- } while (0)
-
-#define PCM_GIANT_EXIT(x) do { \
- if (PCM_LOCKOWNED(x)) \
- panic("%s(%d): [GIANT EXIT] PCM lock owned!", \
- __func__, __LINE__); \
- if (!(_pcm_giant == 0 || _pcm_giant == 1)) \
- panic("%s(%d): [GIANT EXIT] _pcm_giant screwed!", \
- __func__, __LINE__); \
- if ((x)->flags & SD_F_MPSAFE) { \
- if (_pcm_giant == 1) \
- panic("%s(%d): [GIANT EXIT] MPSAFE Giant?", \
- __func__, __LINE__); \
- if (mtx_owned(&Giant) != 0 && snd_verbose > 3) \
- device_printf((x)->dev, \
- "%s(%d): [GIANT EXIT] Giant owned!\n", \
- __func__, __LINE__); \
- } \
- if (_pcm_giant != 0) { \
- if (mtx_owned(&Giant) == 0) \
- panic("%s(%d): [GIANT EXIT] Giant not owned!", \
- __func__, __LINE__); \
- _pcm_giant = 0; \
- mtx_unlock(&Giant); \
- } \
-} while (0)
-#else /* !SND_DIAGNOSTIC */
#define PCM_WAIT(x) do { \
PCM_LOCKASSERT(x); \
while ((x)->flags & SD_F_BUSY) \
@@ -422,7 +320,6 @@ int sound_oss_card_info(oss_card_info *);
mtx_unlock(&Giant); \
} \
} while (0)
-#endif /* SND_DIAGNOSTIC */
#define PCM_GIANT_LEAVE(x) \
PCM_GIANT_EXIT(x); \