* Mon Aug 15 2022 Miroslav Rezanina <mrezanin@redhat.com> - 7.0.0-11
- kvm-QIOChannelSocket-Fix-zero-copy-flush-returning-code-.patch [bz#2107466] - kvm-Add-dirty-sync-missed-zero-copy-migration-stat.patch [bz#2107466] - kvm-migration-multifd-Report-to-user-when-zerocopy-not-w.patch [bz#2107466] - kvm-migration-Avoid-false-positive-on-non-supported-scen.patch [bz#2107466] - kvm-migration-add-remaining-params-has_-true-in-migratio.patch [bz#2107466] - kvm-QIOChannelSocket-Add-support-for-MSG_ZEROCOPY-IPV6.patch [bz#2107466] - kvm-pc-bios-s390-ccw-Fix-booting-with-logical-block-size.patch [bz#2112303] - kvm-vdpa-Fix-bad-index-calculus-at-vhost_vdpa_get_vring_.patch [bz#2116876] - kvm-vdpa-Fix-index-calculus-at-vhost_vdpa_svqs_start.patch [bz#2116876] - kvm-vdpa-Fix-memory-listener-deletions-of-iova-tree.patch [bz#2116876] - kvm-vdpa-Fix-file-descriptor-leak-on-get-features-error.patch [bz#2116876] - Resolves: bz#2107466 (zerocopy capability can be enabled when set migrate capabilities with multifd and compress/xbzrle together) - Resolves: bz#2112303 (virtio-blk: Can't boot fresh installation from used 512 cluster_size image under certain conditions) - Resolves: bz#2116876 (Fixes for vDPA control virtqueue support in Qemu)
This commit is contained in:
		
							parent
							
								
									23d471091d
								
							
						
					
					
						commit
						85d5f0ed1b
					
				
							
								
								
									
										87
									
								
								kvm-Add-dirty-sync-missed-zero-copy-migration-stat.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								kvm-Add-dirty-sync-missed-zero-copy-migration-stat.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,87 @@ | |||||||
|  | From ac346634c5731407baa9de709dbd4d5cc6f45301 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Leonardo Bras <leobras@redhat.com> | ||||||
|  | Date: Mon, 11 Jul 2022 18:11:12 -0300 | ||||||
|  | Subject: [PATCH 02/11] Add dirty-sync-missed-zero-copy migration stat | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  | 
 | ||||||
|  | RH-Author: Leonardo Brás <leobras@redhat.com> | ||||||
|  | RH-MergeRequest: 111: zero-copy-send fixes & improvements | ||||||
|  | RH-Commit: [2/6] 115035fd0a4e4b9439c91fb0f5d1a2f9244ba369 (LeoBras/centos-qemu-kvm) | ||||||
|  | RH-Bugzilla: 2107466 | ||||||
|  | RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> | ||||||
|  | RH-Acked-by: Thomas Huth <thuth@redhat.com> | ||||||
|  | RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||||||
|  | 
 | ||||||
|  | Signed-off-by: Leonardo Bras <leobras@redhat.com> | ||||||
|  | Acked-by: Markus Armbruster <armbru@redhat.com> | ||||||
|  | Acked-by: Peter Xu <peterx@redhat.com> | ||||||
|  | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> | ||||||
|  | Message-Id: <20220711211112.18951-3-leobras@redhat.com> | ||||||
|  | Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||||||
|  | (cherry picked from commit cf20c897338067ab4b70a4596fdccaf90c7e29a1) | ||||||
|  | Signed-off-by: Leonardo Bras <leobras@redhat.com> | ||||||
|  | ---
 | ||||||
|  |  migration/migration.c | 2 ++ | ||||||
|  |  monitor/hmp-cmds.c    | 5 +++++ | ||||||
|  |  qapi/migration.json   | 7 ++++++- | ||||||
|  |  3 files changed, 13 insertions(+), 1 deletion(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/migration/migration.c b/migration/migration.c
 | ||||||
|  | index 8fb3eae910..3a3a7a4a50 100644
 | ||||||
|  | --- a/migration/migration.c
 | ||||||
|  | +++ b/migration/migration.c
 | ||||||
|  | @@ -1017,6 +1017,8 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s)
 | ||||||
|  |      info->ram->normal_bytes = ram_counters.normal * page_size; | ||||||
|  |      info->ram->mbps = s->mbps; | ||||||
|  |      info->ram->dirty_sync_count = ram_counters.dirty_sync_count; | ||||||
|  | +    info->ram->dirty_sync_missed_zero_copy =
 | ||||||
|  | +            ram_counters.dirty_sync_missed_zero_copy;
 | ||||||
|  |      info->ram->postcopy_requests = ram_counters.postcopy_requests; | ||||||
|  |      info->ram->page_size = page_size; | ||||||
|  |      info->ram->multifd_bytes = ram_counters.multifd_bytes; | ||||||
|  | diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
 | ||||||
|  | index 634968498b..9cec01de38 100644
 | ||||||
|  | --- a/monitor/hmp-cmds.c
 | ||||||
|  | +++ b/monitor/hmp-cmds.c
 | ||||||
|  | @@ -305,6 +305,11 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
 | ||||||
|  |              monitor_printf(mon, "postcopy ram: %" PRIu64 " kbytes\n", | ||||||
|  |                             info->ram->postcopy_bytes >> 10); | ||||||
|  |          } | ||||||
|  | +        if (info->ram->dirty_sync_missed_zero_copy) {
 | ||||||
|  | +            monitor_printf(mon,
 | ||||||
|  | +                           "Zero-copy-send fallbacks happened: %" PRIu64 " times\n",
 | ||||||
|  | +                           info->ram->dirty_sync_missed_zero_copy);
 | ||||||
|  | +        }
 | ||||||
|  |      } | ||||||
|  |   | ||||||
|  |      if (info->has_disk) { | ||||||
|  | diff --git a/qapi/migration.json b/qapi/migration.json
 | ||||||
|  | index 5105790cd0..9b38b3c21c 100644
 | ||||||
|  | --- a/qapi/migration.json
 | ||||||
|  | +++ b/qapi/migration.json
 | ||||||
|  | @@ -55,6 +55,10 @@
 | ||||||
|  |  # @postcopy-bytes: The number of bytes sent during the post-copy phase | ||||||
|  |  #                  (since 7.0). | ||||||
|  |  # | ||||||
|  | +# @dirty-sync-missed-zero-copy: Number of times dirty RAM synchronization could
 | ||||||
|  | +#                               not avoid copying dirty pages. This is between
 | ||||||
|  | +#                               0 and @dirty-sync-count * @multifd-channels.
 | ||||||
|  | +#                               (since 7.1)
 | ||||||
|  |  # Since: 0.14 | ||||||
|  |  ## | ||||||
|  |  { 'struct': 'MigrationStats', | ||||||
|  | @@ -65,7 +69,8 @@
 | ||||||
|  |             'postcopy-requests' : 'int', 'page-size' : 'int', | ||||||
|  |             'multifd-bytes' : 'uint64', 'pages-per-second' : 'uint64', | ||||||
|  |             'precopy-bytes' : 'uint64', 'downtime-bytes' : 'uint64', | ||||||
|  | -           'postcopy-bytes' : 'uint64' } }
 | ||||||
|  | +           'postcopy-bytes' : 'uint64',
 | ||||||
|  | +           'dirty-sync-missed-zero-copy' : 'uint64' } }
 | ||||||
|  |   | ||||||
|  |  ## | ||||||
|  |  # @XBZRLECacheStats: | ||||||
|  | -- 
 | ||||||
|  | 2.31.1 | ||||||
|  | 
 | ||||||
							
								
								
									
										56
									
								
								kvm-QIOChannelSocket-Add-support-for-MSG_ZEROCOPY-IPV6.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								kvm-QIOChannelSocket-Add-support-for-MSG_ZEROCOPY-IPV6.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,56 @@ | |||||||
|  | From cb6dc39a5e5d2d981b4b1e983042b3fbb529d5d1 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Leonardo Bras <leobras@redhat.com> | ||||||
|  | Date: Thu, 4 Aug 2022 04:10:43 -0300 | ||||||
|  | Subject: [PATCH 06/11] QIOChannelSocket: Add support for MSG_ZEROCOPY + IPV6 | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  | 
 | ||||||
|  | RH-Author: Leonardo Brás <leobras@redhat.com> | ||||||
|  | RH-MergeRequest: 111: zero-copy-send fixes & improvements | ||||||
|  | RH-Commit: [6/6] 2eb1aba8ebf267a6f67cfba2e489dc88619c7fd4 (LeoBras/centos-qemu-kvm) | ||||||
|  | RH-Bugzilla: 2107466 | ||||||
|  | RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> | ||||||
|  | RH-Acked-by: Thomas Huth <thuth@redhat.com> | ||||||
|  | RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||||||
|  | 
 | ||||||
|  | For using MSG_ZEROCOPY, there are two steps: | ||||||
|  | 1 - io_writev() the packet, which enqueues the packet for sending, and | ||||||
|  | 2 - io_flush(), which gets confirmation that all packets got correctly sent | ||||||
|  | 
 | ||||||
|  | Currently, if MSG_ZEROCOPY is used to send packets over IPV6, no error will | ||||||
|  | be reported in (1), but it will fail in the first time (2) happens. | ||||||
|  | 
 | ||||||
|  | This happens because (2) currently checks for cmsg_level & cmsg_type | ||||||
|  | associated with IPV4 only, before reporting any error. | ||||||
|  | 
 | ||||||
|  | Add checks for cmsg_level & cmsg_type associated with IPV6, and thus enable | ||||||
|  | support for MSG_ZEROCOPY + IPV6 | ||||||
|  | 
 | ||||||
|  | Fixes: 2bc58ffc29 ("QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX") | ||||||
|  | Signed-off-by: Leonardo Bras <leobras@redhat.com> | ||||||
|  | Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> | ||||||
|  | (cherry picked from commit 5258a7e2c0677d16e9e1d06845f60171adf0b290) | ||||||
|  | Signed-off-by: Leonardo Bras <leobras@redhat.com> | ||||||
|  | ---
 | ||||||
|  |  io/channel-socket.c | 4 ++-- | ||||||
|  |  1 file changed, 2 insertions(+), 2 deletions(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/io/channel-socket.c b/io/channel-socket.c
 | ||||||
|  | index eb7baa2184..efd5f60808 100644
 | ||||||
|  | --- a/io/channel-socket.c
 | ||||||
|  | +++ b/io/channel-socket.c
 | ||||||
|  | @@ -747,8 +747,8 @@ static int qio_channel_socket_flush(QIOChannel *ioc,
 | ||||||
|  |          } | ||||||
|  |   | ||||||
|  |          cm = CMSG_FIRSTHDR(&msg); | ||||||
|  | -        if (cm->cmsg_level != SOL_IP &&
 | ||||||
|  | -            cm->cmsg_type != IP_RECVERR) {
 | ||||||
|  | +        if (cm->cmsg_level != SOL_IP   && cm->cmsg_type != IP_RECVERR &&
 | ||||||
|  | +            cm->cmsg_level != SOL_IPV6 && cm->cmsg_type != IPV6_RECVERR) {
 | ||||||
|  |              error_setg_errno(errp, EPROTOTYPE, | ||||||
|  |                               "Wrong cmsg in errqueue"); | ||||||
|  |              return -1; | ||||||
|  | -- 
 | ||||||
|  | 2.31.1 | ||||||
|  | 
 | ||||||
| @ -0,0 +1,65 @@ | |||||||
|  | From 678981c6bb7c964e1591f6f8aba49e9602f64852 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Leonardo Bras <leobras@redhat.com> | ||||||
|  | Date: Mon, 11 Jul 2022 18:11:11 -0300 | ||||||
|  | Subject: [PATCH 01/11] QIOChannelSocket: Fix zero-copy flush returning code 1 | ||||||
|  |  when nothing sent | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  | 
 | ||||||
|  | RH-Author: Leonardo Brás <leobras@redhat.com> | ||||||
|  | RH-MergeRequest: 111: zero-copy-send fixes & improvements | ||||||
|  | RH-Commit: [1/6] cebc887cb61de1572d8ae3232cde45e80c339404 (LeoBras/centos-qemu-kvm) | ||||||
|  | RH-Bugzilla: 2107466 | ||||||
|  | RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> | ||||||
|  | RH-Acked-by: Thomas Huth <thuth@redhat.com> | ||||||
|  | RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||||||
|  | 
 | ||||||
|  | If flush is called when no buffer was sent with MSG_ZEROCOPY, it currently | ||||||
|  | returns 1. This return code should be used only when Linux fails to use | ||||||
|  | MSG_ZEROCOPY on a lot of sendmsg(). | ||||||
|  | 
 | ||||||
|  | Fix this by returning early from flush if no sendmsg(...,MSG_ZEROCOPY) | ||||||
|  | was attempted. | ||||||
|  | 
 | ||||||
|  | Fixes: 2bc58ffc2926 ("QIOChannelSocket: Implement io_writev zero copy flag & io_flush for CONFIG_LINUX") | ||||||
|  | Signed-off-by: Leonardo Bras <leobras@redhat.com> | ||||||
|  | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> | ||||||
|  | Acked-by: Daniel P. Berrangé <berrange@redhat.com> | ||||||
|  | Reviewed-by: Juan Quintela <quintela@redhat.com> | ||||||
|  | Reviewed-by: Peter Xu <peterx@redhat.com> | ||||||
|  | Message-Id: <20220711211112.18951-2-leobras@redhat.com> | ||||||
|  | Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||||||
|  | (cherry picked from commit 927f93e099c4f9184e60a1bc61624ac2d04d0223) | ||||||
|  | Signed-off-by: Leonardo Bras <leobras@redhat.com> | ||||||
|  | ---
 | ||||||
|  |  io/channel-socket.c | 8 +++++++- | ||||||
|  |  1 file changed, 7 insertions(+), 1 deletion(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/io/channel-socket.c b/io/channel-socket.c
 | ||||||
|  | index 8ae8b212cf..eb7baa2184 100644
 | ||||||
|  | --- a/io/channel-socket.c
 | ||||||
|  | +++ b/io/channel-socket.c
 | ||||||
|  | @@ -717,12 +717,18 @@ static int qio_channel_socket_flush(QIOChannel *ioc,
 | ||||||
|  |      struct cmsghdr *cm; | ||||||
|  |      char control[CMSG_SPACE(sizeof(*serr))]; | ||||||
|  |      int received; | ||||||
|  | -    int ret = 1;
 | ||||||
|  | +    int ret;
 | ||||||
|  | +
 | ||||||
|  | +    if (sioc->zero_copy_queued == sioc->zero_copy_sent) {
 | ||||||
|  | +        return 0;
 | ||||||
|  | +    }
 | ||||||
|  |   | ||||||
|  |      msg.msg_control = control; | ||||||
|  |      msg.msg_controllen = sizeof(control); | ||||||
|  |      memset(control, 0, sizeof(control)); | ||||||
|  |   | ||||||
|  | +    ret = 1;
 | ||||||
|  | +
 | ||||||
|  |      while (sioc->zero_copy_sent < sioc->zero_copy_queued) { | ||||||
|  |          received = recvmsg(sioc->fd, &msg, MSG_ERRQUEUE); | ||||||
|  |          if (received < 0) { | ||||||
|  | -- 
 | ||||||
|  | 2.31.1 | ||||||
|  | 
 | ||||||
| @ -0,0 +1,93 @@ | |||||||
|  | From 0753565af588dfa78b3529e359b1590e15fcbdb3 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Leonardo Bras <leobras@redhat.com> | ||||||
|  | Date: Tue, 19 Jul 2022 09:23:45 -0300 | ||||||
|  | Subject: [PATCH 04/11] migration: Avoid false-positive on non-supported | ||||||
|  |  scenarios for zero-copy-send | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  | 
 | ||||||
|  | RH-Author: Leonardo Brás <leobras@redhat.com> | ||||||
|  | RH-MergeRequest: 111: zero-copy-send fixes & improvements | ||||||
|  | RH-Commit: [4/6] f5c7ed6710d92668acb81d0118a71fab0b4e3d43 (LeoBras/centos-qemu-kvm) | ||||||
|  | RH-Bugzilla: 2107466 | ||||||
|  | RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> | ||||||
|  | RH-Acked-by: Thomas Huth <thuth@redhat.com> | ||||||
|  | RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||||||
|  | 
 | ||||||
|  | Migration with zero-copy-send currently has it's limitations, as it can't | ||||||
|  | be used with TLS nor any kind of compression. In such scenarios, it should | ||||||
|  | output errors during parameter / capability setting. | ||||||
|  | 
 | ||||||
|  | But currently there are some ways of setting this not-supported scenarios | ||||||
|  | without printing the error message: | ||||||
|  | 
 | ||||||
|  | !) For 'compression' capability, it works by enabling it together with
 | ||||||
|  | zero-copy-send. This happens because the validity test for zero-copy uses | ||||||
|  | the helper unction migrate_use_compression(), which check for compression | ||||||
|  | presence in s->enabled_capabilities[MIGRATION_CAPABILITY_COMPRESS]. | ||||||
|  | 
 | ||||||
|  | The point here is: the validity test happens before the capability gets | ||||||
|  | enabled. If all of them get enabled together, this test will not return | ||||||
|  | error. | ||||||
|  | 
 | ||||||
|  | In order to fix that, replace migrate_use_compression() by directly testing | ||||||
|  | the cap_list parameter migrate_caps_check(). | ||||||
|  | 
 | ||||||
|  | 2) For features enabled by parameters such as TLS & 'multifd_compression', | ||||||
|  | there was also a possibility of setting non-supported scenarios: setting | ||||||
|  | zero-copy-send first, then setting the unsupported parameter. | ||||||
|  | 
 | ||||||
|  | In order to fix that, also add a check for parameters conflicting with | ||||||
|  | zero-copy-send on migrate_params_check(). | ||||||
|  | 
 | ||||||
|  | 3) XBZRLE is also a compression capability, so it makes sense to also add | ||||||
|  | it to the list of capabilities which are not supported with zero-copy-send. | ||||||
|  | 
 | ||||||
|  | Fixes: 1abaec9a1b2c ("migration: Change zero_copy_send from migration parameter to migration capability") | ||||||
|  | Signed-off-by: Leonardo Bras <leobras@redhat.com> | ||||||
|  | Message-Id: <20220719122345.253713-1-leobras@redhat.com> | ||||||
|  | Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||||||
|  | Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||||||
|  | (cherry picked from commit 90eb69e4f1a16b388d0483543bf6bfc69a9966e4) | ||||||
|  | Signed-off-by: Leonardo Bras <leobras@redhat.com> | ||||||
|  | ---
 | ||||||
|  |  migration/migration.c | 15 ++++++++++++++- | ||||||
|  |  1 file changed, 14 insertions(+), 1 deletion(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/migration/migration.c b/migration/migration.c
 | ||||||
|  | index 3a3a7a4a50..343629d59c 100644
 | ||||||
|  | --- a/migration/migration.c
 | ||||||
|  | +++ b/migration/migration.c
 | ||||||
|  | @@ -1265,7 +1265,9 @@ static bool migrate_caps_check(bool *cap_list,
 | ||||||
|  |  #ifdef CONFIG_LINUX | ||||||
|  |      if (cap_list[MIGRATION_CAPABILITY_ZERO_COPY_SEND] && | ||||||
|  |          (!cap_list[MIGRATION_CAPABILITY_MULTIFD] || | ||||||
|  | -         migrate_use_compression() ||
 | ||||||
|  | +         cap_list[MIGRATION_CAPABILITY_COMPRESS] ||
 | ||||||
|  | +         cap_list[MIGRATION_CAPABILITY_XBZRLE] ||
 | ||||||
|  | +         migrate_multifd_compression() ||
 | ||||||
|  |           migrate_use_tls())) { | ||||||
|  |          error_setg(errp, | ||||||
|  |                     "Zero copy only available for non-compressed non-TLS multifd migration"); | ||||||
|  | @@ -1502,6 +1504,17 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp)
 | ||||||
|  |          error_prepend(errp, "Invalid mapping given for block-bitmap-mapping: "); | ||||||
|  |          return false; | ||||||
|  |      } | ||||||
|  | +
 | ||||||
|  | +#ifdef CONFIG_LINUX
 | ||||||
|  | +    if (migrate_use_zero_copy_send() &&
 | ||||||
|  | +        ((params->has_multifd_compression && params->multifd_compression) ||
 | ||||||
|  | +         (params->has_tls_creds && params->tls_creds && *params->tls_creds))) {
 | ||||||
|  | +        error_setg(errp,
 | ||||||
|  | +                   "Zero copy only available for non-compressed non-TLS multifd migration");
 | ||||||
|  | +        return false;
 | ||||||
|  | +    }
 | ||||||
|  | +#endif
 | ||||||
|  | +
 | ||||||
|  |      return true; | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | -- 
 | ||||||
|  | 2.31.1 | ||||||
|  | 
 | ||||||
| @ -0,0 +1,62 @@ | |||||||
|  | From 9698c0e8dd9b4f5dbc237a3f98ac46297dac85fb Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Leonardo Bras <leobras@redhat.com> | ||||||
|  | Date: Mon, 25 Jul 2022 22:02:35 -0300 | ||||||
|  | Subject: [PATCH 05/11] migration: add remaining params->has_* = true in | ||||||
|  |  migration_instance_init() | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  | 
 | ||||||
|  | RH-Author: Leonardo Brás <leobras@redhat.com> | ||||||
|  | RH-MergeRequest: 111: zero-copy-send fixes & improvements | ||||||
|  | RH-Commit: [5/6] 50bbad254e2356b3ae16f6e00a3db8fd0b22dde9 (LeoBras/centos-qemu-kvm) | ||||||
|  | RH-Bugzilla: 2107466 | ||||||
|  | RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> | ||||||
|  | RH-Acked-by: Thomas Huth <thuth@redhat.com> | ||||||
|  | RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||||||
|  | 
 | ||||||
|  | Some of params->has_* = true are missing in migration_instance_init, this | ||||||
|  | causes migrate_params_check() to skip some tests, allowing some | ||||||
|  | unsupported scenarios. | ||||||
|  | 
 | ||||||
|  | Fix this by adding all missing params->has_* = true in | ||||||
|  | migration_instance_init(). | ||||||
|  | 
 | ||||||
|  | Fixes: 69ef1f36b0 ("migration: define 'tls-creds' and 'tls-hostname' migration parameters") | ||||||
|  | Fixes: 1d58872a91 ("migration: do not wait for free thread") | ||||||
|  | Fixes: d2f1d29b95 ("migration: add support for a "tls-authz" migration parameter") | ||||||
|  | Signed-off-by: Leonardo Bras <leobras@redhat.com> | ||||||
|  | Message-Id: <20220726010235.342927-1-leobras@redhat.com> | ||||||
|  | Reviewed-by: Peter Xu <peterx@redhat.com> | ||||||
|  | Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||||||
|  | (cherry picked from commit df67aa3e61e2c83459da7d815962d9706f1528fc) | ||||||
|  | Signed-off-by: Leonardo Bras <leobras@redhat.com> | ||||||
|  | ---
 | ||||||
|  |  migration/migration.c | 4 ++++ | ||||||
|  |  1 file changed, 4 insertions(+) | ||||||
|  | 
 | ||||||
|  | diff --git a/migration/migration.c b/migration/migration.c
 | ||||||
|  | index 343629d59c..5e78028df4 100644
 | ||||||
|  | --- a/migration/migration.c
 | ||||||
|  | +++ b/migration/migration.c
 | ||||||
|  | @@ -4332,6 +4332,7 @@ static void migration_instance_init(Object *obj)
 | ||||||
|  |      /* Set has_* up only for parameter checks */ | ||||||
|  |      params->has_compress_level = true; | ||||||
|  |      params->has_compress_threads = true; | ||||||
|  | +    params->has_compress_wait_thread = true;
 | ||||||
|  |      params->has_decompress_threads = true; | ||||||
|  |      params->has_throttle_trigger_threshold = true; | ||||||
|  |      params->has_cpu_throttle_initial = true; | ||||||
|  | @@ -4352,6 +4353,9 @@ static void migration_instance_init(Object *obj)
 | ||||||
|  |      params->has_announce_max = true; | ||||||
|  |      params->has_announce_rounds = true; | ||||||
|  |      params->has_announce_step = true; | ||||||
|  | +    params->has_tls_creds = true;
 | ||||||
|  | +    params->has_tls_hostname = true;
 | ||||||
|  | +    params->has_tls_authz = true;
 | ||||||
|  |   | ||||||
|  |      qemu_sem_init(&ms->postcopy_pause_sem, 0); | ||||||
|  |      qemu_sem_init(&ms->postcopy_pause_rp_sem, 0); | ||||||
|  | -- 
 | ||||||
|  | 2.31.1 | ||||||
|  | 
 | ||||||
| @ -0,0 +1,83 @@ | |||||||
|  | From 78bbe28d5f5691330239041448cccfb339eed779 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Leonardo Bras <leobras@redhat.com> | ||||||
|  | Date: Mon, 11 Jul 2022 18:11:13 -0300 | ||||||
|  | Subject: [PATCH 03/11] migration/multifd: Report to user when zerocopy not | ||||||
|  |  working | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  | 
 | ||||||
|  | RH-Author: Leonardo Brás <leobras@redhat.com> | ||||||
|  | RH-MergeRequest: 111: zero-copy-send fixes & improvements | ||||||
|  | RH-Commit: [3/6] 4f9165325b3cb8ff16d8b3b7649ff780fae0e2ad (LeoBras/centos-qemu-kvm) | ||||||
|  | RH-Bugzilla: 2107466 | ||||||
|  | RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com> | ||||||
|  | RH-Acked-by: Thomas Huth <thuth@redhat.com> | ||||||
|  | RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||||||
|  | 
 | ||||||
|  | Some errors, like the lack of Scatter-Gather support by the network | ||||||
|  | interface(NETIF_F_SG) may cause sendmsg(...,MSG_ZEROCOPY) to fail on using | ||||||
|  | zero-copy, which causes it to fall back to the default copying mechanism. | ||||||
|  | 
 | ||||||
|  | After each full dirty-bitmap scan there should be a zero-copy flush | ||||||
|  | happening, which checks for errors each of the previous calls to | ||||||
|  | sendmsg(...,MSG_ZEROCOPY). If all of them failed to use zero-copy, then | ||||||
|  | increment dirty_sync_missed_zero_copy migration stat to let the user know | ||||||
|  | about it. | ||||||
|  | 
 | ||||||
|  | Signed-off-by: Leonardo Bras <leobras@redhat.com> | ||||||
|  | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> | ||||||
|  | Acked-by: Peter Xu <peterx@redhat.com> | ||||||
|  | Message-Id: <20220711211112.18951-4-leobras@redhat.com> | ||||||
|  | Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||||||
|  | (cherry picked from commit d59c40cc483729f2e67c80e58df769ad19976fe9) | ||||||
|  | Signed-off-by: Leonardo Bras <leobras@redhat.com> | ||||||
|  | ---
 | ||||||
|  |  migration/multifd.c | 2 ++ | ||||||
|  |  migration/ram.c     | 5 +++++ | ||||||
|  |  migration/ram.h     | 2 ++ | ||||||
|  |  3 files changed, 9 insertions(+) | ||||||
|  | 
 | ||||||
|  | diff --git a/migration/multifd.c b/migration/multifd.c
 | ||||||
|  | index 0b5b41c53f..96e5f0a058 100644
 | ||||||
|  | --- a/migration/multifd.c
 | ||||||
|  | +++ b/migration/multifd.c
 | ||||||
|  | @@ -626,6 +626,8 @@ int multifd_send_sync_main(QEMUFile *f)
 | ||||||
|  |              if (ret < 0) { | ||||||
|  |                  error_report_err(err); | ||||||
|  |                  return -1; | ||||||
|  | +            } else if (ret == 1) {
 | ||||||
|  | +                dirty_sync_missed_zero_copy();
 | ||||||
|  |              } | ||||||
|  |          } | ||||||
|  |      } | ||||||
|  | diff --git a/migration/ram.c b/migration/ram.c
 | ||||||
|  | index ee40e4a718..c437ff1b1f 100644
 | ||||||
|  | --- a/migration/ram.c
 | ||||||
|  | +++ b/migration/ram.c
 | ||||||
|  | @@ -406,6 +406,11 @@ static void ram_transferred_add(uint64_t bytes)
 | ||||||
|  |      ram_counters.transferred += bytes; | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +void dirty_sync_missed_zero_copy(void)
 | ||||||
|  | +{
 | ||||||
|  | +    ram_counters.dirty_sync_missed_zero_copy++;
 | ||||||
|  | +}
 | ||||||
|  | +
 | ||||||
|  |  /* used by the search for pages to send */ | ||||||
|  |  struct PageSearchStatus { | ||||||
|  |      /* Current block being searched */ | ||||||
|  | diff --git a/migration/ram.h b/migration/ram.h
 | ||||||
|  | index 2c6dc3675d..34adf5cb92 100644
 | ||||||
|  | --- a/migration/ram.h
 | ||||||
|  | +++ b/migration/ram.h
 | ||||||
|  | @@ -86,4 +86,6 @@ void ram_write_tracking_prepare(void);
 | ||||||
|  |  int ram_write_tracking_start(void); | ||||||
|  |  void ram_write_tracking_stop(void); | ||||||
|  |   | ||||||
|  | +void dirty_sync_missed_zero_copy(void);
 | ||||||
|  | +
 | ||||||
|  |  #endif | ||||||
|  | -- 
 | ||||||
|  | 2.31.1 | ||||||
|  | 
 | ||||||
| @ -0,0 +1,63 @@ | |||||||
|  | From 03996a8a826c9186e4a16e1b4757f1ef5947a503 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Thomas Huth <thuth@redhat.com> | ||||||
|  | Date: Fri, 5 Aug 2022 11:42:14 +0200 | ||||||
|  | Subject: [PATCH 07/11] pc-bios/s390-ccw: Fix booting with logical block size < | ||||||
|  |  physical block size | ||||||
|  | 
 | ||||||
|  | RH-Author: Thomas Huth <thuth@redhat.com> | ||||||
|  | RH-MergeRequest: 113: pc-bios/s390-ccw: Fix booting with logical block size < physical block size | ||||||
|  | RH-Commit: [1/1] a45ff477bc7d7011ea6c4d42a1aade213d1e4690 (thuth/qemu-kvm-cs9) | ||||||
|  | RH-Bugzilla: 2112303 | ||||||
|  | RH-Acked-by: Cornelia Huck <cohuck@redhat.com> | ||||||
|  | RH-Acked-by: David Hildenbrand <david@redhat.com> | ||||||
|  | RH-Acked-by: Claudio Imbrenda <None> | ||||||
|  | 
 | ||||||
|  | For accessing single blocks during boot, it's the logical block size that | ||||||
|  | matters. (Physical block sizes are rather interesting e.g. for creating | ||||||
|  | file systems with the correct alignment for speed reasons etc.). | ||||||
|  | So the s390-ccw bios has to use the logical block size for calculating | ||||||
|  | sector numbers during the boot phase, the "physical_block_exp" shift | ||||||
|  | value must not be taken into account. This change fixes the boot process | ||||||
|  | when the guest hast been installed on a disk where the logical block size | ||||||
|  | differs from the physical one, e.g. if the guest has been installed
 | ||||||
|  | like this: | ||||||
|  | 
 | ||||||
|  |  qemu-system-s390x -nographic -accel kvm -m 2G \ | ||||||
|  |   -drive if=none,id=d1,file=fedora.iso,format=raw,media=cdrom \ | ||||||
|  |   -device virtio-scsi -device scsi-cd,drive=d1 \ | ||||||
|  |   -drive if=none,id=d2,file=test.qcow2,format=qcow2 | ||||||
|  |   -device virtio-blk,drive=d2,physical_block_size=4096,logical_block_size=512 | ||||||
|  | 
 | ||||||
|  | Linux correctly uses the logical block size of 512 for the installation, | ||||||
|  | but the s390-ccw bios tries to boot from a disk with 4096 block size so | ||||||
|  | far, as long as this patch has not been applied yet (well, it used to work | ||||||
|  | by accident in the past due to the virtio_assume_scsi() hack that used to | ||||||
|  | enforce 512 byte sectors on all virtio-block disks, but that hack has been | ||||||
|  | well removed in commit 5447de2619050a0a4d to fix other scenarios). | ||||||
|  | 
 | ||||||
|  | Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2112303 | ||||||
|  | Message-Id: <20220805094214.285223-1-thuth@redhat.com> | ||||||
|  | Reviewed-by: Cornelia Huck <cohuck@redhat.com> | ||||||
|  | Reviewed-by: Eric Farman <farman@linux.ibm.com> | ||||||
|  | Signed-off-by: Thomas Huth <thuth@redhat.com> | ||||||
|  | (cherry picked from commit 393296de19650e1400ca265914cfdeb313725363) | ||||||
|  | ---
 | ||||||
|  |  pc-bios/s390-ccw/virtio-blkdev.c | 2 +- | ||||||
|  |  1 file changed, 1 insertion(+), 1 deletion(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blkdev.c
 | ||||||
|  | index 8271c47296..794f99b42c 100644
 | ||||||
|  | --- a/pc-bios/s390-ccw/virtio-blkdev.c
 | ||||||
|  | +++ b/pc-bios/s390-ccw/virtio-blkdev.c
 | ||||||
|  | @@ -173,7 +173,7 @@ int virtio_get_block_size(void)
 | ||||||
|  |   | ||||||
|  |      switch (vdev->senseid.cu_model) { | ||||||
|  |      case VIRTIO_ID_BLOCK: | ||||||
|  | -        return vdev->config.blk.blk_size << vdev->config.blk.physical_block_exp;
 | ||||||
|  | +        return vdev->config.blk.blk_size;
 | ||||||
|  |      case VIRTIO_ID_SCSI: | ||||||
|  |          return vdev->scsi_block_size; | ||||||
|  |      } | ||||||
|  | -- 
 | ||||||
|  | 2.31.1 | ||||||
|  | 
 | ||||||
| @ -0,0 +1,50 @@ | |||||||
|  | From e19adb058502e24580dbc4f6f944cd951ca288ed Mon Sep 17 00:00:00 2001 | ||||||
|  | From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com> | ||||||
|  | Date: Thu, 12 May 2022 19:57:44 +0200 | ||||||
|  | Subject: [PATCH 08/11] vdpa: Fix bad index calculus at | ||||||
|  |  vhost_vdpa_get_vring_base | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  | 
 | ||||||
|  | RH-Author: Eugenio Pérez <eperezma@redhat.com> | ||||||
|  | RH-MergeRequest: 114: vdpa: Fix memory listener deletions of iova tree | ||||||
|  | RH-Commit: [1/4] 754fb8960684fa7a91bddb18c8df58c3b947ee75 (eperezmartin/qemu-kvm) | ||||||
|  | RH-Bugzilla: 2116876 | ||||||
|  | RH-Acked-by: Jason Wang <jasowang@redhat.com> | ||||||
|  | RH-Acked-by: Cindy Lu <lulu@redhat.com> | ||||||
|  | RH-Acked-by: Laurent Vivier <lvivier@redhat.com> | ||||||
|  | 
 | ||||||
|  | Fixes: 6d0b222666 ("vdpa: Adapt vhost_vdpa_get_vring_base to SVQ") | ||||||
|  | 
 | ||||||
|  | Acked-by: Jason Wang <jasowang@redhat.com> | ||||||
|  | Signed-off-by: Eugenio Pérez <eperezma@redhat.com> | ||||||
|  | Message-Id: <20220512175747.142058-4-eperezma@redhat.com> | ||||||
|  | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||||||
|  | Signed-off-by: Michael S. Tsirkin <mst@redhat.com> | ||||||
|  | (cherry picked from commit 639036477ef890958415967e753ca2cbb348c16c) | ||||||
|  | ---
 | ||||||
|  |  hw/virtio/vhost-vdpa.c | 4 ++-- | ||||||
|  |  1 file changed, 2 insertions(+), 2 deletions(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
 | ||||||
|  | index e3e5bce4bb..a7dfac530f 100644
 | ||||||
|  | --- a/hw/virtio/vhost-vdpa.c
 | ||||||
|  | +++ b/hw/virtio/vhost-vdpa.c
 | ||||||
|  | @@ -1193,11 +1193,11 @@ static int vhost_vdpa_get_vring_base(struct vhost_dev *dev,
 | ||||||
|  |                                         struct vhost_vring_state *ring) | ||||||
|  |  { | ||||||
|  |      struct vhost_vdpa *v = dev->opaque; | ||||||
|  | +    int vdpa_idx = ring->index - dev->vq_index;
 | ||||||
|  |      int ret; | ||||||
|  |   | ||||||
|  |      if (v->shadow_vqs_enabled) { | ||||||
|  | -        VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs,
 | ||||||
|  | -                                                      ring->index);
 | ||||||
|  | +        VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, vdpa_idx);
 | ||||||
|  |   | ||||||
|  |          /* | ||||||
|  |           * Setting base as last used idx, so destination will see as available | ||||||
|  | -- 
 | ||||||
|  | 2.31.1 | ||||||
|  | 
 | ||||||
| @ -0,0 +1,58 @@ | |||||||
|  | From 71857062b7aea29fc418e107244cf4083cd78cd7 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com> | ||||||
|  | Date: Tue, 2 Aug 2022 13:24:46 +0200 | ||||||
|  | Subject: [PATCH 11/11] vdpa: Fix file descriptor leak on get features error | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  | 
 | ||||||
|  | RH-Author: Eugenio Pérez <eperezma@redhat.com> | ||||||
|  | RH-MergeRequest: 114: vdpa: Fix memory listener deletions of iova tree | ||||||
|  | RH-Commit: [4/4] bdfe6ed4539ecf68dc8bc4519755f9d5c096447d (eperezmartin/qemu-kvm) | ||||||
|  | RH-Bugzilla: 2116876 | ||||||
|  | RH-Acked-by: Jason Wang <jasowang@redhat.com> | ||||||
|  | RH-Acked-by: Cindy Lu <lulu@redhat.com> | ||||||
|  | RH-Acked-by: Laurent Vivier <lvivier@redhat.com> | ||||||
|  | 
 | ||||||
|  | File descriptor vdpa_device_fd is not free in the case of returning | ||||||
|  | error from vhost_vdpa_get_features. Fixing it by making all errors go to | ||||||
|  | the same error path. | ||||||
|  | 
 | ||||||
|  | Resolves: Coverity CID 1490785 | ||||||
|  | Fixes: 8170ab3f43 ("vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairs") | ||||||
|  | 
 | ||||||
|  | Signed-off-by: Eugenio Pérez <eperezma@redhat.com> | ||||||
|  | Reviewed-by: Laurent Vivier <lvivier@redhat.com> | ||||||
|  | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||||||
|  | Message-Id: <20220802112447.249436-2-eperezma@redhat.com> | ||||||
|  | Signed-off-by: Laurent Vivier <laurent@vivier.eu> | ||||||
|  | (cherry picked from commit aed5da45daf734ddc543c0791e877dac75e16f61) | ||||||
|  | ---
 | ||||||
|  |  net/vhost-vdpa.c | 4 ++-- | ||||||
|  |  1 file changed, 2 insertions(+), 2 deletions(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
 | ||||||
|  | index 50672bcd66..411e71e6c2 100644
 | ||||||
|  | --- a/net/vhost-vdpa.c
 | ||||||
|  | +++ b/net/vhost-vdpa.c
 | ||||||
|  | @@ -566,7 +566,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
 | ||||||
|  |      g_autofree NetClientState **ncs = NULL; | ||||||
|  |      g_autoptr(VhostIOVATree) iova_tree = NULL; | ||||||
|  |      NetClientState *nc; | ||||||
|  | -    int queue_pairs, r, i, has_cvq = 0;
 | ||||||
|  | +    int queue_pairs, r, i = 0, has_cvq = 0;
 | ||||||
|  |   | ||||||
|  |      assert(netdev->type == NET_CLIENT_DRIVER_VHOST_VDPA); | ||||||
|  |      opts = &netdev->u.vhost_vdpa; | ||||||
|  | @@ -582,7 +582,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
 | ||||||
|  |   | ||||||
|  |      r = vhost_vdpa_get_features(vdpa_device_fd, &features, errp); | ||||||
|  |      if (unlikely(r < 0)) { | ||||||
|  | -        return r;
 | ||||||
|  | +        goto err;
 | ||||||
|  |      } | ||||||
|  |   | ||||||
|  |      queue_pairs = vhost_vdpa_get_max_queue_pairs(vdpa_device_fd, features, | ||||||
|  | -- 
 | ||||||
|  | 2.31.1 | ||||||
|  | 
 | ||||||
							
								
								
									
										45
									
								
								kvm-vdpa-Fix-index-calculus-at-vhost_vdpa_svqs_start.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								kvm-vdpa-Fix-index-calculus-at-vhost_vdpa_svqs_start.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,45 @@ | |||||||
|  | From 6335431b70dd55c1d52152d726fa462db2e10eb8 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com> | ||||||
|  | Date: Thu, 12 May 2022 19:57:45 +0200 | ||||||
|  | Subject: [PATCH 09/11] vdpa: Fix index calculus at vhost_vdpa_svqs_start | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  | 
 | ||||||
|  | RH-Author: Eugenio Pérez <eperezma@redhat.com> | ||||||
|  | RH-MergeRequest: 114: vdpa: Fix memory listener deletions of iova tree | ||||||
|  | RH-Commit: [2/4] 9ce732e6bba426f8e00020ee6ad77f972f3e75b5 (eperezmartin/qemu-kvm) | ||||||
|  | RH-Bugzilla: 2116876 | ||||||
|  | RH-Acked-by: Jason Wang <jasowang@redhat.com> | ||||||
|  | RH-Acked-by: Cindy Lu <lulu@redhat.com> | ||||||
|  | RH-Acked-by: Laurent Vivier <lvivier@redhat.com> | ||||||
|  | 
 | ||||||
|  | With the introduction of MQ the index of the vq needs to be calculated | ||||||
|  | with the device model vq_index. | ||||||
|  | 
 | ||||||
|  | Signed-off-by: Eugenio Pérez <eperezma@redhat.com> | ||||||
|  | Acked-by: Jason Wang <jasowang@redhat.com> | ||||||
|  | Message-Id: <20220512175747.142058-5-eperezma@redhat.com> | ||||||
|  | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||||||
|  | Signed-off-by: Michael S. Tsirkin <mst@redhat.com> | ||||||
|  | (cherry picked from commit 1c82fdfef8a227518ffecae9d419bcada995c202) | ||||||
|  | ---
 | ||||||
|  |  hw/virtio/vhost-vdpa.c | 2 +- | ||||||
|  |  1 file changed, 1 insertion(+), 1 deletion(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
 | ||||||
|  | index a7dfac530f..f877b354fa 100644
 | ||||||
|  | --- a/hw/virtio/vhost-vdpa.c
 | ||||||
|  | +++ b/hw/virtio/vhost-vdpa.c
 | ||||||
|  | @@ -1032,7 +1032,7 @@ static bool vhost_vdpa_svqs_start(struct vhost_dev *dev)
 | ||||||
|  |          VirtQueue *vq = virtio_get_queue(dev->vdev, dev->vq_index + i); | ||||||
|  |          VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, i); | ||||||
|  |          struct vhost_vring_addr addr = { | ||||||
|  | -            .index = i,
 | ||||||
|  | +            .index = dev->vq_index + i,
 | ||||||
|  |          }; | ||||||
|  |          int r; | ||||||
|  |          bool ok = vhost_vdpa_svq_setup(dev, svq, i, &err); | ||||||
|  | -- 
 | ||||||
|  | 2.31.1 | ||||||
|  | 
 | ||||||
							
								
								
									
										61
									
								
								kvm-vdpa-Fix-memory-listener-deletions-of-iova-tree.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								kvm-vdpa-Fix-memory-listener-deletions-of-iova-tree.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,61 @@ | |||||||
|  | From b212edc97a471c75f8b8b44ee2a3a2cf82ef14d9 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com> | ||||||
|  | Date: Fri, 22 Jul 2022 10:26:30 +0200 | ||||||
|  | Subject: [PATCH 10/11] vdpa: Fix memory listener deletions of iova tree | ||||||
|  | MIME-Version: 1.0 | ||||||
|  | Content-Type: text/plain; charset=UTF-8 | ||||||
|  | Content-Transfer-Encoding: 8bit | ||||||
|  | 
 | ||||||
|  | RH-Author: Eugenio Pérez <eperezma@redhat.com> | ||||||
|  | RH-MergeRequest: 114: vdpa: Fix memory listener deletions of iova tree | ||||||
|  | RH-Commit: [3/4] ad71f098b3fa8654962ac7872b5393c37c9825f2 (eperezmartin/qemu-kvm) | ||||||
|  | RH-Bugzilla: 2116876 | ||||||
|  | RH-Acked-by: Jason Wang <jasowang@redhat.com> | ||||||
|  | RH-Acked-by: Cindy Lu <lulu@redhat.com> | ||||||
|  | RH-Acked-by: Laurent Vivier <lvivier@redhat.com> | ||||||
|  | 
 | ||||||
|  | vhost_vdpa_listener_region_del is always deleting the first iova entry | ||||||
|  | of the tree, since it's using the needle iova instead of the result's | ||||||
|  | one. | ||||||
|  | 
 | ||||||
|  | This was detected using a vga virtual device in the VM using vdpa SVQ. | ||||||
|  | It makes some extra memory adding and deleting, so the wrong one was | ||||||
|  | mapped / unmapped. This was undetected before since all the memory was | ||||||
|  | mappend and unmapped totally without that device, but other conditions | ||||||
|  | could trigger it too: | ||||||
|  | 
 | ||||||
|  | * mem_region was with .iova = 0, .translated_addr = (correct GPA). | ||||||
|  | * iova_tree_find_iova returned right result, but does not update | ||||||
|  |   mem_region. | ||||||
|  | * iova_tree_remove always removed region with .iova = 0. Right iova were | ||||||
|  |   sent to the device. | ||||||
|  | * Next map will fill the first region with .iova = 0, causing a mapping | ||||||
|  |   with the same iova and device complains, if the next action is a map. | ||||||
|  | * Next unmap will cause to try to unmap again iova = 0, causing the | ||||||
|  |   device to complain that no region was mapped at iova = 0. | ||||||
|  | 
 | ||||||
|  | Fixes: 34e3c94edaef ("vdpa: Add custom IOTLB translations to SVQ") | ||||||
|  | Reported-by: Lei Yang <leiyang@redhat.com> | ||||||
|  | Signed-off-by: Eugenio Pérez <eperezma@redhat.com> | ||||||
|  | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||||||
|  | (cherry picked from commit 75a8ce64f6e37513698857fb4284170da163ed06) | ||||||
|  | ---
 | ||||||
|  |  hw/virtio/vhost-vdpa.c | 2 +- | ||||||
|  |  1 file changed, 1 insertion(+), 1 deletion(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
 | ||||||
|  | index f877b354fa..03dc6014b0 100644
 | ||||||
|  | --- a/hw/virtio/vhost-vdpa.c
 | ||||||
|  | +++ b/hw/virtio/vhost-vdpa.c
 | ||||||
|  | @@ -288,7 +288,7 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener,
 | ||||||
|  |   | ||||||
|  |          result = vhost_iova_tree_find_iova(v->iova_tree, &mem_region); | ||||||
|  |          iova = result->iova; | ||||||
|  | -        vhost_iova_tree_remove(v->iova_tree, &mem_region);
 | ||||||
|  | +        vhost_iova_tree_remove(v->iova_tree, result);
 | ||||||
|  |      } | ||||||
|  |      vhost_vdpa_iotlb_batch_begin_once(v); | ||||||
|  |      ret = vhost_vdpa_dma_unmap(v, iova, int128_get64(llsize)); | ||||||
|  | -- 
 | ||||||
|  | 2.31.1 | ||||||
|  | 
 | ||||||
| @ -151,7 +151,7 @@ Obsoletes: %{name}-block-ssh <= %{epoch}:%{version}                    \ | |||||||
| Summary: QEMU is a machine emulator and virtualizer | Summary: QEMU is a machine emulator and virtualizer | ||||||
| Name: qemu-kvm | Name: qemu-kvm | ||||||
| Version: 7.0.0 | Version: 7.0.0 | ||||||
| Release: 10%{?rcrel}%{?dist}%{?cc_suffix} | Release: 11%{?rcrel}%{?dist}%{?cc_suffix} | ||||||
| # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped | # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped | ||||||
| # Epoch 15 used for RHEL 8 | # Epoch 15 used for RHEL 8 | ||||||
| # Epoch 17 used for RHEL 9 (due to release versioning offset in RHEL 8.5) | # Epoch 17 used for RHEL 9 (due to release versioning offset in RHEL 8.5) | ||||||
| @ -422,6 +422,28 @@ Patch133: kvm-kvm-don-t-use-perror-without-useful-errno.patch | |||||||
| Patch134: kvm-multifd-Copy-pages-before-compressing-them-with-zlib.patch | Patch134: kvm-multifd-Copy-pages-before-compressing-them-with-zlib.patch | ||||||
| # For bz#2099934 - Guest reboot on destination host after postcopy migration completed | # For bz#2099934 - Guest reboot on destination host after postcopy migration completed | ||||||
| Patch135: kvm-Revert-migration-Simplify-unqueue_page.patch | Patch135: kvm-Revert-migration-Simplify-unqueue_page.patch | ||||||
|  | # For bz#2107466 - zerocopy capability can be enabled when set migrate capabilities with multifd and compress/xbzrle together | ||||||
|  | Patch136: kvm-QIOChannelSocket-Fix-zero-copy-flush-returning-code-.patch | ||||||
|  | # For bz#2107466 - zerocopy capability can be enabled when set migrate capabilities with multifd and compress/xbzrle together | ||||||
|  | Patch137: kvm-Add-dirty-sync-missed-zero-copy-migration-stat.patch | ||||||
|  | # For bz#2107466 - zerocopy capability can be enabled when set migrate capabilities with multifd and compress/xbzrle together | ||||||
|  | Patch138: kvm-migration-multifd-Report-to-user-when-zerocopy-not-w.patch | ||||||
|  | # For bz#2107466 - zerocopy capability can be enabled when set migrate capabilities with multifd and compress/xbzrle together | ||||||
|  | Patch139: kvm-migration-Avoid-false-positive-on-non-supported-scen.patch | ||||||
|  | # For bz#2107466 - zerocopy capability can be enabled when set migrate capabilities with multifd and compress/xbzrle together | ||||||
|  | Patch140: kvm-migration-add-remaining-params-has_-true-in-migratio.patch | ||||||
|  | # For bz#2107466 - zerocopy capability can be enabled when set migrate capabilities with multifd and compress/xbzrle together | ||||||
|  | Patch141: kvm-QIOChannelSocket-Add-support-for-MSG_ZEROCOPY-IPV6.patch | ||||||
|  | # For bz#2112303 - virtio-blk: Can't boot fresh installation from used 512 cluster_size image under certain conditions | ||||||
|  | Patch142: kvm-pc-bios-s390-ccw-Fix-booting-with-logical-block-size.patch | ||||||
|  | # For bz#2116876 - Fixes for vDPA control virtqueue support in Qemu | ||||||
|  | Patch143: kvm-vdpa-Fix-bad-index-calculus-at-vhost_vdpa_get_vring_.patch | ||||||
|  | # For bz#2116876 - Fixes for vDPA control virtqueue support in Qemu | ||||||
|  | Patch144: kvm-vdpa-Fix-index-calculus-at-vhost_vdpa_svqs_start.patch | ||||||
|  | # For bz#2116876 - Fixes for vDPA control virtqueue support in Qemu | ||||||
|  | Patch145: kvm-vdpa-Fix-memory-listener-deletions-of-iova-tree.patch | ||||||
|  | # For bz#2116876 - Fixes for vDPA control virtqueue support in Qemu | ||||||
|  | Patch146: kvm-vdpa-Fix-file-descriptor-leak-on-get-features-error.patch | ||||||
| 
 | 
 | ||||||
| # Source-git patches | # Source-git patches | ||||||
| 
 | 
 | ||||||
| @ -1457,6 +1479,25 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ | |||||||
| %endif | %endif | ||||||
| 
 | 
 | ||||||
| %changelog | %changelog | ||||||
|  | * Mon Aug 15 2022 Miroslav Rezanina <mrezanin@redhat.com> - 7.0.0-11 | ||||||
|  | - kvm-QIOChannelSocket-Fix-zero-copy-flush-returning-code-.patch [bz#2107466] | ||||||
|  | - kvm-Add-dirty-sync-missed-zero-copy-migration-stat.patch [bz#2107466] | ||||||
|  | - kvm-migration-multifd-Report-to-user-when-zerocopy-not-w.patch [bz#2107466] | ||||||
|  | - kvm-migration-Avoid-false-positive-on-non-supported-scen.patch [bz#2107466] | ||||||
|  | - kvm-migration-add-remaining-params-has_-true-in-migratio.patch [bz#2107466] | ||||||
|  | - kvm-QIOChannelSocket-Add-support-for-MSG_ZEROCOPY-IPV6.patch [bz#2107466] | ||||||
|  | - kvm-pc-bios-s390-ccw-Fix-booting-with-logical-block-size.patch [bz#2112303] | ||||||
|  | - kvm-vdpa-Fix-bad-index-calculus-at-vhost_vdpa_get_vring_.patch [bz#2116876] | ||||||
|  | - kvm-vdpa-Fix-index-calculus-at-vhost_vdpa_svqs_start.patch [bz#2116876] | ||||||
|  | - kvm-vdpa-Fix-memory-listener-deletions-of-iova-tree.patch [bz#2116876] | ||||||
|  | - kvm-vdpa-Fix-file-descriptor-leak-on-get-features-error.patch [bz#2116876] | ||||||
|  | - Resolves: bz#2107466 | ||||||
|  |   (zerocopy capability can be enabled when set migrate capabilities with multifd and compress/xbzrle together) | ||||||
|  | - Resolves: bz#2112303 | ||||||
|  |   (virtio-blk: Can't boot fresh installation from used 512 cluster_size image under certain conditions) | ||||||
|  | - Resolves: bz#2116876 | ||||||
|  |   (Fixes for vDPA control virtqueue support in Qemu) | ||||||
|  | 
 | ||||||
| * Mon Aug 08 2022 Miroslav Rezanina <mrezanin@redhat.com> - 7.0.0-10 | * Mon Aug 08 2022 Miroslav Rezanina <mrezanin@redhat.com> - 7.0.0-10 | ||||||
| - kvm-vhost-Track-descriptor-chain-in-private-at-SVQ.patch [bz#1939363] | - kvm-vhost-Track-descriptor-chain-in-private-at-SVQ.patch [bz#1939363] | ||||||
| - kvm-vhost-Fix-device-s-used-descriptor-dequeue.patch [bz#1939363] | - kvm-vhost-Fix-device-s-used-descriptor-dequeue.patch [bz#1939363] | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user