All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/12] chardev: refactoring & many bugfixes related tcp_chr_wait_connected
@ 2019-01-15 14:52 Daniel P. Berrangé
  2019-01-15 14:52 ` [Qemu-devel] [PATCH 01/12] chardev: fix validation of options for QMP created chardevs Daniel P. Berrangé
                   ` (12 more replies)
  0 siblings, 13 replies; 40+ messages in thread
From: Daniel P. Berrangé @ 2019-01-15 14:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marc-André Lureau, Thomas Huth, Yongji Xie, Laurent Vivier,
	Paolo Bonzini, Daniel P. Berrangé

This series comes out of a discussion between myself & Yongji Xie in:

  https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg01881.html

I eventually understood that the problem faced was that
tcp_chr_wait_connected was racing with the background connection attempt
previously started, causing two connections to be established. This
broke because some vhost user servers only allow a single connection.

After messing around with the code alot the final solution was in fact
very easy. We simply have to delay the first background connection
attempt until the main loop is running. It will then automatically
turn into a no-op if tcp_chr_wait_connected has been run. This is
dealt with in the last patch in this series

I believe this should solve the problem Yongji Xie faced, and thus not
require us to add support for "nowait" option with client sockets at
all. The reconnect=1 option effectively already implements nowait
semantics, and now plays nicely with tcp_chr_wait_connected.

In investigating this I found various other bugs that needed fixing and
identified some useful refactoring to simplify / clarify the code, hence
this very long series.

This series passes make check-unit & check-qtest (for x86_64 target).

I did a test with tests/vhost-user-bridge too, which was in fact already
broken for the same reason Yongji Xie found - it only accepts a single
connection. This series fixes use of reconnect=1 with vhost-user-bridge.

Despite me not adding new functionality in this series, I think we could
probably do with further unit test cover for the socket chardev backend.
I'll investigate this while waiting for reviews on this series so far.

Daniel P. Berrangé (12):
  chardev: fix validation of options for QMP created chardevs
  chardev: forbid 'reconnect' option with server sockets
  chardev: forbid 'wait' option with client sockets
  chardev: remove many local variables in qemu_chr_parse_socket
  chardev: ensure qemu_chr_parse_compat reports missing driver error
  chardev: remove unused 'sioc' variable & cleanup paths
  chardev: split tcp_chr_wait_connected into two methods
  chardev: split up qmp_chardev_open_socket connection code
  chardev: use a state machine for socket connection state
  chardev: honour the reconnect setting in tcp_chr_wait_connected
  chardev: disallow TLS/telnet/websocket with tcp_chr_wait_connected
  chardev: fix race with client connections in tcp_chr_wait_connected

 chardev/char-socket.c          | 428 +++++++++++++++++++++++----------
 chardev/char.c                 |   2 +
 tests/ivshmem-test.c           |   2 +-
 tests/libqtest.c               |   4 +-
 tests/test-filter-redirector.c |   4 +-
 5 files changed, 303 insertions(+), 137 deletions(-)

-- 
2.20.1

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

end of thread, other threads:[~2019-01-21 21:37 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-15 14:52 [Qemu-devel] [PATCH 00/12] chardev: refactoring & many bugfixes related tcp_chr_wait_connected Daniel P. Berrangé
2019-01-15 14:52 ` [Qemu-devel] [PATCH 01/12] chardev: fix validation of options for QMP created chardevs Daniel P. Berrangé
2019-01-15 19:13   ` Marc-André Lureau
2019-01-16  5:07   ` Thomas Huth
2019-01-16  9:27     ` Daniel P. Berrangé
2019-01-17  9:21       ` Markus Armbruster
2019-01-17 14:13         ` Eric Blake
2019-01-15 14:52 ` [Qemu-devel] [PATCH 02/12] chardev: forbid 'reconnect' option with server sockets Daniel P. Berrangé
2019-01-15 19:13   ` Marc-André Lureau
2019-01-16  5:11   ` Thomas Huth
2019-01-15 14:52 ` [Qemu-devel] [PATCH 03/12] chardev: forbid 'wait' option with client sockets Daniel P. Berrangé
2019-01-15 19:14   ` Marc-André Lureau
2019-01-16  5:17   ` Thomas Huth
2019-01-15 14:52 ` [Qemu-devel] [PATCH 04/12] chardev: remove many local variables in qemu_chr_parse_socket Daniel P. Berrangé
2019-01-15 19:18   ` Marc-André Lureau
2019-01-16  9:33     ` Daniel P. Berrangé
2019-01-15 19:33   ` Eric Blake
2019-01-16  9:31     ` Daniel P. Berrangé
2019-01-15 14:52 ` [Qemu-devel] [PATCH 05/12] chardev: ensure qemu_chr_parse_compat reports missing driver error Daniel P. Berrangé
2019-01-15 19:20   ` Marc-André Lureau
2019-01-15 14:52 ` [Qemu-devel] [PATCH 06/12] chardev: remove unused 'sioc' variable & cleanup paths Daniel P. Berrangé
2019-01-15 19:39   ` Marc-André Lureau
2019-01-16  5:24   ` Thomas Huth
2019-01-16  5:47     ` Peter Xu
2019-01-16  6:01       ` Thomas Huth
2019-01-16  9:34     ` Daniel P. Berrangé
2019-01-15 14:52 ` [Qemu-devel] [PATCH 07/12] chardev: split tcp_chr_wait_connected into two methods Daniel P. Berrangé
2019-01-15 19:44   ` Marc-André Lureau
2019-01-16  9:36     ` Daniel P. Berrangé
2019-01-15 14:52 ` [Qemu-devel] [PATCH 08/12] chardev: split up qmp_chardev_open_socket connection code Daniel P. Berrangé
2019-01-15 21:02   ` Marc-André Lureau
2019-01-15 14:52 ` [Qemu-devel] [PATCH 09/12] chardev: use a state machine for socket connection state Daniel P. Berrangé
2019-01-15 21:05   ` Marc-André Lureau
2019-01-15 14:52 ` [Qemu-devel] [PATCH 10/12] chardev: honour the reconnect setting in tcp_chr_wait_connected Daniel P. Berrangé
2019-01-15 21:22   ` Marc-André Lureau
2019-01-15 14:52 ` [Qemu-devel] [PATCH 11/12] chardev: disallow TLS/telnet/websocket with tcp_chr_wait_connected Daniel P. Berrangé
2019-01-15 21:54   ` Marc-André Lureau
2019-01-16  9:37     ` Daniel P. Berrangé
2019-01-15 14:52 ` [Qemu-devel] [PATCH 12/12] chardev: fix race with client connections in tcp_chr_wait_connected Daniel P. Berrangé
2019-01-21  9:51 ` [Qemu-devel] [PATCH 00/12] chardev: refactoring & many bugfixes related tcp_chr_wait_connected no-reply

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.