<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/sound/virtio, branch v5.15.210</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.15.210</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.15.210'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-05-02T05:44:35+00:00</updated>
<entry>
<title>sound/virtio: Fix cancel_sync warnings on uninitialized work_structs</title>
<updated>2025-05-02T05:44:35+00:00</updated>
<author>
<name>John Stultz</name>
<email>jstultz@google.com</email>
</author>
<published>2025-01-16T19:40:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e03b10c45c7675b6098190c6e7de1b656d8bcdbe'/>
<id>urn:sha1:e03b10c45c7675b6098190c6e7de1b656d8bcdbe</id>
<content type='text'>
[ Upstream commit 3c7df2e27346eb40a0e86230db1ccab195c97cfe ]

Betty reported hitting the following warning:

[    8.709131][  T221] WARNING: CPU: 2 PID: 221 at kernel/workqueue.c:4182
...
[    8.713282][  T221] Call trace:
[    8.713365][  T221]  __flush_work+0x8d0/0x914
[    8.713468][  T221]  __cancel_work_sync+0xac/0xfc
[    8.713570][  T221]  cancel_work_sync+0x24/0x34
[    8.713667][  T221]  virtsnd_remove+0xa8/0xf8 [virtio_snd ab15f34d0dd772f6d11327e08a81d46dc9c36276]
[    8.713868][  T221]  virtsnd_probe+0x48c/0x664 [virtio_snd ab15f34d0dd772f6d11327e08a81d46dc9c36276]
[    8.714035][  T221]  virtio_dev_probe+0x28c/0x390
[    8.714139][  T221]  really_probe+0x1bc/0x4c8
...

It seems we're hitting the error path in virtsnd_probe(), which
triggers a virtsnd_remove() which iterates over the substreams
calling cancel_work_sync() on the elapsed_period work_struct.

Looking at the code, from earlier in:
virtsnd_probe()-&gt;virtsnd_build_devs()-&gt;virtsnd_pcm_parse_cfg()

We set snd-&gt;nsubstreams, allocate the snd-&gt;substreams, and if
we then hit an error on the info allocation or something in
virtsnd_ctl_query_info() fails, we will exit without having
initialized the elapsed_period work_struct.

When that error path unwinds we then call virtsnd_remove()
which as long as the substreams array is allocated, will iterate
through calling cancel_work_sync() on the uninitialized work
struct hitting this warning.

Takashi Iwai suggested this fix, which initializes the substreams
structure right after allocation, so that if we hit the error
paths we avoid trying to cleanup uninitialized data.

Note: I have not yet managed to reproduce the issue myself, so
this patch has had limited testing.

Feedback or thoughts would be appreciated!

Cc: Anton Yakovlev &lt;anton.yakovlev@opensynergy.com&gt;
Cc: "Michael S. Tsirkin" &lt;mst@redhat.com&gt;
Cc: Jaroslav Kysela &lt;perex@perex.cz&gt;
Cc: Takashi Iwai &lt;tiwai@suse.com&gt;
Cc: virtualization@lists.linux.dev
Cc: linux-sound@vger.kernel.org
Cc: kernel-team@android.com
Reported-by: Betty Zhou &lt;bettyzhou@google.com&gt;
Suggested-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Signed-off-by: John Stultz &lt;jstultz@google.com&gt;
Message-Id: &lt;20250116194114.3375616-1-jstultz@google.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>ALSA: virtio: fix kernel-doc</title>
<updated>2021-04-27T06:39:39+00:00</updated>
<author>
<name>Pierre-Louis Bossart</name>
<email>pierre-louis.bossart@linux.intel.com</email>
</author>
<published>2021-04-26T21:39:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e861431303d23428bf26e8496252d7bee260a956'/>
<id>urn:sha1:e861431303d23428bf26e8496252d7bee260a956</id>
<content type='text'>
make W=1 warning:

sound/virtio/virtio_ctl_msg.c:70: warning: expecting prototype for
virtsnd_ctl_msg_request(). Prototype was for
virtsnd_ctl_msg_response() instead

Signed-off-by: Pierre-Louis Bossart &lt;pierre-louis.bossart@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20210426213902.234711-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: virtio: use module_virtio_driver() to simplify the code</title>
<updated>2021-04-12T10:15:34+00:00</updated>
<author>
<name>Chen Huang</name>
<email>chenhuang5@huawei.com</email>
</author>
<published>2021-04-08T12:54:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d91cbe83d319e8923d36f974d8c9b1e1b56fea62'/>
<id>urn:sha1:d91cbe83d319e8923d36f974d8c9b1e1b56fea62</id>
<content type='text'>
module_virtio_driver() makes the code simpler by eliminating
boilerplate code.

Signed-off-by: Chen Huang &lt;chenhuang5@huawei.com&gt;
Reviewed-by: Anton Yakovlev &lt;anton.yakovlev@opensynergy.com&gt;
Link: https://lore.kernel.org/r/20210408125429.1158703-1-chenhuang5@huawei.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: virtio: introduce device suspend/resume support</title>
<updated>2021-03-07T08:08:39+00:00</updated>
<author>
<name>Anton Yakovlev</name>
<email>anton.yakovlev@opensynergy.com</email>
</author>
<published>2021-03-02T16:47:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=575483e90a3292c2afceb7161732046e411d6fdd'/>
<id>urn:sha1:575483e90a3292c2afceb7161732046e411d6fdd</id>
<content type='text'>
All running PCM substreams are stopped on device suspend and restarted
on device resume.

Signed-off-by: Anton Yakovlev &lt;anton.yakovlev@opensynergy.com&gt;
Link: https://lore.kernel.org/r/20210302164709.3142702-10-anton.yakovlev@opensynergy.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: virtio: introduce PCM channel map support</title>
<updated>2021-03-07T08:08:20+00:00</updated>
<author>
<name>Anton Yakovlev</name>
<email>anton.yakovlev@opensynergy.com</email>
</author>
<published>2021-03-02T16:47:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=19325fedf245ca932c58a629d3888a9a393534ab'/>
<id>urn:sha1:19325fedf245ca932c58a629d3888a9a393534ab</id>
<content type='text'>
Enumerate all available PCM channel maps and create ALSA controls.

Signed-off-by: Anton Yakovlev &lt;anton.yakovlev@opensynergy.com&gt;
Link: https://lore.kernel.org/r/20210302164709.3142702-9-anton.yakovlev@opensynergy.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: virtio: introduce jack support</title>
<updated>2021-03-07T08:08:11+00:00</updated>
<author>
<name>Anton Yakovlev</name>
<email>anton.yakovlev@opensynergy.com</email>
</author>
<published>2021-03-02T16:47:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ca61a41f389c80db091db9d4ad5a651e2b4c9f70'/>
<id>urn:sha1:ca61a41f389c80db091db9d4ad5a651e2b4c9f70</id>
<content type='text'>
Enumerate all available jacks and create ALSA controls.

At the moment jacks have a simple implementation and can only be used
to receive notifications about a plugged in/out device.

Signed-off-by: Anton Yakovlev &lt;anton.yakovlev@opensynergy.com&gt;
Link: https://lore.kernel.org/r/20210302164709.3142702-8-anton.yakovlev@opensynergy.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: virtio: PCM substream operators</title>
<updated>2021-03-07T08:08:03+00:00</updated>
<author>
<name>Anton Yakovlev</name>
<email>anton.yakovlev@opensynergy.com</email>
</author>
<published>2021-03-02T16:47:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=da76e9f3e43a7195c69d370ee514cccae6517c76'/>
<id>urn:sha1:da76e9f3e43a7195c69d370ee514cccae6517c76</id>
<content type='text'>
Introduce the operators required for the operation of substreams.

Signed-off-by: Anton Yakovlev &lt;anton.yakovlev@opensynergy.com&gt;
Link: https://lore.kernel.org/r/20210302164709.3142702-7-anton.yakovlev@opensynergy.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: virtio: handling control and I/O messages for the PCM device</title>
<updated>2021-03-07T08:07:44+00:00</updated>
<author>
<name>Anton Yakovlev</name>
<email>anton.yakovlev@opensynergy.com</email>
</author>
<published>2021-03-02T16:47:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f40a28679e0b7cb3a9cc6627a8dbb40961990f0a'/>
<id>urn:sha1:f40a28679e0b7cb3a9cc6627a8dbb40961990f0a</id>
<content type='text'>
The driver implements a message-based transport for I/O substream
operations. Before the start of the substream, the hardware buffer is
sliced into I/O messages, the number of which is equal to the current
number of periods. The size of each message is equal to the current
size of one period.

I/O messages are organized in an ordered queue. The completion of the
I/O message indicates an elapsed period (the only exception is the end
of the stream for the capture substream). Upon completion, the message
is automatically re-added to the end of the queue.

Signed-off-by: Anton Yakovlev &lt;anton.yakovlev@opensynergy.com&gt;
Link: https://lore.kernel.org/r/20210302164709.3142702-6-anton.yakovlev@opensynergy.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: virtio: build PCM devices and substream hardware descriptors</title>
<updated>2021-03-07T08:07:35+00:00</updated>
<author>
<name>Anton Yakovlev</name>
<email>anton.yakovlev@opensynergy.com</email>
</author>
<published>2021-03-02T16:47:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=29b96bf50ba958eb5f097cdc3fbd4c1acf9547a2'/>
<id>urn:sha1:29b96bf50ba958eb5f097cdc3fbd4c1acf9547a2</id>
<content type='text'>
Like the HDA specification, the virtio sound device specification links
PCM substreams, jacks and PCM channel maps into functional groups. For
each discovered group, a PCM device is created, the number of which
coincides with the group number.

Introduce the module parameters for setting the hardware buffer
parameters:
  pcm_buffer_ms [=160]
  pcm_periods_min [=2]
  pcm_periods_max [=16]
  pcm_period_ms_min [=10]
  pcm_period_ms_max [=80]

Signed-off-by: Anton Yakovlev &lt;anton.yakovlev@opensynergy.com&gt;
Link: https://lore.kernel.org/r/20210302164709.3142702-5-anton.yakovlev@opensynergy.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
<entry>
<title>ALSA: virtio: handling control messages</title>
<updated>2021-03-07T08:07:27+00:00</updated>
<author>
<name>Anton Yakovlev</name>
<email>anton.yakovlev@opensynergy.com</email>
</author>
<published>2021-03-02T16:47:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9d45e514da88ff74fc24ffb34e7d6eb92576440b'/>
<id>urn:sha1:9d45e514da88ff74fc24ffb34e7d6eb92576440b</id>
<content type='text'>
The control queue can be used by different parts of the driver to send
commands to the device. Control messages can be either synchronous or
asynchronous. The lifetime of a message is controlled by a reference
count.

Introduce a module parameter to set the message completion timeout:
  msg_timeout_ms [=1000]

Signed-off-by: Anton Yakovlev &lt;anton.yakovlev@opensynergy.com&gt;
Link: https://lore.kernel.org/r/20210302164709.3142702-4-anton.yakovlev@opensynergy.com
Signed-off-by: Takashi Iwai &lt;tiwai@suse.de&gt;
</content>
</entry>
</feed>
