Skip to contentSkip to conversation

RFC: net/slirp: link with libslirp

PATCH In review Marc-André Lureau 6 participants 11 messages Feb 8, 2019 – Feb 12, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RFC: net/slirp: link with libslirp

Once libslirp has received its first release, we can link with the external libslirp library.

The migration data should be compatible with current and older qemu versions (same compatibility as today). See "slirp: add state saving/loading" patch. However, the content should be treated as a blob, as the format may change eventually in the future.

---
 include/migration/qemu-file-types.h |    2 +
 migration/qemu-file.h               |    1 -
 slirp/bootp.h                       |  128 ---
 slirp/debug.h                       |   48 -
 slirp/dhcpv6.h                      |   25 -
 slirp/if.h                          |   23 -
 slirp/ip.h                          |  241 -----
 slirp/ip6.h                         |  159 ---
 slirp/ip6_icmp.h                    |  231 ----
 slirp/ip_icmp.h                     |  165 ---
 slirp/libslirp.h                    |  107 --
 slirp/main.h                        |   18 -
 slirp/mbuf.h                        |  126 ---
 slirp/misc.h                        |   68 --
 slirp/ncsi-pkt.h                    |  419 --------
 slirp/qtailq.h                      |  193 ----
 slirp/sbuf.h                        |   29 -
 slirp/slirp.h                       |  274 -----
 slirp/socket.h                      |  162 ---
 slirp/state.h                       |    9 -
 slirp/tcp.h                         |  180 ----
 slirp/tcp_timer.h                   |  127 ---
 slirp/tcp_var.h                     |  161 ---
 slirp/tcpip.h                       |  101 --
 slirp/tftp.h                        |   51 -
 slirp/udp.h                         |   91 --
 slirp/util.h                        |  127 ---
 net/slirp.c                         |   48 +-
 slirp/arp_table.c                   |   91 --
 slirp/bootp.c                       |  370 -------
 slirp/cksum.c                       |  160 ---
 slirp/dhcpv6.c                      |  206 ----
 slirp/dnssearch.c                   |  310 ------
 slirp/if.c                          |  220 ----
 slirp/ip6_icmp.c                    |  437 --------
 slirp/ip6_input.c                   |   77 --
 slirp/ip6_output.c                  |   38 -
 slirp/ip_icmp.c                     |  469 --------
 slirp/ip_input.c                    |  471 --------
 slirp/ip_output.c                   |  172 ---
 slirp/mbuf.c                        |  237 ----
 slirp/misc.c                        |  320 ------
 slirp/ncsi.c                        |  166 ---
 slirp/ndp_table.c                   |   86 --
 slirp/sbuf.c                        |  188 ----
 slirp/slirp.c                       | 1121 -------------------
 slirp/socket.c                      |  935 ----------------
 slirp/state.c                       |  394 -------
 slirp/tcp_input.c                   | 1554 ---------------------------
 slirp/tcp_output.c                  |  524 ---------
 slirp/tcp_subr.c                    |  985 -----------------
 slirp/tcp_timer.c                   |  293 -----
 slirp/tftp.c                        |  462 --------
 slirp/udp.c                         |  361 -------
 slirp/udp6.c                        |  172 ---
 slirp/util.c                        |  207 ----
 util/main-loop.c                    |    2 -
 vl.c                                |    2 -
 MAINTAINERS                         |    1 -
 Makefile.objs                       |    1 -
 configure                           |   25 +
 net/Makefile.objs                   |    2 +
 slirp/COPYRIGHT                     |   61 --
 slirp/Makefile.objs                 |   34 -
 util/Makefile.objs                  |    1 +
 65 files changed, 76 insertions(+), 14393 deletions(-)
 delete mode 100644 slirp/bootp.h
 delete mode 100644 slirp/debug.h
 delete mode 100644 slirp/dhcpv6.h
 delete mode 100644 slirp/if.h
 delete mode 100644 slirp/ip.h
 delete mode 100644 slirp/ip6.h
 delete mode 100644 slirp/ip6_icmp.h
 delete mode 100644 slirp/ip_icmp.h
 delete mode 100644 slirp/libslirp.h
 delete mode 100644 slirp/main.h
 delete mode 100644 slirp/mbuf.h
 delete mode 100644 slirp/misc.h
 delete mode 100644 slirp/ncsi-pkt.h
 delete mode 100644 slirp/qtailq.h
 delete mode 100644 slirp/sbuf.h
 delete mode 100644 slirp/slirp.h
 delete mode 100644 slirp/socket.h
 delete mode 100644 slirp/state.h
 delete mode 100644 slirp/tcp.h
 delete mode 100644 slirp/tcp_timer.h
 delete mode 100644 slirp/tcp_var.h
 delete mode 100644 slirp/tcpip.h
 delete mode 100644 slirp/tftp.h
 delete mode 100644 slirp/udp.h
 delete mode 100644 slirp/util.h
 delete mode 100644 slirp/arp_table.c
 delete mode 100644 slirp/bootp.c
 delete mode 100644 slirp/cksum.c
 delete mode 100644 slirp/dhcpv6.c
 delete mode 100644 slirp/dnssearch.c
 delete mode 100644 slirp/if.c
 delete mode 100644 slirp/ip6_icmp.c
 delete mode 100644 slirp/ip6_input.c
 delete mode 100644 slirp/ip6_output.c
 delete mode 100644 slirp/ip_icmp.c
 delete mode 100644 slirp/ip_input.c
 delete mode 100644 slirp/ip_output.c
 delete mode 100644 slirp/mbuf.c
 delete mode 100644 slirp/misc.c
 delete mode 100644 slirp/ncsi.c
 delete mode 100644 slirp/ndp_table.c
 delete mode 100644 slirp/sbuf.c
 delete mode 100644 slirp/slirp.c
 delete mode 100644 slirp/socket.c
 delete mode 100644 slirp/state.c
 delete mode 100644 slirp/tcp_input.c
 delete mode 100644 slirp/tcp_output.c
 delete mode 100644 slirp/tcp_subr.c
 delete mode 100644 slirp/tcp_timer.c
 delete mode 100644 slirp/tftp.c
 delete mode 100644 slirp/udp.c
 delete mode 100644 slirp/udp6.c
 delete mode 100644 slirp/util.c
 delete mode 100644 slirp/COPYRIGHT
 delete mode 100644 slirp/Makefile.objs
include/migration/qemu-file-types.h +2 -0
index bd6d7dd7f9..bbe04d4484 100644
@@ -25,6 +25,8 @@
 #ifndef QEMU_FILE_H
 #define QEMU_FILE_H
 
+int qemu_file_get_error(QEMUFile *f);
+
 void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, size_t size);
 void qemu_put_byte(QEMUFile *f, int v);
 
migration/qemu-file.h +0 -1
index 2ccfcfb2a8..13baf896bd 100644
@@ -149,7 +149,6 @@ void qemu_update_position(QEMUFile *f, size_t size);
 void qemu_file_reset_rate_limit(QEMUFile *f);
 void qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate);
 int64_t qemu_file_get_rate_limit(QEMUFile *f);
-int qemu_file_get_error(QEMUFile *f);
 void qemu_file_set_error(QEMUFile *f, int ret);
 int qemu_file_shutdown(QEMUFile *f);
 QEMUFile *qemu_file_get_return_path(QEMUFile *f);
slirp/bootp.h deleted +0 -128

128 lines not on this page · raw message

slirp/debug.h deleted +0 -48

48 lines not on this page · raw message

slirp/dhcpv6.h deleted +0 -25
deleted file mode 100644
index 3373f6cb89..0000000000
@@ -1,25 +0,0 @@
-/*
- * Definitions and prototypes for SLIRP stateless DHCPv6
- *
- * Copyright 2016 Thomas Huth, Red Hat Inc.
- *
- * This work is licensed under the terms of the GNU GPL, version 2
- * or later. See the COPYING file in the top-level directory.
- */
-#ifndef SLIRP_DHCPV6_H
-#define SLIRP_DHCPV6_H
-
-#define DHCPV6_SERVER_PORT 547
-
-#define ALLDHCP_MULTICAST { .s6_addr = \
-                            { 0xff, 0x02, 0x00, 0x00,\
-                            0x00, 0x00, 0x00, 0x00,\
-                            0x00, 0x00, 0x00, 0x00,\
-                            0x00, 0x01, 0x00, 0x02 } }
-
-#define in6_dhcp_multicast(a)\
-    in6_equal(a, &(struct in6_addr)ALLDHCP_MULTICAST)
-
-void dhcpv6_input(struct sockaddr_in6 *srcsas, struct mbuf *m);
-
-#endif
slirp/if.h deleted +0 -23
deleted file mode 100644
index 69569c10df..0000000000
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
- */
-
-#ifndef IF_H
-#define IF_H
-
-#define IF_COMPRESS	0x01	/* We want compression */
-#define IF_NOCOMPRESS	0x02	/* Do not do compression */
-#define IF_AUTOCOMP	0x04	/* Autodetect (default) */
-#define IF_NOCIDCOMP	0x08	/* CID compression */
-
-#define IF_MTU 1500
-#define IF_MRU 1500
-#define	IF_COMP IF_AUTOCOMP	/* Flags for compression */
-
-/* 2 for alignment, 14 for ethernet */
-#define IF_MAXLINKHDR (2 + ETH_HLEN)
-
-#endif
slirp/ip.h deleted +0 -241

241 lines not on this page · raw message

slirp/ip6.h deleted +0 -159

159 lines not on this page · raw message

slirp/ip6_icmp.h deleted +0 -231

231 lines not on this page · raw message

slirp/ip_icmp.h deleted +0 -165

165 lines not on this page · raw message

slirp/libslirp.h deleted +0 -107

107 lines not on this page · raw message

slirp/main.h deleted +0 -18
deleted file mode 100644
index f11d4572b7..0000000000
@@ -1,18 +0,0 @@
-/*
- * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
- */
-
-#ifndef SLIRP_MAIN_H
-#define SLIRP_MAIN_H
-
-extern unsigned curtime;
-extern struct in_addr loopback_addr;
-extern unsigned long loopback_mask;
-
-int if_encap(Slirp *slirp, struct mbuf *ifm);
-ssize_t slirp_send(struct socket *so, const void *buf, size_t len, int flags);
-
-#endif
slirp/mbuf.h deleted +0 -126

126 lines not on this page · raw message

slirp/misc.h deleted +0 -68

68 lines not on this page · raw message

slirp/ncsi-pkt.h deleted +0 -419

419 lines not on this page · raw message

slirp/qtailq.h deleted +0 -193

193 lines not on this page · raw message

slirp/sbuf.h deleted +0 -29
deleted file mode 100644
index 1cb9a42834..0000000000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
- */
-
-#ifndef SBUF_H
-#define SBUF_H
-
-#define sbspace(sb) ((sb)->sb_datalen - (sb)->sb_cc)
-
-struct sbuf {
-	uint32_t sb_cc;		/* actual chars in buffer */
-	uint32_t sb_datalen;	/* Length of data  */
-	char	*sb_wptr;	/* write pointer. points to where the next
-				 * bytes should be written in the sbuf */
-	char	*sb_rptr;	/* read pointer. points to where the next
-				 * byte should be read from the sbuf */
-	char	*sb_data;	/* Actual data */
-};
-
-void sbfree(struct sbuf *);
-bool sbdrop(struct sbuf *, int);
-void sbreserve(struct sbuf *, int);
-void sbappend(struct socket *, struct mbuf *);
-void sbcopy(struct sbuf *, int, int, char *);
-
-#endif
slirp/slirp.h deleted +0 -274

274 lines not on this page · raw message

slirp/socket.h deleted +0 -162

162 lines not on this page · raw message

slirp/state.h deleted +0 -9
deleted file mode 100644
index 154866898f..0000000000
@@ -1,9 +0,0 @@
-#ifndef SLIRP_STATE_H_
-#define SLIRP_STATE_H_
-
-#include "libslirp.h"
-
-void slirp_state_register(Slirp *slirp);
-void slirp_state_unregister(Slirp *slirp);
-
-#endif /* SLIRP_STATE_H_ */
slirp/tcp.h deleted +0 -180

180 lines not on this page · raw message

slirp/tcp_timer.h deleted +0 -127

127 lines not on this page · raw message

slirp/tcp_var.h deleted +0 -161

161 lines not on this page · raw message

slirp/tcpip.h deleted +0 -101

92 lines not on this page · raw message

slirp/tftp.h deleted +0 -51

51 lines not on this page · raw message

slirp/udp.h deleted +0 -91

91 lines not on this page · raw message

slirp/util.h deleted +0 -127

127 lines not on this page · raw message

net/slirp.c +46 -2

48 lines not on this page · raw message

slirp/arp_table.c deleted +0 -91

91 lines not on this page · raw message

slirp/bootp.c deleted +0 -370

370 lines not on this page · raw message

slirp/cksum.c deleted +0 -160

160 lines not on this page · raw message

slirp/dhcpv6.c deleted +0 -206

206 lines not on this page · raw message

slirp/dnssearch.c deleted +0 -310

310 lines not on this page · raw message

slirp/if.c deleted +0 -220

220 lines not on this page · raw message

slirp/ip6_icmp.c deleted +0 -437

437 lines not on this page · raw message

slirp/ip6_input.c deleted +0 -77

77 lines not on this page · raw message

slirp/ip6_output.c deleted +0 -38
deleted file mode 100644
index 19d1ae7748..0000000000

Lines of this file are not shown. View the raw message.

slirp/ip_icmp.c deleted +0 -469

469 lines not on this page · raw message

slirp/ip_input.c deleted +0 -471

471 lines not on this page · raw message

slirp/ip_output.c deleted +0 -172

172 lines not on this page · raw message

slirp/mbuf.c deleted +0 -237

237 lines not on this page · raw message

slirp/misc.c deleted +0 -320

320 lines not on this page · raw message

slirp/ncsi.c deleted +0 -166

166 lines not on this page · raw message

slirp/ndp_table.c deleted +0 -86

86 lines not on this page · raw message

slirp/sbuf.c deleted +0 -188

188 lines not on this page · raw message

slirp/slirp.c deleted +0 -1121

1,121 lines not on this page · raw message

slirp/socket.c deleted +0 -935

935 lines not on this page · raw message

slirp/state.c deleted +0 -394

394 lines not on this page · raw message

slirp/tcp_input.c deleted +0 -1554

1,554 lines not on this page · raw message

slirp/tcp_output.c deleted +0 -524

524 lines not on this page · raw message

slirp/tcp_subr.c deleted +0 -985

985 lines not on this page · raw message

slirp/tcp_timer.c deleted +0 -293

293 lines not on this page · raw message

slirp/tftp.c deleted +0 -462

462 lines not on this page · raw message

slirp/udp.c deleted +0 -361

361 lines not on this page · raw message

slirp/udp6.c deleted +0 -172

172 lines not on this page · raw message

slirp/util.c deleted +0 -207

207 lines not on this page · raw message

util/main-loop.c +0 -2
index d4a521caeb..e1e349ca5c 100644

Lines of this file are not shown. View the raw message.

vl.c +0 -2
index 9e4dba7f92..721bd00946 100644

Lines of this file are not shown. View the raw message.

MAINTAINERS +0 -1
index 9a76845581..6af36057c8 100644

Lines of this file are not shown. View the raw message.

Makefile.objs +0 -1
index b7aae33367..90a7edeb4b 100644

Lines of this file are not shown. View the raw message.

configure +25 -0
index fbd0825488..ec6c3f3df8 100755

Lines of this file are not shown. View the raw message.

net/Makefile.objs +2 -0
index b2bf88a0ef..7282c57c94 100644

Lines of this file are not shown. View the raw message.

slirp/COPYRIGHT deleted +0 -61

61 lines not on this page · raw message

slirp/Makefile.objs deleted +0 -34
deleted file mode 100644
index 88340a583b..0000000000

Lines of this file are not shown. View the raw message.

util/Makefile.objs +1 -0
index 0820923c18..d67a31452f 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.21.0.rc0.1.g036caf7885

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 2 lines · Marc-André Lureau

Once libslirp has received its first release, we can link with the external libslirp library.

Is there a scheduled date?

Quoted 65 lines

The migration data should be compatible with current and older qemu versions (same compatibility as today). See "slirp: add state saving/loading" patch. However, the content should be treated as a blob, as the format may change eventually in the future.

---
 include/migration/qemu-file-types.h |    2 +
 migration/qemu-file.h               |    1 -
 slirp/bootp.h                       |  128 ---
 slirp/debug.h                       |   48 -
 slirp/dhcpv6.h                      |   25 -
 slirp/if.h                          |   23 -
 slirp/ip.h                          |  241 -----
 slirp/ip6.h                         |  159 ---
 slirp/ip6_icmp.h                    |  231 ----
 slirp/ip_icmp.h                     |  165 ---
 slirp/libslirp.h                    |  107 --
 slirp/main.h                        |   18 -
 slirp/mbuf.h                        |  126 ---
 slirp/misc.h                        |   68 --
 slirp/ncsi-pkt.h                    |  419 --------
 slirp/qtailq.h                      |  193 ----
 slirp/sbuf.h                        |   29 -
 slirp/slirp.h                       |  274 -----
 slirp/socket.h                      |  162 ---
 slirp/state.h                       |    9 -
 slirp/tcp.h                         |  180 ----
 slirp/tcp_timer.h                   |  127 ---
 slirp/tcp_var.h                     |  161 ---
 slirp/tcpip.h                       |  101 --
 slirp/tftp.h                        |   51 -
 slirp/udp.h                         |   91 --
 slirp/util.h                        |  127 ---
 net/slirp.c                         |   48 +-
 slirp/arp_table.c                   |   91 --
 slirp/bootp.c                       |  370 -------
 slirp/cksum.c                       |  160 ---
 slirp/dhcpv6.c                      |  206 ----
 slirp/dnssearch.c                   |  310 ------
 slirp/if.c                          |  220 ----
 slirp/ip6_icmp.c                    |  437 --------
 slirp/ip6_input.c                   |   77 --
 slirp/ip6_output.c                  |   38 -
 slirp/ip_icmp.c                     |  469 --------
 slirp/ip_input.c                    |  471 --------
 slirp/ip_output.c                   |  172 ---
 slirp/mbuf.c                        |  237 ----
 slirp/misc.c                        |  320 ------
 slirp/ncsi.c                        |  166 ---
 slirp/ndp_table.c                   |   86 --
 slirp/sbuf.c                        |  188 ----
 slirp/slirp.c                       | 1121 -------------------
 slirp/socket.c                      |  935 ----------------
 slirp/state.c                       |  394 -------
 slirp/tcp_input.c                   | 1554 ---------------------------
 slirp/tcp_output.c                  |  524 ---------
 slirp/tcp_subr.c                    |  985 -----------------
 slirp/tcp_timer.c                   |  293 -----
 slirp/tftp.c                        |  462 --------
 slirp/udp.c                         |  361 -------
 slirp/udp6.c                        |  172 ---
 slirp/util.c                        |  207 ----
 util/main-loop.c                    |    2 -
 vl.c                                |    2 -
Quoted 8 lines
 MAINTAINERS                         |    1 -
 Makefile.objs                       |    1 -
 configure                           |   25 +
 net/Makefile.objs                   |    2 +
 slirp/COPYRIGHT                     |   61 --
 slirp/Makefile.objs                 |   34 -
 util/Makefile.objs                  |    1 +
 65 files changed, 76 insertions(+), 14393 deletions(-)

Nice...

Reviewed-by on v1 1/1
#2 lore raw
In reply to Marc-André Lureau

Marc-André Lureau, le ven. 08 févr. 2019 19:12:26 +0100, a ecrit:

Quoted 9 lines

Once libslirp has received its first release, we can link with the external libslirp library.

The migration data should be compatible with current and older qemu versions (same compatibility as today). See "slirp: add state saving/loading" patch. However, the content should be treated as a blob, as the format may change eventually in the future.

Thanks so much for all this work :)

#3 lore raw
In reply to Marc-André Lureau
Quoted 8 lines · Marc-André Lureau

Once libslirp has received its first release, we can link with the external libslirp library.

The migration data should be compatible with current and older qemu versions (same compatibility as today). See "slirp: add state saving/loading" patch. However, the content should be treated as a blob, as the format may change eventually in the future.

Could you elaborate a bit on what you mean by "the format might change" ? It's not clear to me what libslirp's API/ABI guarantees are here to ensure that QEMU can retain cross-QEMU-version migration compatibility and that QEMU version X with libslirp version Y can migrate both to and from QEMU version X with libslirp version Z.

thanks
-- PMM

#4 lore raw

Hi

Quoted 12 lines · Peter Maydell
Quoted 8 lines · Marc-André Lureau

Once libslirp has received its first release, we can link with the external libslirp library.

The migration data should be compatible with current and older qemu versions (same compatibility as today). See "slirp: add state saving/loading" patch. However, the content should be treated as a blob, as the format may change eventually in the future.

Quoted 6 lines

Could you elaborate a bit on what you mean by "the format might change" ? It's not clear to me what libslirp's API/ABI guarantees are here to ensure that QEMU can retain cross-QEMU-version migration compatibility and that QEMU version X with libslirp version Y can migrate both to and from QEMU version X with libslirp version Z.

So far, the migration code should be 1:1 with existing qemu code. It's tricky to tell the compatibility on existing code, but the saved bitstream version_id is 4, and it can load some older versions (I am not sure all the way down to original migration code).

QEMU bitstream version shouldn't be relevant here, as qemu will get and provide a binary blob.

libslirp should aim at keeping compatibility with its own older bitstreams. A newer version will fail to be read with a library that doesn't support it.

Does that sound correct?

thanks

#5 lore raw
In reply to Marc-André Lureau
Quoted 7 lines · Marc-André Lureau

Once libslirp has received its first release, we can link with the external libslirp library.

The migration data should be compatible with current and older qemu versions (same compatibility as today). See "slirp: add state saving/loading" patch. However, the content should be treated as a blob, as the format may change eventually in the future.

How are we going to manage live migration compat if libslirp changes the blob content ?

Bear in mind that we need to support all existing QEMU releases live migrating to effectively all future QEMU releases, with all future libslirp releases, in *both* directions. ie arbitrarily newer libslirp needs to be able to emit a blob format that can be read by arbitrarily older slirp inside QEMU.

Normally we tie data format changes to the machine type. How are we going to achieve such machine type associations with an external libslirp ?

It seems to me that if a libslirp wants to change live migration format, it will need to support both the old and new formats indefinitely, and the new format must be an opt-in. QEMU can then tell libslirp which migraiton format based on the machine type.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#6 lore raw

Hi

Quoted 10 lines · Daniel P. Berrangé
Quoted 7 lines · Marc-André Lureau

Once libslirp has received its first release, we can link with the external libslirp library.

The migration data should be compatible with current and older qemu versions (same compatibility as today). See "slirp: add state saving/loading" patch. However, the content should be treated as a blob, as the format may change eventually in the future.

Quoted 8 lines

How are we going to manage live migration compat if libslirp changes the blob content ?

Bear in mind that we need to support all existing QEMU releases live migrating to effectively all future QEMU releases, with all future libslirp releases, in *both* directions. ie arbitrarily newer libslirp needs to be able to emit a blob format that can be read by arbitrarily older slirp inside QEMU.

Right, this is all supported currently with the proposed patch set, since it is effectively the same code.

So register_savevm_live() get passed slirp_state_version() (currently == 4)

& slirp_state_load() get the version_id from QEMU.

Quoted 4 lines

Normally we tie data format changes to the machine type. How are we going to achieve such machine type associations with an external libslirp ?

Is this relevant for slirp? I don't see any version tied to machine type. Am I missing something?

thanks

Quoted 8 lines

It seems to me that if a libslirp wants to change live migration format, it will need to support both the old and new formats indefinitely, and the new format must be an opt-in. QEMU can then tell libslirp which migraiton format based on the machine type.

ok

Quoted 7 lines

Regards,
Daniel
--

|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#7 lore raw
Quoted 31 lines · Marc-André Lureau

Hi

Quoted 10 lines · Daniel P. Berrangé
Quoted 7 lines · Marc-André Lureau

Once libslirp has received its first release, we can link with the external libslirp library.

The migration data should be compatible with current and older qemu versions (same compatibility as today). See "slirp: add state saving/loading" patch. However, the content should be treated as a blob, as the format may change eventually in the future.

Quoted 8 lines

How are we going to manage live migration compat if libslirp changes the blob content ?

Bear in mind that we need to support all existing QEMU releases live migrating to effectively all future QEMU releases, with all future libslirp releases, in *both* directions. ie arbitrarily newer libslirp needs to be able to emit a blob format that can be read by arbitrarily older slirp inside QEMU.

Right, this is all supported currently with the proposed patch set, since it is effectively the same code.

So register_savevm_live() get passed slirp_state_version() (currently == 4)

& slirp_state_load() get the version_id from QEMU.

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

Normally we tie data format changes to the machine type. How are we going to achieve such machine type associations with an external libslirp ?

Is this relevant for slirp? I don't see any version tied to machine type. Am I missing something?

Old to new would work provided new slirp can read & understand all previous slirp state versions. It is entirely possible no one ever tested new -> old live migration with slirp. I doubt we would have tested it in RHEL, since we don't really care very much about slirp in context of migration.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#8 lore raw
In reply to Marc-André Lureau

Marc-André Lureau, le lun. 11 févr. 2019 12:34:47 +0100, a ecrit:

Quoted 20 lines · Daniel P. Berrangé
Quoted 10 lines · Marc-André Lureau
Quoted 7 lines

Once libslirp has received its first release, we can link with the external libslirp library.

The migration data should be compatible with current and older qemu versions (same compatibility as today). See "slirp: add state saving/loading" patch. However, the content should be treated as a blob, as the format may change eventually in the future.

Quoted 8 lines

How are we going to manage live migration compat if libslirp changes the blob content ?

Bear in mind that we need to support all existing QEMU releases live migrating to effectively all future QEMU releases, with all future libslirp releases, in *both* directions. ie arbitrarily newer libslirp needs to be able to emit a blob format that can be read by arbitrarily older slirp inside QEMU.

Quoted 6 lines

Right, this is all supported currently with the proposed patch set, since it is effectively the same code.

So register_savevm_live() get passed slirp_state_version() (currently == 4)

& slirp_state_load() get the version_id from QEMU.

Mmm, but do we guarantee that the current version of slirp will be able to read blobs produced by future versions of slirp?

Future extensions of the format would have to be so that the current version could discard their content without issues.

Perhaps qemu should actually explicitly pass 4 to register_savevm_live(), for that function to only record that format (and thus get compatibility of course) and only bump to greater values when qemu is modified to make use of a functionality which requires extending the blob format, which then makes it unreadable by older qemu releases, but that is fine for qemu.

Samuel

#9 lore raw
Quoted 34 lines · Samuel Thibault

Marc-André Lureau, le lun. 11 févr. 2019 12:34:47 +0100, a ecrit:

Quoted 20 lines · Daniel P. Berrangé
Quoted 10 lines · Marc-André Lureau
Quoted 7 lines

Once libslirp has received its first release, we can link with the external libslirp library.

The migration data should be compatible with current and older qemu versions (same compatibility as today). See "slirp: add state saving/loading" patch. However, the content should be treated as a blob, as the format may change eventually in the future.

Quoted 8 lines

How are we going to manage live migration compat if libslirp changes the blob content ?

Bear in mind that we need to support all existing QEMU releases live migrating to effectively all future QEMU releases, with all future libslirp releases, in *both* directions. ie arbitrarily newer libslirp needs to be able to emit a blob format that can be read by arbitrarily older slirp inside QEMU.

Quoted 6 lines

Right, this is all supported currently with the proposed patch set, since it is effectively the same code.

So register_savevm_live() get passed slirp_state_version() (currently == 4)

& slirp_state_load() get the version_id from QEMU.

Mmm, but do we guarantee that the current version of slirp will be able to read blobs produced by future versions of slirp?

Future extensions of the format would have to be so that the current version could discard their content without issues.

Quoted 6 lines

Perhaps qemu should actually explicitly pass 4 to register_savevm_live(), for that function to only record that format (and thus get compatibility of course) and only bump to greater values when qemu is modified to make use of a functionality which requires extending the blob format, which then makes it unreadable by older qemu releases, but that is fine for qemu.

If QEMU wants to make use of functionality that requires the new blob format, it would have to restrict that based on machine type. That way it can ensure full compatibility with old QEMU.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#10 lore raw
Quoted 42 lines · * Daniel P. Berrangé ([email protected]) wrote:
Quoted 34 lines · Samuel Thibault

Marc-André Lureau, le lun. 11 févr. 2019 12:34:47 +0100, a ecrit:

Quoted 20 lines · Daniel P. Berrangé
Quoted 10 lines · Marc-André Lureau
Quoted 7 lines

Once libslirp has received its first release, we can link with the external libslirp library.

The migration data should be compatible with current and older qemu versions (same compatibility as today). See "slirp: add state saving/loading" patch. However, the content should be treated as a blob, as the format may change eventually in the future.

Quoted 8 lines

How are we going to manage live migration compat if libslirp changes the blob content ?

Bear in mind that we need to support all existing QEMU releases live migrating to effectively all future QEMU releases, with all future libslirp releases, in *both* directions. ie arbitrarily newer libslirp needs to be able to emit a blob format that can be read by arbitrarily older slirp inside QEMU.

Quoted 6 lines

Right, this is all supported currently with the proposed patch set, since it is effectively the same code.

So register_savevm_live() get passed slirp_state_version() (currently == 4)

& slirp_state_load() get the version_id from QEMU.

Mmm, but do we guarantee that the current version of slirp will be able to read blobs produced by future versions of slirp?

Future extensions of the format would have to be so that the current version could discard their content without issues.

Quoted 6 lines

Perhaps qemu should actually explicitly pass 4 to register_savevm_live(), for that function to only record that format (and thus get compatibility of course) and only bump to greater values when qemu is modified to make use of a functionality which requires extending the blob format, which then makes it unreadable by older qemu releases, but that is fine for qemu.

Quoted 3 lines

If QEMU wants to make use of functionality that requires the new blob format, it would have to restrict that based on machine type. That way it can ensure full compatibility with old QEMU.

Library compatibility for migration blobs is messy; we've had the same problem with usbredir.

It's very difficult to keep track of; for example lets say that libslirp gets used by 3 or 4 different projects, and the package maintainer for libslirp in your favorite distro updates it - it's not necessarily obvious to them that doing so could break qemu migration.

The ideal way is to work in terms of features and not versions; so that a machine type can enable libslirp-feature-foo in the new machine type and only then will the migration contents change.

Dave

Quoted 6 lines

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK