Skip to contentSkip to conversation

Introduce userspace-driven ALSA timers

PATCH Superseded Ivan Orlov 3 participants 8 messages Jul 29, 2024 – Jul 30, 2024

Subsystems (4)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Ivan Orlov

author
#0 lore raw

v2 cover Introduce userspace-driven ALSA timers

There are multiple possible timer sources which could be useful for the sound stream synchronization: hrtimers, hardware clocks (e.g. PTP), timer wheels (jiffies). Currently, using one of them to synchronize the audio stream of snd-aloop module would require writing a kernel-space driver which exports an ALSA timer through the snd_timer interface.

However, it is not really convenient for application developers, who may want to define their custom timer sources for audio synchronization.

For instance, we could have a network application which receives frames and sends them to snd-aloop pcm device, and another application listening on the other end of snd-aloop. It makes sense to transfer a new period of data only when certain amount of frames is received through the network, but definitely not when a certain amount of jiffies on a local system elapses. Since all of the devices are purely virtual it won't introduce any glitches and will help the application developers to avoid using sample-rate conversion.

This patch series introduces userspace-driven ALSA timers: virtual timers which are created and controlled from userspace. The timer can be created from the userspace using the new ioctl SNDRV_TIMER_IOCTL_CREATE. After creating a timer, it becomes available for use system-wide, so it can be passed to snd-aloop as a timer source (timer_source parameter would be "-1.SNDRV_TIMER_GLOBAL_UDRIVEN.{timer_id}"). When the userspace app decides to trigger a timer, it calls another ioctl SNDRV_TIMER_IOCTL_TRIGGER on the file descriptor of a timer. It initiates a transfer of a new period of data.

Userspace-driven timers are associated with file descriptors. If the application wishes to destroy the timer, it can simply release the file descriptor of a virtual timer.

I believe introducing new ioctl calls is quite inconvenient (as we have a limited amount of them), but other possible ways of app <-> kernel communication (like virtual FS) seem completely inappropriate for this task (but I'd love to discuss alternative solutions).

This patch series also updates the snd-aloop module so the global timers can be used as a timer_source for it (it allows using userspace-driven timers as timer source).

V2 of this patch series fixes some problems found by Christophe Jaillet <[email protected]>. Please, find the patch-specific changelog in the following patches.

Ivan Orlov (4):
ALSA: aloop: Allow using global timers
Docs/sound: Add documentation for userspace-driven ALSA timers
ALSA: timer: Introduce virtual userspace-driven timers
selftests: ALSA: Cover userspace-driven timers with test

 Documentation/sound/index.rst               |   1 +
 Documentation/sound/utimers.rst             | 120 +++++++++++
 include/uapi/sound/asound.h                 |  17 ++
 sound/core/Kconfig                          |  10 +
 sound/core/timer.c                          | 213 ++++++++++++++++++++
 sound/drivers/aloop.c                       |   2 +
 tools/testing/selftests/alsa/Makefile       |   2 +-
 tools/testing/selftests/alsa/global-timer.c |  87 ++++++++
 tools/testing/selftests/alsa/utimer-test.c  | 137 +++++++++++++
 9 files changed, 588 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/sound/utimers.rst
 create mode 100644 tools/testing/selftests/alsa/global-timer.c
 create mode 100644 tools/testing/selftests/alsa/utimer-test.c
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 1/4 ALSA: aloop: Allow using global timers

Allow using global timers as a timer source when card id is equal to -1 in the timer_source parameter.

---
V1 -> V2:
- No changes

 sound/drivers/aloop.c | 2 ++
 1 file changed, 2 insertions(+)
sound/drivers/aloop.c +2 -0
index d6dd4b8c750a..a1e5e7fe9c72 100644
@@ -1130,6 +1130,8 @@ static int loopback_parse_timer_id(const char *str,
 			}
 		}
 	}
+	if (card_idx == -1)
+		tid->dev_class = SNDRV_TIMER_CLASS_GLOBAL;
 	if (!err && tid) {
 		tid->card = card_idx;
 		tid->device = dev;
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v2 2/4 Docs/sound: Add documentation for userspace-driven ALSA timers

In reply to Ivan Orlov

Add the documentation which describes the new userspace-driven timers API introduced in this patch series. The documentation contains:

- Description of userspace-driven ALSA timers, what they are for
- Description of the timers API
- Example of how the timers can be created and triggered
- How the timers can be used as a timer sources for snd-aloop module

---
V1 -> V2:
- No changes

 Documentation/sound/index.rst   |   1 +
 Documentation/sound/utimers.rst | 120 ++++++++++++++++++++++++++++++++
 2 files changed, 121 insertions(+)
 create mode 100644 Documentation/sound/utimers.rst
Documentation/sound/index.rst +1 -0
index 7e67e12730d3..c437f2a4bc85 100644
@@ -13,6 +13,7 @@ Sound Subsystem Documentation
    alsa-configuration
    hd-audio/index
    cards/index
+   utimers
 
 .. only::  subproject and html
 
Documentation/sound/utimers.rst new file +120 -0

120 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#3 lore raw

PATCH v2 3/4 ALSA: timer: Introduce virtual userspace-driven timers

In reply to Ivan Orlov

Implement two ioctl calls in order to support virtual userspace-driven ALSA timers.

The first ioctl is SNDRV_TIMER_IOCTL_CREATE, which gets the snd_utimer_info struct as a parameter and returns a file descriptor of a virtual timer. It also updates the id field of the snd_utimer_info struct, which provides a unique identifier for the timer (basically, the subdevice number which can be used when creating timer instances).

This patch also introduces a tiny id allocator for the userspace-driven timers, which guarantees that we don't have more than 128 of them in the system.

Another ioctl is SNDRV_TIMER_IOCTL_TRIGGER, which allows us to trigger the virtual timer (and calls snd_timer_interrupt for the timer under the hood), causing all of the timer instances binded to this timer to execute their callbacks.

The maximum amount of ticks available for the timer is 1 for the sake of simplification of the userspace API. 'start', 'stop', 'open' and 'close' callbacks for the userspace-driven timers are empty since we don't really do any hardware initialization here.

---
V1 -> V2:
- Add missing kfree for the utimer name in snd_utimer_free
- Remove extra newline in sound core Kconfig
- Use IDA allocator API to allocate utimer ids
- Use kasprintf for the timer name instead of kzalloc + sprintf

 include/uapi/sound/asound.h |  17 +++
 sound/core/Kconfig          |  10 ++
 sound/core/timer.c          | 213 ++++++++++++++++++++++++++++++++++++
 3 files changed, 240 insertions(+)
include/uapi/sound/asound.h +17 -0
index 8bf7e8a0eb6f..ade952a54edd 100644
@@ -894,6 +894,7 @@ enum {
 #define SNDRV_TIMER_GLOBAL_RTC		1	/* unused */
 #define SNDRV_TIMER_GLOBAL_HPET		2
 #define SNDRV_TIMER_GLOBAL_HRTIMER	3
+#define SNDRV_TIMER_GLOBAL_UDRIVEN	4
 
 /* info flags */
 #define SNDRV_TIMER_FLG_SLAVE		(1<<0)	/* cannot be controlled */
@@ -974,6 +975,20 @@ struct snd_timer_status {
 };
 #endif
 
+/*
+ * This structure describes the userspace-driven timer. Such timers are purely virtual,
+ * and can only be triggered from software (for instance, by userspace application).
+ */
+struct snd_utimer_info {
+	/*
+	 * To pretend being a normal timer, we need to know the frame rate and
+	 * the period size in frames.
+	 */
+	snd_pcm_uframes_t frame_rate;
+	snd_pcm_uframes_t period_size;
+	unsigned int id;
+};
+
 #define SNDRV_TIMER_IOCTL_PVERSION	_IOR('T', 0x00, int)
 #define SNDRV_TIMER_IOCTL_NEXT_DEVICE	_IOWR('T', 0x01, struct snd_timer_id)
 #define SNDRV_TIMER_IOCTL_TREAD_OLD	_IOW('T', 0x02, int)
@@ -990,6 +1005,8 @@ struct snd_timer_status {
 #define SNDRV_TIMER_IOCTL_CONTINUE	_IO('T', 0xa2)
 #define SNDRV_TIMER_IOCTL_PAUSE		_IO('T', 0xa3)
 #define SNDRV_TIMER_IOCTL_TREAD64	_IOW('T', 0xa4, int)
+#define SNDRV_TIMER_IOCTL_CREATE	_IOWR('T', 0xa5, struct snd_utimer_info)
+#define SNDRV_TIMER_IOCTL_TRIGGER	_IO('T', 0xa6)
 
 #if __BITS_PER_LONG == 64
 #define SNDRV_TIMER_IOCTL_TREAD SNDRV_TIMER_IOCTL_TREAD_OLD
sound/core/Kconfig +10 -0
index b970a1734647..670b26cf3065 100644
@@ -251,6 +251,16 @@ config SND_JACK_INJECTION_DEBUG
 	  Say Y if you are debugging via jack injection interface.
 	  If unsure select "N".
 
+config SND_UTIMER
+	bool "Enable support for userspace-controlled virtual timers"
+	depends on SND_TIMER
+	help
+	  Say Y to enable the support of userspace-controlled timers. These
+	  timers are purely virtual, and they are supposed to be triggered
+	  from userspace. They could be quite useful when synchronizing the
+	  sound timing with userspace applications (for instance, when sending
+	  data through snd-aloop).
+
 config SND_VMASTER
 	bool
 
sound/core/timer.c +213 -0

237 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#7 lore raw

PATCH v2 4/4 selftests: ALSA: Cover userspace-driven timers with test

In reply to Ivan Orlov

Add a test for the new functionality of userspace-driven timers and the tool which allows us to count timer ticks in a certain time period. The test:

1. Creates a userspace-driven timer with ioctl to /dev/snd/timer
2. Starts the global-timer application to count the ticks of the timer from step 1.
3. Asynchronously triggers the timer multiple times with some interval
4. Compares the amount of caught ticks with the amount of trigger calls.

Since we can't include <alsa/asoundlib.h> and <sound/asound.h> in one file due to overlapping declarations, I have to split the test into two
applications: one of them counts the amount of timer ticks in the defined time period, and another one is the actual test which creates the timer, triggers it periodically and starts the first app to count the amount of ticks in a separate thread.

Besides from testing the functionality itself, the test represents a sample application showing userspace-driven ALSA timers API.

---
- Return NULL in the pthreaded function (ticking_func)
- Process TIMER_NO_EVENT enum in the timer app output processing loop

 tools/testing/selftests/alsa/Makefile       |   2 +-
 tools/testing/selftests/alsa/global-timer.c |  87 +++++++++++++
 tools/testing/selftests/alsa/utimer-test.c  | 137 ++++++++++++++++++++
 3 files changed, 225 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/alsa/global-timer.c
 create mode 100644 tools/testing/selftests/alsa/utimer-test.c
tools/testing/selftests/alsa/Makefile +1 -1
index c1ce39874e2b..0d5bd8ea900b 100644
@@ -12,7 +12,7 @@ LDLIBS+=-lpthread
 
 OVERRIDE_TARGETS = 1
 
-TEST_GEN_PROGS := mixer-test pcm-test test-pcmtest-driver
+TEST_GEN_PROGS := mixer-test pcm-test utimer-test test-pcmtest-driver global-timer
 
 TEST_GEN_PROGS_EXTENDED := libatest.so
 
tools/testing/selftests/alsa/global-timer.c new file +87 -0

87 lines not on this page · raw message

tools/testing/selftests/alsa/utimer-test.c new file +137 -0

137 lines not on this page · raw message

Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH v2 3/4] ALSA: timer: Introduce virtual userspace-driven timers

In reply to Ivan Orlov
Quoted 2 lines · Ivan Orlov
include/uapi/sound/asound.h +0 -0

(snip)

include/uapi/sound/asound.h struct snd_timer_status { · line 988

Quoted 11 lines
include/uapi/sound/asound.h +11 -0
+/*
+ * This structure describes the userspace-driven timer. Such timers are purely virtual,
+ * and can only be triggered from software (for instance, by userspace application).
+ */
+struct snd_utimer_info {
+	/*
+	 * To pretend being a normal timer, we need to know the frame rate and
+	 * the period size in frames.
+	 */
+	snd_pcm_uframes_t frame_rate;
+	snd_pcm_uframes_t period_size;

The units in timer API should be independent from PCM. So use the explicit type such as __u64 here (so that you don't need the compat ioctl conversion, too).

include/uapi/sound/asound.h

Quoted 2 lines
include/uapi/sound/asound.h +2 -0
+	unsigned int id;
+};

We often put some reserved fields for future extension. But I'm not sure whether it's needed at this time for this kind of simple interface, though.

include/uapi/sound/asound.h struct snd_timer_status { · line 1009

Quoted 9 lines

#define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int)
#define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id)
#define SNDRV_TIMER_IOCTL_TREAD_OLD _IOW('T', 0x02, int)

include/uapi/sound/asound.h +2 -0
@@ -990,6 +1005,8 @@ struct snd_timer_status {
 #define SNDRV_TIMER_IOCTL_CONTINUE	_IO('T', 0xa2)
 #define SNDRV_TIMER_IOCTL_PAUSE		_IO('T', 0xa3)
 #define SNDRV_TIMER_IOCTL_TREAD64	_IOW('T', 0xa4, int)
+#define SNDRV_TIMER_IOCTL_CREATE	_IOWR('T', 0xa5, struct snd_utimer_info)
+#define SNDRV_TIMER_IOCTL_TRIGGER	_IO('T', 0xa6)

Once after adding the new API, don't forget to bump the protocol version defined in SNDRV_TIMER_VERSION.

Quoted 2 lines
sound/core/timer.c +0 -0

(snip)

sound/core/timer.c enum { · line 2030

Quoted 6 lines
sound/core/timer.c +6 -0
+#ifdef CONFIG_SND_UTIMER
+/*
+ * Since userspace-driven timers are passed to userspace, we need to have an identifier
+ * which will allow us to use them (basically, the subdevice number of udriven timer).
+ */
+DEFINE_IDA(snd_utimer_ids);

Missing static.

Quoted 3 lines
sound/core/timer.c +3 -0
+static int snd_utimer_create(struct snd_utimer_info *utimer_info,
+			     struct snd_utimer **r_utimer)
+{

(snip)

sound/core/timer.c enum { · line 2155

Quoted 9 lines
sound/core/timer.c +9 -0
+	err = snd_timer_new(NULL, utimer->name, &tid, &timer);
+	if (err < 0) {
+		pr_err("Can't create userspace-driven timer\n");
+		goto err_timer_new;
+	}
+
+	timer->module = THIS_MODULE;
+	timer->hw = timer_hw;
+	timer->hw.resolution = NANO / utimer_info->frame_rate * utimer_info->period_size;

A sanity check is definitely needed for parameters like this. e.g. you'd hit a zero-division Oops with this code. Also, the resolution should be neither too small nor too high.

sound/core/timer.c enum { · line 2191

Quoted 10 lines
sound/core/timer.c +10 -0
+static int snd_utimer_ioctl_create(struct file *file,
+				   struct snd_utimer_info __user *_utimer_info)
+{
+	struct snd_utimer *utimer;
+	struct snd_utimer_info *utimer_info;
+	int err;
+
+	utimer_info = memdup_user(_utimer_info, sizeof(*utimer_info));
+	if (IS_ERR(utimer_info))
+		return PTR_ERR(no_free_ptr(utimer_info));

no_free_ptr() is used only for the automatic cleanup stuff.

sound/core/timer.c enum { · line 2218

Quoted 4 lines
sound/core/timer.c +4 -0
+static int snd_utimer_ioctl_create(struct file *file,
+				   struct snd_utimer_info __user *_utimer_info)
+{
+	return -EINVAL;

Better to keep -ENOTTY?

thanks,

Takashi

author
#5 lore raw

Re: [PATCH v2 3/4] ALSA: timer: Introduce virtual userspace-driven timers

Quoted 5 lines · Takashi Iwai
Quoted 2 lines · Ivan Orlov
include/uapi/sound/asound.h +0 -0

(snip)

Hi Takashi,

Thank you so much for the review.

Quoted 7 lines
Quoted 7 lines
include/uapi/sound/asound.h +7 -0
+/*
+ * This structure describes the userspace-driven timer. Such timers are purely virtual,
+ * and can only be triggered from software (for instance, by userspace application).
+ */
+struct snd_utimer_info {
+	/*
+	 * To pretend being a normal timer, we need to know the frame rate and
Quoted 9 lines

include/uapi/sound/asound.h struct snd_timer_status { · line 988

Quoted 4 lines
include/uapi/sound/asound.h +4 -0
+	 * the period size in frames.
+	 */
+	snd_pcm_uframes_t frame_rate;
+	snd_pcm_uframes_t period_size;

The units in timer API should be independent from PCM. So use the explicit type such as __u64 here (so that you don't need the compat ioctl conversion, too).

Alright, I'll use __u64 here (initially I thought it is going to be more clear because it specifies the unit period_size is stored in, but I agree that it should be completely independent from pcm).

Quoted 7 lines

include/uapi/sound/asound.h

Quoted 2 lines
include/uapi/sound/asound.h +2 -0
+	unsigned int id;
+};

We often put some reserved fields for future extension. But I'm not sure whether it's needed at this time for this kind of simple interface, though.

Yeah, I don't think we are going to add anything else to the timers anytime soon... However, I'll probably add a small reserved space here (16 bytes, for instance), just in case we decide to add more parameters. Thanks!

Quoted 4 lines
Quoted 4 lines
  #define SNDRV_TIMER_IOCTL_PVERSION	_IOR('T', 0x00, int)
  #define SNDRV_TIMER_IOCTL_NEXT_DEVICE	_IOWR('T', 0x01, struct snd_timer_id)
  #define SNDRV_TIMER_IOCTL_TREAD_OLD	_IOW('T', 0x02, int)
include/uapi/sound/asound.h +0 -0
@@ -990,6 +1005,8 @@ struct snd_timer_status {
Quoted 9 lines

include/uapi/sound/asound.h struct snd_timer_status { · line 1009

Quoted 5 lines
include/uapi/sound/asound.h +2 -0
  #define SNDRV_TIMER_IOCTL_CONTINUE	_IO('T', 0xa2)
  #define SNDRV_TIMER_IOCTL_PAUSE		_IO('T', 0xa3)
  #define SNDRV_TIMER_IOCTL_TREAD64	_IOW('T', 0xa4, int)
+#define SNDRV_TIMER_IOCTL_CREATE	_IOWR('T', 0xa5, struct snd_utimer_info)
+#define SNDRV_TIMER_IOCTL_TRIGGER	_IO('T', 0xa6)

Once after adding the new API, don't forget to bump the protocol version defined in SNDRV_TIMER_VERSION.

Ah, alright, I'll fix that in V3. Sorry, haven't noticed it :(

Quoted 12 lines
Quoted 2 lines
sound/core/timer.c +0 -0

(snip)

sound/core/timer.c enum { · line 2030

Quoted 6 lines
sound/core/timer.c +6 -0
+#ifdef CONFIG_SND_UTIMER
+/*
+ * Since userspace-driven timers are passed to userspace, we need to have an identifier
+ * which will allow us to use them (basically, the subdevice number of udriven timer).
+ */
+DEFINE_IDA(snd_utimer_ids);

Missing static.

Ah, yes, I missed the static here. thanks!

Quoted 4 lines
Quoted 3 lines
sound/core/timer.c +3 -0
+static int snd_utimer_create(struct snd_utimer_info *utimer_info,
+			     struct snd_utimer **r_utimer)
+{

(snip)

Quoted 14 lines

sound/core/timer.c enum { · line 2155

Quoted 9 lines
sound/core/timer.c +9 -0
+	err = snd_timer_new(NULL, utimer->name, &tid, &timer);
+	if (err < 0) {
+		pr_err("Can't create userspace-driven timer\n");
+		goto err_timer_new;
+	}
+
+	timer->module = THIS_MODULE;
+	timer->hw = timer_hw;
+	timer->hw.resolution = NANO / utimer_info->frame_rate * utimer_info->period_size;

A sanity check is definitely needed for parameters like this. e.g. you'd hit a zero-division Oops with this code. Also, the resolution should be neither too small nor too high.

Yeah, allowing zero division here (and overflows) is a very bad idea... I'll add some checks in V3.

Quoted 4 lines
Quoted 4 lines
sound/core/timer.c +4 -0
+static int snd_utimer_ioctl_create(struct file *file,
+				   struct snd_utimer_info __user *_utimer_info)
+{
+	struct snd_utimer *utimer;
Quoted 9 lines

sound/core/timer.c enum { · line 2191

Quoted 6 lines
sound/core/timer.c +6 -0
+	struct snd_utimer_info *utimer_info;
+	int err;
+
+	utimer_info = memdup_user(_utimer_info, sizeof(*utimer_info));
+	if (IS_ERR(utimer_info))
+		return PTR_ERR(no_free_ptr(utimer_info));

no_free_ptr() is used only for the automatic cleanup stuff.

Probably, I should use automatic cleanup here as well (as it is done in snd_timer_user_ginfo).

Quoted 6 lines

sound/core/timer.c enum { · line 2218

Quoted 4 lines
sound/core/timer.c +4 -0
+static int snd_utimer_ioctl_create(struct file *file,
+				   struct snd_utimer_info __user *_utimer_info)
+{
+	return -EINVAL;

Better to keep -ENOTTY?

Initial idea was that EINVAL here would say that the functionality is supported, but disabled in the config, but it seems like it breaks the convention this way so I'm going to change this to ENOTTY in the next version.

Thank you!

Signature · 2 lines
Kind regards,
Ivan Orlov
#6 lore raw

Re: [PATCH v2 3/4] ALSA: timer: Introduce virtual userspace-driven timers

In reply to Ivan Orlov
kernel test robot noticed the following build warnings:

Hi Ivan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tiwai-sound/for-next]
[also build test WARNING on tiwai-sound/for-linus linus/master v6.11-rc1 next-20240729] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ivan-Orlov/ALSA-aloop-Allow-using-global-timers/20240729-171015
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link:    https://lore.kernel.org/r/20240729085905.6602-4-ivan.orlov0322%40gmail.com
patch subject: [PATCH v2 3/4] ALSA: timer: Introduce virtual userspace-driven timers
config: nios2-randconfig-r113-20240730 (https://download.01.org/0day-ci/archive/20240730/[email protected]/config)
compiler: nios2-linux-gcc (GCC) 14.1.0
reproduce: (https://download.01.org/0day-ci/archive/20240730/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)

>> sound/core/timer.c:2030:1: sparse: sparse: symbol 'snd_utimer_ids' was not declared. Should it be static?

sound/core/timer.c:230:12: sparse: sparse: context imbalance in 'check_matching_master_slave' - different lock contexts for basic block sound/core/timer.c:405:9: sparse: sparse: context imbalance in 'remove_slave_links' - wrong count at exit sound/core/timer.c:456:9: sparse: sparse: context imbalance in 'snd_timer_close_locked' - wrong count at exit sound/core/timer.c:492:15: sparse: sparse: context imbalance in 'snd_timer_resolution' - different lock contexts for basic block sound/core/timer.c:541:12: sparse: sparse: context imbalance in 'snd_timer_start1' - wrong count at exit sound/core/timer.c:596:12: sparse: sparse: context imbalance in 'snd_timer_start_slave' - wrong count at exit sound/core/timer.c:616:12: sparse: sparse: context imbalance in 'snd_timer_stop1' - wrong count at exit sound/core/timer.c:673:9: sparse: sparse: context imbalance in 'snd_timer_stop_slave' - wrong count at exit sound/core/timer.c:780:25: sparse: sparse: context imbalance in 'snd_timer_process_callbacks' - unexpected unlock sound/core/timer.c:798:9: sparse: sparse: context imbalance in 'snd_timer_clear_callbacks' - wrong count at exit sound/core/timer.c:806:13: sparse: sparse: context imbalance in 'snd_timer_work' - different lock contexts for basic block sound/core/timer.c:825:6: sparse: sparse: context imbalance in 'snd_timer_interrupt' - different lock contexts for basic block sound/core/timer.c:1049:6: sparse: sparse: context imbalance in 'snd_timer_notify' - different lock contexts for basic block sound/core/timer.c:1323:9: sparse: sparse: context imbalance in 'snd_timer_user_interrupt' - wrong count at exit sound/core/timer.c:1430:12: sparse: sparse: context imbalance in 'realloc_user_queue' - wrong count at exit sound/core/timer.c:1672:12: sparse: sparse: context imbalance in 'snd_timer_user_gstatus' - different lock contexts for basic block sound/core/timer.c:2412:9: sparse: sparse: context imbalance in 'snd_timer_user_poll' - wrong count at exit

vim +/snd_utimer_ids +2030 sound/core/timer.c

2024
2025 #ifdef CONFIG_SND_UTIMER
2026 /*
2027 * Since userspace-driven timers are passed to userspace, we need to have an identifier
2028 * which will allow us to use them (basically, the subdevice number of udriven timer).
2029 */

> 2030	DEFINE_IDA(snd_utimer_ids);

2031

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki