<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/char/virtio_console.c, branch linux-4.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-04-20T07:06:43Z</updated>
<entry>
<title>virtio_console: eliminate anonymous module_init &amp; module_exit</title>
<updated>2022-04-20T07:06:43Z</updated>
<author>
<name>Randy Dunlap</name>
</author>
<published>2022-03-16T19:20:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=93e3d88321d2274fa4e26b006e19cc10fec331c2'/>
<id>urn:sha1:93e3d88321d2274fa4e26b006e19cc10fec331c2</id>
<content type='text'>
[ Upstream commit fefb8a2a941338d871e2d83fbd65fbfa068857bd ]

Eliminate anonymous module_init() and module_exit(), which can lead to
confusion or ambiguity when reading System.map, crashes/oops/bugs,
or an initcall_debug log.

Give each of these init and exit functions unique driver-specific
names to eliminate the anonymous names.

Example 1: (System.map)
 ffffffff832fc78c t init
 ffffffff832fc79e t init
 ffffffff832fc8f8 t init

Example 2: (initcall_debug log)
 calling  init+0x0/0x12 @ 1
 initcall init+0x0/0x12 returned 0 after 15 usecs
 calling  init+0x0/0x60 @ 1
 initcall init+0x0/0x60 returned 0 after 2 usecs
 calling  init+0x0/0x9a @ 1
 initcall init+0x0/0x9a returned 0 after 74 usecs

Signed-off-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Reviewed-by: Amit Shah &lt;amit@kernel.org&gt;
Cc: virtualization@lists.linux-foundation.org
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Link: https://lore.kernel.org/r/20220316192010.19001-3-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>virtio_console: break out of buf poll on remove</title>
<updated>2022-04-20T07:06:27Z</updated>
<author>
<name>Michael S. Tsirkin</name>
</author>
<published>2021-10-05T07:04:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c53b9dd3ce53d911c2b4946eed90574c3bee9f22'/>
<id>urn:sha1:c53b9dd3ce53d911c2b4946eed90574c3bee9f22</id>
<content type='text'>
[ Upstream commit 0e7174b9d5877130fec41fb4a16e0c2ee4958d44 ]

A common pattern for device reset is currently:
vdev-&gt;config-&gt;reset(vdev);
.. cleanup ..

reset prevents new interrupts from arriving and waits for interrupt
handlers to finish.

However if - as is common - the handler queues a work request which is
flushed during the cleanup stage, we have code adding buffers / trying
to get buffers while device is reset. Not good.

This was reproduced by running
	modprobe virtio_console
	modprobe -r virtio_console
in a loop.

Fix this up by calling virtio_break_device + flush before reset.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1786239
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>virtio_console: Assure used length from device is limited</title>
<updated>2021-07-20T14:21:14Z</updated>
<author>
<name>Xie Yongji</name>
</author>
<published>2021-05-25T12:56:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9e2b8368b2079437c6840f3303cb0b7bc9b896ee'/>
<id>urn:sha1:9e2b8368b2079437c6840f3303cb0b7bc9b896ee</id>
<content type='text'>
[ Upstream commit d00d8da5869a2608e97cfede094dfc5e11462a46 ]

The buf-&gt;len might come from an untrusted device. This
ensures the value would not exceed the size of the buffer
to avoid data corruption or loss.

Signed-off-by: Xie Yongji &lt;xieyongji@bytedance.com&gt;
Acked-by: Jason Wang &lt;jasowang@redhat.com&gt;
Link: https://lore.kernel.org/r/20210525125622.1203-1-xieyongji@bytedance.com
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>virtio: virtio_console: add missing MODULE_DEVICE_TABLE() for rproc serial</title>
<updated>2020-07-22T07:10:53Z</updated>
<author>
<name>Alexander Lobakin</name>
</author>
<published>2020-06-23T11:09:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ea7d91c63d57950129ba5d58f3c9458b7f387680'/>
<id>urn:sha1:ea7d91c63d57950129ba5d58f3c9458b7f387680</id>
<content type='text'>
commit 897c44f0bae574c5fb318c759b060bebf9dd6013 upstream.

rproc_serial_id_table lacks an exposure to module devicetable, so
when remoteproc firmware requests VIRTIO_ID_RPROC_SERIAL, no uevent
is generated and no module autoloading occurs.
Add missing MODULE_DEVICE_TABLE() annotation and move the existing
one for VIRTIO_ID_CONSOLE right to the table itself.

Fixes: 1b6370463e88 ("virtio_console: Add support for remoteproc serial")
Cc: &lt;stable@vger.kernel.org&gt; # v3.8+
Signed-off-by: Alexander Lobakin &lt;alobakin@pm.me&gt;
Reviewed-by: Amit Shah &lt;amit@kernel.org&gt;
Link: https://lore.kernel.org/r/x7C_CbeJtoGMy258nwAXASYz3xgFMFpyzmUvOyZzRnQrgWCREBjaqBOpAUS7ol4NnZYvSVwmTsCG0Ohyfvta-ygw6HMHcoeKK0C3QFiAO_Q=@pm.me
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>virtio_console: move removal code</title>
<updated>2019-11-28T17:29:05Z</updated>
<author>
<name>Michael S. Tsirkin</name>
</author>
<published>2018-04-20T17:51:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f79198530d65175c01b828d8613297686df23f2c'/>
<id>urn:sha1:f79198530d65175c01b828d8613297686df23f2c</id>
<content type='text'>
[ Upstream commit aa44ec867030a72e8aa127977e37dec551d8df19 ]

Will make it reusable for error handling.

Cc: stable@vger.kernel.org
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>virtio_console: drop custom control queue cleanup</title>
<updated>2019-11-28T17:29:04Z</updated>
<author>
<name>Michael S. Tsirkin</name>
</author>
<published>2018-04-20T17:49:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=083aae5aecf5c60f9d2be12d9d60fec86d214b39'/>
<id>urn:sha1:083aae5aecf5c60f9d2be12d9d60fec86d214b39</id>
<content type='text'>
[ Upstream commit 61a8950c5c5708cf2068b29ffde94e454e528208 ]

We now cleanup all VQs on device removal - no need
to handle the control VQ specially.

Cc: stable@vger.kernel.org
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>virtio_console: fix uninitialized variable use</title>
<updated>2019-11-28T17:29:04Z</updated>
<author>
<name>Michael S. Tsirkin</name>
</author>
<published>2017-03-29T20:22:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=20e9c1101260dfbe3e169a259591408ccab61c22'/>
<id>urn:sha1:20e9c1101260dfbe3e169a259591408ccab61c22</id>
<content type='text'>
[ Upstream commit 2055997f983c6db7b5c3940ce5f8f822657d5bc3 ]

We try to disable callbacks on c_ivq even without multiport
even though that vq is not initialized in this configuration.

Fixes: c743d09dbd01 ("virtio: console: Disable callbacks for virtqueues at start of S4 freeze")
Suggested-by: Mike Galbraith &lt;efault@gmx.de&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>virtio_console: allocate inbufs in add_port() only if it is needed</title>
<updated>2019-11-28T17:29:04Z</updated>
<author>
<name>Laurent Vivier</name>
</author>
<published>2019-11-14T12:25:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=55b15b9aac90bbe6dafbd732a813ba9afc85cfcc'/>
<id>urn:sha1:55b15b9aac90bbe6dafbd732a813ba9afc85cfcc</id>
<content type='text'>
[ Upstream commit d791cfcbf98191122af70b053a21075cb450d119 ]

When we hot unplug a virtserialport and then try to hot plug again,
it fails:

(qemu) chardev-add socket,id=serial0,path=/tmp/serial0,server,nowait
(qemu) device_add virtserialport,bus=virtio-serial0.0,nr=2,\
                  chardev=serial0,id=serial0,name=serial0
(qemu) device_del serial0
(qemu) device_add virtserialport,bus=virtio-serial0.0,nr=2,\
                  chardev=serial0,id=serial0,name=serial0
kernel error:
  virtio-ports vport2p2: Error allocating inbufs
qemu error:
  virtio-serial-bus: Guest failure in adding port 2 for device \
                     virtio-serial0.0

This happens because buffers for the in_vq are allocated when the port is
added but are not released when the port is unplugged.

They are only released when virtconsole is removed (see a7a69ec0d8e4)

To avoid the problem and to be symmetric, we could allocate all the buffers
in init_vqs() as they are released in remove_vqs(), but it sounds like
a waste of memory.

Rather than that, this patch changes add_port() logic to ignore ENOSPC
error in fill_queue(), which means queue has already been filled.

Fixes: a7a69ec0d8e4 ("virtio_console: free buffers after reset")
Cc: mst@redhat.com
Cc: stable@vger.kernel.org
Signed-off-by: Laurent Vivier &lt;lvivier@redhat.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>virtio_console: don't tie bufs to a vq</title>
<updated>2019-11-28T17:29:04Z</updated>
<author>
<name>Michael S. Tsirkin</name>
</author>
<published>2018-04-20T16:54:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d811bffe7e5358712de7c40d1a712a62dd5451f3'/>
<id>urn:sha1:d811bffe7e5358712de7c40d1a712a62dd5451f3</id>
<content type='text'>
[ Upstream commit 2855b33514d290c51d52d94e25d3ef942cd4d578 ]

an allocated buffer doesn't need to be tied to a vq -
only vq-&gt;vdev is ever used. Pass the function the
just what it needs - the vdev.

Cc: stable@vger.kernel.org
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>virtio_console: reset on out of memory</title>
<updated>2019-11-28T17:29:04Z</updated>
<author>
<name>Michael S. Tsirkin</name>
</author>
<published>2018-04-20T18:00:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8688e0d2018a4b1161c1c679a4fd4ce83a3265e0'/>
<id>urn:sha1:8688e0d2018a4b1161c1c679a4fd4ce83a3265e0</id>
<content type='text'>
[ Upstream commit 5c60300d68da32ca77f7f978039dc72bfc78b06b ]

When out of memory and we can't add ctrl vq buffers,
probe fails. Unfortunately the error handling is
out of spec: it calls del_vqs without bothering
to reset the device first.

To fix, call the full cleanup function in this case.

Cc: stable@vger.kernel.org
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
</feed>
