From nobody Fri May 3 14:20:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148965498673638.02560255395326; Thu, 16 Mar 2017 02:03:06 -0700 (PDT) Received: from localhost ([::1]:41689 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coRJI-0003Lc-9n for importer@patchew.org; Thu, 16 Mar 2017 05:03:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coRI4-0003Jp-CA for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1coRI3-00006V-7L for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53432) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1coRI2-000063-V8 for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:47 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E36397F40B; Thu, 16 Mar 2017 09:01:46 +0000 (UTC) Received: from secure.mitica (ovpn-116-230.ams2.redhat.com [10.36.116.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F4895C3FA; Thu, 16 Mar 2017 09:01:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E36397F40B Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E36397F40B From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 16 Mar 2017 10:01:36 +0100 Message-Id: <20170316090141.13421-2-quintela@redhat.com> In-Reply-To: <20170316090141.13421-1-quintela@redhat.com> References: <20170316090141.13421-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 16 Mar 2017 09:01:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/6] Change the method to calculate dirty-pages-rate X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chao Fan , dgilbert@redhat.com, Li Zhijian Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Chao Fan In function cpu_physical_memory_sync_dirty_bitmap, file include/exec/ram_addr.h: if (src[idx][offset]) { unsigned long bits =3D atomic_xchg(&src[idx][offset], 0); unsigned long new_dirty; new_dirty =3D ~dest[k]; dest[k] |=3D bits; new_dirty &=3D bits; num_dirty +=3D ctpopl(new_dirty); } After these codes executed, only the pages not dirtied in bitmap(dest), but dirtied in dirty_memory[DIRTY_MEMORY_MIGRATION] will be calculated. For example: When ram_list.dirty_memory[DIRTY_MEMORY_MIGRATION] =3D 0b00001111, and atomic_rcu_read(&migration_bitmap_rcu)->bmap =3D 0b00000011, the new_dirty will be 0b00001100, and this function will return 2 but not 4 which is expected. the dirty pages in dirty_memory[DIRTY_MEMORY_MIGRATION] are all new, so these should be calculated also. Signed-off-by: Chao Fan Signed-off-by: Li Zhijian Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- include/exec/ram_addr.h | 5 ++++- migration/ram.c | 12 +++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index cd432e7..b05dc84 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -355,7 +355,8 @@ static inline void cpu_physical_memory_clear_dirty_rang= e(ram_addr_t start, static inline uint64_t cpu_physical_memory_sync_dirty_bitmap(unsigned long *dest, ram_addr_t start, - ram_addr_t length) + ram_addr_t length, + int64_t *real_dirty_pages) { ram_addr_t addr; unsigned long page =3D BIT_WORD(start >> TARGET_PAGE_BITS); @@ -379,6 +380,7 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(unsigned= long *dest, if (src[idx][offset]) { unsigned long bits =3D atomic_xchg(&src[idx][offset], 0); unsigned long new_dirty; + *real_dirty_pages +=3D ctpopl(bits); new_dirty =3D ~dest[k]; dest[k] |=3D bits; new_dirty &=3D bits; @@ -398,6 +400,7 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(unsigned= long *dest, start + addr, TARGET_PAGE_SIZE, DIRTY_MEMORY_MIGRATION)) { + *real_dirty_pages +=3D 1; long k =3D (start + addr) >> TARGET_PAGE_BITS; if (!test_and_set_bit(k, dest)) { num_dirty++; diff --git a/migration/ram.c b/migration/ram.c index 719425b..de1e0a3 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -576,18 +576,18 @@ static inline bool migration_bitmap_clear_dirty(ram_a= ddr_t addr) return ret; } =20 +static int64_t num_dirty_pages_period; static void migration_bitmap_sync_range(ram_addr_t start, ram_addr_t lengt= h) { unsigned long *bitmap; bitmap =3D atomic_rcu_read(&migration_bitmap_rcu)->bmap; - migration_dirty_pages +=3D - cpu_physical_memory_sync_dirty_bitmap(bitmap, start, length); + migration_dirty_pages +=3D cpu_physical_memory_sync_dirty_bitmap(bitma= p, + start, length, &num_dirty_pages_period); } =20 /* Fix me: there are too many global variables used in migration process. = */ static int64_t start_time; static int64_t bytes_xfer_prev; -static int64_t num_dirty_pages_period; static uint64_t xbzrle_cache_miss_prev; static uint64_t iterations_prev; =20 @@ -620,7 +620,6 @@ uint64_t ram_pagesize_summary(void) static void migration_bitmap_sync(void) { RAMBlock *block; - uint64_t num_dirty_pages_init =3D migration_dirty_pages; MigrationState *s =3D migrate_get_current(); int64_t end_time; int64_t bytes_xfer_now; @@ -646,9 +645,8 @@ static void migration_bitmap_sync(void) rcu_read_unlock(); qemu_mutex_unlock(&migration_bitmap_mutex); =20 - trace_migration_bitmap_sync_end(migration_dirty_pages - - num_dirty_pages_init); - num_dirty_pages_period +=3D migration_dirty_pages - num_dirty_pages_in= it; + trace_migration_bitmap_sync_end(num_dirty_pages_period); + end_time =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); =20 /* more than 1 second =3D 1000 millisecons */ --=20 2.9.3 From nobody Fri May 3 14:20:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1489655279660201.2119296726528; Thu, 16 Mar 2017 02:07:59 -0700 (PDT) Received: from localhost ([::1]:41714 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coRO2-0007eU-IN for importer@patchew.org; Thu, 16 Mar 2017 05:07:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coRI9-0003Oq-Q2 for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1coRI4-00007G-Rn for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60786) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1coRI4-00006k-Jo for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 86EFA8046D for ; Thu, 16 Mar 2017 09:01:48 +0000 (UTC) Received: from secure.mitica (ovpn-116-230.ams2.redhat.com [10.36.116.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 406815C3FA; Thu, 16 Mar 2017 09:01:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 86EFA8046D Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 86EFA8046D From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 16 Mar 2017 10:01:37 +0100 Message-Id: <20170316090141.13421-3-quintela@redhat.com> In-Reply-To: <20170316090141.13421-1-quintela@redhat.com> References: <20170316090141.13421-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 16 Mar 2017 09:01:48 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/6] migration: use "" as the default for tls-creds/hostname X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dgilbert@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Berrange" The tls-creds parameter has a default value of NULL indicating that TLS should not be used. Setting it to non-NULL enables use of TLS. Once tls-creds are set to a non-NULL value via the monitor, it isn't possible to set them back to NULL again, due to current implementation limitations. The empty string is not a valid QObject identifier, so this switches to use "" as the default, indicating that TLS will not be used The tls-hostname parameter has a default value of NULL indicating the the hostname from the migrate connection URI should be used. Again, once tls-hostname is set non-NULL, to override the default hostname for x509 cert validation, it isn't possible to reset it back to NULL via the monitor. The empty string is not a valid hostname, so this switches to use "" as the default, indicating that the migrate URI hostname should be used. Using "" as the default for both, also means that the monitor commands "info migrate_parameters" / "query-migrate-parameters" will report existance of tls-creds/tls-parameters even when set to their default values. Signed-off-by: Daniel P. Berrange Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Eric Blake Signed-off-by: Juan Quintela --- migration/migration.c | 4 ++++ migration/tls.c | 2 +- qapi-schema.json | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 3dab684..54060f7 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -110,6 +110,8 @@ MigrationState *migrate_get_current(void) =20 if (!once) { qemu_mutex_init(¤t_migration.src_page_req_mutex); + current_migration.parameters.tls_creds =3D g_strdup(""); + current_migration.parameters.tls_hostname =3D g_strdup(""); once =3D true; } return ¤t_migration; @@ -458,6 +460,7 @@ void migration_channel_process_incoming(MigrationState = *s, ioc, object_get_typename(OBJECT(ioc))); =20 if (s->parameters.tls_creds && + *s->parameters.tls_creds && !object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS)) { Error *local_err =3D NULL; @@ -480,6 +483,7 @@ void migration_channel_connect(MigrationState *s, ioc, object_get_typename(OBJECT(ioc)), hostname); =20 if (s->parameters.tls_creds && + *s->parameters.tls_creds && !object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS)) { Error *local_err =3D NULL; diff --git a/migration/tls.c b/migration/tls.c index 203c11d..45bec44 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -141,7 +141,7 @@ void migration_tls_channel_connect(MigrationState *s, return; } =20 - if (s->parameters.tls_hostname) { + if (s->parameters.tls_hostname && *s->parameters.tls_hostname) { hostname =3D s->parameters.tls_hostname; } if (!hostname) { diff --git a/qapi-schema.json b/qapi-schema.json index 32b4a4b..eb9bf67 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1036,6 +1036,8 @@ # credentials must be for a 'server' endpoint. Setting this # will enable TLS for all migrations. The default is unset, # resulting in unsecured migration at the QEMU level. (Since 2= .7) +# An empty string means that QEMU will use plain text mode for +# migration, rather than TLS (Since 2.9) # # @tls-hostname: #optional hostname of the target host for the migration. = This # is required when using x509 based TLS credentials and the @@ -1043,6 +1045,8 @@ # example if using fd: or exec: based migration, the # hostname must be provided so that the server's x509 # certificate identity can be validated. (Since 2.7) +# An empty string means that QEMU will use the hostname +# associated with the migration URI, if any. (Since 2.9) # # @max-bandwidth: to set maximum speed for migration. maximum speed in # bytes per second. (Since 2.8) --=20 2.9.3 From nobody Fri May 3 14:20:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1489655193517885.7608272713335; Thu, 16 Mar 2017 02:06:33 -0700 (PDT) Received: from localhost ([::1]:41710 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coRMb-0006MW-UM for importer@patchew.org; Thu, 16 Mar 2017 05:06:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coRIB-0003P0-Mp for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1coRI6-00007m-7d for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53662) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1coRI6-00007S-2F for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:50 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 07E1641A21; Thu, 16 Mar 2017 09:01:50 +0000 (UTC) Received: from secure.mitica (ovpn-116-230.ams2.redhat.com [10.36.116.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id D40545C3FD; Thu, 16 Mar 2017 09:01:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 07E1641A21 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 07E1641A21 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 16 Mar 2017 10:01:38 +0100 Message-Id: <20170316090141.13421-4-quintela@redhat.com> In-Reply-To: <20170316090141.13421-1-quintela@redhat.com> References: <20170316090141.13421-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 16 Mar 2017 09:01:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/6] migration/block: Avoid invoking blk_drain too frequently X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dgilbert@redhat.com, Lidong Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Lidong Chen Increase bmds->cur_dirty after submit io, so reduce the frequency involve into blk_drain, and improve the performance obviously when block migration. The performance test result of this patch: During the block dirty save phase, this patch improve guest os IOPS from 4.0K to 9.5K. and improve the migration speed from 505856 rsec/s to 855756 rsec/s. Signed-off-by: Lidong Chen Reviewed-by: Fam Zheng Signed-off-by: Juan Quintela --- migration/block.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/migration/block.c b/migration/block.c index 6741228..7734ff7 100644 --- a/migration/block.c +++ b/migration/block.c @@ -576,6 +576,9 @@ static int mig_save_device_dirty(QEMUFile *f, BlkMigDev= State *bmds, } =20 bdrv_reset_dirty_bitmap(bmds->dirty_bitmap, sector, nr_sectors= ); + sector +=3D nr_sectors; + bmds->cur_dirty =3D sector; + break; } sector +=3D BDRV_SECTORS_PER_DIRTY_CHUNK; --=20 2.9.3 From nobody Fri May 3 14:20:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148965508329653.522192020706484; Thu, 16 Mar 2017 02:04:43 -0700 (PDT) Received: from localhost ([::1]:41695 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coRKs-0004YM-6W for importer@patchew.org; Thu, 16 Mar 2017 05:04:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coRI8-0003O7-Ro for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1coRI8-00008M-1g for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44920) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1coRI7-000085-PF for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:51 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AAA4DC0092CB; Thu, 16 Mar 2017 09:01:51 +0000 (UTC) Received: from secure.mitica (ovpn-116-230.ams2.redhat.com [10.36.116.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C6C971C80; Thu, 16 Mar 2017 09:01:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AAA4DC0092CB Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AAA4DC0092CB From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 16 Mar 2017 10:01:39 +0100 Message-Id: <20170316090141.13421-5-quintela@redhat.com> In-Reply-To: <20170316090141.13421-1-quintela@redhat.com> References: <20170316090141.13421-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 16 Mar 2017 09:01:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/6] vmstate: fix failed iotests case 68 and 91 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QingFeng Hao , Halil Pasic , dgilbert@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: QingFeng Hao This problem affects s390x only if we are running without KVM. Basically, S390CPU.irqstate is unused if we do not use KVM, and thus no buffer is allocated. This causes size=3D0, first_elem=3DNULL and n_elems=3D1 in vmstate_load_state and vmstate_save_state. And the assert fails. With this fix we can go back to the old behavior and support VMS_VBUFFER with size 0 and nullptr. Signed-off-by: QingFeng Hao Signed-off-by: Halil Pasic Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Juan Quintela --- migration/vmstate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/vmstate.c b/migration/vmstate.c index 78b3cd4..7b4a607 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -109,7 +109,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescri= ption *vmsd, vmstate_handle_alloc(first_elem, field, opaque); if (field->flags & VMS_POINTER) { first_elem =3D *(void **)first_elem; - assert(first_elem || !n_elems); + assert(first_elem || !n_elems || !size); } for (i =3D 0; i < n_elems; i++) { void *curr_elem =3D first_elem + size * i; @@ -117,7 +117,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescri= ption *vmsd, if (field->flags & VMS_ARRAY_OF_POINTER) { curr_elem =3D *(void **)curr_elem; } - if (!curr_elem) { + if (!curr_elem && size) { /* if null pointer check placeholder and do not follow= */ assert(field->flags & VMS_ARRAY_OF_POINTER); ret =3D vmstate_info_nullptr.get(f, curr_elem, size, N= ULL); @@ -325,7 +325,7 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescr= iption *vmsd, trace_vmstate_save_state_loop(vmsd->name, field->name, n_elems= ); if (field->flags & VMS_POINTER) { first_elem =3D *(void **)first_elem; - assert(first_elem || !n_elems); + assert(first_elem || !n_elems || !size); } for (i =3D 0; i < n_elems; i++) { void *curr_elem =3D first_elem + size * i; @@ -336,7 +336,7 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescr= iption *vmsd, assert(curr_elem); curr_elem =3D *(void **)curr_elem; } - if (!curr_elem) { + if (!curr_elem && size) { /* if null pointer write placeholder and do not follow= */ assert(field->flags & VMS_ARRAY_OF_POINTER); vmstate_info_nullptr.put(f, curr_elem, size, NULL, NUL= L); --=20 2.9.3 From nobody Fri May 3 14:20:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1489654992194100.7629093108751; Thu, 16 Mar 2017 02:03:12 -0700 (PDT) Received: from localhost ([::1]:41691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coRJN-0003QL-Cc for importer@patchew.org; Thu, 16 Mar 2017 05:03:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coRI9-0003Ox-TW for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1coRI9-00009A-6B for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50752) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1coRI9-00008c-11 for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:53 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F375A7E9DA for ; Thu, 16 Mar 2017 09:01:52 +0000 (UTC) Received: from secure.mitica (ovpn-116-230.ams2.redhat.com [10.36.116.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 084C85C3FA; Thu, 16 Mar 2017 09:01:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F375A7E9DA Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com F375A7E9DA From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 16 Mar 2017 10:01:40 +0100 Message-Id: <20170316090141.13421-6-quintela@redhat.com> In-Reply-To: <20170316090141.13421-1-quintela@redhat.com> References: <20170316090141.13421-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 16 Mar 2017 09:01:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 5/6] RAMBlocks: qemu_ram_is_shared X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dgilbert@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Provide a helper to say whether a RAMBlock was created as a shared mapping. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- exec.c | 5 +++++ include/exec/cpu-common.h | 1 + 2 files changed, 6 insertions(+) diff --git a/exec.c b/exec.c index a22f5a0..e57a8a2 100644 --- a/exec.c +++ b/exec.c @@ -1561,6 +1561,11 @@ const char *qemu_ram_get_idstr(RAMBlock *rb) return rb->idstr; } =20 +bool qemu_ram_is_shared(RAMBlock *rb) +{ + return rb->flags & RAM_SHARED; +} + /* Called with iothread lock held. */ void qemu_ram_set_idstr(RAMBlock *new_block, const char *name, DeviceState= *dev) { diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index b62f0d8..4d45a72 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -69,6 +69,7 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_= offset, void qemu_ram_set_idstr(RAMBlock *block, const char *name, DeviceState *de= v); void qemu_ram_unset_idstr(RAMBlock *block); const char *qemu_ram_get_idstr(RAMBlock *rb); +bool qemu_ram_is_shared(RAMBlock *rb); size_t qemu_ram_pagesize(RAMBlock *block); size_t qemu_ram_pagesize_largest(void); =20 --=20 2.9.3 From nobody Fri May 3 14:20:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1489655193178861.6093721420386; Thu, 16 Mar 2017 02:06:33 -0700 (PDT) Received: from localhost ([::1]:41711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coRMd-0006Nj-Pu for importer@patchew.org; Thu, 16 Mar 2017 05:06:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coRIF-0003Rn-4Z for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:02:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1coRIA-00009m-Ey for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53714) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1coRIA-00009J-9N for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:01:54 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 47E963DBE9 for ; Thu, 16 Mar 2017 09:01:54 +0000 (UTC) Received: from secure.mitica (ovpn-116-230.ams2.redhat.com [10.36.116.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 532F771C80; Thu, 16 Mar 2017 09:01:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 47E963DBE9 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 47E963DBE9 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 16 Mar 2017 10:01:41 +0100 Message-Id: <20170316090141.13421-7-quintela@redhat.com> In-Reply-To: <20170316090141.13421-1-quintela@redhat.com> References: <20170316090141.13421-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 16 Mar 2017 09:01:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 6/6] postcopy: Check for shared memory X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dgilbert@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Postcopy doesn't support migration of RAM shared with another process yet (we've got a bunch of things to understand). Check for the case and don't allow postcopy to be enabled. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/postcopy-ram.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index effbeb6..dc80dbb 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -95,6 +95,19 @@ static bool ufd_version_check(int ufd) return true; } =20 +/* Callback from postcopy_ram_supported_by_host block iterator. + */ +static int test_range_shared(const char *block_name, void *host_addr, + ram_addr_t offset, ram_addr_t length, void *o= paque) +{ + if (qemu_ram_is_shared(qemu_ram_block_by_name(block_name))) { + error_report("Postcopy on shared RAM (%s) is not yet supported", + block_name); + return 1; + } + return 0; +} + /* * Note: This has the side effect of munlock'ing all of RAM, that's * normally fine since if the postcopy succeeds it gets turned back on at = the @@ -127,6 +140,11 @@ bool postcopy_ram_supported_by_host(void) goto out; } =20 + /* We don't support postcopy with shared RAM yet */ + if (qemu_ram_foreach_block(test_range_shared, NULL)) { + goto out; + } + /* * userfault and mlock don't go together; we'll put it back later if * it was enabled. --=20 2.9.3