From 1442ce82435b714cab29846ae7ffc4e8eb021ef2 Mon Sep 17 00:00:00 2001 From: "Danilo C. L. de Paula" Date: Fri, 6 Sep 2019 00:33:12 +0100 Subject: [PATCH] * Fri Sep 06 2019 Danilo Cesar Lemes de Paula - 4.1.0-7.el8 - kvm-trace-Clarify-DTrace-SystemTap-help-message.patch [bz#1516220] - kvm-socket-Add-backlog-parameter-to-socket_listen.patch [bz#1726898] - kvm-socket-Add-num-connections-to-qio_channel_socket_syn.patch [bz#1726898] - kvm-socket-Add-num-connections-to-qio_channel_socket_asy.patch [bz#1726898] - kvm-socket-Add-num-connections-to-qio_net_listener_open_.patch [bz#1726898] - kvm-multifd-Use-number-of-channels-as-listen-backlog.patch [bz#1726898] - kvm-pseries-Fix-compat_pvr-on-reset.patch [bz#1744107] - kvm-spapr-Set-compat-mode-in-spapr_core_plug.patch [bz#1744107] - Resolves: bz#1516220 (-trace help prints an incomplete list of trace events) - Resolves: bz#1726898 (Parallel migration fails with error "Unable to write to socket: Connection reset by peer" now and then) - Resolves: bz#1744107 (Migration from P8(qemu4.1) to P9(qemu4.1), after migration, qemu crash on destination with error message "qemu-kvm: error while loading state for instance 0x1 of device 'cpu'") --- ...number-of-channels-as-listen-backlog.patch | 50 +++ kvm-pseries-Fix-compat_pvr-on-reset.patch | 80 +++++ ...d-backlog-parameter-to-socket_listen.patch | 295 ++++++++++++++++++ ...onnections-to-qio_channel_socket_asy.patch | 144 +++++++++ ...onnections-to-qio_channel_socket_syn.patch | 173 ++++++++++ ...onnections-to-qio_net_listener_open_.patch | 151 +++++++++ ...r-Set-compat-mode-in-spapr_core_plug.patch | 127 ++++++++ ...larify-DTrace-SystemTap-help-message.patch | 80 +++++ qemu-kvm.spec | 34 +- 9 files changed, 1133 insertions(+), 1 deletion(-) create mode 100644 kvm-multifd-Use-number-of-channels-as-listen-backlog.patch create mode 100644 kvm-pseries-Fix-compat_pvr-on-reset.patch create mode 100644 kvm-socket-Add-backlog-parameter-to-socket_listen.patch create mode 100644 kvm-socket-Add-num-connections-to-qio_channel_socket_asy.patch create mode 100644 kvm-socket-Add-num-connections-to-qio_channel_socket_syn.patch create mode 100644 kvm-socket-Add-num-connections-to-qio_net_listener_open_.patch create mode 100644 kvm-spapr-Set-compat-mode-in-spapr_core_plug.patch create mode 100644 kvm-trace-Clarify-DTrace-SystemTap-help-message.patch diff --git a/kvm-multifd-Use-number-of-channels-as-listen-backlog.patch b/kvm-multifd-Use-number-of-channels-as-listen-backlog.patch new file mode 100644 index 0000000..d48d556 --- /dev/null +++ b/kvm-multifd-Use-number-of-channels-as-listen-backlog.patch @@ -0,0 +1,50 @@ +From 8c93ef106ecf2aa0604ffe7fee3d628b88c2b015 Mon Sep 17 00:00:00 2001 +From: Juan Quintela +Date: Wed, 4 Sep 2019 10:26:06 +0100 +Subject: [PATCH 6/8] multifd: Use number of channels as listen backlog +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Juan Quintela +Message-id: <20190904102606.15744-6-quintela@redhat.com> +Patchwork-id: 90273 +O-Subject: [RHEL-AV-8.1 qemu-kvm PATCH 5/5] multifd: Use number of channels as listen backlog +Bugzilla: 1726898 +RH-Acked-by: Dr. David Alan Gilbert +RH-Acked-by: Peter Xu +RH-Acked-by: Danilo de Paula + +Reviewed-by: Daniel P. Berrangé +Signed-off-by: Juan Quintela +(cherry picked from commit 0705e56496d2b155b5796c6b28d4110e5bcbd5d8) +Signed-off-by: Juan Quintela +Signed-off-by: Danilo C. L. de Paula +--- + migration/socket.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/migration/socket.c b/migration/socket.c +index e63f5e1..97c9efd 100644 +--- a/migration/socket.c ++++ b/migration/socket.c +@@ -178,10 +178,15 @@ static void socket_start_incoming_migration(SocketAddress *saddr, + { + QIONetListener *listener = qio_net_listener_new(); + size_t i; ++ int num = 1; + + qio_net_listener_set_name(listener, "migration-socket-listener"); + +- if (qio_net_listener_open_sync(listener, saddr, 1, errp) < 0) { ++ if (migrate_use_multifd()) { ++ num = migrate_multifd_channels(); ++ } ++ ++ if (qio_net_listener_open_sync(listener, saddr, num, errp) < 0) { + object_unref(OBJECT(listener)); + return; + } +-- +1.8.3.1 + diff --git a/kvm-pseries-Fix-compat_pvr-on-reset.patch b/kvm-pseries-Fix-compat_pvr-on-reset.patch new file mode 100644 index 0000000..f03db5e --- /dev/null +++ b/kvm-pseries-Fix-compat_pvr-on-reset.patch @@ -0,0 +1,80 @@ +From 88cfbf2cc3e93a276f9d036850265eb8c2f5310c Mon Sep 17 00:00:00 2001 +From: Laurent Vivier +Date: Wed, 4 Sep 2019 10:31:38 +0100 +Subject: [PATCH 7/8] pseries: Fix compat_pvr on reset + +RH-Author: Laurent Vivier +Message-id: <20190904103139.29870-2-lvivier@redhat.com> +Patchwork-id: 90274 +O-Subject: [RHEL-AV-8.1.0 qemu-kvm PATCH 1/2] pseries: Fix compat_pvr on reset +Bugzilla: 1744107 +RH-Acked-by: John Snow +RH-Acked-by: David Gibson +RH-Acked-by: Thomas Huth + +If we a migrate P8 machine to a P9 machine, the migration fails on +destination with: + + error while loading state for instance 0x1 of device 'cpu' + load of migration failed: Operation not permitted + +This is caused because the compat_pvr field is only present for the first +CPU. +Originally, spapr_machine_reset() calls ppc_set_compat() to set the value +max_compat_pvr for the first cpu and this was propagated to all CPUs by +spapr_cpu_reset(). Now, as spapr_cpu_reset() is called before that, the +value is not propagated to all CPUs and the migration fails. + +To fix that, propagate the new value to all CPUs in spapr_machine_reset(). + +Fixes: 25c9780d38d4 ("spapr: Reset CAS & IRQ subsystem after devices") +Signed-off-by: Laurent Vivier +Message-Id: <20190826090812.19080-1-lvivier@redhat.com> +Reviewed-by: Greg Kurz +Signed-off-by: David Gibson +(cherry picked from commit ce03a193e1172ff7d4b3303ec7472dc29183db8c) + +BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1744107 +BRANCH: rhel-av-8.1.0/master-4.1.0 +UPSTREAM: Merged +Signed-off-by: Danilo C. L. de Paula +--- + hw/ppc/spapr.c | 8 +++++++- + hw/ppc/spapr_cpu_core.c | 2 ++ + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c +index 9b500d2..30bf7bb 100644 +--- a/hw/ppc/spapr.c ++++ b/hw/ppc/spapr.c +@@ -1746,7 +1746,13 @@ static void spapr_machine_reset(MachineState *machine) + spapr_ovec_cleanup(spapr->ov5_cas); + spapr->ov5_cas = spapr_ovec_new(); + +- ppc_set_compat(first_ppc_cpu, spapr->max_compat_pvr, &error_fatal); ++ /* ++ * reset compat_pvr for all CPUs ++ * as qemu_devices_reset() is called before this, ++ * it can't be propagated by spapr_cpu_reset() ++ * from the first CPU to all the others ++ */ ++ ppc_set_compat_all(spapr->max_compat_pvr, &error_fatal); + } + + if (!SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) { +diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c +index 29a3c7d..ae43c57 100644 +--- a/hw/ppc/spapr_cpu_core.c ++++ b/hw/ppc/spapr_cpu_core.c +@@ -41,6 +41,8 @@ static void spapr_cpu_reset(void *opaque) + + /* Set compatibility mode to match the boot CPU, which was either set + * by the machine reset code or by CAS. This should never fail. ++ * At startup the value is already set for all the CPUs ++ * but we need this when we hotplug a new CPU + */ + ppc_set_compat(cpu, POWERPC_CPU(first_cpu)->compat_pvr, &error_abort); + +-- +1.8.3.1 + diff --git a/kvm-socket-Add-backlog-parameter-to-socket_listen.patch b/kvm-socket-Add-backlog-parameter-to-socket_listen.patch new file mode 100644 index 0000000..f3dfe2d --- /dev/null +++ b/kvm-socket-Add-backlog-parameter-to-socket_listen.patch @@ -0,0 +1,295 @@ +From fce683618bc605eaedfdcea0db974734c111a2e9 Mon Sep 17 00:00:00 2001 +From: Juan Quintela +Date: Wed, 4 Sep 2019 10:26:02 +0100 +Subject: [PATCH 2/8] socket: Add backlog parameter to socket_listen +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Juan Quintela +Message-id: <20190904102606.15744-2-quintela@redhat.com> +Patchwork-id: 90270 +O-Subject: [RHEL-AV-8.1 qemu-kvm PATCH 1/5] socket: Add backlog parameter to socket_listen +Bugzilla: 1726898 +RH-Acked-by: Dr. David Alan Gilbert +RH-Acked-by: Peter Xu +RH-Acked-by: Danilo de Paula + +Current parameter was always one. We continue with that value for now +in all callers. + +Signed-off-by: Juan Quintela +Reviewed-by: Daniel P. Berrangé +--- +Moved trace to socket_listen +(cherry picked from commit e5b6353cf25c99c3f08bf51e29933352f7140e8f) +Signed-off-by: Juan Quintela + +Signed-off-by: Danilo C. L. de Paula +--- + include/qemu/sockets.h | 2 +- + io/channel-socket.c | 2 +- + qga/channel-posix.c | 2 +- + tests/test-util-sockets.c | 12 ++++++------ + util/qemu-sockets.c | 33 ++++++++++++++++++++++----------- + util/trace-events | 3 +++ + 6 files changed, 34 insertions(+), 20 deletions(-) + +diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h +index 8140fea..57cd049 100644 +--- a/include/qemu/sockets.h ++++ b/include/qemu/sockets.h +@@ -41,7 +41,7 @@ int unix_connect(const char *path, Error **errp); + + SocketAddress *socket_parse(const char *str, Error **errp); + int socket_connect(SocketAddress *addr, Error **errp); +-int socket_listen(SocketAddress *addr, Error **errp); ++int socket_listen(SocketAddress *addr, int num, Error **errp); + void socket_listen_cleanup(int fd, Error **errp); + int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp); + +diff --git a/io/channel-socket.c b/io/channel-socket.c +index bec3d93..a533c8b 100644 +--- a/io/channel-socket.c ++++ b/io/channel-socket.c +@@ -202,7 +202,7 @@ int qio_channel_socket_listen_sync(QIOChannelSocket *ioc, + int fd; + + trace_qio_channel_socket_listen_sync(ioc, addr); +- fd = socket_listen(addr, errp); ++ fd = socket_listen(addr, 1, errp); + if (fd < 0) { + trace_qio_channel_socket_listen_fail(ioc); + return -1; +diff --git a/qga/channel-posix.c b/qga/channel-posix.c +index 5a925a9..8fc205a 100644 +--- a/qga/channel-posix.c ++++ b/qga/channel-posix.c +@@ -215,7 +215,7 @@ static gboolean ga_channel_open(GAChannel *c, const gchar *path, + return false; + } + +- fd = socket_listen(addr, &local_err); ++ fd = socket_listen(addr, 1, &local_err); + qapi_free_SocketAddress(addr); + if (local_err != NULL) { + g_critical("%s", error_get_pretty(local_err)); +diff --git a/tests/test-util-sockets.c b/tests/test-util-sockets.c +index f1ebffe..c8e1893 100644 +--- a/tests/test-util-sockets.c ++++ b/tests/test-util-sockets.c +@@ -93,7 +93,7 @@ static void test_socket_fd_pass_name_good(void) + g_assert_cmpint(fd, !=, mon_fd); + close(fd); + +- fd = socket_listen(&addr, &error_abort); ++ fd = socket_listen(&addr, 1, &error_abort); + g_assert_cmpint(fd, !=, -1); + g_assert_cmpint(fd, !=, mon_fd); + close(fd); +@@ -124,7 +124,7 @@ static void test_socket_fd_pass_name_bad(void) + g_assert_cmpint(fd, ==, -1); + error_free_or_abort(&err); + +- fd = socket_listen(&addr, &err); ++ fd = socket_listen(&addr, 1, &err); + g_assert_cmpint(fd, ==, -1); + error_free_or_abort(&err); + +@@ -151,7 +151,7 @@ static void test_socket_fd_pass_name_nomon(void) + g_assert_cmpint(fd, ==, -1); + error_free_or_abort(&err); + +- fd = socket_listen(&addr, &err); ++ fd = socket_listen(&addr, 1, &err); + g_assert_cmpint(fd, ==, -1); + error_free_or_abort(&err); + +@@ -174,7 +174,7 @@ static void test_socket_fd_pass_num_good(void) + fd = socket_connect(&addr, &error_abort); + g_assert_cmpint(fd, ==, sfd); + +- fd = socket_listen(&addr, &error_abort); ++ fd = socket_listen(&addr, 1, &error_abort); + g_assert_cmpint(fd, ==, sfd); + + g_free(addr.u.fd.str); +@@ -197,7 +197,7 @@ static void test_socket_fd_pass_num_bad(void) + g_assert_cmpint(fd, ==, -1); + error_free_or_abort(&err); + +- fd = socket_listen(&addr, &err); ++ fd = socket_listen(&addr, 1, &err); + g_assert_cmpint(fd, ==, -1); + error_free_or_abort(&err); + +@@ -220,7 +220,7 @@ static void test_socket_fd_pass_num_nocli(void) + g_assert_cmpint(fd, ==, -1); + error_free_or_abort(&err); + +- fd = socket_listen(&addr, &err); ++ fd = socket_listen(&addr, 1, &err); + g_assert_cmpint(fd, ==, -1); + error_free_or_abort(&err); + +diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c +index a5092db..a39ada4 100644 +--- a/util/qemu-sockets.c ++++ b/util/qemu-sockets.c +@@ -31,6 +31,7 @@ + #include "qapi/qobject-input-visitor.h" + #include "qapi/qobject-output-visitor.h" + #include "qemu/cutils.h" ++#include "trace.h" + + #ifndef AI_ADDRCONFIG + # define AI_ADDRCONFIG 0 +@@ -207,6 +208,7 @@ static int try_bind(int socket, InetSocketAddress *saddr, struct addrinfo *e) + + static int inet_listen_saddr(InetSocketAddress *saddr, + int port_offset, ++ int num, + Error **errp) + { + struct addrinfo ai,*res,*e; +@@ -303,7 +305,7 @@ static int inet_listen_saddr(InetSocketAddress *saddr, + goto listen_failed; + } + } else { +- if (!listen(slisten, 1)) { ++ if (!listen(slisten, num)) { + goto listen_ok; + } + if (errno != EADDRINUSE) { +@@ -746,6 +748,7 @@ static int vsock_connect_saddr(VsockSocketAddress *vaddr, Error **errp) + } + + static int vsock_listen_saddr(VsockSocketAddress *vaddr, ++ int num, + Error **errp) + { + struct sockaddr_vm svm; +@@ -767,7 +770,7 @@ static int vsock_listen_saddr(VsockSocketAddress *vaddr, + return -1; + } + +- if (listen(slisten, 1) != 0) { ++ if (listen(slisten, num) != 0) { + error_setg_errno(errp, errno, "Failed to listen on socket"); + closesocket(slisten); + return -1; +@@ -808,6 +811,7 @@ static int vsock_connect_saddr(VsockSocketAddress *vaddr, Error **errp) + } + + static int vsock_listen_saddr(VsockSocketAddress *vaddr, ++ int num, + Error **errp) + { + vsock_unsupported(errp); +@@ -825,6 +829,7 @@ static int vsock_parse(VsockSocketAddress *addr, const char *str, + #ifndef _WIN32 + + static int unix_listen_saddr(UnixSocketAddress *saddr, ++ int num, + Error **errp) + { + struct sockaddr_un un; +@@ -886,7 +891,7 @@ static int unix_listen_saddr(UnixSocketAddress *saddr, + error_setg_errno(errp, errno, "Failed to bind socket to %s", path); + goto err; + } +- if (listen(sock, 1) < 0) { ++ if (listen(sock, num) < 0) { + error_setg_errno(errp, errno, "Failed to listen on socket"); + goto err; + } +@@ -953,6 +958,7 @@ static int unix_connect_saddr(UnixSocketAddress *saddr, Error **errp) + #else + + static int unix_listen_saddr(UnixSocketAddress *saddr, ++ int num, + Error **errp) + { + error_setg(errp, "unix sockets are not available on windows"); +@@ -976,7 +982,7 @@ int unix_listen(const char *str, Error **errp) + + saddr = g_new0(UnixSocketAddress, 1); + saddr->path = g_strdup(str); +- sock = unix_listen_saddr(saddr, errp); ++ sock = unix_listen_saddr(saddr, 1, errp); + qapi_free_UnixSocketAddress(saddr); + return sock; + } +@@ -1033,9 +1039,13 @@ fail: + return NULL; + } + +-static int socket_get_fd(const char *fdstr, Error **errp) ++static int socket_get_fd(const char *fdstr, int num, Error **errp) + { + int fd; ++ if (num != 1) { ++ error_setg_errno(errp, EINVAL, "socket_get_fd: too many connections"); ++ return -1; ++ } + if (cur_mon) { + fd = monitor_get_fd(cur_mon, fdstr, errp); + if (fd < 0) { +@@ -1071,7 +1081,7 @@ int socket_connect(SocketAddress *addr, Error **errp) + break; + + case SOCKET_ADDRESS_TYPE_FD: +- fd = socket_get_fd(addr->u.fd.str, errp); ++ fd = socket_get_fd(addr->u.fd.str, 1, errp); + break; + + case SOCKET_ADDRESS_TYPE_VSOCK: +@@ -1084,25 +1094,26 @@ int socket_connect(SocketAddress *addr, Error **errp) + return fd; + } + +-int socket_listen(SocketAddress *addr, Error **errp) ++int socket_listen(SocketAddress *addr, int num, Error **errp) + { + int fd; + ++ trace_socket_listen(num); + switch (addr->type) { + case SOCKET_ADDRESS_TYPE_INET: +- fd = inet_listen_saddr(&addr->u.inet, 0, errp); ++ fd = inet_listen_saddr(&addr->u.inet, 0, num, errp); + break; + + case SOCKET_ADDRESS_TYPE_UNIX: +- fd = unix_listen_saddr(&addr->u.q_unix, errp); ++ fd = unix_listen_saddr(&addr->u.q_unix, num, errp); + break; + + case SOCKET_ADDRESS_TYPE_FD: +- fd = socket_get_fd(addr->u.fd.str, errp); ++ fd = socket_get_fd(addr->u.fd.str, num, errp); + break; + + case SOCKET_ADDRESS_TYPE_VSOCK: +- fd = vsock_listen_saddr(&addr->u.vsock, errp); ++ fd = vsock_listen_saddr(&addr->u.vsock, num, errp); + break; + + default: +diff --git a/util/trace-events b/util/trace-events +index 9dbd237..83b6639 100644 +--- a/util/trace-events ++++ b/util/trace-events +@@ -64,6 +64,9 @@ lockcnt_futex_wait(const void *lockcnt, int val) "lockcnt %p waiting on %d" + lockcnt_futex_wait_resume(const void *lockcnt, int new) "lockcnt %p after wait: %d" + lockcnt_futex_wake(const void *lockcnt) "lockcnt %p waking up one waiter" + ++# qemu-sockets.c ++socket_listen(int num) "backlog: %d" ++ + # qemu-thread-common.h + qemu_mutex_lock(void *mutex, const char *file, const int line) "waiting on mutex %p (%s:%d)" + qemu_mutex_locked(void *mutex, const char *file, const int line) "taken mutex %p (%s:%d)" +-- +1.8.3.1 + diff --git a/kvm-socket-Add-num-connections-to-qio_channel_socket_asy.patch b/kvm-socket-Add-num-connections-to-qio_channel_socket_asy.patch new file mode 100644 index 0000000..0512189 --- /dev/null +++ b/kvm-socket-Add-num-connections-to-qio_channel_socket_asy.patch @@ -0,0 +1,144 @@ +From d2bb195f057fd21444644d3996551fe8775043e5 Mon Sep 17 00:00:00 2001 +From: Juan Quintela +Date: Wed, 4 Sep 2019 10:26:04 +0100 +Subject: [PATCH 4/8] socket: Add num connections to qio_channel_socket_async() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Juan Quintela +Message-id: <20190904102606.15744-4-quintela@redhat.com> +Patchwork-id: 90271 +O-Subject: [RHEL-AV-8.1 qemu-kvm PATCH 3/5] socket: Add num connections to qio_channel_socket_async() +Bugzilla: 1726898 +RH-Acked-by: Dr. David Alan Gilbert +RH-Acked-by: Peter Xu +RH-Acked-by: Danilo de Paula + +Reviewed-by: Daniel P. Berrangé +Signed-off-by: Juan Quintela +(cherry picked from commit 7959e29ea0d6100038367beff9a0da0c83b322a2) +Signed-off-by: Juan Quintela +Signed-off-by: Danilo C. L. de Paula +--- + include/io/channel-socket.h | 2 ++ + io/channel-socket.c | 30 +++++++++++++++++++++++------- + io/trace-events | 2 +- + tests/test-io-channel-socket.c | 2 +- + 4 files changed, 27 insertions(+), 9 deletions(-) + +diff --git a/include/io/channel-socket.h b/include/io/channel-socket.h +index ed88e5b..777ff59 100644 +--- a/include/io/channel-socket.h ++++ b/include/io/channel-socket.h +@@ -140,6 +140,7 @@ int qio_channel_socket_listen_sync(QIOChannelSocket *ioc, + * qio_channel_socket_listen_async: + * @ioc: the socket channel object + * @addr: the address to listen to ++ * @num: the expected ammount of connections + * @callback: the function to invoke on completion + * @opaque: user data to pass to @callback + * @destroy: the function to free @opaque +@@ -155,6 +156,7 @@ int qio_channel_socket_listen_sync(QIOChannelSocket *ioc, + */ + void qio_channel_socket_listen_async(QIOChannelSocket *ioc, + SocketAddress *addr, ++ int num, + QIOTaskFunc callback, + gpointer opaque, + GDestroyNotify destroy, +diff --git a/io/channel-socket.c b/io/channel-socket.c +index 6258c25..b74f5b9 100644 +--- a/io/channel-socket.c ++++ b/io/channel-socket.c +@@ -220,14 +220,27 @@ int qio_channel_socket_listen_sync(QIOChannelSocket *ioc, + } + + ++struct QIOChannelListenWorkerData { ++ SocketAddress *addr; ++ int num; /* amount of expected connections */ ++}; ++ ++static void qio_channel_listen_worker_free(gpointer opaque) ++{ ++ struct QIOChannelListenWorkerData *data = opaque; ++ ++ qapi_free_SocketAddress(data->addr); ++ g_free(data); ++} ++ + static void qio_channel_socket_listen_worker(QIOTask *task, + gpointer opaque) + { + QIOChannelSocket *ioc = QIO_CHANNEL_SOCKET(qio_task_get_source(task)); +- SocketAddress *addr = opaque; ++ struct QIOChannelListenWorkerData *data = opaque; + Error *err = NULL; + +- qio_channel_socket_listen_sync(ioc, addr, 1, &err); ++ qio_channel_socket_listen_sync(ioc, data->addr, data->num, &err); + + qio_task_set_error(task, err); + } +@@ -235,6 +248,7 @@ static void qio_channel_socket_listen_worker(QIOTask *task, + + void qio_channel_socket_listen_async(QIOChannelSocket *ioc, + SocketAddress *addr, ++ int num, + QIOTaskFunc callback, + gpointer opaque, + GDestroyNotify destroy, +@@ -242,16 +256,18 @@ void qio_channel_socket_listen_async(QIOChannelSocket *ioc, + { + QIOTask *task = qio_task_new( + OBJECT(ioc), callback, opaque, destroy); +- SocketAddress *addrCopy; ++ struct QIOChannelListenWorkerData *data; + +- addrCopy = QAPI_CLONE(SocketAddress, addr); ++ data = g_new0(struct QIOChannelListenWorkerData, 1); ++ data->addr = QAPI_CLONE(SocketAddress, addr); ++ data->num = num; + + /* socket_listen() blocks in DNS lookups, so we must use a thread */ +- trace_qio_channel_socket_listen_async(ioc, addr); ++ trace_qio_channel_socket_listen_async(ioc, addr, num); + qio_task_run_in_thread(task, + qio_channel_socket_listen_worker, +- addrCopy, +- (GDestroyNotify)qapi_free_SocketAddress, ++ data, ++ qio_channel_listen_worker_free, + context); + } + +diff --git a/io/trace-events b/io/trace-events +index 2e6aa1d..d7bc70b 100644 +--- a/io/trace-events ++++ b/io/trace-events +@@ -18,7 +18,7 @@ qio_channel_socket_connect_async(void *ioc, void *addr) "Socket connect async io + qio_channel_socket_connect_fail(void *ioc) "Socket connect fail ioc=%p" + qio_channel_socket_connect_complete(void *ioc, int fd) "Socket connect complete ioc=%p fd=%d" + qio_channel_socket_listen_sync(void *ioc, void *addr, int num) "Socket listen sync ioc=%p addr=%p num=%d" +-qio_channel_socket_listen_async(void *ioc, void *addr) "Socket listen async ioc=%p addr=%p" ++qio_channel_socket_listen_async(void *ioc, void *addr, int num) "Socket listen async ioc=%p addr=%p num=%d" + qio_channel_socket_listen_fail(void *ioc) "Socket listen fail ioc=%p" + qio_channel_socket_listen_complete(void *ioc, int fd) "Socket listen complete ioc=%p fd=%d" + qio_channel_socket_dgram_sync(void *ioc, void *localAddr, void *remoteAddr) "Socket dgram sync ioc=%p localAddr=%p remoteAddr=%p" +diff --git a/tests/test-io-channel-socket.c b/tests/test-io-channel-socket.c +index 6eebcee..50235c1 100644 +--- a/tests/test-io-channel-socket.c ++++ b/tests/test-io-channel-socket.c +@@ -113,7 +113,7 @@ static void test_io_channel_setup_async(SocketAddress *listen_addr, + + lioc = qio_channel_socket_new(); + qio_channel_socket_listen_async( +- lioc, listen_addr, ++ lioc, listen_addr, 1, + test_io_channel_complete, &data, NULL, NULL); + + g_main_loop_run(data.loop); +-- +1.8.3.1 + diff --git a/kvm-socket-Add-num-connections-to-qio_channel_socket_syn.patch b/kvm-socket-Add-num-connections-to-qio_channel_socket_syn.patch new file mode 100644 index 0000000..1cac5e6 --- /dev/null +++ b/kvm-socket-Add-num-connections-to-qio_channel_socket_syn.patch @@ -0,0 +1,173 @@ +From 307f4596dc70dcabac9da3ec680d377e1df21397 Mon Sep 17 00:00:00 2001 +From: Juan Quintela +Date: Wed, 4 Sep 2019 10:26:03 +0100 +Subject: [PATCH 3/8] socket: Add num connections to qio_channel_socket_sync() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Juan Quintela +Message-id: <20190904102606.15744-3-quintela@redhat.com> +Patchwork-id: 90272 +O-Subject: [RHEL-AV-8.1 qemu-kvm PATCH 2/5] socket: Add num connections to qio_channel_socket_sync() +Bugzilla: 1726898 +RH-Acked-by: Dr. David Alan Gilbert +RH-Acked-by: Peter Xu +RH-Acked-by: Danilo de Paula + +Reviewed-by: Daniel P. Berrangé +Signed-off-by: Juan Quintela +(cherry picked from commit 4e2d8bf6f143138ad121545a7cf4525e36040039) +Signed-off-by: Juan Quintela +Signed-off-by: Danilo C. L. de Paula +--- + include/io/channel-socket.h | 2 ++ + io/channel-socket.c | 7 ++++--- + io/net-listener.c | 2 +- + io/trace-events | 2 +- + scsi/qemu-pr-helper.c | 3 ++- + tests/test-char.c | 4 ++-- + tests/test-io-channel-socket.c | 2 +- + tests/tpm-emu.c | 2 +- + 8 files changed, 14 insertions(+), 10 deletions(-) + +diff --git a/include/io/channel-socket.h b/include/io/channel-socket.h +index d7134d2..ed88e5b 100644 +--- a/include/io/channel-socket.h ++++ b/include/io/channel-socket.h +@@ -123,6 +123,7 @@ void qio_channel_socket_connect_async(QIOChannelSocket *ioc, + * qio_channel_socket_listen_sync: + * @ioc: the socket channel object + * @addr: the address to listen to ++ * @num: the expected ammount of connections + * @errp: pointer to a NULL-initialized error object + * + * Attempt to listen to the address @addr. This method +@@ -132,6 +133,7 @@ void qio_channel_socket_connect_async(QIOChannelSocket *ioc, + */ + int qio_channel_socket_listen_sync(QIOChannelSocket *ioc, + SocketAddress *addr, ++ int num, + Error **errp); + + /** +diff --git a/io/channel-socket.c b/io/channel-socket.c +index a533c8b..6258c25 100644 +--- a/io/channel-socket.c ++++ b/io/channel-socket.c +@@ -197,12 +197,13 @@ void qio_channel_socket_connect_async(QIOChannelSocket *ioc, + + int qio_channel_socket_listen_sync(QIOChannelSocket *ioc, + SocketAddress *addr, ++ int num, + Error **errp) + { + int fd; + +- trace_qio_channel_socket_listen_sync(ioc, addr); +- fd = socket_listen(addr, 1, errp); ++ trace_qio_channel_socket_listen_sync(ioc, addr, num); ++ fd = socket_listen(addr, num, errp); + if (fd < 0) { + trace_qio_channel_socket_listen_fail(ioc); + return -1; +@@ -226,7 +227,7 @@ static void qio_channel_socket_listen_worker(QIOTask *task, + SocketAddress *addr = opaque; + Error *err = NULL; + +- qio_channel_socket_listen_sync(ioc, addr, &err); ++ qio_channel_socket_listen_sync(ioc, addr, 1, &err); + + qio_task_set_error(task, err); + } +diff --git a/io/net-listener.c b/io/net-listener.c +index d8cfe52..dc81150 100644 +--- a/io/net-listener.c ++++ b/io/net-listener.c +@@ -82,7 +82,7 @@ int qio_net_listener_open_sync(QIONetListener *listener, + for (i = 0; i < nresaddrs; i++) { + QIOChannelSocket *sioc = qio_channel_socket_new(); + +- if (qio_channel_socket_listen_sync(sioc, resaddrs[i], ++ if (qio_channel_socket_listen_sync(sioc, resaddrs[i], 1, + err ? NULL : &err) == 0) { + success = true; + +diff --git a/io/trace-events b/io/trace-events +index 3783905..2e6aa1d 100644 +--- a/io/trace-events ++++ b/io/trace-events +@@ -17,7 +17,7 @@ qio_channel_socket_connect_sync(void *ioc, void *addr) "Socket connect sync ioc= + qio_channel_socket_connect_async(void *ioc, void *addr) "Socket connect async ioc=%p addr=%p" + qio_channel_socket_connect_fail(void *ioc) "Socket connect fail ioc=%p" + qio_channel_socket_connect_complete(void *ioc, int fd) "Socket connect complete ioc=%p fd=%d" +-qio_channel_socket_listen_sync(void *ioc, void *addr) "Socket listen sync ioc=%p addr=%p" ++qio_channel_socket_listen_sync(void *ioc, void *addr, int num) "Socket listen sync ioc=%p addr=%p num=%d" + qio_channel_socket_listen_async(void *ioc, void *addr) "Socket listen async ioc=%p addr=%p" + qio_channel_socket_listen_fail(void *ioc) "Socket listen fail ioc=%p" + qio_channel_socket_listen_complete(void *ioc, int fd) "Socket listen complete ioc=%p fd=%d" +diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c +index a256ce4..a8a74d1 100644 +--- a/scsi/qemu-pr-helper.c ++++ b/scsi/qemu-pr-helper.c +@@ -1005,7 +1005,8 @@ int main(int argc, char **argv) + .u.q_unix.path = socket_path, + }; + server_ioc = qio_channel_socket_new(); +- if (qio_channel_socket_listen_sync(server_ioc, &saddr, &local_err) < 0) { ++ if (qio_channel_socket_listen_sync(server_ioc, &saddr, ++ 1, &local_err) < 0) { + object_unref(OBJECT(server_ioc)); + error_report_err(local_err); + return 1; +diff --git a/tests/test-char.c b/tests/test-char.c +index f9440cd..af131fc 100644 +--- a/tests/test-char.c ++++ b/tests/test-char.c +@@ -666,7 +666,7 @@ char_socket_addr_to_opt_str(SocketAddress *addr, bool fd_pass, + char *optstr; + g_assert(!reconnect); + if (is_listen) { +- qio_channel_socket_listen_sync(ioc, addr, &error_abort); ++ qio_channel_socket_listen_sync(ioc, addr, 1, &error_abort); + } else { + qio_channel_socket_connect_sync(ioc, addr, &error_abort); + } +@@ -891,7 +891,7 @@ static void char_socket_client_test(gconstpointer opaque) + */ + ioc = qio_channel_socket_new(); + g_assert_nonnull(ioc); +- qio_channel_socket_listen_sync(ioc, config->addr, &error_abort); ++ qio_channel_socket_listen_sync(ioc, config->addr, 1, &error_abort); + addr = qio_channel_socket_get_local_address(ioc, &error_abort); + g_assert_nonnull(addr); + +diff --git a/tests/test-io-channel-socket.c b/tests/test-io-channel-socket.c +index d2053c4..6eebcee 100644 +--- a/tests/test-io-channel-socket.c ++++ b/tests/test-io-channel-socket.c +@@ -57,7 +57,7 @@ static void test_io_channel_setup_sync(SocketAddress *listen_addr, + QIOChannelSocket *lioc; + + lioc = qio_channel_socket_new(); +- qio_channel_socket_listen_sync(lioc, listen_addr, &error_abort); ++ qio_channel_socket_listen_sync(lioc, listen_addr, 1, &error_abort); + + if (listen_addr->type == SOCKET_ADDRESS_TYPE_INET) { + SocketAddress *laddr = qio_channel_socket_get_local_address( +diff --git a/tests/tpm-emu.c b/tests/tpm-emu.c +index 125e697..c43ac4a 100644 +--- a/tests/tpm-emu.c ++++ b/tests/tpm-emu.c +@@ -76,7 +76,7 @@ void *tpm_emu_ctrl_thread(void *data) + QIOChannelSocket *lioc = qio_channel_socket_new(); + QIOChannel *ioc; + +- qio_channel_socket_listen_sync(lioc, s->addr, &error_abort); ++ qio_channel_socket_listen_sync(lioc, s->addr, 1, &error_abort); + + g_mutex_lock(&s->data_mutex); + s->data_cond_signal = true; +-- +1.8.3.1 + diff --git a/kvm-socket-Add-num-connections-to-qio_net_listener_open_.patch b/kvm-socket-Add-num-connections-to-qio_net_listener_open_.patch new file mode 100644 index 0000000..edadfe8 --- /dev/null +++ b/kvm-socket-Add-num-connections-to-qio_net_listener_open_.patch @@ -0,0 +1,151 @@ +From c7029ffd110bdd4bab6847cd485898dbc5acf5f3 Mon Sep 17 00:00:00 2001 +From: Juan Quintela +Date: Wed, 4 Sep 2019 10:26:05 +0100 +Subject: [PATCH 5/8] socket: Add num connections to + qio_net_listener_open_sync() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Juan Quintela +Message-id: <20190904102606.15744-5-quintela@redhat.com> +Patchwork-id: 90269 +O-Subject: [RHEL-AV-8.1 qemu-kvm PATCH 4/5] socket: Add num connections to qio_net_listener_open_sync() +Bugzilla: 1726898 +RH-Acked-by: Dr. David Alan Gilbert +RH-Acked-by: Peter Xu +RH-Acked-by: Danilo de Paula + +Reviewed-by: Daniel P. Berrangé +Signed-off-by: Juan Quintela +(cherry picked from commit fc8135c63021e8e442a7a894e5434f210614a73c) +Signed-off-by: Juan Quintela +Signed-off-by: Danilo C. L. de Paula +--- + blockdev-nbd.c | 2 +- + chardev/char-socket.c | 2 +- + include/io/net-listener.h | 2 ++ + io/net-listener.c | 3 ++- + migration/socket.c | 2 +- + qemu-nbd.c | 2 +- + ui/vnc.c | 4 ++-- + 7 files changed, 10 insertions(+), 7 deletions(-) + +diff --git a/blockdev-nbd.c b/blockdev-nbd.c +index 66eebab..06041a2 100644 +--- a/blockdev-nbd.c ++++ b/blockdev-nbd.c +@@ -102,7 +102,7 @@ void nbd_server_start(SocketAddress *addr, const char *tls_creds, + qio_net_listener_set_name(nbd_server->listener, + "nbd-listener"); + +- if (qio_net_listener_open_sync(nbd_server->listener, addr, errp) < 0) { ++ if (qio_net_listener_open_sync(nbd_server->listener, addr, 1, errp) < 0) { + goto error; + } + +diff --git a/chardev/char-socket.c b/chardev/char-socket.c +index 7ca5d97..8c7c9da 100644 +--- a/chardev/char-socket.c ++++ b/chardev/char-socket.c +@@ -1160,7 +1160,7 @@ static int qmp_chardev_open_socket_server(Chardev *chr, + qio_net_listener_set_name(s->listener, name); + g_free(name); + +- if (qio_net_listener_open_sync(s->listener, s->addr, errp) < 0) { ++ if (qio_net_listener_open_sync(s->listener, s->addr, 1, errp) < 0) { + object_unref(OBJECT(s->listener)); + s->listener = NULL; + return -1; +diff --git a/include/io/net-listener.h b/include/io/net-listener.h +index 8081ac5..fb10170 100644 +--- a/include/io/net-listener.h ++++ b/include/io/net-listener.h +@@ -95,6 +95,7 @@ void qio_net_listener_set_name(QIONetListener *listener, + * qio_net_listener_open_sync: + * @listener: the network listener object + * @addr: the address to listen on ++ * @num: the amount of expected connections + * @errp: pointer to a NULL initialized error object + * + * Synchronously open a listening connection on all +@@ -104,6 +105,7 @@ void qio_net_listener_set_name(QIONetListener *listener, + */ + int qio_net_listener_open_sync(QIONetListener *listener, + SocketAddress *addr, ++ int num, + Error **errp); + + /** +diff --git a/io/net-listener.c b/io/net-listener.c +index dc81150..5d8a226 100644 +--- a/io/net-listener.c ++++ b/io/net-listener.c +@@ -62,6 +62,7 @@ static gboolean qio_net_listener_channel_func(QIOChannel *ioc, + + int qio_net_listener_open_sync(QIONetListener *listener, + SocketAddress *addr, ++ int num, + Error **errp) + { + QIODNSResolver *resolver = qio_dns_resolver_get_instance(); +@@ -82,7 +83,7 @@ int qio_net_listener_open_sync(QIONetListener *listener, + for (i = 0; i < nresaddrs; i++) { + QIOChannelSocket *sioc = qio_channel_socket_new(); + +- if (qio_channel_socket_listen_sync(sioc, resaddrs[i], 1, ++ if (qio_channel_socket_listen_sync(sioc, resaddrs[i], num, + err ? NULL : &err) == 0) { + success = true; + +diff --git a/migration/socket.c b/migration/socket.c +index 98efdc0..e63f5e1 100644 +--- a/migration/socket.c ++++ b/migration/socket.c +@@ -181,7 +181,7 @@ static void socket_start_incoming_migration(SocketAddress *saddr, + + qio_net_listener_set_name(listener, "migration-socket-listener"); + +- if (qio_net_listener_open_sync(listener, saddr, errp) < 0) { ++ if (qio_net_listener_open_sync(listener, saddr, 1, errp) < 0) { + object_unref(OBJECT(listener)); + return; + } +diff --git a/qemu-nbd.c b/qemu-nbd.c +index a8cb39e..e6a52bf 100644 +--- a/qemu-nbd.c ++++ b/qemu-nbd.c +@@ -1054,7 +1054,7 @@ int main(int argc, char **argv) + server = qio_net_listener_new(); + if (socket_activation == 0) { + saddr = nbd_build_socket_address(sockpath, bindto, port); +- if (qio_net_listener_open_sync(server, saddr, &local_err) < 0) { ++ if (qio_net_listener_open_sync(server, saddr, 1, &local_err) < 0) { + object_unref(OBJECT(server)); + error_report_err(local_err); + exit(EXIT_FAILURE); +diff --git a/ui/vnc.c b/ui/vnc.c +index 933dc36..b042593 100644 +--- a/ui/vnc.c ++++ b/ui/vnc.c +@@ -3760,7 +3760,7 @@ static int vnc_display_listen(VncDisplay *vd, + qio_net_listener_set_name(vd->listener, "vnc-listen"); + for (i = 0; i < nsaddr; i++) { + if (qio_net_listener_open_sync(vd->listener, +- saddr[i], ++ saddr[i], 1, + errp) < 0) { + return -1; + } +@@ -3775,7 +3775,7 @@ static int vnc_display_listen(VncDisplay *vd, + qio_net_listener_set_name(vd->wslistener, "vnc-ws-listen"); + for (i = 0; i < nwsaddr; i++) { + if (qio_net_listener_open_sync(vd->wslistener, +- wsaddr[i], ++ wsaddr[i], 1, + errp) < 0) { + return -1; + } +-- +1.8.3.1 + diff --git a/kvm-spapr-Set-compat-mode-in-spapr_core_plug.patch b/kvm-spapr-Set-compat-mode-in-spapr_core_plug.patch new file mode 100644 index 0000000..f2b6090 --- /dev/null +++ b/kvm-spapr-Set-compat-mode-in-spapr_core_plug.patch @@ -0,0 +1,127 @@ +From 50cee68ce9dc31033969905cf0358d0f641d056a Mon Sep 17 00:00:00 2001 +From: Laurent Vivier +Date: Wed, 4 Sep 2019 10:31:39 +0100 +Subject: [PATCH 8/8] spapr: Set compat mode in spapr_core_plug() + +RH-Author: Laurent Vivier +Message-id: <20190904103139.29870-3-lvivier@redhat.com> +Patchwork-id: 90276 +O-Subject: [RHEL-AV-8.1.0 qemu-kvm PATCH 2/2] spapr: Set compat mode in spapr_core_plug() +Bugzilla: 1744107 +RH-Acked-by: John Snow +RH-Acked-by: David Gibson +RH-Acked-by: Thomas Huth + +From: Greg Kurz + +A recent change in spapr_machine_reset() showed that resetting the compat +mode in spapr_machine_reset() for the boot vCPU and in spapr_cpu_reset() +for all other vCPUs was fragile. The fix was thus to reset the compat mode +for all vCPUs in spapr_machine_reset(), but we still have to propagate +it to hot-plugged CPUs. This is still performed from spapr_cpu_reset(), +hence resulting in ppc_set_compat() being called twice for every vCPU at +machine reset. Apart from wasting cycles, which isn't really an issue +during machine reset, this seems to indicate that spapr_cpu_reset() isn't +the best place to set the compat mode. + +A natural candidate for CPU-hotplug specific code is spapr_core_plug(). +Also, it sits in the same file as spapr_machine_reset() : this makes +it easier for someone who wants to know when the compat PVR is set. + +Call ppc_set_compat() from there. This doesn't need to be done for +initial vCPUs since the compat PVR is 0 and spapr_machine_reset() sets +the appropriate value later. No need to do this on manually added vCPUS +on the destination QEMU during migration since the compat PVR is +part of the migrated vCPU state. Both conditions can be checked with +spapr_drc_hotplugged(). + +Signed-off-by: Greg Kurz +Message-Id: <156701285312.499757.7807417667750711711.stgit@bahia.lan> +Signed-off-by: David Gibson +(cherry picked from commit b1e815674343a171e51ce447495957e289091e9f) +Signed-off-by: Laurent Vivier + +BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1744107 +BRANCH: rhel-av-8.1.0/master-4.1.0 +UPSTREAM: Merged +Signed-off-by: Danilo C. L. de Paula +--- + hw/ppc/spapr.c | 24 ++++++++++++++++-------- + hw/ppc/spapr_cpu_core.c | 7 ------- + 2 files changed, 16 insertions(+), 15 deletions(-) + +diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c +index 30bf7bb..41a6070 100644 +--- a/hw/ppc/spapr.c ++++ b/hw/ppc/spapr.c +@@ -1746,12 +1746,6 @@ static void spapr_machine_reset(MachineState *machine) + spapr_ovec_cleanup(spapr->ov5_cas); + spapr->ov5_cas = spapr_ovec_new(); + +- /* +- * reset compat_pvr for all CPUs +- * as qemu_devices_reset() is called before this, +- * it can't be propagated by spapr_cpu_reset() +- * from the first CPU to all the others +- */ + ppc_set_compat_all(spapr->max_compat_pvr, &error_fatal); + } + +@@ -3826,6 +3820,7 @@ static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev, + CPUArchId *core_slot; + int index; + bool hotplugged = spapr_drc_hotplugged(dev); ++ int i; + + core_slot = spapr_find_cpu_slot(MACHINE(hotplug_dev), cc->core_id, &index); + if (!core_slot) { +@@ -3859,13 +3854,26 @@ static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev, + core_slot->cpu = OBJECT(dev); + + if (smc->pre_2_10_has_unused_icps) { +- int i; +- + for (i = 0; i < cc->nr_threads; i++) { + cs = CPU(core->threads[i]); + pre_2_10_vmstate_unregister_dummy_icp(cs->cpu_index); + } + } ++ ++ /* ++ * Set compatibility mode to match the boot CPU, which was either set ++ * by the machine reset code or by CAS. ++ */ ++ if (hotplugged) { ++ for (i = 0; i < cc->nr_threads; i++) { ++ ppc_set_compat(core->threads[i], POWERPC_CPU(first_cpu)->compat_pvr, ++ &local_err); ++ if (local_err) { ++ error_propagate(errp, local_err); ++ return; ++ } ++ } ++ } + } + + static void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, +diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c +index ae43c57..85f2746 100644 +--- a/hw/ppc/spapr_cpu_core.c ++++ b/hw/ppc/spapr_cpu_core.c +@@ -39,13 +39,6 @@ static void spapr_cpu_reset(void *opaque) + * using an RTAS call */ + cs->halted = 1; + +- /* Set compatibility mode to match the boot CPU, which was either set +- * by the machine reset code or by CAS. This should never fail. +- * At startup the value is already set for all the CPUs +- * but we need this when we hotplug a new CPU +- */ +- ppc_set_compat(cpu, POWERPC_CPU(first_cpu)->compat_pvr, &error_abort); +- + env->spr[SPR_HIOR] = 0; + + lpcr = env->spr[SPR_LPCR]; +-- +1.8.3.1 + diff --git a/kvm-trace-Clarify-DTrace-SystemTap-help-message.patch b/kvm-trace-Clarify-DTrace-SystemTap-help-message.patch new file mode 100644 index 0000000..a3bfed4 --- /dev/null +++ b/kvm-trace-Clarify-DTrace-SystemTap-help-message.patch @@ -0,0 +1,80 @@ +From 5d45e3a5d2e2d929095489a37579c3b7fc059450 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= +Date: Tue, 3 Sep 2019 14:21:10 +0100 +Subject: [PATCH 1/8] trace: Clarify DTrace/SystemTap help message +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RH-Author: Philippe Mathieu-Daudé +Message-id: <20190903142110.25673-2-philmd@redhat.com> +Patchwork-id: 90255 +O-Subject: [RHEL-AV-8.1.0 qemu-kvm PATCH 1/1] trace: Clarify DTrace/SystemTap help message +Bugzilla: 1516220 +RH-Acked-by: John Snow +RH-Acked-by: Peter Xu +RH-Acked-by: Stefan Hajnoczi + +Most tracing backends are implemented within QEMU, except the +DTrace/SystemTap backends. + +One side effect is when running 'qemu -trace help', an incomplete +list of trace events is displayed when using the DTrace/SystemTap +backends. + +This is partly due to trace events registered as modules with +trace_init(), and since the events are not used within QEMU, +the linker optimize and remove the unused modules (which is +OK in this particular case). +Currently only the events compiled in trace-root.o and in the +last trace.o member of libqemuutil.a are linked, resulting in +an incomplete list of events. + +To avoid confusion, improve the help message, recommending to +use the proper systemtap script to display the events list. + +Before: + + $ lm32-softmmu/qemu-system-lm32 -trace help 2>&1 | wc -l + 70 + +After: + + $ lm32-softmmu/qemu-system-lm32 -trace help + Run 'qemu-trace-stap list qemu-system-lm32' to print a list + of names of trace points with the DTrace/SystemTap backends. + + $ qemu-trace-stap list qemu-system-lm32 | wc -l + 1136 + +Signed-off-by: Philippe Mathieu-Daudé +Message-id: 20190823142203.5210-1-philmd@redhat.com +Message-Id: <20190823142203.5210-1-philmd@redhat.com> +Signed-off-by: Stefan Hajnoczi +(cherry picked from commit 9f591a5d95e1969969632ab44cf35e505c8ddc3b) +Signed-off-by: Philippe Mathieu-Daudé +Signed-off-by: Danilo C. L. de Paula +--- + trace/control.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/trace/control.c b/trace/control.c +index 43fb786..d9cafc1 100644 +--- a/trace/control.c ++++ b/trace/control.c +@@ -165,6 +165,12 @@ void trace_list_events(void) + while ((ev = trace_event_iter_next(&iter)) != NULL) { + fprintf(stderr, "%s\n", trace_event_get_name(ev)); + } ++#ifdef CONFIG_TRACE_DTRACE ++ fprintf(stderr, "This list of names of trace points may be incomplete " ++ "when using the DTrace/SystemTap backends.\n" ++ "Run 'qemu-trace-stap list %s' to print the full list.\n", ++ error_get_progname()); ++#endif + } + + static void do_trace_enable_events(const char *line_buf) +-- +1.8.3.1 + diff --git a/qemu-kvm.spec b/qemu-kvm.spec index e1168f4..7618078 100644 --- a/qemu-kvm.spec +++ b/qemu-kvm.spec @@ -67,7 +67,7 @@ Obsoletes: %1-rhev Summary: QEMU is a machine emulator and virtualizer Name: qemu-kvm Version: 4.1.0 -Release: 6%{?dist} +Release: 7%{?dist} # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped Epoch: 15 License: GPLv2 and GPLv2+ and CC-BY @@ -150,6 +150,22 @@ Patch33: kvm-memory-Split-zones-when-do-coalesced_io_del.patch Patch34: kvm-memory-Remove-has_coalesced_range-counter.patch # For bz#1743142 - Boot guest with multiple e1000 devices, qemu will crash after several guest reboots: kvm_mem_ioeventfd_add: error adding ioeventfd: No space left on device (28) Patch35: kvm-memory-Fix-up-memory_region_-add-del-_coalescing.patch +# For bz#1516220 - -trace help prints an incomplete list of trace events +Patch36: kvm-trace-Clarify-DTrace-SystemTap-help-message.patch +# For bz#1726898 - Parallel migration fails with error "Unable to write to socket: Connection reset by peer" now and then +Patch37: kvm-socket-Add-backlog-parameter-to-socket_listen.patch +# For bz#1726898 - Parallel migration fails with error "Unable to write to socket: Connection reset by peer" now and then +Patch38: kvm-socket-Add-num-connections-to-qio_channel_socket_syn.patch +# For bz#1726898 - Parallel migration fails with error "Unable to write to socket: Connection reset by peer" now and then +Patch39: kvm-socket-Add-num-connections-to-qio_channel_socket_asy.patch +# For bz#1726898 - Parallel migration fails with error "Unable to write to socket: Connection reset by peer" now and then +Patch40: kvm-socket-Add-num-connections-to-qio_net_listener_open_.patch +# For bz#1726898 - Parallel migration fails with error "Unable to write to socket: Connection reset by peer" now and then +Patch41: kvm-multifd-Use-number-of-channels-as-listen-backlog.patch +# For bz#1744107 - Migration from P8(qemu4.1) to P9(qemu4.1), after migration, qemu crash on destination with error message "qemu-kvm: error while loading state for instance 0x1 of device 'cpu'" +Patch42: kvm-pseries-Fix-compat_pvr-on-reset.patch +# For bz#1744107 - Migration from P8(qemu4.1) to P9(qemu4.1), after migration, qemu crash on destination with error message "qemu-kvm: error while loading state for instance 0x1 of device 'cpu'" +Patch43: kvm-spapr-Set-compat-mode-in-spapr_core_plug.patch BuildRequires: wget BuildRequires: rpm-build @@ -1091,6 +1107,22 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ %changelog +* Fri Sep 06 2019 Danilo Cesar Lemes de Paula - 4.1.0-7.el8 +- kvm-trace-Clarify-DTrace-SystemTap-help-message.patch [bz#1516220] +- kvm-socket-Add-backlog-parameter-to-socket_listen.patch [bz#1726898] +- kvm-socket-Add-num-connections-to-qio_channel_socket_syn.patch [bz#1726898] +- kvm-socket-Add-num-connections-to-qio_channel_socket_asy.patch [bz#1726898] +- kvm-socket-Add-num-connections-to-qio_net_listener_open_.patch [bz#1726898] +- kvm-multifd-Use-number-of-channels-as-listen-backlog.patch [bz#1726898] +- kvm-pseries-Fix-compat_pvr-on-reset.patch [bz#1744107] +- kvm-spapr-Set-compat-mode-in-spapr_core_plug.patch [bz#1744107] +- Resolves: bz#1516220 + (-trace help prints an incomplete list of trace events) +- Resolves: bz#1726898 + (Parallel migration fails with error "Unable to write to socket: Connection reset by peer" now and then) +- Resolves: bz#1744107 + (Migration from P8(qemu4.1) to P9(qemu4.1), after migration, qemu crash on destination with error message "qemu-kvm: error while loading state for instance 0x1 of device 'cpu'") + * Wed Sep 04 2019 Danilo Cesar Lemes de Paula - 4.1.0-6.el8 - kvm-memory-Refactor-memory_region_clear_coalescing.patch [bz#1743142] - kvm-memory-Split-zones-when-do-coalesced_io_del.patch [bz#1743142]