From nobody Mon May 13 15:49:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683659937; cv=none; d=zohomail.com; s=zohoarc; b=gkhsc6c2Hvx+haiWkvZDnuyvEQZJ2sAuItnk0MljvpP1DTBXjyqACAPJx0dRkD8KgSY15WDOLW010HH7VB+YSnlI2c/YPBFi3+O9/IFo7SiGwmPKc8NAq2ynytKVLqZHiVu0EB+SyQrIcm9Oq8XLaLC+aTTjfxhvcg1FiEhwak0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683659937; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=c9ljSb2eKK7vwZQKYVCSNx7jRq8NEWLsTxmxseTS694=; b=B2jS67fivPJB7ZVD//Zvkm2AP86s/OlBjhqH2/d45WFbFBmRjkOhkciE43kMfSqixfniGUl0OMY1o/ZT0v3/7yCd7PGil/UdG6CSzF8erTHyaL/VORanDAiGMw+OXRNdhXxQ2iAeygbukxVCKqPJkFyBxD84ixmqRz5FUzhBS8Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683659937898605.4340247498612; Tue, 9 May 2023 12:18:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwSq9-0003zY-2H; Tue, 09 May 2023 15:17:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSq7-0003yS-Sq for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSq6-0006Rt-DK for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:35 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-180-kZyDeBBROG6P0f_yYW59Mw-1; Tue, 09 May 2023 15:17:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 672C03806710; Tue, 9 May 2023 19:17:30 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45D2D63F84; Tue, 9 May 2023 19:17:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683659853; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c9ljSb2eKK7vwZQKYVCSNx7jRq8NEWLsTxmxseTS694=; b=hev68dvsD+fhxh09+gb19xNS3Sgn8DCYQbhCj/F7IABMHpB57c3aKX0SV40XkwKslwZ6qU RFaT+GZlFwwoUHm9trhGw8HwNroz5cezQ7A+oN5K9YAWMK9icS2IgSzx+rVtfyNaU6iL6x aWhRNsMnsxiRlCgxTv6+2esvfGEzpLQ= X-MC-Unique: kZyDeBBROG6P0f_yYW59Mw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: "Dr. David Alan Gilbert" , Leonardo Bras , Hanna Reitz , Kevin Wolf , Paolo Bonzini , Hailiang Zhang , Eric Blake , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Markus Armbruster , Lukas Straub Subject: [PULL 01/10] ram: Add public helper to set colo bitmap Date: Tue, 9 May 2023 21:17:15 +0200 Message-Id: <20230509191724.86159-2-quintela@redhat.com> In-Reply-To: <20230509191724.86159-1-quintela@redhat.com> References: <20230509191724.86159-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683659940036100003 Content-Type: text/plain; charset="utf-8" From: Lukas Straub The overhead of the mutex in non-multifd mode is negligible, because in that case its just the single thread taking the mutex. This will be used in the next commits to add colo support to multifd. Signed-off-by: Lukas Straub Reviewed-by: Juan Quintela Message-Id: <22d83cb428f37929563155531bfb69fd8953cc61.1683572883.git.lukass= traub2@web.de> Signed-off-by: Juan Quintela --- migration/ram.c | 17 ++++++++++++++--- migration/ram.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index f78e9912cd..0346c1c1ed 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3408,6 +3408,18 @@ static ram_addr_t host_page_offset_from_ram_block_of= fset(RAMBlock *block, return ((uintptr_t)block->host + offset) & (block->page_size - 1); } =20 +void colo_record_bitmap(RAMBlock *block, ram_addr_t *normal, uint normal_n= um) +{ + qemu_mutex_lock(&ram_state->bitmap_mutex); + for (int i =3D 0; i < normal_num; i++) { + ram_addr_t offset =3D normal[i]; + ram_state->migration_dirty_pages +=3D !test_and_set_bit( + offset >> TARGET_PAGE_BITS, + block->bmap); + } + qemu_mutex_unlock(&ram_state->bitmap_mutex); +} + static inline void *colo_cache_from_block_offset(RAMBlock *block, ram_addr_t offset, bool record_bitmap) { @@ -3425,9 +3437,8 @@ static inline void *colo_cache_from_block_offset(RAMB= lock *block, * It help us to decide which pages in ram cache should be flushed * into VM's RAM later. */ - if (record_bitmap && - !test_and_set_bit(offset >> TARGET_PAGE_BITS, block->bmap)) { - ram_state->migration_dirty_pages++; + if (record_bitmap) { + colo_record_bitmap(block, &offset, 1); } return block->colo_cache + offset; } diff --git a/migration/ram.h b/migration/ram.h index 6fffbeb5f1..887d1fbae6 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -82,6 +82,7 @@ int colo_init_ram_cache(void); void colo_flush_ram_cache(void); void colo_release_ram_cache(void); void colo_incoming_start_dirty_log(void); +void colo_record_bitmap(RAMBlock *block, ram_addr_t *normal, uint normal_n= um); =20 /* Background snapshot */ bool ram_write_tracking_available(void); --=20 2.40.0 From nobody Mon May 13 15:49:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683659944; cv=none; d=zohomail.com; s=zohoarc; b=Qq7kVBB9AeJ5LoZg1DwUK5go4oJIxdMHi+0/ewF1e6e0m28gS/wwyNE9QK9zupE6FLWr9Tz7pdtGIt4dYZzVEZ3cNF+l4Z8cvSIgtq/NxhAeje4AIgTcTo3pDNnCjzcvtJwltE6cZaKhiyjM+T3jq4omuxyVEpjCix53CYeMV+c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683659944; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1BcKbF05eEbnrWAtopGD6CGeHNYVEyo8PXD3zb0NYcI=; b=IZVkPe+t8kF4c+ZBmcwPITkR+w8wopn7nUIPX0yJPOR0aGAYlV8BB77NQzBQWk4DkjjbwLPysKnBuYPJoexbI29kGabRNCI0UkZk0ZnumDx0WcoObQ4va2yu24w7a7pJ4Eq/gJqq5yhTq8x/8jr8LDFIKhDJz7rTsZIXS1Eu+9I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683659944092927.7915699683412; Tue, 9 May 2023 12:19:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwSqC-00042z-LM; Tue, 09 May 2023 15:17:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqA-00040G-Nw for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSq9-0006U0-8W for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:38 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-627-gLtK75TQPjWe17S7cb5A7g-1; Tue, 09 May 2023 15:17:34 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B8DA33850550; Tue, 9 May 2023 19:17:32 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABDD263F5B; Tue, 9 May 2023 19:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683659856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1BcKbF05eEbnrWAtopGD6CGeHNYVEyo8PXD3zb0NYcI=; b=WyLbglALGWWQLEnOyt0pTqwFcPArg5xp1PlJJs9zQBhD/6wtAE0h6H0RB2sL4ql+8AqrAn hinbc5jtx847TefOZePhE+EHMloG81Jul4nCrrp+6H7M2M277io3qOaNWc75zETbfeIpD7 X7Nyq96mH9/es1LJOxBwSme5mlDcro4= X-MC-Unique: gLtK75TQPjWe17S7cb5A7g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: "Dr. David Alan Gilbert" , Leonardo Bras , Hanna Reitz , Kevin Wolf , Paolo Bonzini , Hailiang Zhang , Eric Blake , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Markus Armbruster , Lukas Straub Subject: [PULL 02/10] ram: Let colo_flush_ram_cache take the bitmap_mutex Date: Tue, 9 May 2023 21:17:16 +0200 Message-Id: <20230509191724.86159-3-quintela@redhat.com> In-Reply-To: <20230509191724.86159-1-quintela@redhat.com> References: <20230509191724.86159-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683659945492100001 Content-Type: text/plain; charset="utf-8" From: Lukas Straub This is not required, colo_flush_ram_cache does not run concurrently with the multifd threads since the cache is only flushed after everything has been received. But it makes me more comfortable. This will be used in the next commits to add colo support to multifd. Signed-off-by: Lukas Straub Reviewed-by: Juan Quintela Message-Id: <35cb23ba854151d38a31e3a5c8a1020e4283cb4a.1683572883.git.lukass= traub2@web.de> Signed-off-by: Juan Quintela --- migration/ram.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index 0346c1c1ed..3fa720dad9 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3814,6 +3814,7 @@ void colo_flush_ram_cache(void) unsigned long offset =3D 0; =20 memory_global_dirty_log_sync(); + qemu_mutex_lock(&ram_state->bitmap_mutex); WITH_RCU_READ_LOCK_GUARD() { RAMBLOCK_FOREACH_NOT_IGNORED(block) { ramblock_sync_dirty_bitmap(ram_state, block); @@ -3848,6 +3849,7 @@ void colo_flush_ram_cache(void) } } } + qemu_mutex_unlock(&ram_state->bitmap_mutex); trace_colo_flush_ram_cache_end(); } =20 --=20 2.40.0 From nobody Mon May 13 15:49:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683659950; cv=none; d=zohomail.com; s=zohoarc; b=TRRaR4MVjmIQYKpLWCQchK+VYynn5AYXHkjnq6sSr87+iKssW+Rwgy2SD3bACxnlyZQVCgSSwxup2S42c3qvO615h2PGi0MBQVmJO6+BPn1tOtEJm9MOfv0zP09vX/oE63r3tlR+HVQhJlp4sk/NJit4rybkkPQ0OZ+0tO+nwGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683659950; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bCIQ+gyew/5doBamjimo636wJ5lxtyiSG+aPsHSQQEw=; b=aP4kppucAw6VWZSGKP+nWYJFsiChuDg2OOXLIS/cXDbNBM5CaPPFh4X+FQL35G+DQafMBhu4uDqkjuQ35v/jog/KZxfhtU8nfzm9F13TRDy+C2r60uxbwC3cH+Rzu7JpXxU2M9QwwYfp1kkbq8Ny1CtrXjYHnXU5D+Sj14Xd6Lk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683659950337734.4302280406193; Tue, 9 May 2023 12:19:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwSqE-00043t-A8; Tue, 09 May 2023 15:17:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqD-000437-1j for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqB-0006Uj-Fh for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:40 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-428-CxQO4dh2NtaQPTEAqiln_w-1; Tue, 09 May 2023 15:17:35 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1263829AA2CF; Tue, 9 May 2023 19:17:35 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BA1363F84; Tue, 9 May 2023 19:17:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683659858; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bCIQ+gyew/5doBamjimo636wJ5lxtyiSG+aPsHSQQEw=; b=iEj7TvsS8l5zVbPsSKGNIRKj7fegKKic/8bcQ/eTm1TJqVreEjdjG/7uhTdbsC6nTvoUR1 8UHw0gjxGZNK4fHuKU0DriSBkJ3LAcf0HuYuWXuXmKefoIpi6GlwXyuA2N8fhxsl8N3ulh peFhYr4kjT9JJyBkdVwclf2jKtDp2tY= X-MC-Unique: CxQO4dh2NtaQPTEAqiln_w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: "Dr. David Alan Gilbert" , Leonardo Bras , Hanna Reitz , Kevin Wolf , Paolo Bonzini , Hailiang Zhang , Eric Blake , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Markus Armbruster , Lukas Straub Subject: [PULL 03/10] multifd: Add the ramblock to MultiFDRecvParams Date: Tue, 9 May 2023 21:17:17 +0200 Message-Id: <20230509191724.86159-4-quintela@redhat.com> In-Reply-To: <20230509191724.86159-1-quintela@redhat.com> References: <20230509191724.86159-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683659951524100001 Content-Type: text/plain; charset="utf-8" From: Lukas Straub This will be used in the next commits to add colo support to multifd. Signed-off-by: Lukas Straub Reviewed-by: Juan Quintela Message-Id: <88135197411df1a71d7832962b39abf60faf0021.1683572883.git.lukass= traub2@web.de> Signed-off-by: Juan Quintela --- migration/multifd.c | 11 +++++------ migration/multifd.h | 2 ++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index 4e71c19292..5c4298eadf 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -281,7 +281,6 @@ static void multifd_send_fill_packet(MultiFDSendParams = *p) static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp) { MultiFDPacket_t *packet =3D p->packet; - RAMBlock *block; int i; =20 packet->magic =3D be32_to_cpu(packet->magic); @@ -331,21 +330,21 @@ static int multifd_recv_unfill_packet(MultiFDRecvPara= ms *p, Error **errp) =20 /* make sure that ramblock is 0 terminated */ packet->ramblock[255] =3D 0; - block =3D qemu_ram_block_by_name(packet->ramblock); - if (!block) { + p->block =3D qemu_ram_block_by_name(packet->ramblock); + if (!p->block) { error_setg(errp, "multifd: unknown ram block %s", packet->ramblock); return -1; } =20 - p->host =3D block->host; + p->host =3D p->block->host; for (i =3D 0; i < p->normal_num; i++) { uint64_t offset =3D be64_to_cpu(packet->offset[i]); =20 - if (offset > (block->used_length - p->page_size)) { + if (offset > (p->block->used_length - p->page_size)) { error_setg(errp, "multifd: offset too long %" PRIu64 " (max " RAM_ADDR_FMT ")", - offset, block->used_length); + offset, p->block->used_length); return -1; } p->normal[i] =3D offset; diff --git a/migration/multifd.h b/migration/multifd.h index 7cfc265148..a835643b48 100644 --- a/migration/multifd.h +++ b/migration/multifd.h @@ -175,6 +175,8 @@ typedef struct { uint32_t next_packet_size; /* packets sent through this channel */ uint64_t num_packets; + /* ramblock */ + RAMBlock *block; /* ramblock host address */ uint8_t *host; /* non zero pages recv through this channel */ --=20 2.40.0 From nobody Mon May 13 15:49:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683659940; cv=none; d=zohomail.com; s=zohoarc; b=TtCSmx2di4mwwbGLV2qZjuHNxSOdgmX0+TzbXY5J7y3yFrxUbOp02yJZntY7R4rfv+64Jy+Li3fqC9WZN+2+sN2gbl49hEOs6ybi5U6TjPPPbAWubpST19dYsmAsa06m6CuvmAarZydmS6iCDQRWTdrY+Ok6KV3gYc/ejBIS9pc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683659940; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iI6oWetrlZ8mPaEGRhEP0KH20gw4XCVgMaYYbERpVJ8=; b=bu82Z9jT4bsP9Y+fGl2LQg8FBhb3fiQDBr0Z80VCeBRbnPf2k6C3id6LZ4si4LVKeVNP8/OyRKjtbPSBtwYp0YLDFn31hILZOlHFwx9KO9J1nEwRKAJpMOH7K3iLTZ3PfDTS/vKTfayQOjTzQ4EsU2gSp4J+uU2wDVXkZwy2g4c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683659940903363.15459462771366; Tue, 9 May 2023 12:19:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwSqJ-000476-3F; Tue, 09 May 2023 15:17:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqG-00045w-Pu for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqF-0006Xv-Bs for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:44 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-624-HN4VjpyXNf6SIHiSO2poog-1; Tue, 09 May 2023 15:17:39 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4E0BA100F64F; Tue, 9 May 2023 19:17:38 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A7C663F84; Tue, 9 May 2023 19:17:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683659862; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iI6oWetrlZ8mPaEGRhEP0KH20gw4XCVgMaYYbERpVJ8=; b=ONiGdQj5DTpnfSCj+oACOLE77Z10bvXhRpVg9IpYYXq0MUP92qlQ4TiN9ZgZOMHpvgu7Zc Lt+8NaNJDhxUAPhgUtCPYZI32YFH2z1rbWfHjfRByHzzpzsBumM0DVxR45oGmaboUe5nTE vtv+Di25th8hvkvl21g/S7ouetQBh0s= X-MC-Unique: HN4VjpyXNf6SIHiSO2poog-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: "Dr. David Alan Gilbert" , Leonardo Bras , Hanna Reitz , Kevin Wolf , Paolo Bonzini , Hailiang Zhang , Eric Blake , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Markus Armbruster , Vladimir Sementsov-Ogievskiy , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Lukas Straub , Zhang Chen Subject: [PULL 04/10] block/meson.build: prefer positive condition for replication Date: Tue, 9 May 2023 21:17:18 +0200 Message-Id: <20230509191724.86159-5-quintela@redhat.com> In-Reply-To: <20230509191724.86159-1-quintela@redhat.com> References: <20230509191724.86159-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683659942056100007 From: Vladimir Sementsov-Ogievskiy Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Lukas Straub Reviewed-by: Zhang Chen Message-Id: <20230428194928.1426370-2-vsementsov@yandex-team.ru> Signed-off-by: Juan Quintela --- block/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/meson.build b/block/meson.build index 382bec0e7d..b9a72e219b 100644 --- a/block/meson.build +++ b/block/meson.build @@ -84,7 +84,7 @@ block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-w= in32.c', 'win32-aio.c') block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref,= iokit]) block_ss.add(when: libiscsi, if_true: files('iscsi-opts.c')) block_ss.add(when: 'CONFIG_LINUX', if_true: files('nvme.c')) -if not get_option('replication').disabled() +if get_option('replication').allowed() block_ss.add(files('replication.c')) endif block_ss.add(when: libaio, if_true: files('linux-aio.c')) --=20 2.40.0 From nobody Mon May 13 15:49:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683659963; cv=none; d=zohomail.com; s=zohoarc; b=TSfZdHc4qa3lZfo5aYz5ZHiZy4H+G59DnLt9dk6cKK1OwC+QVWjqrHtmuuId2rKYM3SV4LuXMEr9i01vZLbdWBPl2TBgW8QaklLSYpeaeDNK33BuaRo93XJ16bJrbQuITq4zt+5dGfeqNumdAIRWNLO+cq7Oyq9NxAWDE/3I+A4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683659963; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ImCQ+Y4FYqkgMFc7wGSlxrvJOlIh84jvmaO/wR4Nyjs=; b=ZjinaEdDUQkEA1SB32VTpPnbYe6TxZm155LBo2QwZd1GDgukA51TYXmx6fwMnq1e1RnN+CCHD8+SCYnnj7Dig8HXWL9mCMYUmIbeGZpg3lL12JaP52R4MYkvw3+oc+8eHCjF2XJE1KK7bAhNKcAYi88PUW/tRLAMzMDVt/lZgpE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683659963167679.2053266785463; Tue, 9 May 2023 12:19:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwSqK-00047P-5a; Tue, 09 May 2023 15:17:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqH-00046O-W4 for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqG-0006Yu-HB for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:45 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-471-WjeNkoKgNbS4QrvhH5SU3g-1; Tue, 09 May 2023 15:17:42 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DD9E7380673B; Tue, 9 May 2023 19:17:40 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9554963F84; Tue, 9 May 2023 19:17:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683659863; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ImCQ+Y4FYqkgMFc7wGSlxrvJOlIh84jvmaO/wR4Nyjs=; b=jIGqbGuMO2gCLFE6sHWULfD3PQtfNz5/Zr66Lu3m2Q9SabBsPhzatCPG86zxpOu7J3feV7 ovF2uardF2X1Y8KxbaSZNN1gVDjpzudumz7S9Ka+3owIGXu9FB93TsOKX9q8TFan7OBF6N rgGdo5RH3Et0BOB2iwULqFRpD9zEej4= X-MC-Unique: WjeNkoKgNbS4QrvhH5SU3g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: "Dr. David Alan Gilbert" , Leonardo Bras , Hanna Reitz , Kevin Wolf , Paolo Bonzini , Hailiang Zhang , Eric Blake , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Markus Armbruster , Vladimir Sementsov-Ogievskiy , Zhang Chen Subject: [PULL 05/10] colo: make colo_checkpoint_notify static and provide simpler API Date: Tue, 9 May 2023 21:17:19 +0200 Message-Id: <20230509191724.86159-6-quintela@redhat.com> In-Reply-To: <20230509191724.86159-1-quintela@redhat.com> References: <20230509191724.86159-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683659963722100003 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy colo_checkpoint_notify() is mostly used in colo.c. Outside we use it once when x-checkpoint-delay migration parameter is set. So, let's simplify the external API to only that function - notify COLO that parameter was set. This make external API more robust and hides implementation details from external callers. Also this helps us to make COLO module optional in further patch (i.e. we are going to add possibility not build the COLO module). Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Peter Xu Reviewed-by: Zhang Chen Message-Id: <20230428194928.1426370-3-vsementsov@yandex-team.ru> Signed-off-by: Juan Quintela --- include/migration/colo.h | 9 ++++++++- migration/colo.c | 29 ++++++++++++++++++----------- migration/options.c | 4 +--- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/include/migration/colo.h b/include/migration/colo.h index 5fbe1a6d5d..7ef315473e 100644 --- a/include/migration/colo.h +++ b/include/migration/colo.h @@ -36,6 +36,13 @@ COLOMode get_colo_mode(void); /* failover */ void colo_do_failover(void); =20 -void colo_checkpoint_notify(void *opaque); +/* + * colo_checkpoint_delay_set + * + * Handles change of x-checkpoint-delay migration parameter, called from + * migrate_params_apply() to notify COLO module about the change. + */ +void colo_checkpoint_delay_set(void); + void colo_shutdown(void); #endif diff --git a/migration/colo.c b/migration/colo.c index 07bfa21fea..c9e0b909b9 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -65,6 +65,24 @@ static bool colo_runstate_is_stopped(void) return runstate_check(RUN_STATE_COLO) || !runstate_is_running(); } =20 +static void colo_checkpoint_notify(void *opaque) +{ + MigrationState *s =3D opaque; + int64_t next_notify_time; + + qemu_event_set(&s->colo_checkpoint_event); + s->colo_checkpoint_time =3D qemu_clock_get_ms(QEMU_CLOCK_HOST); + next_notify_time =3D s->colo_checkpoint_time + migrate_checkpoint_dela= y(); + timer_mod(s->colo_delay_timer, next_notify_time); +} + +void colo_checkpoint_delay_set(void) +{ + if (migration_in_colo_state()) { + colo_checkpoint_notify(migrate_get_current()); + } +} + static void secondary_vm_do_failover(void) { /* COLO needs enable block-replication */ @@ -644,17 +662,6 @@ out: } } =20 -void colo_checkpoint_notify(void *opaque) -{ - MigrationState *s =3D opaque; - int64_t next_notify_time; - - qemu_event_set(&s->colo_checkpoint_event); - s->colo_checkpoint_time =3D qemu_clock_get_ms(QEMU_CLOCK_HOST); - next_notify_time =3D s->colo_checkpoint_time + migrate_checkpoint_dela= y(); - timer_mod(s->colo_delay_timer, next_notify_time); -} - void migrate_start_colo_process(MigrationState *s) { qemu_mutex_unlock_iothread(); diff --git a/migration/options.c b/migration/options.c index 2e759cc306..9d92b15b76 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1253,9 +1253,7 @@ static void migrate_params_apply(MigrateSetParameters= *params, Error **errp) =20 if (params->has_x_checkpoint_delay) { s->parameters.x_checkpoint_delay =3D params->x_checkpoint_delay; - if (migration_in_colo_state()) { - colo_checkpoint_notify(s); - } + colo_checkpoint_delay_set(); } =20 if (params->has_block_incremental) { --=20 2.40.0 From nobody Mon May 13 15:49:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683659975; cv=none; d=zohomail.com; s=zohoarc; b=YaT4yNqJw1i6QNedMaZ9ZuUvRRr8rFrAL8YRYljDMnMaOYMiEkNHjc1/7EJseBsas3GiaRFkLXeo0tuQv+ieAk78eJLVMvdIdSsFMtFqszcPIeOku5w5B3gsFNigOFLNw1QkbqvaRxo8yV+yDOJRiIo0cobCYXjloANDBCspWHQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683659975; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ilDhpVAXmU3raGA2w7Bqg/c/YOK1TBF6wrbFuLI6gPc=; b=TY8+IebO11D2j0XiTv0p9vTXMU55+hYPJSoLQhsruDgnByhX6IQWXeI6TjBTNoEChDHtrhMfLcys0oZr2d1wDgeBYIohm5SOAeM/oBPkBt2UZ3P05jmk8LuUi84gJadlSSSGPublXI36a0pEH8N6uDakM+9X0bKVnF7NC8cNDwQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683659975947640.5483323104161; Tue, 9 May 2023 12:19:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwSqP-000494-DH; Tue, 09 May 2023 15:17:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqN-000482-H1 for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqK-0006Zk-3P for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:51 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-29-xdP4JW6BOCaAER6Em56Y2w-1; Tue, 09 May 2023 15:17:44 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 584BF101A55C; Tue, 9 May 2023 19:17:43 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30B3E63F89; Tue, 9 May 2023 19:17:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683659867; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ilDhpVAXmU3raGA2w7Bqg/c/YOK1TBF6wrbFuLI6gPc=; b=FMKgG3n3dX0dJKSq1gwXp/zRmPvZ/hv6TYw9EmsKnAeBb1FbJ9lpjzIHbGXLVbq37+C6gR gMCUB2rsrygFVr1np/IqBPt4dmrKdfQWHd4VGbih9LVFWoP0GCkFBjZ5hKEgSJcDSH8+dK tAvXbaXfFvMW9AGK33dD7T6X2zn/Xys= X-MC-Unique: xdP4JW6BOCaAER6Em56Y2w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: "Dr. David Alan Gilbert" , Leonardo Bras , Hanna Reitz , Kevin Wolf , Paolo Bonzini , Hailiang Zhang , Eric Blake , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Markus Armbruster , Vladimir Sementsov-Ogievskiy Subject: [PULL 06/10] build: move COLO under CONFIG_REPLICATION Date: Tue, 9 May 2023 21:17:20 +0200 Message-Id: <20230509191724.86159-7-quintela@redhat.com> In-Reply-To: <20230509191724.86159-1-quintela@redhat.com> References: <20230509191724.86159-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683659977340100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy We don't allow to use x-colo capability when replication is not configured. So, no reason to build COLO when replication is disabled, it's unusable in this case. Note also that the check in migrate_caps_check() is not the only restriction: some functions in migration/colo.c will just abort if called with not defined CONFIG_REPLICATION, for example: migration_iteration_finish() case MIGRATION_STATUS_COLO: migrate_start_colo_process() colo_process_checkpoint() abort() It could probably make sense to have possibility to enable COLO without REPLICATION, but this requires deeper audit of colo & replication code, which may be done later if needed. Signed-off-by: Vladimir Sementsov-Ogievskiy Acked-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela Message-Id: <20230428194928.1426370-4-vsementsov@yandex-team.ru> Signed-off-by: Juan Quintela --- hmp-commands.hx | 2 ++ migration/colo.c | 28 ------------------------ migration/meson.build | 6 ++++-- migration/migration-hmp-cmds.c | 2 ++ migration/migration.c | 6 ++++++ qapi/migration.json | 9 +++++--- stubs/colo.c | 39 ++++++++++++++++++++++++++++++++++ stubs/meson.build | 1 + 8 files changed, 60 insertions(+), 33 deletions(-) create mode 100644 stubs/colo.c diff --git a/hmp-commands.hx b/hmp-commands.hx index 9afbb54a51..2cbd0f77a0 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1052,6 +1052,7 @@ SRST migration (or once already in postcopy). ERST =20 +#ifdef CONFIG_REPLICATION { .name =3D "x_colo_lost_heartbeat", .args_type =3D "", @@ -1060,6 +1061,7 @@ ERST "a failover or takeover is needed.", .cmd =3D hmp_x_colo_lost_heartbeat, }, +#endif =20 SRST ``x_colo_lost_heartbeat`` diff --git a/migration/colo.c b/migration/colo.c index c9e0b909b9..6c7c313956 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -26,9 +26,7 @@ #include "qemu/rcu.h" #include "migration/failover.h" #include "migration/ram.h" -#ifdef CONFIG_REPLICATION #include "block/replication.h" -#endif #include "net/colo-compare.h" #include "net/colo.h" #include "block/block.h" @@ -86,7 +84,6 @@ void colo_checkpoint_delay_set(void) static void secondary_vm_do_failover(void) { /* COLO needs enable block-replication */ -#ifdef CONFIG_REPLICATION int old_state; MigrationIncomingState *mis =3D migration_incoming_get_current(); Error *local_err =3D NULL; @@ -151,14 +148,10 @@ static void secondary_vm_do_failover(void) if (mis->migration_incoming_co) { qemu_coroutine_enter(mis->migration_incoming_co); } -#else - abort(); -#endif } =20 static void primary_vm_do_failover(void) { -#ifdef CONFIG_REPLICATION MigrationState *s =3D migrate_get_current(); int old_state; Error *local_err =3D NULL; @@ -199,9 +192,6 @@ static void primary_vm_do_failover(void) =20 /* Notify COLO thread that failover work is finished */ qemu_sem_post(&s->colo_exit_sem); -#else - abort(); -#endif } =20 COLOMode get_colo_mode(void) @@ -235,7 +225,6 @@ void colo_do_failover(void) } } =20 -#ifdef CONFIG_REPLICATION void qmp_xen_set_replication(bool enable, bool primary, bool has_failover, bool failover, Error **errp) @@ -289,7 +278,6 @@ void qmp_xen_colo_do_checkpoint(Error **errp) /* Notify all filters of all NIC to do checkpoint */ colo_notify_filters_event(COLO_EVENT_CHECKPOINT, errp); } -#endif =20 COLOStatus *qmp_query_colo_status(Error **errp) { @@ -453,15 +441,11 @@ static int colo_do_checkpoint_transaction(MigrationSt= ate *s, } qemu_mutex_lock_iothread(); =20 -#ifdef CONFIG_REPLICATION replication_do_checkpoint_all(&local_err); if (local_err) { qemu_mutex_unlock_iothread(); goto out; } -#else - abort(); -#endif =20 colo_send_message(s->to_dst_file, COLO_MESSAGE_VMSTATE_SEND, &local_er= r); if (local_err) { @@ -579,15 +563,11 @@ static void colo_process_checkpoint(MigrationState *s) object_unref(OBJECT(bioc)); =20 qemu_mutex_lock_iothread(); -#ifdef CONFIG_REPLICATION replication_start_all(REPLICATION_MODE_PRIMARY, &local_err); if (local_err) { qemu_mutex_unlock_iothread(); goto out; } -#else - abort(); -#endif =20 vm_start(); qemu_mutex_unlock_iothread(); @@ -755,7 +735,6 @@ static void colo_incoming_process_checkpoint(MigrationI= ncomingState *mis, return; } =20 -#ifdef CONFIG_REPLICATION replication_get_error_all(&local_err); if (local_err) { error_propagate(errp, local_err); @@ -772,9 +751,6 @@ static void colo_incoming_process_checkpoint(MigrationI= ncomingState *mis, qemu_mutex_unlock_iothread(); return; } -#else - abort(); -#endif /* Notify all filters of all NIC to do checkpoint */ colo_notify_filters_event(COLO_EVENT_CHECKPOINT, &local_err); =20 @@ -881,15 +857,11 @@ void *colo_process_incoming_thread(void *opaque) object_unref(OBJECT(bioc)); =20 qemu_mutex_lock_iothread(); -#ifdef CONFIG_REPLICATION replication_start_all(REPLICATION_MODE_SECONDARY, &local_err); if (local_err) { qemu_mutex_unlock_iothread(); goto out; } -#else - abort(); -#endif vm_start(); qemu_mutex_unlock_iothread(); trace_colo_vm_state_change("stop", "run"); diff --git a/migration/meson.build b/migration/meson.build index 75de868bb7..eb41b77db9 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -13,8 +13,6 @@ softmmu_ss.add(files( 'block-dirty-bitmap.c', 'channel.c', 'channel-block.c', - 'colo-failover.c', - 'colo.c', 'exec.c', 'fd.c', 'global_state.c', @@ -33,6 +31,10 @@ softmmu_ss.add(files( 'threadinfo.c', ), gnutls) =20 +if get_option('replication').allowed() + softmmu_ss.add(files('colo-failover.c', 'colo.c')) +endif + softmmu_ss.add(when: rdma, if_true: files('rdma.c')) if get_option('live_block_migration').allowed() softmmu_ss.add(files('block.c')) diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 4e9f00e7dc..9885d7c9f7 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -643,6 +643,7 @@ void hmp_migrate_start_postcopy(Monitor *mon, const QDi= ct *qdict) hmp_handle_error(mon, err); } =20 +#ifdef CONFIG_REPLICATION void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict) { Error *err =3D NULL; @@ -650,6 +651,7 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDic= t *qdict) qmp_x_colo_lost_heartbeat(&err); hmp_handle_error(mon, err); } +#endif =20 typedef struct HMPMigrationStatus { QEMUTimer *timer; diff --git a/migration/migration.c b/migration/migration.c index 0ee07802a5..01ee92e699 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -392,6 +392,12 @@ void migration_incoming_disable_colo(void) =20 int migration_incoming_enable_colo(void) { +#ifndef CONFIG_REPLICATION + error_report("ENABLE_COLO command come in migration stream, but COLO " + "module is not built in"); + return -ENOTSUP; +#endif + if (ram_block_discard_disable(true)) { error_report("COLO: cannot disable RAM discard"); return -EBUSY; diff --git a/qapi/migration.json b/qapi/migration.json index 82000adce4..30e2542f1b 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1383,7 +1383,8 @@ # ## { 'command': 'x-colo-lost-heartbeat', - 'features': [ 'unstable' ] } + 'features': [ 'unstable' ], + 'if': 'CONFIG_REPLICATION' } =20 ## # @migrate_cancel: @@ -1659,7 +1660,8 @@ ## { 'struct': 'COLOStatus', 'data': { 'mode': 'COLOMode', 'last-mode': 'COLOMode', - 'reason': 'COLOExitReason' } } + 'reason': 'COLOExitReason' }, + 'if': 'CONFIG_REPLICATION' } =20 ## # @query-colo-status: @@ -1676,7 +1678,8 @@ # Since: 3.1 ## { 'command': 'query-colo-status', - 'returns': 'COLOStatus' } + 'returns': 'COLOStatus', + 'if': 'CONFIG_REPLICATION' } =20 ## # @migrate-recover: diff --git a/stubs/colo.c b/stubs/colo.c new file mode 100644 index 0000000000..cf9816d368 --- /dev/null +++ b/stubs/colo.c @@ -0,0 +1,39 @@ +#include "qemu/osdep.h" +#include "qemu/notify.h" +#include "net/colo-compare.h" +#include "migration/colo.h" +#include "migration/migration.h" +#include "qemu/error-report.h" +#include "qapi/qapi-commands-migration.h" + +void colo_shutdown(void) +{ +} + +void *colo_process_incoming_thread(void *opaque) +{ + error_report("Impossible happend: trying to start COLO thread when COL= O " + "module is not built in"); + abort(); +} + +void colo_checkpoint_delay_set(void) +{ +} + +void migrate_start_colo_process(MigrationState *s) +{ + error_report("Impossible happend: trying to start COLO when COLO " + "module is not built in"); + abort(); +} + +bool migration_in_colo_state(void) +{ + return false; +} + +bool migration_incoming_in_colo_state(void) +{ + return false; +} diff --git a/stubs/meson.build b/stubs/meson.build index b2b5956d97..8412cad15f 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -45,6 +45,7 @@ stub_ss.add(files('target-get-monitor-def.c')) stub_ss.add(files('target-monitor-defs.c')) stub_ss.add(files('trace-control.c')) stub_ss.add(files('uuid.c')) +stub_ss.add(files('colo.c')) stub_ss.add(files('vmstate.c')) stub_ss.add(files('vm-stop.c')) stub_ss.add(files('win32-kbd-hook.c')) --=20 2.40.0 From nobody Mon May 13 15:49:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683659962; cv=none; d=zohomail.com; s=zohoarc; b=fci67P3i63yBOGGk4wTAndvz2PgTYLWb29MAnSR3l7LGKJsNnlczxLWUD9+STHeQoOIgAw4TbT8ssuc2F67XXet485iLl+kYtvzVDHLoe4iTSeTZrF3WAt8+voY1xHPTLhrisduyAxmaJnfInnWYLnSGO+TkSt1T5gtMZlZ544Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683659962; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aMwqFrekBrHNVs7iPH8fTanv0PAFiGUUYVML+ojz91k=; b=bKa2WoXhlVWfBBg75c0EHWVc2dbYBDcYvf6MAq8GELVpX4KroAuS4TLXGvg34kJTohXcwAdO3N4pQRJ+JHDdw5zKUhgz0b+xcogWLRMIH8yjrpqJdPqlwAtkHia4QbH+IVZshrAu40QENj1yxYllvh6nrtM/z149Tu+HMNHnADE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683659962872545.0131507482226; Tue, 9 May 2023 12:19:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwSqP-0004AC-Gc; Tue, 09 May 2023 15:17:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqO-00048F-0X for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqM-0006aH-GP for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:51 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-529-_hu-Jl1dNkOtJnawOcz5Tg-1; Tue, 09 May 2023 15:17:46 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CCD0F1C09A40; Tue, 9 May 2023 19:17:45 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E65E63F84; Tue, 9 May 2023 19:17:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683659869; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aMwqFrekBrHNVs7iPH8fTanv0PAFiGUUYVML+ojz91k=; b=JFsepuQkQFI2+STbSKctNZSOfbB3WDKB6kTgDNR56qsBQVCCf6sFmii9P0WyfW7Ej3pcKB 3z4Ts/2yKXWQTaWDJ22s9Ksj/IMuD5K4fW8TrIlSIv8PHsEb1WX1WblNGOBC8SoGi1DVDL gpFm4wuOhWx5QR5mAUtznsM04/+CCdQ= X-MC-Unique: _hu-Jl1dNkOtJnawOcz5Tg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: "Dr. David Alan Gilbert" , Leonardo Bras , Hanna Reitz , Kevin Wolf , Paolo Bonzini , Hailiang Zhang , Eric Blake , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Markus Armbruster , Vladimir Sementsov-Ogievskiy , Zhang Chen Subject: [PULL 07/10] migration: drop colo_incoming_thread from MigrationIncomingState Date: Tue, 9 May 2023 21:17:21 +0200 Message-Id: <20230509191724.86159-8-quintela@redhat.com> In-Reply-To: <20230509191724.86159-1-quintela@redhat.com> References: <20230509191724.86159-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683659963437100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy have_colo_incoming_thread variable is unused. colo_incoming_thread can be local. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Peter Xu Reviewed-by: Zhang Chen Message-Id: <20230428194928.1426370-6-vsementsov@yandex-team.ru> Signed-off-by: Juan Quintela --- migration/migration.c | 7 ++++--- migration/migration.h | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 01ee92e699..3ab3b1c3e6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -544,6 +544,8 @@ process_incoming_migration_co(void *opaque) =20 /* we get COLO info, and know if we are in COLO mode */ if (!ret && migration_incoming_colo_enabled()) { + QemuThread colo_incoming_thread; + /* Make sure all file formats throw away their mutable metadata */ bdrv_activate_all(&local_err); if (local_err) { @@ -551,14 +553,13 @@ process_incoming_migration_co(void *opaque) goto fail; } =20 - qemu_thread_create(&mis->colo_incoming_thread, "COLO incoming", + qemu_thread_create(&colo_incoming_thread, "COLO incoming", colo_process_incoming_thread, mis, QEMU_THREAD_JOINABLE); - mis->have_colo_incoming_thread =3D true; qemu_coroutine_yield(); =20 qemu_mutex_unlock_iothread(); /* Wait checkpoint incoming thread exit before free resource */ - qemu_thread_join(&mis->colo_incoming_thread); + qemu_thread_join(&colo_incoming_thread); qemu_mutex_lock_iothread(); /* We hold the global iothread lock, so it is safe here */ colo_release_ram_cache(); diff --git a/migration/migration.h b/migration/migration.h index 3a918514e7..7721c7658b 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -162,8 +162,6 @@ struct MigrationIncomingState { =20 int state; =20 - bool have_colo_incoming_thread; - QemuThread colo_incoming_thread; /* The coroutine we should enter (back) after failover */ Coroutine *migration_incoming_co; QemuSemaphore colo_incoming_sem; --=20 2.40.0 From nobody Mon May 13 15:49:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683659953; cv=none; d=zohomail.com; s=zohoarc; b=eBLwaoEOkaUDKN8uknyrtQJzKag+gxCYQ/E1TRc8xHQeVGnMAP7i62+JLkZE2k2xDUSaPM9uXTWr7y8zbxHN2wvLnrAGwUp3EUOQt8qVvjqiyW0fxL+2koCWf9oIkqhj4NjADeqmAwydDe2J4fuKroCMRm+Ae9LlIfWTu/8Z+DA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683659953; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sPPvOnvoiNHlMZuQYN+LxR+BbPHgjAYQVqBEiBP7vnI=; b=bYVPbzOuU9xgaB232feCFD5JUZNXRUAO1q9qhv26HHMwyzqvsR13/wbDv7LgaDVJzuCPZWj477KoPo1e2BjAb663XvRl9agdk7Wto4ooHMhcdxoIP90ui9yIZg7gWgVcq+GsZjegwfYrfbzOqPpCNSe5ZpZH2vuAa1KgrIOxs4E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683659953846379.2659633286394; Tue, 9 May 2023 12:19:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwSqc-0004Dj-9p; Tue, 09 May 2023 15:18:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqa-0004DP-J9 for qemu-devel@nongnu.org; Tue, 09 May 2023 15:18:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqZ-0006bk-3B for qemu-devel@nongnu.org; Tue, 09 May 2023 15:18:04 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-wAZEx8SyN7COxPhQakbfBQ-1; Tue, 09 May 2023 15:17:59 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4CF811C09A40; Tue, 9 May 2023 19:17:48 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 20AC763F5B; Tue, 9 May 2023 19:17:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683659882; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sPPvOnvoiNHlMZuQYN+LxR+BbPHgjAYQVqBEiBP7vnI=; b=WNOz5c3CDsREXiGLI/ztXdaJyR/UevTTlUqcbEY4/Q/zR0KIcG6nCM76G+IGBXwg25a0d6 o6TcaSSd15RSYnwh9zm1aTKF4AD6ACrkNaKk3CmSSfMzH9I33TlNpQxpiJG/K4CVOv+FtV FbM5+tcnqxZUzrnxPP9ol8yj/KR1YSc= X-MC-Unique: wAZEx8SyN7COxPhQakbfBQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: "Dr. David Alan Gilbert" , Leonardo Bras , Hanna Reitz , Kevin Wolf , Paolo Bonzini , Hailiang Zhang , Eric Blake , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Markus Armbruster , Vladimir Sementsov-Ogievskiy , Zhang Chen Subject: [PULL 08/10] migration: process_incoming_migration_co: simplify code flow around ret Date: Tue, 9 May 2023 21:17:22 +0200 Message-Id: <20230509191724.86159-9-quintela@redhat.com> In-Reply-To: <20230509191724.86159-1-quintela@redhat.com> References: <20230509191724.86159-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683659954162100009 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Peter Xu Reviewed-by: Zhang Chen Message-Id: <20230428194928.1426370-7-vsementsov@yandex-team.ru> Signed-off-by: Juan Quintela --- migration/migration.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 3ab3b1c3e6..230f91f5a7 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -542,8 +542,13 @@ process_incoming_migration_co(void *opaque) /* Else if something went wrong then just fall out of the normal e= xit */ } =20 + if (ret < 0) { + error_report("load of migration failed: %s", strerror(-ret)); + goto fail; + } + /* we get COLO info, and know if we are in COLO mode */ - if (!ret && migration_incoming_colo_enabled()) { + if (migration_incoming_colo_enabled()) { QemuThread colo_incoming_thread; =20 /* Make sure all file formats throw away their mutable metadata */ @@ -565,10 +570,6 @@ process_incoming_migration_co(void *opaque) colo_release_ram_cache(); } =20 - if (ret < 0) { - error_report("load of migration failed: %s", strerror(-ret)); - goto fail; - } mis->bh =3D qemu_bh_new(process_incoming_migration_bh, mis); qemu_bh_schedule(mis->bh); mis->migration_incoming_co =3D NULL; --=20 2.40.0 From nobody Mon May 13 15:49:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683659968; cv=none; d=zohomail.com; s=zohoarc; b=iULv+rJlsqyEDAlyAmkac5wJVTIZ9lm+TwKY0k7qW7grN+eGQOdSnPZOAs3moyhzRopyZI21BgW+GUhZE+ovFKCi31P2RLOvKyALJb0Hxh5LYgKzapd+BTRIha5MRq+fMgnI9C8YDh66hIH6CbRWDkvzl+7c76clLWnzs0RFumg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683659968; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=y8yUWxZBI4WbeI8emXU3tzoUUh9YUQs7F7iFHrOnxz8=; b=F0jODDQkIzco/U2hiE+ToJxA5xWSCjBjkzffuoVMuE/4rsiX8qVWwEDwQvjtgljQQdLjd0WwEbIkirNrOSGMn4ng8DcZhAxqGzJD9BEduBEiL4BYK4ClMNI+rCs3DoFcxoumJwP9mrYxtUYUy8sgReg3V4kfoxGFEZb0dPbRQ+s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683659968520522.1946074783032; Tue, 9 May 2023 12:19:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwSqW-0004CN-CV; Tue, 09 May 2023 15:18:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqV-0004Bv-0a for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqT-0006b5-Hg for qemu-devel@nongnu.org; Tue, 09 May 2023 15:17:58 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-643-aRid8sCIPeyTXkGvJLp9lQ-1; Tue, 09 May 2023 15:17:52 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 94CA585A588; Tue, 9 May 2023 19:17:50 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90ED463F84; Tue, 9 May 2023 19:17:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683659877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y8yUWxZBI4WbeI8emXU3tzoUUh9YUQs7F7iFHrOnxz8=; b=HAfW/pEo9BJZrHaCwaTZu0KdVHRx3l7BH9xlq0W26dJN9F2MNyZkraKQQqnHycZn7Sgma7 gMWQhxs6e/dzQd50bQSCs9huKp+dFs00v194CRCkReEuyYkPaOsknanetJ9Jcww4SPtalK YHEf2OCcLjm8LW8acdOs/LnLcsuycSw= X-MC-Unique: aRid8sCIPeyTXkGvJLp9lQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: "Dr. David Alan Gilbert" , Leonardo Bras , Hanna Reitz , Kevin Wolf , Paolo Bonzini , Hailiang Zhang , Eric Blake , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Markus Armbruster , Vladimir Sementsov-Ogievskiy Subject: [PULL 09/10] migration: disallow change capabilities in COLO state Date: Tue, 9 May 2023 21:17:23 +0200 Message-Id: <20230509191724.86159-10-quintela@redhat.com> In-Reply-To: <20230509191724.86159-1-quintela@redhat.com> References: <20230509191724.86159-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683659969587100001 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy COLO is not listed as running state in migrate_is_running(), so, it's theoretically possible to disable colo capability in COLO state and the unexpected error in migration_iteration_finish() is reachable. Let's disallow that in qmp_migrate_set_capabilities. Than the error becomes absolutely unreachable: we can get into COLO state only with enabled capability and can't disable it while we are in COLO state. So substitute the error by simple assertion. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Peter Xu Message-Id: <20230428194928.1426370-10-vsementsov@yandex-team.ru> Signed-off-by: Juan Quintela --- migration/migration.c | 5 +---- migration/options.c | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 230f91f5a7..4959f7ee44 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2781,10 +2781,7 @@ static void migration_iteration_finish(MigrationStat= e *s) runstate_set(RUN_STATE_POSTMIGRATE); break; case MIGRATION_STATUS_COLO: - if (!migrate_colo()) { - error_report("%s: critical error: calling COLO code without " - "COLO enabled", __func__); - } + assert(migrate_colo()); migrate_start_colo_process(s); s->vm_was_running =3D true; /* Fallthrough */ diff --git a/migration/options.c b/migration/options.c index 9d92b15b76..7ed88b7b32 100644 --- a/migration/options.c +++ b/migration/options.c @@ -598,7 +598,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilitySt= atusList *params, MigrationCapabilityStatusList *cap; bool new_caps[MIGRATION_CAPABILITY__MAX]; =20 - if (migration_is_running(s->state)) { + if (migration_is_running(s->state) || migration_in_colo_state()) { error_setg(errp, QERR_MIGRATION_ACTIVE); return; } --=20 2.40.0 From nobody Mon May 13 15:49:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683659950; cv=none; d=zohomail.com; s=zohoarc; b=XJfEoZL2pkVJFQFe39OsXlF6r26vbCGbk4yrU/Q5n4sLIIHU6QcRznvi52C4FFjaSCtnwaomkTJsW18LRnf8ehJmibnnEufEBlW//rtBzO+V+80nqeDkawlQh7KARGL8iCp7K7+95ZieVfXiQloQt593KGatonLwjBdvW3wOKIE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683659950; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EXFLxsOojO36t9lZ90qTxaAgi8JWSTRtAUEm+5nsQXo=; b=EGOPE1BxeDQzG4Ejn6TtmRqfolR5Slhwrgl6zPjha7cGfzXBzpELj7V/dfrSg/5JoPtvxfmtni3kYJxJ0lhNuTUlAw3SQypfXKSqCH+gn5XMkMURgXZwMUoFCqd7WSDcXKIkyNoHNm2WNPsWmxmHFbxQPAe2YCmhvTvM6pwuY5c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683659950758468.16663374935763; Tue, 9 May 2023 12:19:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwSqh-0004Qu-Qy; Tue, 09 May 2023 15:18:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqg-0004La-1m for qemu-devel@nongnu.org; Tue, 09 May 2023 15:18:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwSqe-0006cR-GC for qemu-devel@nongnu.org; Tue, 09 May 2023 15:18:09 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-632-LcJ253w4N1SHrorwr2xMLA-1; Tue, 09 May 2023 15:17:58 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 32E5685A5B1; Tue, 9 May 2023 19:17:53 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id D79C863F5B; Tue, 9 May 2023 19:17:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683659885; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EXFLxsOojO36t9lZ90qTxaAgi8JWSTRtAUEm+5nsQXo=; b=ios+dO6Jh2W+rKWGbM+PuH20gF0HAg/Ot8pJ1Ki18WPfaj23NrXiFTVs6XjNE+Z7jG3VPN 8uY5gqsrgjR24xLoJSjAm1TnSEmvlS3S17QT97GM95+z8DPSjYwJBfS/MdmOlCXH/fauRe meW6+2gldtcSs7UIpZCZ3mE54aPtD0M= X-MC-Unique: LcJ253w4N1SHrorwr2xMLA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: "Dr. David Alan Gilbert" , Leonardo Bras , Hanna Reitz , Kevin Wolf , Paolo Bonzini , Hailiang Zhang , Eric Blake , Juan Quintela , qemu-block@nongnu.org, Peter Xu , Markus Armbruster , Vladimir Sementsov-Ogievskiy , Lukas Straub , Zhang Chen Subject: [PULL 10/10] migration: block incoming colo when capability is disabled Date: Tue, 9 May 2023 21:17:24 +0200 Message-Id: <20230509191724.86159-11-quintela@redhat.com> In-Reply-To: <20230509191724.86159-1-quintela@redhat.com> References: <20230509191724.86159-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683659951528100002 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy We generally require same set of capabilities on source and target. Let's require x-colo capability to use COLO on target. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela Reviewed-by: Peter Xu Reviewed-by: Lukas Straub Reviewed-by: Zhang Chen Message-Id: <20230428194928.1426370-11-vsementsov@yandex-team.ru> Signed-off-by: Juan Quintela --- docs/COLO-FT.txt | 1 + migration/migration.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/docs/COLO-FT.txt b/docs/COLO-FT.txt index 8ec653f81c..2e760a4aee 100644 --- a/docs/COLO-FT.txt +++ b/docs/COLO-FT.txt @@ -210,6 +210,7 @@ children.0=3Dchilds0 \ =20 3. On Secondary VM's QEMU monitor, issue command {"execute":"qmp_capabilities"} +{"execute": "migrate-set-capabilities", "arguments": {"capabilities": [ {"= capability": "x-colo", "state": true } ] } } {"execute": "nbd-server-start", "arguments": {"addr": {"type": "inet", "da= ta": {"host": "0.0.0.0", "port": "9999"} } } } {"execute": "nbd-server-add", "arguments": {"device": "parent0", "writable= ": true } } =20 diff --git a/migration/migration.c b/migration/migration.c index 4959f7ee44..7558c8edbd 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -398,6 +398,12 @@ int migration_incoming_enable_colo(void) return -ENOTSUP; #endif =20 + if (!migrate_colo()) { + error_report("ENABLE_COLO command come in migration stream, but c-= colo " + "capability is not set"); + return -EINVAL; + } + if (ram_block_discard_disable(true)) { error_report("COLO: cannot disable RAM discard"); return -EBUSY; --=20 2.40.0