virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] hwrng: virtio - add an internal buffer
@ 2021-10-28 10:11 Laurent Vivier
  2021-10-28 10:11 ` [PATCH v2 1/4] " Laurent Vivier
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Laurent Vivier @ 2021-10-28 10:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Laurent Vivier, Herbert Xu, amit, Michael S . Tsirkin, rusty,
	virtualization, Alexander Potapenko, linux-crypto, Matt Mackall,
	akong, Dmitriy Vyukov

hwrng core uses two buffers that can be mixed in the virtio-rng queue.

This series fixes the problem by adding an internal buffer in virtio-rng.

Once the internal buffer is added, we can fix two other problems:

- to be able to release the driver without waiting the device releases the
  buffer

- actually returns some data when wait=0 as we can have some already
  available data

It also tries to improve the performance by always having a buffer in
the queue of the device.

v2:
fixes issue reported by syzbot+b86736b5935e0d25b446@syzkaller.appspotmail.com
by reseting data_idx to 0 when the buffer is submitted not when it is
received as the consumer checks for data_avail, not only for the completion.

Laurent Vivier (4):
  hwrng: virtio - add an internal buffer
  hwrng: virtio - don't wait on cleanup
  hwrng: virtio - don't waste entropy
  hwrng: virtio - always add a pending request

 drivers/char/hw_random/virtio-rng.c | 86 ++++++++++++++++++++++-------
 1 file changed, 65 insertions(+), 21 deletions(-)

-- 
2.31.1


_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-08-09 20:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-28 10:11 [PATCH v2 0/4] hwrng: virtio - add an internal buffer Laurent Vivier
2021-10-28 10:11 ` [PATCH v2 1/4] " Laurent Vivier
2021-10-28 10:11 ` [PATCH v2 2/4] hwrng: virtio - don't wait on cleanup Laurent Vivier
2021-10-28 10:11 ` [PATCH v2 3/4] hwrng: virtio - don't waste entropy Laurent Vivier
2021-10-28 10:11 ` [PATCH v2 4/4] hwrng: virtio - always add a pending request Laurent Vivier
     [not found]   ` <7e64ce61-89b1-40aa-8295-00ca42b9a959@arm.com>
     [not found]     ` <2c1198c4-77aa-5cb8-6bb4-b974850651be@arm.com>
2022-08-03 11:39       ` Michael S. Tsirkin
     [not found]         ` <33f0f429-491c-49da-bd2e-bf9f62cb3efb@arm.com>
2022-08-03 12:55           ` Michael S. Tsirkin
     [not found]             ` <a18f9406-fdc5-130b-0460-eb5ad75d8876@arm.com>
2022-08-09 20:16               ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).