From nobody Sat May 11 09:33:18 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=1681996817; cv=none; d=zohomail.com; s=zohoarc; b=VoU09zoF/HiBlfnOsKbOrEA2KioGVPrYpBt/3LZTQF9xkMifXmOUz/XmkTxo1BOXsDzvQmUOHcGMvjmgvr3PQAFyIdM1f8w1qMkYJIR/ySEQ7/C0i4y8t73vY7ct4mQcqruLn4kRMKypGF52mMJ3xx7CW5ei10K68CRTnLbBw1w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996817; 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=6o32OnKQySspYCv1i0uC98rIrrhiIlUItNYIUCo5zFI=; b=B0lCOo/69NlN9Bfi2e+cUDKokVUzm369vMupckOL0MqqJl5pk4e2vJQd8vq//gGdezXcg9podwjPXi1W3pGQ/9CQt0+a2zb6+hchSOhxyaoqEEaOIvQ/kCk8ckWwP6MatcbLNu+rwJMHol58pNgNBz0qvdbuSceMsqq994vYfN0= 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 1681996817852679.2632144465372; Thu, 20 Apr 2023 06:20:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUB1-0001Zi-TN; Thu, 20 Apr 2023 09:18:19 -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 1ppUAk-0001U7-DD for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:03 -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 1ppUAi-0005cO-SG for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:02 -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-8-VvgXwVnNN8WW_fyMmNlQQw-1; Thu, 20 Apr 2023 09:17:54 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 11D18281424A; Thu, 20 Apr 2023 13:17:54 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E414C16024; Thu, 20 Apr 2023 13:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996680; 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=6o32OnKQySspYCv1i0uC98rIrrhiIlUItNYIUCo5zFI=; b=Gqz7WVDMXMtMewvCQ7VVZnVKSCRzp6ZZUZuJEsTvEb5XNgKxy5iKPMj7NwEfUOkYxFV+IP 8iEsL6QzGbjl0okECaaWV9nVQ/5cdGtSWlCoez/h1dmraJvbNOSnp4hW3W29kiK0bSPcGD VzQN9F8fumOU2S48olWiOZkaqgIo9do= X-MC-Unique: VvgXwVnNN8WW_fyMmNlQQw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , =?UTF-8?q?=E6=9D=8E=E7=9A=86=E4=BF=8A?= Subject: [PULL 01/20] migration: remove extra whitespace character for code style Date: Thu, 20 Apr 2023 15:17:32 +0200 Message-Id: <20230420131751.28534-2-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-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.8 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: 1681996819447100003 From: =E6=9D=8E=E7=9A=86=E4=BF=8A Fix code style. Signed-off-by: =E6=9D=8E=E7=9A=86=E4=BF=8A Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index 79d881f735..0e68099bf9 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3293,7 +3293,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque) =20 migration_ops =3D g_malloc0(sizeof(MigrationOps)); migration_ops->ram_save_target_page =3D ram_save_target_page_legacy; - ret =3D multifd_send_sync_main(f); + ret =3D multifd_send_sync_main(f); if (ret < 0) { return ret; } --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681996804; cv=none; d=zohomail.com; s=zohoarc; b=K1j752nLQWJKw51C8wyt2kWGhAiaNLxo1LjGKHbZ1+8VrZ3pUZOG+2F1QBUlcOWlc68wN9VmDqpyiKFQGachR+p1vLuQZOeznP91Is+Bmms4nAigULBQaO4VuXU9NRwiC0cro4BFXGIqvbw+8hrXknZQAa41+xLw2XucRna13aw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996804; 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=4TPdA40OOwfMarlX475oBacyThfJJiayiWrnafYAYy4=; b=eVW1pYPLPjbLKOQ96X4/mI8tBgEH/Egaoos/GfgNQoNuzjPA5mJn9go0C2M51QXV4BNiuRhgsn6kRtEpoNy8ENqYYldEN3Q5zO9q6pPiTBAimEY1cksAA3RB8dEt6pxZ/lrnImIQ2OXcJuownJDxo1/sLnO5rARvOogiMNSqZiQ= 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 16819968044761012.5218994597964; Thu, 20 Apr 2023 06:20:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUB7-0001pS-ED; Thu, 20 Apr 2023 09:18:25 -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 1ppUB5-0001kv-I6 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:23 -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 1ppUB4-0005km-23 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:23 -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-441-p47HN8bZO7a0pMZV9Fapmg-1; Thu, 20 Apr 2023 09:17:58 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EEA39800047 for ; Thu, 20 Apr 2023 13:17:54 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56DA6C16024; Thu, 20 Apr 2023 13:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996700; 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=4TPdA40OOwfMarlX475oBacyThfJJiayiWrnafYAYy4=; b=QG9sn1d14evEPQyvtE86RQGw3z3pIYnhpQN2OJaw6QFSVQJ7X+K/D2GfBHAomsGwLVsDR7 wgCmoxqBPHnx9wmmac40H8kPneccXgfVatv4Rr/b+VVoPBRZeZ42p0o9KerezjzdUd4ukv gXaB6zvpvPUx30KJufR5HmGo/dyLpGA= X-MC-Unique: p47HN8bZO7a0pMZV9Fapmg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini Subject: [PULL 02/20] postcopy-ram: do not use qatomic_mb_read Date: Thu, 20 Apr 2023 15:17:33 +0200 Message-Id: <20230420131751.28534-3-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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, 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: 1681996805771100003 Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini It does not even pair with a qatomic_mb_set(), so it is clearer to use load-acquire in this case; they are synonyms. Signed-off-by: Paolo Bonzini Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/postcopy-ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 93f39f8e06..7d24dac397 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -1500,7 +1500,7 @@ static PostcopyState incoming_postcopy_state; =20 PostcopyState postcopy_state_get(void) { - return qatomic_mb_read(&incoming_postcopy_state); + return qatomic_load_acquire(&incoming_postcopy_state); } =20 /* Set the state and return the old state */ --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681996774; cv=none; d=zohomail.com; s=zohoarc; b=ESN/JzPmQa+0uZ5sAPOEvyHpOfZY5yD8OTaZOQMDExVCwAMY9+UF4hIKmoiZrg/+NoWVqQ+CPulQe910iIxDUdGbzsoLJY9SxOAVKqpoRoHUjfQSDSbDz6BRg/nV2oIK5WemAfTzpWVCAms18c4uo5ImY/tEf3AlhfLA8Wd0Zlw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996774; 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=VirGQ9KNoqS+QrqmjH+r2cCMH2niifD5RoldGCmIoDI=; b=BRBja2KwViw61c8N3yxFzpbws5hEwMZ/snVmyXlIqp1NEIhZmGtnJBKnpjMRBdv7zuByDq5qnyBwCsykIRA823ke2WYeDYq6Mw2odDqOVMPYhCAYCb336im6pEP4vpZJ+aLGVL4iLjKHIjOV8S+eVo6c7TANoUmInRpgQhgByv4= 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 1681996774271893.3088072856557; Thu, 20 Apr 2023 06:19:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUAw-0001VC-1b; Thu, 20 Apr 2023 09:18:16 -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 1ppUAj-0001U5-Oy for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:03 -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 1ppUAh-0005c0-PK for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:01 -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-664-YdDPIaesPQugIzcrg0GuFw-1; Thu, 20 Apr 2023 09:17:56 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2D47C2814257 for ; Thu, 20 Apr 2023 13:17:56 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3FEFEC16024; Thu, 20 Apr 2023 13:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996678; 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=VirGQ9KNoqS+QrqmjH+r2cCMH2niifD5RoldGCmIoDI=; b=Y9zWAFEve+hmPiHcY6edcYfmtpdyo46lMPvJdkr4Y5KYjDR2gidGXy9yZ7Mi6tPKLkPDRK B/dvGxATgWZbYmCOCfQqcjJlek/U+iViOANyjyVTj4AN4+x462KsROb0NQOJWpSbazzWDX 1+sZjYbQ/gNu3t+/sQqUzphEf+QdMoM= X-MC-Unique: YdDPIaesPQugIzcrg0GuFw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Peter Xu Subject: [PULL 03/20] migration: Merge ram_counters and ram_atomic_counters Date: Thu, 20 Apr 2023 15:17:34 +0200 Message-Id: <20230420131751.28534-4-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: 1681996775076100003 Content-Type: text/plain; charset="utf-8" Using MgrationStats as type for ram_counters mean that we didn't have to re-declare each value in another struct. The need of atomic counters have make us to create MigrationAtomicStats for this atomic counters. Create RAMStats type which is a merge of MigrationStats and MigrationAtomicStats removing unused members. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- Fix typos found by David Edmondson --- migration/migration.c | 8 ++++---- migration/multifd.c | 4 ++-- migration/ram.c | 39 ++++++++++++++++----------------------- migration/ram.h | 28 +++++++++++++++------------- 4 files changed, 37 insertions(+), 42 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index bda4789193..10483f3cab 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1140,12 +1140,12 @@ static void populate_ram_info(MigrationInfo *info, = MigrationState *s) size_t page_size =3D qemu_target_page_size(); =20 info->ram =3D g_malloc0(sizeof(*info->ram)); - info->ram->transferred =3D stat64_get(&ram_atomic_counters.transferred= ); + info->ram->transferred =3D stat64_get(&ram_counters.transferred); info->ram->total =3D ram_bytes_total(); - info->ram->duplicate =3D stat64_get(&ram_atomic_counters.duplicate); + info->ram->duplicate =3D stat64_get(&ram_counters.duplicate); /* legacy value. It is not used anymore */ info->ram->skipped =3D 0; - info->ram->normal =3D stat64_get(&ram_atomic_counters.normal); + info->ram->normal =3D stat64_get(&ram_counters.normal); info->ram->normal_bytes =3D info->ram->normal * page_size; info->ram->mbps =3D s->mbps; info->ram->dirty_sync_count =3D ram_counters.dirty_sync_count; @@ -1157,7 +1157,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->pages_per_second =3D s->pages_per_second; info->ram->precopy_bytes =3D ram_counters.precopy_bytes; info->ram->downtime_bytes =3D ram_counters.downtime_bytes; - info->ram->postcopy_bytes =3D stat64_get(&ram_atomic_counters.postcopy= _bytes); + info->ram->postcopy_bytes =3D stat64_get(&ram_counters.postcopy_bytes); =20 if (migrate_use_xbzrle()) { info->xbzrle_cache =3D g_malloc0(sizeof(*info->xbzrle_cache)); diff --git a/migration/multifd.c b/migration/multifd.c index cbc0dfe39b..01fab01a92 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -433,7 +433,7 @@ static int multifd_send_pages(QEMUFile *f) transferred =3D ((uint64_t) pages->num) * p->page_size + p->packet_len; qemu_file_acct_rate_limit(f, transferred); ram_counters.multifd_bytes +=3D transferred; - stat64_add(&ram_atomic_counters.transferred, transferred); + stat64_add(&ram_counters.transferred, transferred); qemu_mutex_unlock(&p->mutex); qemu_sem_post(&p->sem); =20 @@ -628,7 +628,7 @@ int multifd_send_sync_main(QEMUFile *f) p->pending_job++; qemu_file_acct_rate_limit(f, p->packet_len); ram_counters.multifd_bytes +=3D p->packet_len; - stat64_add(&ram_atomic_counters.transferred, p->packet_len); + stat64_add(&ram_counters.transferred, p->packet_len); qemu_mutex_unlock(&p->mutex); qemu_sem_post(&p->sem); } diff --git a/migration/ram.c b/migration/ram.c index 0e68099bf9..71320ed27a 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -458,25 +458,18 @@ uint64_t ram_bytes_remaining(void) 0; } =20 -/* - * NOTE: not all stats in ram_counters are used in reality. See comments - * for struct MigrationAtomicStats. The ultimate result of ram migration - * counters will be a merged version with both ram_counters and the atomic - * fields in ram_atomic_counters. - */ -MigrationStats ram_counters; -MigrationAtomicStats ram_atomic_counters; +RAMStats ram_counters; =20 void ram_transferred_add(uint64_t bytes) { if (runstate_is_running()) { ram_counters.precopy_bytes +=3D bytes; } else if (migration_in_postcopy()) { - stat64_add(&ram_atomic_counters.postcopy_bytes, bytes); + stat64_add(&ram_counters.postcopy_bytes, bytes); } else { ram_counters.downtime_bytes +=3D bytes; } - stat64_add(&ram_atomic_counters.transferred, bytes); + stat64_add(&ram_counters.transferred, bytes); } =20 void dirty_sync_missed_zero_copy(void) @@ -756,7 +749,7 @@ void mig_throttle_counter_reset(void) =20 rs->time_last_bitmap_sync =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); rs->num_dirty_pages_period =3D 0; - rs->bytes_xfer_prev =3D stat64_get(&ram_atomic_counters.transferred); + rs->bytes_xfer_prev =3D stat64_get(&ram_counters.transferred); } =20 /** @@ -1130,8 +1123,8 @@ uint64_t ram_pagesize_summary(void) =20 uint64_t ram_get_total_transferred_pages(void) { - return stat64_get(&ram_atomic_counters.normal) + - stat64_get(&ram_atomic_counters.duplicate) + + return stat64_get(&ram_counters.normal) + + stat64_get(&ram_counters.duplicate) + compression_counters.pages + xbzrle_counters.pages; } =20 @@ -1192,7 +1185,7 @@ static void migration_trigger_throttle(RAMState *rs) MigrationState *s =3D migrate_get_current(); uint64_t threshold =3D s->parameters.throttle_trigger_threshold; uint64_t bytes_xfer_period =3D - stat64_get(&ram_atomic_counters.transferred) - rs->bytes_xfer_prev; + stat64_get(&ram_counters.transferred) - rs->bytes_xfer_prev; uint64_t bytes_dirty_period =3D rs->num_dirty_pages_period * TARGET_PA= GE_SIZE; uint64_t bytes_dirty_threshold =3D bytes_xfer_period * threshold / 100; =20 @@ -1255,7 +1248,7 @@ static void migration_bitmap_sync(RAMState *rs) /* reset period counters */ rs->time_last_bitmap_sync =3D end_time; rs->num_dirty_pages_period =3D 0; - rs->bytes_xfer_prev =3D stat64_get(&ram_atomic_counters.transferre= d); + rs->bytes_xfer_prev =3D stat64_get(&ram_counters.transferred); } if (migrate_use_events()) { qapi_event_send_migration_pass(ram_counters.dirty_sync_count); @@ -1331,7 +1324,7 @@ static int save_zero_page(PageSearchStatus *pss, QEMU= File *f, RAMBlock *block, int len =3D save_zero_page_to_file(pss, f, block, offset); =20 if (len) { - stat64_add(&ram_atomic_counters.duplicate, 1); + stat64_add(&ram_counters.duplicate, 1); ram_transferred_add(len); return 1; } @@ -1368,9 +1361,9 @@ static bool control_save_page(PageSearchStatus *pss, = RAMBlock *block, } =20 if (bytes_xmit > 0) { - stat64_add(&ram_atomic_counters.normal, 1); + stat64_add(&ram_counters.normal, 1); } else if (bytes_xmit =3D=3D 0) { - stat64_add(&ram_atomic_counters.duplicate, 1); + stat64_add(&ram_counters.duplicate, 1); } =20 return true; @@ -1402,7 +1395,7 @@ static int save_normal_page(PageSearchStatus *pss, RA= MBlock *block, qemu_put_buffer(file, buf, TARGET_PAGE_SIZE); } ram_transferred_add(TARGET_PAGE_SIZE); - stat64_add(&ram_atomic_counters.normal, 1); + stat64_add(&ram_counters.normal, 1); return 1; } =20 @@ -1458,7 +1451,7 @@ static int ram_save_multifd_page(QEMUFile *file, RAMB= lock *block, if (multifd_queue_page(file, block, offset) < 0) { return -1; } - stat64_add(&ram_atomic_counters.normal, 1); + stat64_add(&ram_counters.normal, 1); =20 return 1; } @@ -1497,7 +1490,7 @@ update_compress_thread_counts(const CompressParam *pa= ram, int bytes_xmit) ram_transferred_add(bytes_xmit); =20 if (param->zero_page) { - stat64_add(&ram_atomic_counters.duplicate, 1); + stat64_add(&ram_counters.duplicate, 1); return; } =20 @@ -2632,9 +2625,9 @@ void acct_update_position(QEMUFile *f, size_t size, b= ool zero) uint64_t pages =3D size / TARGET_PAGE_SIZE; =20 if (zero) { - stat64_add(&ram_atomic_counters.duplicate, pages); + stat64_add(&ram_counters.duplicate, pages); } else { - stat64_add(&ram_atomic_counters.normal, pages); + stat64_add(&ram_counters.normal, pages); ram_transferred_add(size); qemu_file_credit_transfer(f, size); } diff --git a/migration/ram.h b/migration/ram.h index 81cbb0947c..7c026b5242 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -35,25 +35,27 @@ #include "qemu/stats64.h" =20 /* - * These are the migration statistic counters that need to be updated using - * atomic ops (can be accessed by more than one thread). Here since we - * cannot modify MigrationStats directly to use Stat64 as it was defined in - * the QAPI scheme, we define an internal structure to hold them, and we - * propagate the real values when QMP queries happen. - * - * IOW, the corresponding fields within ram_counters on these specific - * fields will be always zero and not being used at all; they're just - * placeholders to make it QAPI-compatible. + * These are the ram migration statistic counters. It is loosely + * based on MigrationStats. We change to Stat64 any counter that + * needs to be updated using atomic ops (can be accessed by more than + * one thread). */ typedef struct { - Stat64 transferred; + int64_t dirty_pages_rate; + int64_t dirty_sync_count; + uint64_t dirty_sync_missed_zero_copy; + uint64_t downtime_bytes; Stat64 duplicate; + uint64_t multifd_bytes; Stat64 normal; Stat64 postcopy_bytes; -} MigrationAtomicStats; + int64_t postcopy_requests; + uint64_t precopy_bytes; + int64_t remaining; + Stat64 transferred; +} RAMStats; =20 -extern MigrationAtomicStats ram_atomic_counters; -extern MigrationStats ram_counters; +extern RAMStats ram_counters; extern XBZRLECacheStats xbzrle_counters; extern CompressionStats compression_counters; =20 --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681996726; cv=none; d=zohomail.com; s=zohoarc; b=jiAFZZ05gD7Ru3SG47S1VH3TK6pX02HhdIRysHaVLmqaiCDkYoXAsy1G6P3jK0/xu9Cif/Vt674XwqhyxLLy0Vv0ubWbWn8tDQ2ELvQnaODs/rKuk6hb969xWUD7xWMLNdTjIC2bTdJlf2lQYBO5XK2yGl4tMLzsDdev9EEj0Qs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996726; 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=eTO429KLqwUbEQU+ZtqrLHI39e9KpeLfEvHvRX65iNQ=; b=SIQxBRuzWsitoDgmBqCTeTX5fXfWQhw/ihCTMUFEeMlIoWiHaWlJIkObUuZ91jzI9aza4oTJHOpMQrrE2mq2xp9YZX6K8Cx+HoIqS9fS1AwaiPPJ3LJffBffQ9/0sv/8mOpWWZo6TpCb/B4UmgqR5W6vjhx2GOhBuXnkH7q4gkU= 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 1681996726878115.94778343088706; Thu, 20 Apr 2023 06:18:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUAr-0001V3-1g; Thu, 20 Apr 2023 09:18:13 -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 1ppUAj-0001U3-Ni for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:03 -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 1ppUAh-0005cC-VX for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:01 -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-1-nOFC-zOJNO6GT8ZOIRTtBg-1; Thu, 20 Apr 2023 09:17:57 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9718A884EC0; Thu, 20 Apr 2023 13:17:57 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 725C4C16024; Thu, 20 Apr 2023 13:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996679; 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=eTO429KLqwUbEQU+ZtqrLHI39e9KpeLfEvHvRX65iNQ=; b=Vr35yIywXxpE3F15eTGEQUsY653mmaXlPLMZvTND5+sqndFcFF3FAJ2jIl5oDNe4ccEril xb1bIi0umdvm1RG6r6Cl/uiq+l0FkSDSgQ8wVGq2VfH2D4dc5hwT2uyJgR1h1b3lb938gj QBUJavsA1nBbW8m+NwGu52yhYxxF7r8= X-MC-Unique: nOFC-zOJNO6GT8ZOIRTtBg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , David Edmondson , Peter Xu Subject: [PULL 04/20] migration: Update atomic stats out of the mutex Date: Thu, 20 Apr 2023 15:17:35 +0200 Message-Id: <20230420131751.28534-5-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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, 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: 1681996729334100003 Content-Type: text/plain; charset="utf-8" Reviewed-by: David Edmondson Reviewed-by: Peter Xu Signed-off-by: Juan Quintela --- migration/multifd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index 01fab01a92..6ef3a27938 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -433,8 +433,8 @@ static int multifd_send_pages(QEMUFile *f) transferred =3D ((uint64_t) pages->num) * p->page_size + p->packet_len; qemu_file_acct_rate_limit(f, transferred); ram_counters.multifd_bytes +=3D transferred; + qemu_mutex_unlock(&p->mutex); stat64_add(&ram_counters.transferred, transferred); - qemu_mutex_unlock(&p->mutex); qemu_sem_post(&p->sem); =20 return 1; @@ -628,8 +628,8 @@ int multifd_send_sync_main(QEMUFile *f) p->pending_job++; qemu_file_acct_rate_limit(f, p->packet_len); ram_counters.multifd_bytes +=3D p->packet_len; + qemu_mutex_unlock(&p->mutex); stat64_add(&ram_counters.transferred, p->packet_len); - qemu_mutex_unlock(&p->mutex); qemu_sem_post(&p->sem); } for (i =3D 0; i < migrate_multifd_channels(); i++) { --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681996903; cv=none; d=zohomail.com; s=zohoarc; b=QaJmBLgnPn8GoPwj87kZxUteTVsjfGxECHs8VL+xgYgOw4sD8gQUuPAXjK5gD29d8yZMVqunSs5igeqQaTCs+5SvFr9suWnsvBoun0QX67PzhnhfzQmfZAch0UZjyGM6gb2pae6qtkY6w2i8XTGab4RtUQc4gFyxcgckrk01ShM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996903; 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=PIZiNP4HVa8w9fFOyLZGSLJknz7pMkuwv3sznNSWh58=; b=UspVle2Zjyla2b6nwcUFi+4Yc6VUO6KROTqktnIzhUoU2xiOVwpBRFARGk62noIzalW3kOLG+LBe0dLsW6tufTZ5Y55jP46u54b7c5F9X5RjqJrks2Fh+lX3mKFCL6fFeZT24zs30irmRXbwexKGezcCC06SqlDE9aDC0t5JiHs= 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 1681996903341978.2797787311134; Thu, 20 Apr 2023 06:21:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUB4-0001bl-0a; Thu, 20 Apr 2023 09:18:22 -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 1ppUAn-0001UC-3Y for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:05 -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 1ppUAl-0005dI-JB for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:04 -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-107-Xlto3EsXMp-oujabHPbMOA-1; Thu, 20 Apr 2023 09:17:59 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CEBF2884EC0; Thu, 20 Apr 2023 13:17:58 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE3E0C16024; Thu, 20 Apr 2023 13:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996682; 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=PIZiNP4HVa8w9fFOyLZGSLJknz7pMkuwv3sznNSWh58=; b=P7WXL5qOUneKc1BQOYB/wobEz6qOrEne+okn4U9FApGszMumkJ+IjJcjSGvouZe6qo/jQQ uo6BFD/W0nUYf+xMJiTYwyhSN3Q+CZ1+aCJBjuQUZc+DU/Jr2VIk0jZ1sJK1FNprMJDlwj sS0nid5RzX+79WkGvefyN+MzLItw68s= X-MC-Unique: Xlto3EsXMp-oujabHPbMOA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , David Edmondson , Peter Xu Subject: [PULL 05/20] migration: Make multifd_bytes atomic Date: Thu, 20 Apr 2023 15:17:36 +0200 Message-Id: <20230420131751.28534-6-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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, 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: 1681996904237100003 Content-Type: text/plain; charset="utf-8" In the spirit of: commit 394d323bc3451e4d07f13341cb8817fac8dfbadd Author: Peter Xu Date: Tue Oct 11 17:55:51 2022 -0400 migration: Use atomic ops properly for page accountings Reviewed-by: David Edmondson Reviewed-by: Peter Xu Signed-off-by: Juan Quintela --- migration/migration.c | 4 ++-- migration/multifd.c | 4 ++-- migration/ram.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 10483f3cab..c3debe71f6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1153,7 +1153,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) ram_counters.dirty_sync_missed_zero_copy; info->ram->postcopy_requests =3D ram_counters.postcopy_requests; info->ram->page_size =3D page_size; - info->ram->multifd_bytes =3D ram_counters.multifd_bytes; + info->ram->multifd_bytes =3D stat64_get(&ram_counters.multifd_bytes); info->ram->pages_per_second =3D s->pages_per_second; info->ram->precopy_bytes =3D ram_counters.precopy_bytes; info->ram->downtime_bytes =3D ram_counters.downtime_bytes; @@ -3778,7 +3778,7 @@ static MigThrError migration_detect_error(MigrationSt= ate *s) static uint64_t migration_total_bytes(MigrationState *s) { return qemu_file_total_transferred(s->to_dst_file) + - ram_counters.multifd_bytes; + stat64_get(&ram_counters.multifd_bytes); } =20 static void migration_calculate_complete(MigrationState *s) diff --git a/migration/multifd.c b/migration/multifd.c index 6ef3a27938..1c992abf53 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -432,9 +432,9 @@ static int multifd_send_pages(QEMUFile *f) p->pages =3D pages; transferred =3D ((uint64_t) pages->num) * p->page_size + p->packet_len; qemu_file_acct_rate_limit(f, transferred); - ram_counters.multifd_bytes +=3D transferred; qemu_mutex_unlock(&p->mutex); stat64_add(&ram_counters.transferred, transferred); + stat64_add(&ram_counters.multifd_bytes, transferred); qemu_sem_post(&p->sem); =20 return 1; @@ -627,9 +627,9 @@ int multifd_send_sync_main(QEMUFile *f) p->flags |=3D MULTIFD_FLAG_SYNC; p->pending_job++; qemu_file_acct_rate_limit(f, p->packet_len); - ram_counters.multifd_bytes +=3D p->packet_len; qemu_mutex_unlock(&p->mutex); stat64_add(&ram_counters.transferred, p->packet_len); + stat64_add(&ram_counters.multifd_bytes, p->packet_len); qemu_sem_post(&p->sem); } for (i =3D 0; i < migrate_multifd_channels(); i++) { diff --git a/migration/ram.h b/migration/ram.h index 7c026b5242..ed70391317 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -46,7 +46,7 @@ typedef struct { uint64_t dirty_sync_missed_zero_copy; uint64_t downtime_bytes; Stat64 duplicate; - uint64_t multifd_bytes; + Stat64 multifd_bytes; Stat64 normal; Stat64 postcopy_bytes; int64_t postcopy_requests; --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681997005; cv=none; d=zohomail.com; s=zohoarc; b=KBP8Yx/TDryZ19iay7WalfEuxNTDqtg0GQMW0tdgkIg4kPTF0iMtlcR/TCzoLoqatcsfBH7EwipDZf+xXVPaWAS/Ngshmft03U1s1AVg5fyEtl9ciqfKCTBQvWR9kg+SaYab6RgsaS4RDmnVcUBJlux1OFr7hlrVOGJcN+5ed6I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681997005; 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=gL0ykmtNo3ZxZwrOtOTDv2wucS3IWqU34lcBpNTCV7s=; b=aHrGjvG656E03Aa3IBm9Jygn3ixgZ9TK90bxs4qCbfsu2GNJoYd6VD4U+60CJStbNDAqDlrf8+2OTOmJ+mXVMcNRNKJ/A349lHvkSAPJMW1XQqdo1rcxCf7Zdk+FaW+T3S2J1cxBYfyFtzmDzepgKSdztLZMfF8DoZ7VtMqjGaY= 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 1681997005472893.058601933298; Thu, 20 Apr 2023 06:23:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUB4-0001gJ-Tb; Thu, 20 Apr 2023 09:18:22 -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 1ppUAu-0001VW-KQ for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:13 -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 1ppUAr-0005fa-Lr for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:11 -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-147-hKKLIVenMce8txMiY6F9_w-1; Thu, 20 Apr 2023 09:18:00 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E2A5085A5A3 for ; Thu, 20 Apr 2023 13:17:59 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22D94C16026; Thu, 20 Apr 2023 13:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996689; 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=gL0ykmtNo3ZxZwrOtOTDv2wucS3IWqU34lcBpNTCV7s=; b=MAHhab8CX3Qy4b3h2q3eURk4UqQ/O7UemTHneYuMyMVhFuPCdKnSqWS6rNi2Dhsp0BJ/r9 PC/f2nu5L/F9CPF47VNbQhIwv01avf1gQjTvHwQVo4oQ9hNtXOPD530rUWDBHTWKKghS7U CkqLlfnTJdwwvjm8QY8v+y6O63kUOds= X-MC-Unique: hKKLIVenMce8txMiY6F9_w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Peter Xu Subject: [PULL 06/20] migration: Make dirty_sync_missed_zero_copy atomic Date: Thu, 20 Apr 2023 15:17:37 +0200 Message-Id: <20230420131751.28534-7-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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, 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: 1681997006362100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/migration.c | 2 +- migration/multifd.c | 2 +- migration/ram.c | 5 ----- migration/ram.h | 4 +--- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index c3debe71f6..66e5197b77 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1150,7 +1150,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->mbps =3D s->mbps; info->ram->dirty_sync_count =3D ram_counters.dirty_sync_count; info->ram->dirty_sync_missed_zero_copy =3D - ram_counters.dirty_sync_missed_zero_copy; + stat64_get(&ram_counters.dirty_sync_missed_zero_copy); info->ram->postcopy_requests =3D ram_counters.postcopy_requests; info->ram->page_size =3D page_size; info->ram->multifd_bytes =3D stat64_get(&ram_counters.multifd_bytes); diff --git a/migration/multifd.c b/migration/multifd.c index 1c992abf53..903df2117b 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -576,7 +576,7 @@ static int multifd_zero_copy_flush(QIOChannel *c) return -1; } if (ret =3D=3D 1) { - dirty_sync_missed_zero_copy(); + stat64_add(&ram_counters.dirty_sync_missed_zero_copy, 1); } =20 return ret; diff --git a/migration/ram.c b/migration/ram.c index 71320ed27a..93e0a48af4 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -472,11 +472,6 @@ void ram_transferred_add(uint64_t bytes) stat64_add(&ram_counters.transferred, bytes); } =20 -void dirty_sync_missed_zero_copy(void) -{ - ram_counters.dirty_sync_missed_zero_copy++; -} - struct MigrationOps { int (*ram_save_target_page)(RAMState *rs, PageSearchStatus *pss); }; diff --git a/migration/ram.h b/migration/ram.h index ed70391317..2170c55e67 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -43,7 +43,7 @@ typedef struct { int64_t dirty_pages_rate; int64_t dirty_sync_count; - uint64_t dirty_sync_missed_zero_copy; + Stat64 dirty_sync_missed_zero_copy; uint64_t downtime_bytes; Stat64 duplicate; Stat64 multifd_bytes; @@ -114,6 +114,4 @@ void ram_write_tracking_prepare(void); int ram_write_tracking_start(void); void ram_write_tracking_stop(void); =20 -void dirty_sync_missed_zero_copy(void); - #endif --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681996763; cv=none; d=zohomail.com; s=zohoarc; b=kKRA7ZTd+QAGFz3uVkt8lX5EZFsbSUgJH3PoGBs8EY/5Z5AUXWOv/gwJ9EzctB5cWWZtx2ir1HDdSrOO5csAgQWeM3ndVS2QH4dU2bsNotGbEzAE760JY5u+UhrZ/qpHPanNWtOkkPfzCNeEh/wTyxn03YHo8KZS1nCD44bm8Z4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996763; 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=cT9l59Y4GSadWstb/Go/h8p2mUI+dL2YBlwxDVEEcfI=; b=mew4Vko9vYxLXiDJCNd2bWnzuovgMGtNJfLA3vg9ryu30W5IF8v8X7t0W8dh1MszAO2zgXNs+mhi8kASccEVsohl7MzP7+C3bGSuaJDIgX5UpsfY6l5IwYlvtDH1bMkjBUEusnnmdHDiZpHYydQelwpRpfs40qde7MB+gs3N9jQ= 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 1681996763388905.8921194309544; Thu, 20 Apr 2023 06: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 1ppUB4-0001dv-I2; Thu, 20 Apr 2023 09:18:22 -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 1ppUAn-0001UO-It for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:05 -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 1ppUAl-0005dM-Lb for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:05 -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-142-ifQBww58NZaSfPljLEqIWw-1; Thu, 20 Apr 2023 09:18:01 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 09530101A557 for ; Thu, 20 Apr 2023 13:18:01 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A1A5C16024; Thu, 20 Apr 2023 13:18:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996682; 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=cT9l59Y4GSadWstb/Go/h8p2mUI+dL2YBlwxDVEEcfI=; b=K3l9n0W2A3ch3v7HWIdUY4ZoqmCWI2ymMmLWxhaEG5GdaFKiyMvRPHX2Y3P3sOfXlLu/gG d6yQdZJJ70f8WbLaKdweoY/3GzDum4JG2ce0Di1M8aE4N0bJNEC/28PZ2g/xutm6pgjBXY KIFJvIuAbADlKB8zifSpY/bk2ojLIps= X-MC-Unique: ifQBww58NZaSfPljLEqIWw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Peter Xu Subject: [PULL 07/20] migration: Make precopy_bytes atomic Date: Thu, 20 Apr 2023 15:17:38 +0200 Message-Id: <20230420131751.28534-8-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: 1681996765477100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/migration.c | 2 +- migration/ram.c | 2 +- migration/ram.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 66e5197b77..cbd6f6f235 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1155,7 +1155,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->page_size =3D page_size; info->ram->multifd_bytes =3D stat64_get(&ram_counters.multifd_bytes); info->ram->pages_per_second =3D s->pages_per_second; - info->ram->precopy_bytes =3D ram_counters.precopy_bytes; + info->ram->precopy_bytes =3D stat64_get(&ram_counters.precopy_bytes); info->ram->downtime_bytes =3D ram_counters.downtime_bytes; info->ram->postcopy_bytes =3D stat64_get(&ram_counters.postcopy_bytes); =20 diff --git a/migration/ram.c b/migration/ram.c index 93e0a48af4..0b4693215e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -463,7 +463,7 @@ RAMStats ram_counters; void ram_transferred_add(uint64_t bytes) { if (runstate_is_running()) { - ram_counters.precopy_bytes +=3D bytes; + stat64_add(&ram_counters.precopy_bytes, bytes); } else if (migration_in_postcopy()) { stat64_add(&ram_counters.postcopy_bytes, bytes); } else { diff --git a/migration/ram.h b/migration/ram.h index 2170c55e67..a766b895fa 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -50,7 +50,7 @@ typedef struct { Stat64 normal; Stat64 postcopy_bytes; int64_t postcopy_requests; - uint64_t precopy_bytes; + Stat64 precopy_bytes; int64_t remaining; Stat64 transferred; } RAMStats; --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681996782; cv=none; d=zohomail.com; s=zohoarc; b=Os01aPFeS4W87nap7Z+e0up41PMEx4nj2rWHeOrLPbribQUEPYdoXkFbLij5Sijy6IOLEG/fMAR9boodwBSdmNi5ON5I+Fvk8+nxemWdM743Hl6xH/GUkJ4RjQc/3xV2kHOHjPlMQfxVJl0Zbnsreae1ce4nNUnCai7vXDWmM7w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996782; 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=b8nktDbQGhyng8rEyggk/WN70WXELiml8F6XRH+ytTY=; b=Z2IdEfeGy1KylQGtvR5iuj8yFAO79nBDsnU5N/9x79WC67ObxiV4icGT+I2mHjTo/mmOTzrtkY2oGKmJ+9Vmn+10cRJcotKjQ1TEvuvCDeMRQc2p2FR/uP9BY0ZWQlfZesT+twIZa5mf9EUlGqPgdofsXgjT8qHdlcW+nP5f9A0= 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 1681996782610705.2707129759883; Thu, 20 Apr 2023 06:19:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUB6-0001oS-6d; Thu, 20 Apr 2023 09:18:24 -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 1ppUAp-0001V1-IW for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:08 -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 1ppUAm-0005dW-F8 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:06 -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-471-qqNAn2AsN8OgpKvAFOxS7A-1; Thu, 20 Apr 2023 09:18:02 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2BC6587A9E9 for ; Thu, 20 Apr 2023 13:18:02 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 539ABC16024; Thu, 20 Apr 2023 13:18:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996683; 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=b8nktDbQGhyng8rEyggk/WN70WXELiml8F6XRH+ytTY=; b=dW0HUGt8b8jpn3gxBJITxvGgE3dEW1BCqAppurBZpX/2jja/YC0gIeBJx+3xJVYnxTGu3b PKCwfCdcIRF/MLlwT0+iO+5KmYkFh1n+mlkl/VXATh76UCeSOTfECBKTbOW/yt9z0gmSTs x1MVddQebWox593uKLTReTK971//C7k= X-MC-Unique: qqNAn2AsN8OgpKvAFOxS7A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Peter Xu Subject: [PULL 08/20] migration: Make downtime_bytes atomic Date: Thu, 20 Apr 2023 15:17:39 +0200 Message-Id: <20230420131751.28534-9-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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, 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: 1681996784228100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/migration.c | 2 +- migration/ram.c | 2 +- migration/ram.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index cbd6f6f235..4ca2173d85 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1156,7 +1156,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->multifd_bytes =3D stat64_get(&ram_counters.multifd_bytes); info->ram->pages_per_second =3D s->pages_per_second; info->ram->precopy_bytes =3D stat64_get(&ram_counters.precopy_bytes); - info->ram->downtime_bytes =3D ram_counters.downtime_bytes; + info->ram->downtime_bytes =3D stat64_get(&ram_counters.downtime_bytes); info->ram->postcopy_bytes =3D stat64_get(&ram_counters.postcopy_bytes); =20 if (migrate_use_xbzrle()) { diff --git a/migration/ram.c b/migration/ram.c index 0b4693215e..b1722b6071 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -467,7 +467,7 @@ void ram_transferred_add(uint64_t bytes) } else if (migration_in_postcopy()) { stat64_add(&ram_counters.postcopy_bytes, bytes); } else { - ram_counters.downtime_bytes +=3D bytes; + stat64_add(&ram_counters.downtime_bytes, bytes); } stat64_add(&ram_counters.transferred, bytes); } diff --git a/migration/ram.h b/migration/ram.h index a766b895fa..bb52632424 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -44,7 +44,7 @@ typedef struct { int64_t dirty_pages_rate; int64_t dirty_sync_count; Stat64 dirty_sync_missed_zero_copy; - uint64_t downtime_bytes; + Stat64 downtime_bytes; Stat64 duplicate; Stat64 multifd_bytes; Stat64 normal; --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681997023; cv=none; d=zohomail.com; s=zohoarc; b=bNJZnbYiba6LkdbABt8aA0dgqmcgTf91qtaKe3xcXIMlSr670SQf7NTR612ynmhmEnroF/f5jiEHba3RmmuvTZ2e72ZM3NUGGI3B2MDHnLWNyWGSUKEjDT6geBL8wPph60jlT+JWF/EuvW1MBSs1WK7u+z6xKgkXaTB0mROkN/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681997023; 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=GjcTrAksCxmbiPlNvbjUXnHDSgjwXW8MBUgNQYev5Eg=; b=BXebB01xsALGKGvR0EAPTzMC/mV5XsWj/mPfIKzzkuONlYyJoicaYZp2V2OwirwsxjpOn1XEV7Ms57sRKfS2WFOMTzWYiqEcDDYX84dtYmiVGJV19XWDJ/iPtD30UHR2nzPSS1HCW/BOfGfoI1emi9GDd0HfgSkmzGj71QYpOpo= 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 1681997023408261.51846348083063; Thu, 20 Apr 2023 06:23:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUB7-0001pH-1w; Thu, 20 Apr 2023 09:18:25 -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 1ppUAp-0001V5-Ic for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:08 -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 1ppUAn-0005dr-Vr for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:07 -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-342--rSU_mW-MVSzzapI13V6RA-1; Thu, 20 Apr 2023 09:18:03 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4385087A9E6 for ; Thu, 20 Apr 2023 13:18:03 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78711C16024; Thu, 20 Apr 2023 13:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996684; 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=GjcTrAksCxmbiPlNvbjUXnHDSgjwXW8MBUgNQYev5Eg=; b=HpxA0L8Mj2PNmwH7DQfFP8q5lSRmry2/a6gVMwGkfo+DaCME3K9txxHjgqgm7D/F2tQg/O T6SHsKPdrILWhKY/e+ciAeZIN+gmpcvjlgqtWIw6d6C/heJGjhA+mXLnL3kdnG/LFE5f6S M0BxLgsPGQWvu6o+zFLLmRHPUMz3kBY= X-MC-Unique: -rSU_mW-MVSzzapI13V6RA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Peter Xu Subject: [PULL 09/20] migration: Make dirty_sync_count atomic Date: Thu, 20 Apr 2023 15:17:40 +0200 Message-Id: <20230420131751.28534-10-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: 1681997025149100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/migration.c | 3 ++- migration/ram.c | 13 +++++++------ migration/ram.h | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 4ca2173d85..97c227aa85 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1148,7 +1148,8 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->normal =3D stat64_get(&ram_counters.normal); info->ram->normal_bytes =3D info->ram->normal * page_size; info->ram->mbps =3D s->mbps; - info->ram->dirty_sync_count =3D ram_counters.dirty_sync_count; + info->ram->dirty_sync_count =3D + stat64_get(&ram_counters.dirty_sync_count); info->ram->dirty_sync_missed_zero_copy =3D stat64_get(&ram_counters.dirty_sync_missed_zero_copy); info->ram->postcopy_requests =3D ram_counters.postcopy_requests; diff --git a/migration/ram.c b/migration/ram.c index b1722b6071..3c13136559 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -764,7 +764,7 @@ static void xbzrle_cache_zero_page(RAMState *rs, ram_ad= dr_t current_addr) /* We don't care if this fails to allocate a new cache page * as long as it updated an old one */ cache_insert(XBZRLE.cache, current_addr, XBZRLE.zero_target_page, - ram_counters.dirty_sync_count); + stat64_get(&ram_counters.dirty_sync_count)); } =20 #define ENCODING_FLAG_XBZRLE 0x1 @@ -790,13 +790,13 @@ static int save_xbzrle_page(RAMState *rs, PageSearchS= tatus *pss, int encoded_len =3D 0, bytes_xbzrle; uint8_t *prev_cached_page; QEMUFile *file =3D pss->pss_channel; + uint64_t generation =3D stat64_get(&ram_counters.dirty_sync_count); =20 - if (!cache_is_cached(XBZRLE.cache, current_addr, - ram_counters.dirty_sync_count)) { + if (!cache_is_cached(XBZRLE.cache, current_addr, generation)) { xbzrle_counters.cache_miss++; if (!rs->last_stage) { if (cache_insert(XBZRLE.cache, current_addr, *current_data, - ram_counters.dirty_sync_count) =3D=3D -1) { + generation) =3D=3D -1) { return -1; } else { /* update *current_data when the page has been @@ -1209,7 +1209,7 @@ static void migration_bitmap_sync(RAMState *rs) RAMBlock *block; int64_t end_time; =20 - ram_counters.dirty_sync_count++; + stat64_add(&ram_counters.dirty_sync_count, 1); =20 if (!rs->time_last_bitmap_sync) { rs->time_last_bitmap_sync =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIM= E); @@ -1246,7 +1246,8 @@ static void migration_bitmap_sync(RAMState *rs) rs->bytes_xfer_prev =3D stat64_get(&ram_counters.transferred); } if (migrate_use_events()) { - qapi_event_send_migration_pass(ram_counters.dirty_sync_count); + uint64_t generation =3D stat64_get(&ram_counters.dirty_sync_count); + qapi_event_send_migration_pass(generation); } } =20 diff --git a/migration/ram.h b/migration/ram.h index bb52632424..8c0d07c43a 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -42,7 +42,7 @@ */ typedef struct { int64_t dirty_pages_rate; - int64_t dirty_sync_count; + Stat64 dirty_sync_count; Stat64 dirty_sync_missed_zero_copy; Stat64 downtime_bytes; Stat64 duplicate; --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681996982; cv=none; d=zohomail.com; s=zohoarc; b=kbe/k31NYWs/fZW0wN3WYsSmI5umOxrwavxzRLgIPplw7n3RodIQOO8HMzjiXn9aIpBeSTVIV+Lw2sotTgZJRgJ0XuR6SJK9LrYA2dp/pdL7NsSRHZwxq+Y8n0ssn9bClaunB7AHzIMjhV0Fig8xZQOH6rt+/m+96SzKoT7Y8AI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996982; 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=Onh57vrnmdF/fkaMzeSarm7LYi+lYdgF6rW+lcbE5rM=; b=Mdcs3xMYtFWa4yA6xeb8itILZZgIbB8dXYxWODSf0EQclw1nbijjfdMYnKDF+dWHWhGwLLgvx4zmM7brsmAL83Kq0ljqdHk9Hj3FSuFbisMwJjUJ6AqAR86Qp+TacKKyMYwFxHqp6MbRMliGFG47UFspaa5m+lFZAGnd7Ud7fHU= 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 1681996982847422.11347877905916; Thu, 20 Apr 2023 06:23:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUBI-0001wT-N2; Thu, 20 Apr 2023 09:18:36 -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 1ppUAz-0001Zd-CF for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:17 -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 1ppUAw-0005gy-QT for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:17 -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-442-66e-RW4HM6CyTs_VLTfMIQ-1; Thu, 20 Apr 2023 09:18:04 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5E671185A78B for ; Thu, 20 Apr 2023 13:18:04 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C0C9C16024; Thu, 20 Apr 2023 13:18:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996693; 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=Onh57vrnmdF/fkaMzeSarm7LYi+lYdgF6rW+lcbE5rM=; b=GcJnx2qh2LD4uCuNNIwAdjEJPvAUkYizuXZw7PDFabPi19ok2ayiLaDL08ojzyRKOAUC9+ xmzUyJQWhjfITmSceNGOhtZsEf37grTP5bAFepxbZ3rr6KMqfmEf4HPOUb0zbGTTOEaT6S 6faFUiowz6ThuTuDHhbGiRiO7FP4Ky8= X-MC-Unique: 66e-RW4HM6CyTs_VLTfMIQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Peter Xu Subject: [PULL 10/20] migration: Make postcopy_requests atomic Date: Thu, 20 Apr 2023 15:17:41 +0200 Message-Id: <20230420131751.28534-11-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: 1681996983551100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/migration.c | 3 ++- migration/ram.c | 2 +- migration/ram.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 97c227aa85..09b37a6603 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1152,7 +1152,8 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) stat64_get(&ram_counters.dirty_sync_count); info->ram->dirty_sync_missed_zero_copy =3D stat64_get(&ram_counters.dirty_sync_missed_zero_copy); - info->ram->postcopy_requests =3D ram_counters.postcopy_requests; + info->ram->postcopy_requests =3D + stat64_get(&ram_counters.postcopy_requests); info->ram->page_size =3D page_size; info->ram->multifd_bytes =3D stat64_get(&ram_counters.multifd_bytes); info->ram->pages_per_second =3D s->pages_per_second; diff --git a/migration/ram.c b/migration/ram.c index 3c13136559..fe69ecaef4 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2169,7 +2169,7 @@ int ram_save_queue_pages(const char *rbname, ram_addr= _t start, ram_addr_t len) RAMBlock *ramblock; RAMState *rs =3D ram_state; =20 - ram_counters.postcopy_requests++; + stat64_add(&ram_counters.postcopy_requests, 1); RCU_READ_LOCK_GUARD(); =20 if (!rbname) { diff --git a/migration/ram.h b/migration/ram.h index 8c0d07c43a..afa68521d7 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -49,7 +49,7 @@ typedef struct { Stat64 multifd_bytes; Stat64 normal; Stat64 postcopy_bytes; - int64_t postcopy_requests; + Stat64 postcopy_requests; Stat64 precopy_bytes; int64_t remaining; Stat64 transferred; --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681997053; cv=none; d=zohomail.com; s=zohoarc; b=XI4f9XH7iMsf2eKA1GM7GT7awc00uWyOiXqHlt5artQVq4u7A62cq7pN/HjuDMplYh3WQpIvjzxeLFO1FOX6dRmKxM/2Ti/zQrEyReGtf4+S+b11/XcejlDN1Zy4OjJ91dkOGAY6bAvahaSPJurjRRQJ8QWaJ1e4rubtn2YQE8A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681997053; 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=4JcaSme6KV6OfGQWcqIPJFBdErusq0CmJOoFtFFK0Wc=; b=e1IisLWEaTCnr6ivKZunB+nxwZCYzTkWO0wfxX4iQc8mP7XpP9POfynLtOtrrs0+hwX/2dFW2OHXuKutxWrwvKauDoaJK1ewlY1rsv/uMG4KJuyW5JbX2b8GDMgTMZD2okoBrrRQBnbEQe136JqxSIp4U6JRHUd55Ef3aQm1Ck4= 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 1681997053751152.3459238538029; Thu, 20 Apr 2023 06:24:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUB5-0001jC-Bf; Thu, 20 Apr 2023 09:18:23 -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 1ppUAt-0001VL-0Y for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:13 -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 1ppUAr-0005f4-9a for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:10 -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-77-agcG3RgXNsyWAnWBRehSvg-1; Thu, 20 Apr 2023 09:18:05 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6C608281424A for ; Thu, 20 Apr 2023 13:18:05 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4613C16024; Thu, 20 Apr 2023 13:18:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996687; 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=4JcaSme6KV6OfGQWcqIPJFBdErusq0CmJOoFtFFK0Wc=; b=NNDyGbpgbt9Q/P+SYAWTUKIbohnDEbGeozFcbKDp8nw5DN54t/KkJAocUTdD3qBjixUBPZ 3WHNtYRg315iY2K+EHY7mo4e/muBHXkK4syW8u44flkKWfwy5m8Xrm5HH3iaTvf69wHJHD VpxpyVUwFMAWhJrQTHwsxDBJgj/D4x4= X-MC-Unique: agcG3RgXNsyWAnWBRehSvg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Peter Xu Subject: [PULL 11/20] migration: Make dirty_pages_rate atomic Date: Thu, 20 Apr 2023 15:17:42 +0200 Message-Id: <20230420131751.28534-12-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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, 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: 1681997054847100001 Content-Type: text/plain; charset="utf-8" In this case we use qatomic operations instead of Stat64 wrapper because there is no stat64_set(). Defining the 64 bit wrapper is trivial. The one without atomics is more interesting. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/migration.c | 6 ++++-- migration/ram.c | 5 +++-- migration/ram.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 09b37a6603..50eae2fbcd 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1190,7 +1190,8 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) =20 if (s->state !=3D MIGRATION_STATUS_COMPLETED) { info->ram->remaining =3D ram_bytes_remaining(); - info->ram->dirty_pages_rate =3D ram_counters.dirty_pages_rate; + info->ram->dirty_pages_rate =3D + qatomic_read__nocheck(&ram_counters.dirty_pages_rate); } } =20 @@ -3844,7 +3845,8 @@ static void migration_update_counters(MigrationState = *s, * if we haven't sent anything, we don't want to * recalculate. 10000 is a small enough number for our purposes */ - if (ram_counters.dirty_pages_rate && transferred > 10000) { + if (qatomic_read__nocheck(&ram_counters.dirty_pages_rate) && + transferred > 10000) { s->expected_downtime =3D ram_counters.remaining / bandwidth; } =20 diff --git a/migration/ram.c b/migration/ram.c index fe69ecaef4..7400abf5e1 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1129,8 +1129,9 @@ static void migration_update_rates(RAMState *rs, int6= 4_t end_time) double compressed_size; =20 /* calculate period counters */ - ram_counters.dirty_pages_rate =3D rs->num_dirty_pages_period * 1000 - / (end_time - rs->time_last_bitmap_sync); + qatomic_set__nocheck(&ram_counters.dirty_pages_rate, + rs->num_dirty_pages_period * 1000 / + (end_time - rs->time_last_bitmap_sync)); =20 if (!page_count) { return; diff --git a/migration/ram.h b/migration/ram.h index afa68521d7..574a604b72 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -41,7 +41,7 @@ * one thread). */ typedef struct { - int64_t dirty_pages_rate; + aligned_uint64_t dirty_pages_rate; Stat64 dirty_sync_count; Stat64 dirty_sync_missed_zero_copy; Stat64 downtime_bytes; --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681996965; cv=none; d=zohomail.com; s=zohoarc; b=d3NWTf6wsEwB23m+LNf+R5GV++orxyR0hJsfNgmQG3bcaKbL33B4l7JAx7OrEduzbkwbjTvmNRqlWDqxRtWw/drAbBm5B6uRC21BNEBzM4UqeG1tG1K1RYc2+I1dY9cbFQHJdRGkiXeIvhwQ7hxHdszc9qid3F8X8AylSj30VrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996965; 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=fpIe2fggh0WgGhk7dw5U2PA0cF4YjoQLtGpttx1vF90=; b=ee2tb6pEhxe6D2P36F2zZDgDcGMcwBSaTstl1xMEpVkr3328e4tjDFYsYExVgG51S6QPcMW0GUtKANSy/5XHNkRHcO8ds1lGXd75V8hze27vVzB/+KzkfYb6QOBBGXJkpQZXTdmRi33gN9xF/5z0V8TqPv2/qKmyyDTJDIKG49w= 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 1681996965047164.0733178277111; Thu, 20 Apr 2023 06:22:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUB7-0001pk-OC; Thu, 20 Apr 2023 09:18:25 -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 1ppUAt-0001VT-Fx for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:13 -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 1ppUAr-0005fY-KD for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:10 -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-583-TTduI9KZNmqLZMlS9lSMzg-1; Thu, 20 Apr 2023 09:18:07 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4BDDD29AA39B for ; Thu, 20 Apr 2023 13:18:07 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5641C16024; Thu, 20 Apr 2023 13:18:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996689; 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=fpIe2fggh0WgGhk7dw5U2PA0cF4YjoQLtGpttx1vF90=; b=Wxn6qspExtOMtUav+PktwGfW0udwM/LL4yEC0uz/ipn1OwHrIwFPDT3p/EP8BBPSc9Ux4g eWogG0KIo1Rjr7hhovicqL/tHhikE6pFyn712lXtBQ8tsSnTjpPHH+hgYDMX55W8zA7hqF ROWBAOli9myTwrJ9oRWM4jow4H6OQ+c= X-MC-Unique: TTduI9KZNmqLZMlS9lSMzg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Peter Xu Subject: [PULL 12/20] migration: Make dirty_bytes_last_sync atomic Date: Thu, 20 Apr 2023 15:17:43 +0200 Message-Id: <20230420131751.28534-13-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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, 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: 1681996967290100003 Content-Type: text/plain; charset="utf-8" As we set its value, it needs to be operated with atomics. We rename it from remaining to better reflect its meaning. Statistics always return the real reamaining bytes. This was used to store how much pages where dirty on the previous generation, so we can calculate the expected downtime as: dirty_bytes_last_sync / current_bandwith. If we use the actual remaining bytes, we would see a very small value at the end of the iteration. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- I am open to use ram_bytes_remaining() in its only use and be more "optimistic" about the downtime. --- migration/migration.c | 4 +++- migration/ram.c | 3 ++- migration/ram.h | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 50eae2fbcd..83d3bfbf62 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3847,7 +3847,9 @@ static void migration_update_counters(MigrationState = *s, */ if (qatomic_read__nocheck(&ram_counters.dirty_pages_rate) && transferred > 10000) { - s->expected_downtime =3D ram_counters.remaining / bandwidth; + s->expected_downtime =3D + qatomic_read__nocheck(&ram_counters.dirty_bytes_last_sync) / + bandwidth; } =20 qemu_file_reset_rate_limit(s->to_dst_file); diff --git a/migration/ram.c b/migration/ram.c index 7400abf5e1..7bbaf8cd86 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1224,7 +1224,8 @@ static void migration_bitmap_sync(RAMState *rs) RAMBLOCK_FOREACH_NOT_IGNORED(block) { ramblock_sync_dirty_bitmap(rs, block); } - ram_counters.remaining =3D ram_bytes_remaining(); + qatomic_set__nocheck(&ram_counters.dirty_bytes_last_sync, + ram_bytes_remaining()); } qemu_mutex_unlock(&rs->bitmap_mutex); =20 diff --git a/migration/ram.h b/migration/ram.h index 574a604b72..8093ebc210 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -41,6 +41,7 @@ * one thread). */ typedef struct { + aligned_uint64_t dirty_bytes_last_sync; aligned_uint64_t dirty_pages_rate; Stat64 dirty_sync_count; Stat64 dirty_sync_missed_zero_copy; @@ -51,7 +52,6 @@ typedef struct { Stat64 postcopy_bytes; Stat64 postcopy_requests; Stat64 precopy_bytes; - int64_t remaining; Stat64 transferred; } RAMStats; =20 --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681996953; cv=none; d=zohomail.com; s=zohoarc; b=bCd9VpuTp8BB2Dz8cVzjKEqBHGUOfYkF5YuhNaRSu8bjAkf2p4PxAVJTwfHJplaC4A85aeGrfHrxKGEJVvsIcMn74TwI3TublIrvFNNPQGhX2IoEJ6SHhXTl6M71nELDay05BvMnSQghpqMRL01MnNnJxjHH8bk/XP+Y2l/Iw0M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996953; 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=MJ6gdf6F+x8ADzWpDsmFOY1phzyWlH2wNBarYw84/Ps=; b=at3jFVubr0V/mLkPB5PbJL7B37HPI5H0ybsWp8n7SnucDPHDLmldZEi9W2fqkeWZo4Zie1qx+TdY8VVWKan+hXfTYrR/dVJjQ0TYPdeQsn4XLKa5o1x3O5+d5LKainwcIW3VVUCHIsSqnxVu/39KOrqs3SCfIR5MtDkbP31qhtc= 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 1681996953801708.1865059778514; Thu, 20 Apr 2023 06:22:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUB4-0001cV-BP; Thu, 20 Apr 2023 09:18:22 -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 1ppUAv-0001VX-AO for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:13 -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 1ppUAt-0005fq-8I for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:12 -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-568-b6goYd3sMIiEXrSPJutJug-1; Thu, 20 Apr 2023 09:18:08 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7C294884EC1 for ; Thu, 20 Apr 2023 13:18:08 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91374C16026; Thu, 20 Apr 2023 13:18:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996690; 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=MJ6gdf6F+x8ADzWpDsmFOY1phzyWlH2wNBarYw84/Ps=; b=FxxU/hqt1VYKkGpaHTmP6wEQfUkzaRjgnONWSVZiWAkkQk9ItwGACRB+QloKHFMvV75M2C 4wRU7TcCllwR3NgJx8pEE1GQkVaDmGyUSXG9SBhK1UFyrkp3jD1ZIxuvts3XLl3O6nxkHB qHlr5bxhhyliDY32vThFvFOecPB3+fg= X-MC-Unique: b6goYd3sMIiEXrSPJutJug-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Peter Xu Subject: [PULL 13/20] migration: Rename duplicate to zero_pages Date: Thu, 20 Apr 2023 15:17:44 +0200 Message-Id: <20230420131751.28534-14-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: 1681996954154100001 Content-Type: text/plain; charset="utf-8" Rest of counters that refer to pages has a _pages suffix. And historically, this showed the number of pages composed of the same character, here comes the name "duplicated". But since years ago, it refers to the number of zero_pages. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/migration.c | 2 +- migration/ram.c | 10 +++++----- migration/ram.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 83d3bfbf62..20ef5b683b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1142,7 +1142,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram =3D g_malloc0(sizeof(*info->ram)); info->ram->transferred =3D stat64_get(&ram_counters.transferred); info->ram->total =3D ram_bytes_total(); - info->ram->duplicate =3D stat64_get(&ram_counters.duplicate); + info->ram->duplicate =3D stat64_get(&ram_counters.zero_pages); /* legacy value. It is not used anymore */ info->ram->skipped =3D 0; info->ram->normal =3D stat64_get(&ram_counters.normal); diff --git a/migration/ram.c b/migration/ram.c index 7bbaf8cd86..1a098a9c21 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1119,7 +1119,7 @@ uint64_t ram_pagesize_summary(void) uint64_t ram_get_total_transferred_pages(void) { return stat64_get(&ram_counters.normal) + - stat64_get(&ram_counters.duplicate) + + stat64_get(&ram_counters.zero_pages) + compression_counters.pages + xbzrle_counters.pages; } =20 @@ -1322,7 +1322,7 @@ static int save_zero_page(PageSearchStatus *pss, QEMU= File *f, RAMBlock *block, int len =3D save_zero_page_to_file(pss, f, block, offset); =20 if (len) { - stat64_add(&ram_counters.duplicate, 1); + stat64_add(&ram_counters.zero_pages, 1); ram_transferred_add(len); return 1; } @@ -1361,7 +1361,7 @@ static bool control_save_page(PageSearchStatus *pss, = RAMBlock *block, if (bytes_xmit > 0) { stat64_add(&ram_counters.normal, 1); } else if (bytes_xmit =3D=3D 0) { - stat64_add(&ram_counters.duplicate, 1); + stat64_add(&ram_counters.zero_pages, 1); } =20 return true; @@ -1488,7 +1488,7 @@ update_compress_thread_counts(const CompressParam *pa= ram, int bytes_xmit) ram_transferred_add(bytes_xmit); =20 if (param->zero_page) { - stat64_add(&ram_counters.duplicate, 1); + stat64_add(&ram_counters.zero_pages, 1); return; } =20 @@ -2623,7 +2623,7 @@ void acct_update_position(QEMUFile *f, size_t size, b= ool zero) uint64_t pages =3D size / TARGET_PAGE_SIZE; =20 if (zero) { - stat64_add(&ram_counters.duplicate, pages); + stat64_add(&ram_counters.zero_pages, pages); } else { stat64_add(&ram_counters.normal, pages); ram_transferred_add(size); diff --git a/migration/ram.h b/migration/ram.h index 8093ebc210..b27ce01f2e 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -46,7 +46,7 @@ typedef struct { Stat64 dirty_sync_count; Stat64 dirty_sync_missed_zero_copy; Stat64 downtime_bytes; - Stat64 duplicate; + Stat64 zero_pages; Stat64 multifd_bytes; Stat64 normal; Stat64 postcopy_bytes; --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681996732; cv=none; d=zohomail.com; s=zohoarc; b=Fw2+DkHpdP+8Np+RTFJKqRiUuSmNxHWtSbRib8j9PpLah3j86rfjnkp4exnRdiYZwSkxf+Te6Ci7oXE6ftTowvozQbDUXdWaDxx4rvGdhVvmD6Mqi9Ha+F37aq8ZDPuAfAkoQe6v58B0BcQIDqLDXgH8QSLN2Zy+m3x1Y3QcvSQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996732; 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=2Cj6Olm5jKKOgFQJS9oa9wUJfodK/sh+vpBAvRIw4K8=; b=P+QmanUVhrccq+BlcFQz3KiAPjndT332Ou6xuhnOwONpEKyp+g7kmw7GGWxCUlRIxoh/HKyiWO0tC5rEan+zzVopR+PrTQwCXQRKf31OpfyluQ50FrKda1PxkZ8x5vthMHigQyXd4fF5wjsEbbYkPqDv6b9F6Ho8KV9CKtVMEAE= 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 1681996732922198.1555721723729; Thu, 20 Apr 2023 06:18:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUBF-0001um-GD; Thu, 20 Apr 2023 09:18:34 -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 1ppUB5-0001kY-GI for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:23 -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 1ppUAu-0005g9-15 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:23 -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-541-2ilKVAn4PC6wrdKDwgIrFQ-1; Thu, 20 Apr 2023 09:18:09 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9D0B3800B35 for ; Thu, 20 Apr 2023 13:18:09 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3A56C16027; Thu, 20 Apr 2023 13:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996691; 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=2Cj6Olm5jKKOgFQJS9oa9wUJfodK/sh+vpBAvRIw4K8=; b=aYKSA8e03fRqRyvLSAU50eIMAJje3pTaOAfF3R5XzQ87h25JOsjoo8kb8Ej+NhNwNNoKW/ P8mbwvzw9UO+00FlouEBWyBxFz8FvVEpAACd5MEanHF9jCnApxKpdnUx2q+n1ZqXWNxYSl UqKbxEx4Y1rotDg6gEv0/I2pfZ1d4IY= X-MC-Unique: 2ilKVAn4PC6wrdKDwgIrFQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Peter Xu Subject: [PULL 14/20] migration: Rename normal to normal_pages Date: Thu, 20 Apr 2023 15:17:45 +0200 Message-Id: <20230420131751.28534-15-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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_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: 1681996733297100001 Content-Type: text/plain; charset="utf-8" Rest of counters that refer to pages has a _pages suffix. And historically, this showed the number of full pages transferred. The name "normal" refered to the fact that they were sent without any optimization (compression, xbzrle, zero_page, ...). Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/migration.c | 2 +- migration/ram.c | 10 +++++----- migration/ram.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 20ef5b683b..f311bb5f93 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1145,7 +1145,7 @@ static void populate_ram_info(MigrationInfo *info, Mi= grationState *s) info->ram->duplicate =3D stat64_get(&ram_counters.zero_pages); /* legacy value. It is not used anymore */ info->ram->skipped =3D 0; - info->ram->normal =3D stat64_get(&ram_counters.normal); + info->ram->normal =3D stat64_get(&ram_counters.normal_pages); info->ram->normal_bytes =3D info->ram->normal * page_size; info->ram->mbps =3D s->mbps; info->ram->dirty_sync_count =3D diff --git a/migration/ram.c b/migration/ram.c index 1a098a9c21..7ad92f8756 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1118,7 +1118,7 @@ uint64_t ram_pagesize_summary(void) =20 uint64_t ram_get_total_transferred_pages(void) { - return stat64_get(&ram_counters.normal) + + return stat64_get(&ram_counters.normal_pages) + stat64_get(&ram_counters.zero_pages) + compression_counters.pages + xbzrle_counters.pages; } @@ -1359,7 +1359,7 @@ static bool control_save_page(PageSearchStatus *pss, = RAMBlock *block, } =20 if (bytes_xmit > 0) { - stat64_add(&ram_counters.normal, 1); + stat64_add(&ram_counters.normal_pages, 1); } else if (bytes_xmit =3D=3D 0) { stat64_add(&ram_counters.zero_pages, 1); } @@ -1393,7 +1393,7 @@ static int save_normal_page(PageSearchStatus *pss, RA= MBlock *block, qemu_put_buffer(file, buf, TARGET_PAGE_SIZE); } ram_transferred_add(TARGET_PAGE_SIZE); - stat64_add(&ram_counters.normal, 1); + stat64_add(&ram_counters.normal_pages, 1); return 1; } =20 @@ -1449,7 +1449,7 @@ static int ram_save_multifd_page(QEMUFile *file, RAMB= lock *block, if (multifd_queue_page(file, block, offset) < 0) { return -1; } - stat64_add(&ram_counters.normal, 1); + stat64_add(&ram_counters.normal_pages, 1); =20 return 1; } @@ -2625,7 +2625,7 @@ void acct_update_position(QEMUFile *f, size_t size, b= ool zero) if (zero) { stat64_add(&ram_counters.zero_pages, pages); } else { - stat64_add(&ram_counters.normal, pages); + stat64_add(&ram_counters.normal_pages, pages); ram_transferred_add(size); qemu_file_credit_transfer(f, size); } diff --git a/migration/ram.h b/migration/ram.h index b27ce01f2e..11a0fde99b 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -48,7 +48,7 @@ typedef struct { Stat64 downtime_bytes; Stat64 zero_pages; Stat64 multifd_bytes; - Stat64 normal; + Stat64 normal_pages; Stat64 postcopy_bytes; Stat64 postcopy_requests; Stat64 precopy_bytes; --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681996739; cv=none; d=zohomail.com; s=zohoarc; b=UEPT3WSegRAyLZftSDgLrSoRYjp3uRQw+aNip2Oju3cgHvEZV3WUyGJGOTIzxMIIRdjVNohFzCDrVFLwiDX0QwkrUC0rgA1TDtmyIY1Hh98wMZO+O9+Eg98Su16RWPL1Pxl5ie7SViV0P31kXBTrtftNOOG2PL83rGNSytdmFY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996739; 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=FKOygxpLQ4Voj25YXcm8opwMTmqDKiU9niO3PnT4uJg=; b=WrFopSvIbr5BZvj75J7Z5GNbjo3OglImUy2hQldL+TvrB4RahMdo5VaTNScj2Utf50RvEP2IZy6ZN9lT6klDDeNI+wAHP0qikSn5QkpGURBsVR7dRIWx0/C9cLbx4a4Pnb06jQVhFR9nBi3TgGzpWjNCKJyZRocaPWIi2Ec20zw= 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 1681996739375906.7693046856307; Thu, 20 Apr 2023 06:18:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUBK-0001y2-6F; Thu, 20 Apr 2023 09:18:38 -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 1ppUBE-0001sh-4u for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:32 -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 1ppUAw-0005h4-TX for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:31 -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-619-db8KR1PzObG7Lap0_WkoLg-1; Thu, 20 Apr 2023 09:18:11 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CD4DC1C0514B; Thu, 20 Apr 2023 13:18:10 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id E24B6C16024; Thu, 20 Apr 2023 13:18:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996694; 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=FKOygxpLQ4Voj25YXcm8opwMTmqDKiU9niO3PnT4uJg=; b=b0C25cec9rZoSzOUHt/fhqOdKG1XbDxT3M5Y2EYsSRXpru0FzRk29gZgkxJqEh4p/CAS3J Zbs+1vsaUN2Lxs9PHRazB7+GF8U+SgQ9bt8bvMY7yqggrTJBigNQosCI0XSjj5O3SAP3FZ UAKq+p4TpFh+DZCljvBJqoD12WFMyqg= X-MC-Unique: db8KR1PzObG7Lap0_WkoLg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Eric Blake , Lukas Straub Subject: [PULL 15/20] migration: Handle block device inactivation failures better Date: Thu, 20 Apr 2023 15:17:46 +0200 Message-Id: <20230420131751.28534-16-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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, 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: 1681996740022100001 Content-Type: text/plain; charset="utf-8" From: Eric Blake Consider what happens when performing a migration between two host machines connected to an NFS server serving multiple block devices to the guest, when the NFS server becomes unavailable. The migration attempts to inactivate all block devices on the source (a necessary step before the destination can take over); but if the NFS server is non-responsive, the attempt to inactivate can itself fail. When that happens, the destination fails to get the migrated guest (good, because the source wasn't able to flush everything properly): (qemu) qemu-kvm: load of migration failed: Input/output error at which point, our only hope for the guest is for the source to take back control. With the current code base, the host outputs a message, but = then appears to resume: (qemu) qemu-kvm: qemu_savevm_state_complete_precopy_non_iterable: bdrv_in= activate_all() failed (-1) (src qemu)info status VM status: running but a second migration attempt now asserts: (src qemu) qemu-kvm: ../block.c:6738: int bdrv_inactivate_recurse(BlockDr= iverState *): Assertion `!(bs->open_flags & BDRV_O_INACTIVE)' failed. Whether the guest is recoverable on the source after the first failure is debatable, but what we do not want is to have qemu itself fail due to an assertion. It looks like the problem is as follows: In migration.c:migration_completion(), the source sets 'inactivate' to true (since COLO is not enabled), then tries savevm.c:qemu_savevm_state_complete_precopy() with a request to inactivate block devices. In turn, this calls block.c:bdrv_inactivate_all(), which fails when flushing runs up against the non-responsive NFS server. With savevm failing, we are now left in a state where some, but not all, of the block devices have been inactivated; but migration_completion() then jumps to 'fail' rather than 'fail_invalidate' and skips an attempt to reclaim those those disks by calling bdrv_activate_all(). Even if we do attempt to reclaim disks, we aren't taking note of failure there, either. Thus, we have reached a state where the migration engine has forgotten all state about whether a block device is inactive, because we did not set s->block_inactive in enough places; so migration allows the source to reach vm_start() and resume execution, violating the block layer invariant that the guest CPUs should not be restarted while a device is inactive. Note that the code in migration.c:migrate_fd_cancel() will also try to reactivate all block devices if s->block_inactive was set, but because we failed to set that flag after the first failure, the source assumes it has reclaimed all devices, even though it still has remaining inactivated devices and does not try again. Normally, qmp_cont() will also try to reactivate all disks (or correctly fail if the disks are not reclaimable because NFS is not yet back up), but the auto-resumption of the source after a migration failure does not go through qmp_cont(). And because we have left the block layer in an inconsistent state with devices still inactivated, the later migration attempt is hitting the assertion failure. Since it is important to not resume the source with inactive disks, this patch marks s->block_inactive before attempting inactivation, rather than after succeeding, in order to prevent any vm_start() until it has successfully reactivated all devices. See also https://bugzilla.redhat.com/show_bug.cgi?id=3D2058982 Signed-off-by: Eric Blake Reviewed-by: Juan Quintela Acked-by: Lukas Straub Tested-by: Lukas Straub Signed-off-by: Juan Quintela --- migration/migration.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index f311bb5f93..d630193272 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3447,13 +3447,11 @@ static void migration_completion(MigrationState *s) MIGRATION_STATUS_DEVICE); } if (ret >=3D 0) { + s->block_inactive =3D inactivate; qemu_file_set_rate_limit(s->to_dst_file, INT64_MAX); ret =3D qemu_savevm_state_complete_precopy(s->to_dst_file,= false, inactivate); } - if (inactivate && ret >=3D 0) { - s->block_inactive =3D true; - } } qemu_mutex_unlock_iothread(); =20 @@ -3525,6 +3523,7 @@ fail_invalidate: bdrv_activate_all(&local_err); if (local_err) { error_report_err(local_err); + s->block_inactive =3D true; } else { s->block_inactive =3D false; } --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681997024; cv=none; d=zohomail.com; s=zohoarc; b=NCKij36zJUHKfCTfjP21vIkVMSWKE8NurowPYZrFZAEtUGBUQPMpvynsyOoH9DL4mTmNCjwHYPxp+rwoDAGd/EPf9swRWVI0CLQmjNw3y2P9qDKH+Krj6YhbL3gbvo9eVTDQ4mfRFmTt/NYgTeaHinxPs2QlQQ99+aZeMAfhZTg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681997024; 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=ciIcbPI9hOjqUEVUJJbQtIKfDfIvPSrlIPnUOzP0G8A=; b=PQRPq1sHe9rU0l6koqz+wt1r7/23zHvQ/NRgKq924HsKSHt8qwsdftxjtJ9i37Y3sdIQ27F9Oos0fWUoNbtZer4ASiBH2ENaHInG1nZ21gFPIV1kfNmYY/w70U7UXbg9kdCTagDRacCYbhZMQRrv7MbUCHYCvTWtWscUm4EcY6o= 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 1681997024548154.6429890301108; Thu, 20 Apr 2023 06:23:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUB5-0001lE-Lo; Thu, 20 Apr 2023 09:18:23 -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 1ppUAz-0001Zb-1L for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:17 -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 1ppUAw-0005gm-Ep for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:16 -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-639-2VWF7HUHNLOy6C5TO3UDcg-1; Thu, 20 Apr 2023 09:18:12 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1B49A800B35 for ; Thu, 20 Apr 2023 13:18:12 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 200B2C16024; Thu, 20 Apr 2023 13:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996693; 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=ciIcbPI9hOjqUEVUJJbQtIKfDfIvPSrlIPnUOzP0G8A=; b=EV8GvC7e+6ct6xGZ7E7OZostxk23cMQFWeZm1dOkK6PKAQDKe/MaP9ZX7rTYadw74SLKo9 ImfxQYNLcqeiV9UyGBqQ/RzEF4FZs2mH0xFU1SLZtkZBPsumUt/ATG12l/pHes8QkjYeXp 5LFE7WG8nX3DsGnoTWilztBkX86JDlE= X-MC-Unique: 2VWF7HUHNLOy6C5TO3UDcg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Peter Xu , David Hildenbrand Subject: [PULL 16/20] util/mmap-alloc: qemu_fd_getfs() Date: Thu, 20 Apr 2023 15:17:47 +0200 Message-Id: <20230420131751.28534-17-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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, 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: 1681997025733100005 Content-Type: text/plain; charset="utf-8" From: Peter Xu This new helper fetches file system type for a fd. Only Linux is implemented so far. Currently only tmpfs and hugetlbfs are defined, but it can grow as needed. Signed-off-by: Peter Xu Reviewed-by: David Hildenbrand Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- include/qemu/mmap-alloc.h | 7 +++++++ util/mmap-alloc.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/include/qemu/mmap-alloc.h b/include/qemu/mmap-alloc.h index 2825e231a7..8344daaa03 100644 --- a/include/qemu/mmap-alloc.h +++ b/include/qemu/mmap-alloc.h @@ -1,8 +1,15 @@ #ifndef QEMU_MMAP_ALLOC_H #define QEMU_MMAP_ALLOC_H =20 +typedef enum { + QEMU_FS_TYPE_UNKNOWN =3D 0, + QEMU_FS_TYPE_TMPFS, + QEMU_FS_TYPE_HUGETLBFS, + QEMU_FS_TYPE_NUM, +} QemuFsType; =20 size_t qemu_fd_getpagesize(int fd); +QemuFsType qemu_fd_getfs(int fd); =20 /** * qemu_ram_mmap: mmap anonymous memory, the specified file or device. diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c index 5ed7d29183..ed14f9c64d 100644 --- a/util/mmap-alloc.c +++ b/util/mmap-alloc.c @@ -27,8 +27,36 @@ =20 #ifdef CONFIG_LINUX #include +#include #endif =20 +QemuFsType qemu_fd_getfs(int fd) +{ +#ifdef CONFIG_LINUX + struct statfs fs; + int ret; + + if (fd < 0) { + return QEMU_FS_TYPE_UNKNOWN; + } + + do { + ret =3D fstatfs(fd, &fs); + } while (ret !=3D 0 && errno =3D=3D EINTR); + + switch (fs.f_type) { + case TMPFS_MAGIC: + return QEMU_FS_TYPE_TMPFS; + case HUGETLBFS_MAGIC: + return QEMU_FS_TYPE_HUGETLBFS; + default: + return QEMU_FS_TYPE_UNKNOWN; + } +#else + return QEMU_FS_TYPE_UNKNOWN; +#endif +} + size_t qemu_fd_getpagesize(int fd) { #ifdef CONFIG_LINUX --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681996937; cv=none; d=zohomail.com; s=zohoarc; b=QhR0NBHXpiW3XVLaDWrDDQ3CYmD1ClGmMThAO6fXuNWm68OGLma2hbXoxwHh5q2XNy9GwYz4C+AinuRYI9+EVlAfE2W/05qu0yudZ7YzrErVE3ACzxCwVxw0qd5b0bbhoxGZOacAPWh1JO+EJxbO1870lE92HaItgabie6kS7d8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996937; 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=VZcCockVh9iyRvZHm9M48mFzVhopmL1Xp8SDzX78a/4=; b=HFsraU4pO6u/Hmw4Vwx8+HioCxuClPiQ8N5EKwmpVAdM5kguQlua67KWf7eMEP56pvM1gLc0geCSYFHEP7L2QKVZt+O+Q4urCvtaTr45f4xqoXZ/orwoGbuZletbk49mjVM+sYzzvf7xHX2OxciyuI7RIPb6rkrdvCYpwpIOQzY= 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 1681996937977327.27074419376186; Thu, 20 Apr 2023 06:22:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUBC-0001rX-MD; Thu, 20 Apr 2023 09:18:30 -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 1ppUB0-0001Zz-AW for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:19 -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 1ppUAy-0005hK-Ll for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:18 -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-299-lushXsBkPSO6gXHOU5oHMA-1; Thu, 20 Apr 2023 09:18:13 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5AB7E811E7B for ; Thu, 20 Apr 2023 13:18:13 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65B9BC16024; Thu, 20 Apr 2023 13:18:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996695; 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=VZcCockVh9iyRvZHm9M48mFzVhopmL1Xp8SDzX78a/4=; b=iC+8uasozSq680O//iTmFKloBXWFu2i9qrYOxYdEOL5lIGrvH15V8jXJNAZrxp7Wf59d9a 2A/hcGLQTr9rvukZJ9LaA+QWmCY7ohJGLu46u7BJuqwrULg6SqDaQ7QphRjil9ADCgc5GU c5vCjRg860l7fOnbuFOdnbW0eIDrZGY= X-MC-Unique: lushXsBkPSO6gXHOU5oHMA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Peter Xu , David Hildenbrand Subject: [PULL 17/20] vl.c: Create late backends before migration object Date: Thu, 20 Apr 2023 15:17:48 +0200 Message-Id: <20230420131751.28534-18-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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, 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: 1681996938602100001 Content-Type: text/plain; charset="utf-8" From: Peter Xu The migration object may want to check against different types of memory when initialized. Delay the creation to be after late backends. Signed-off-by: Peter Xu Reviewed-by: Juan Quintela Reviewed-by: David Hildenbrand Signed-off-by: Juan Quintela --- softmmu/vl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index ea20b23e4c..ad394b402f 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -3583,14 +3583,19 @@ void qemu_init(int argc, char **argv) machine_class->name, machine_class->deprecation_reaso= n); } =20 + /* + * Create backends before creating migration objects, so that it can + * check against compatibilities on the backend memories (e.g. postcopy + * over memory-backend-file objects). + */ + qemu_create_late_backends(); + /* * Note: creates a QOM object, must run only after global and * compat properties have been set up. */ migration_object_init(); =20 - qemu_create_late_backends(); - /* parse features once if machine provides default cpu_type */ current_machine->cpu_type =3D machine_class->default_cpu_type; if (cpu_option) { --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681996784; cv=none; d=zohomail.com; s=zohoarc; b=FZkNjC+wpX0iASEGQHyap0j8f+YTglafuz4rNLl1g8jHIlGny1hwIcxYPbYgnucMlLVdOHvb30GrsSbWFBHkJktHXhWIOsv2vJ65Do795P+thFjo32+g2qKoFblCMW1WSjGtpYQGFEHVbmzOnKZ2rD3qT+rLQ5b6/pFufEdYDgg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996784; 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=qTpIH6J0Oeu1R8sR8xhP8NxkFo3ADKWp+t7Ys+B7VIs=; b=XgAw1oGpZN6KYN+yFbJ4Uy3tM0hPnFbN5YU2npdL6Oy0IhQPMhmEsNUc6DCXepVdTlQ4b2Qm4vMJcULMvDkRngPeK02Ly/CI59yjKNtvT5Oyo2whH+Jd+OOnOpZq8Ng2npiWm+6a3M3e+5Ec3QtcT2e8vGg6ooTf+v6LS0/QYJE= 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 1681996784821302.1901323624262; Thu, 20 Apr 2023 06:19:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUB9-0001q7-Hv; Thu, 20 Apr 2023 09:18:27 -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 1ppUB2-0001ar-31 for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:21 -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 1ppUAz-0005j8-RS for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:19 -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-632-w26ENRVIMiGmsuA6BGm3-Q-1; Thu, 20 Apr 2023 09:18:14 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 704701C0514B for ; Thu, 20 Apr 2023 13:18:14 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0FE3C16024; Thu, 20 Apr 2023 13:18:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996696; 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=qTpIH6J0Oeu1R8sR8xhP8NxkFo3ADKWp+t7Ys+B7VIs=; b=CG5y0LH20zhJ0wcZnm/XVgPiCiZo2wnRv6Gx8YzSQmbU/aatb2SsntHpwysH8DdIW2ERWy u1uaqG/651PDX8VWA22ITD8r1KKgtUikeSt2Zbb0HH763frqHIcW2gK03UQ/QPGcpg8wrE wvas4+sTOIvuYWtBzJ/jheW5fw6plnY= X-MC-Unique: w26ENRVIMiGmsuA6BGm3-Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Peter Xu Subject: [PULL 18/20] migration/postcopy: Detect file system on dest host Date: Thu, 20 Apr 2023 15:17:49 +0200 Message-Id: <20230420131751.28534-19-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: 1681996785241100005 Content-Type: text/plain; charset="utf-8" From: Peter Xu Postcopy requires the memory support userfaultfd to work. Right now we check it but it's a bit too late (when switching to postcopy migration). Do that early right at enabling of postcopy. Note that this is still only a best effort because ramblocks can be dynamically created. We can add check in hostmem creations and fail if postcopy enabled, but maybe that's too aggressive. Still, we have chance to fail the most obvious where we know there's an existing unsupported ramblock. Signed-off-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/postcopy-ram.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 7d24dac397..d7b48dd920 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -36,6 +36,7 @@ #include "yank_functions.h" #include "tls.h" #include "qemu/userfaultfd.h" +#include "qemu/mmap-alloc.h" =20 /* Arbitrary limit on size of each discard command, * keeps them around ~200 bytes @@ -336,11 +337,12 @@ static bool ufd_check_and_apply(int ufd, MigrationInc= omingState *mis) =20 /* Callback from postcopy_ram_supported_by_host block iterator. */ -static int test_ramblock_postcopiable(RAMBlock *rb, void *opaque) +static int test_ramblock_postcopiable(RAMBlock *rb) { const char *block_name =3D qemu_ram_get_idstr(rb); ram_addr_t length =3D qemu_ram_get_used_length(rb); size_t pagesize =3D qemu_ram_pagesize(rb); + QemuFsType fs; =20 if (length % pagesize) { error_report("Postcopy requires RAM blocks to be a page size multi= ple," @@ -348,6 +350,15 @@ static int test_ramblock_postcopiable(RAMBlock *rb, vo= id *opaque) "page size of 0x%zx", block_name, length, pagesize); return 1; } + + if (rb->fd >=3D 0) { + fs =3D qemu_fd_getfs(rb->fd); + if (fs !=3D QEMU_FS_TYPE_TMPFS && fs !=3D QEMU_FS_TYPE_HUGETLBFS) { + error_report("Host backend files need to be TMPFS or HUGETLBFS= only"); + return 1; + } + } + return 0; } =20 @@ -366,6 +377,7 @@ bool postcopy_ram_supported_by_host(MigrationIncomingSt= ate *mis) struct uffdio_range range_struct; uint64_t feature_mask; Error *local_err =3D NULL; + RAMBlock *block; =20 if (qemu_target_page_size() > pagesize) { error_report("Target page size bigger than host page size"); @@ -390,9 +402,23 @@ bool postcopy_ram_supported_by_host(MigrationIncomingS= tate *mis) goto out; } =20 - /* We don't support postcopy with shared RAM yet */ - if (foreach_not_ignored_block(test_ramblock_postcopiable, NULL)) { - goto out; + /* + * We don't support postcopy with some type of ramblocks. + * + * NOTE: we explicitly ignored ramblock_is_ignored() instead we checked + * all possible ramblocks. This is because this function can be called + * when creating the migration object, during the phase RAM_MIGRATABLE + * is not even properly set for all the ramblocks. + * + * A side effect of this is we'll also check against RAM_SHARED + * ramblocks even if migrate_ignore_shared() is set (in which case + * we'll never migrate RAM_SHARED at all), but normally this shouldn't + * affect in reality, or we can revisit. + */ + RAMBLOCK_FOREACH(block) { + if (test_ramblock_postcopiable(block)) { + goto out; + } } =20 /* --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681996744; cv=none; d=zohomail.com; s=zohoarc; b=c01rMeVqWmxASRTMXEyLEvBm6ZoPe+eumVNEX0Lqw+Ewr2rhgTXogR8XAKt9DnqVNNBhvY4rB51uzDgncNFR2qAzCQNdrnpzVyj4uiOjpbLs3pK78KLDYXEhXtCOylo5NbWP0ZZnfryp8W1p/coivGIoEL2x9+OyXbm2vjmmUxU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996744; 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=beNK2HPiTfpmckPKYaYFis9YWA71zWB5eliN1H6DlkQ=; b=SRL8ZVrqA9xzqU5sD8WJGejLdYSVfjBj3wXYk9FYTRMAyFHtN1koN5Nk1eOTmHnJuRkclXX9TZgXln3Ggd8M989HmAudr3/k6lIoRNEjZxdjoAaTeMxefajvhr7HzRgbreAHS+AnvakoE6pocLcdF92YbXQz5T52CB2WASJSwD8= 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 1681996744576564.2540255622657; Thu, 20 Apr 2023 06: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 1ppUBB-0001rE-NW; Thu, 20 Apr 2023 09:18:29 -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 1ppUB3-0001b0-4T for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:21 -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 1ppUAz-0005jS-Ru for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:20 -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-435-sLhkT5ABNjC5aAccZ6WbXg-1; Thu, 20 Apr 2023 09:18:16 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9E8B4884EC0; Thu, 20 Apr 2023 13:18:15 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id BBB08C16026; Thu, 20 Apr 2023 13:18:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996697; 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=beNK2HPiTfpmckPKYaYFis9YWA71zWB5eliN1H6DlkQ=; b=JlhY+klgkLnkRI0LcXUXPTgFA2sEyyPzI5/3t7/7pjDMZDmEzhzq46xAMKX5+HT9sKXO/L OmRUZKmP+JM8ZfQTUnjfB/u+GbxCTmHikpvRrdZwS2+uPk4PDkcFmgpeEGVczVPLD+kd0Z abGhz2rq7uvfmRtzQV+HRKv9jKEhLzs= X-MC-Unique: sLhkT5ABNjC5aAccZ6WbXg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Vladimir Sementsov-Ogievskiy Subject: [PULL 19/20] migration: rename enabled_capabilities to capabilities Date: Thu, 20 Apr 2023 15:17:50 +0200 Message-Id: <20230420131751.28534-20-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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, 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: 1681996746095100003 Content-Type: text/plain; charset="utf-8" It is clear from the context what that means, and such a long name with the extra long names of the capabilities make very difficilut to stay inside the 80 columns limit. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 52 +++++++++++++++++++++---------------------- migration/migration.h | 2 +- migration/rdma.c | 4 ++-- migration/savevm.c | 6 ++--- 4 files changed, 31 insertions(+), 33 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index d630193272..0c2376bc7e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -364,8 +364,7 @@ static bool migrate_late_block_activate(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[ - MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE]; + return s->capabilities[MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE]; } =20 /* @@ -944,7 +943,7 @@ MigrationCapabilityStatusList *qmp_query_migrate_capabi= lities(Error **errp) #endif caps =3D g_malloc0(sizeof(*caps)); caps->capability =3D i; - caps->state =3D s->enabled_capabilities[i]; + caps->state =3D s->capabilities[i]; QAPI_LIST_APPEND(tail, caps); } =20 @@ -1495,13 +1494,13 @@ void qmp_migrate_set_capabilities(MigrationCapabili= tyStatusList *params, return; } =20 - memcpy(cap_list, s->enabled_capabilities, sizeof(cap_list)); + memcpy(cap_list, s->capabilities, sizeof(cap_list)); if (!migrate_caps_check(cap_list, params, errp)) { return; } =20 for (cap =3D params; cap; cap =3D cap->next) { - s->enabled_capabilities[cap->value->capability] =3D cap->value->st= ate; + s->capabilities[cap->value->capability] =3D cap->value->state; } } =20 @@ -2570,7 +2569,7 @@ bool migrate_release_ram(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_RELEASE_RAM]; + return s->capabilities[MIGRATION_CAPABILITY_RELEASE_RAM]; } =20 bool migrate_postcopy_ram(void) @@ -2579,7 +2578,7 @@ bool migrate_postcopy_ram(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; + return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM]; } =20 bool migrate_postcopy(void) @@ -2593,7 +2592,7 @@ bool migrate_auto_converge(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE]; + return s->capabilities[MIGRATION_CAPABILITY_AUTO_CONVERGE]; } =20 bool migrate_zero_blocks(void) @@ -2602,7 +2601,7 @@ bool migrate_zero_blocks(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; + return s->capabilities[MIGRATION_CAPABILITY_ZERO_BLOCKS]; } =20 bool migrate_postcopy_blocktime(void) @@ -2611,7 +2610,7 @@ bool migrate_postcopy_blocktime(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME= ]; + return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_BLOCKTIME]; } =20 bool migrate_use_compression(void) @@ -2620,7 +2619,7 @@ bool migrate_use_compression(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_COMPRESS]; + return s->capabilities[MIGRATION_CAPABILITY_COMPRESS]; } =20 int migrate_compress_level(void) @@ -2665,7 +2664,7 @@ bool migrate_dirty_bitmaps(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; + return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; } =20 bool migrate_ignore_shared(void) @@ -2674,7 +2673,7 @@ bool migrate_ignore_shared(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED]; + return s->capabilities[MIGRATION_CAPABILITY_X_IGNORE_SHARED]; } =20 bool migrate_validate_uuid(void) @@ -2683,7 +2682,7 @@ bool migrate_validate_uuid(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; + return s->capabilities[MIGRATION_CAPABILITY_VALIDATE_UUID]; } =20 bool migrate_use_events(void) @@ -2692,7 +2691,7 @@ bool migrate_use_events(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_EVENTS]; + return s->capabilities[MIGRATION_CAPABILITY_EVENTS]; } =20 bool migrate_use_multifd(void) @@ -2701,7 +2700,7 @@ bool migrate_use_multifd(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_MULTIFD]; + return s->capabilities[MIGRATION_CAPABILITY_MULTIFD]; } =20 bool migrate_pause_before_switchover(void) @@ -2710,8 +2709,7 @@ bool migrate_pause_before_switchover(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[ - MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER]; + return s->capabilities[MIGRATION_CAPABILITY_PAUSE_BEFORE_SWITCHOVER]; } =20 int migrate_multifd_channels(void) @@ -2758,7 +2756,7 @@ bool migrate_use_zero_copy_send(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; + return s->capabilities[MIGRATION_CAPABILITY_ZERO_COPY_SEND]; } #endif =20 @@ -2777,7 +2775,7 @@ int migrate_use_xbzrle(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_XBZRLE]; + return s->capabilities[MIGRATION_CAPABILITY_XBZRLE]; } =20 uint64_t migrate_xbzrle_cache_size(void) @@ -2804,7 +2802,7 @@ bool migrate_use_block(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK]; + return s->capabilities[MIGRATION_CAPABILITY_BLOCK]; } =20 bool migrate_use_return_path(void) @@ -2813,7 +2811,7 @@ bool migrate_use_return_path(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_RETURN_PATH]; + return s->capabilities[MIGRATION_CAPABILITY_RETURN_PATH]; } =20 bool migrate_use_block_incremental(void) @@ -2831,7 +2829,7 @@ bool migrate_background_snapshot(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHO= T]; + return s->capabilities[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]; } =20 bool migrate_postcopy_preempt(void) @@ -2840,7 +2838,7 @@ bool migrate_postcopy_preempt(void) =20 s =3D migrate_get_current(); =20 - return s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]; + return s->capabilities[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]; } =20 /* migration thread support */ @@ -3582,7 +3580,7 @@ fail: bool migrate_colo_enabled(void) { MigrationState *s =3D migrate_get_current(); - return s->enabled_capabilities[MIGRATION_CAPABILITY_X_COLO]; + return s->capabilities[MIGRATION_CAPABILITY_X_COLO]; } =20 typedef enum MigThrError { @@ -4448,7 +4446,7 @@ void migration_global_dump(Monitor *mon) } =20 #define DEFINE_PROP_MIG_CAP(name, x) \ - DEFINE_PROP_BOOL(name, MigrationState, enabled_capabilities[x], false) + DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) =20 static Property migration_properties[] =3D { DEFINE_PROP_BOOL("store-global-state", MigrationState, @@ -4647,7 +4645,7 @@ static bool migration_object_check(MigrationState *ms= , Error **errp) } =20 for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - if (ms->enabled_capabilities[i]) { + if (ms->capabilities[i]) { QAPI_LIST_PREPEND(head, migrate_cap_add(i, true)); } } diff --git a/migration/migration.h b/migration/migration.h index 310ae8901b..04e0860b4e 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -310,7 +310,7 @@ struct MigrationState { int64_t downtime_start; int64_t downtime; int64_t expected_downtime; - bool enabled_capabilities[MIGRATION_CAPABILITY__MAX]; + bool capabilities[MIGRATION_CAPABILITY__MAX]; int64_t setup_time; /* * Whether guest was running when we enter the completion stage. diff --git a/migration/rdma.c b/migration/rdma.c index df646be35e..f35f021963 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -4179,7 +4179,7 @@ void rdma_start_outgoing_migration(void *opaque, } =20 ret =3D qemu_rdma_source_init(rdma, - s->enabled_capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp); + s->capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp); =20 if (ret) { goto err; @@ -4201,7 +4201,7 @@ void rdma_start_outgoing_migration(void *opaque, } =20 ret =3D qemu_rdma_source_init(rdma_return_path, - s->enabled_capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], er= rp); + s->capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp); =20 if (ret) { goto return_path_err; diff --git a/migration/savevm.c b/migration/savevm.c index aa54a67fda..589ef926ab 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -253,7 +253,7 @@ static uint32_t get_validatable_capabilities_count(void) uint32_t result =3D 0; int i; for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - if (should_validate_capability(i) && s->enabled_capabilities[i]) { + if (should_validate_capability(i) && s->capabilities[i]) { result++; } } @@ -275,7 +275,7 @@ static int configuration_pre_save(void *opaque) state->capabilities =3D g_renew(MigrationCapability, state->capabiliti= es, state->caps_count); for (i =3D j =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - if (should_validate_capability(i) && s->enabled_capabilities[i]) { + if (should_validate_capability(i) && s->capabilities[i]) { state->capabilities[j++] =3D i; } } @@ -325,7 +325,7 @@ static bool configuration_validate_capabilities(SaveSta= te *state) continue; } source_state =3D test_bit(i, source_caps_bm); - target_state =3D s->enabled_capabilities[i]; + target_state =3D s->capabilities[i]; if (source_state !=3D target_state) { error_report("Capability %s is %s, but received capability is = %s", MigrationCapability_str(i), --=20 2.39.2 From nobody Sat May 11 09:33:18 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=1681996946; cv=none; d=zohomail.com; s=zohoarc; b=dW3TDVX6spl4PIl2Z51Ux236uw3zPwESzXrFN+NlWtL6NVN2qy+2AX5XZwHb6AR2zOZ9IUQA2lrTzYQUqj7rs8d1I3omH1TQQvIwl700LLfi7SUItodicBzgVv1tOzFiFSZKczqUTP5VGDoIdQDx1vYksAQnu6YWW1F5HgUU/Z0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681996946; 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=3/qIwzwOLz11lHNsRHqRlaNtXndhl96MSsfSLJn65YM=; b=MlQ4LLHmSyw+Q0GSrxulkhI4yRmjQ9zokDzncbXAl9TgU7A8OGjAXIefG+du+DT4B+i5xXomHx/AdV2FoVy7Vb+nAGZWgjdUSfwfqX7K/HKsUxueVhlKP4r/Bs2ncaxu2KsMDl7/aUV+ZaLYKfpMgrEzDuqrf2VSZDMiElxnGMo= 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 16819969466051001.1835217379544; Thu, 20 Apr 2023 06:22:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppUBC-0001rK-G4; Thu, 20 Apr 2023 09:18:30 -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 1ppUB3-0001b2-Mz for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:21 -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 1ppUB1-0005jo-Tg for qemu-devel@nongnu.org; Thu, 20 Apr 2023 09:18:21 -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-267-5zMSJf4rPCqlIX6dm4yJ3A-1; Thu, 20 Apr 2023 09:18:17 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AB94D101A552; Thu, 20 Apr 2023 13:18:16 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5FD3C16024; Thu, 20 Apr 2023 13:18:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681996698; 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=3/qIwzwOLz11lHNsRHqRlaNtXndhl96MSsfSLJn65YM=; b=UpbU0J49eRjdUDtUaAtXXbHgNyHFc/0EhfNQsbDf/ws5K1n1CmaDNeRlre9cUnL2KGjZVe JLQQmxeGvlSgMMob6tWXfyWNjZUS+sLTLGkmPPDy140A7AW1AixL+EYqnN3D4jQhtpP8DS uiLDqdARvokNj8C2zn6ddZEBEdkNFt0= X-MC-Unique: 5zMSJf4rPCqlIX6dm4yJ3A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Paolo Bonzini , Vladimir Sementsov-Ogievskiy Subject: [PULL 20/20] migration: Pass migrate_caps_check() the old and new caps Date: Thu, 20 Apr 2023 15:17:51 +0200 Message-Id: <20230420131751.28534-21-quintela@redhat.com> In-Reply-To: <20230420131751.28534-1-quintela@redhat.com> References: <20230420131751.28534-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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, 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: 1681996947120100001 Content-Type: text/plain; charset="utf-8" We used to pass the old capabilities array and the new capabilities as a list. Signed-off-by: Juan Quintela Reviewed-by: Vladimir Sementsov-Ogievskiy --- migration/migration.c | 80 +++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 49 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 0c2376bc7e..7b0d4a9d8f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1300,30 +1300,20 @@ WriteTrackingSupport migrate_query_write_tracking(v= oid) } =20 /** - * @migration_caps_check - check capability validity + * @migration_caps_check - check capability compatibility * - * @cap_list: old capability list, array of bool - * @params: new capabilities to be applied soon + * @old_caps: old capability list + * @new_caps: new capability list * @errp: set *errp if the check failed, with reason * * Returns true if check passed, otherwise false. */ -static bool migrate_caps_check(bool *cap_list, - MigrationCapabilityStatusList *params, - Error **errp) +static bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **err= p) { - MigrationCapabilityStatusList *cap; - bool old_postcopy_cap; MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 - old_postcopy_cap =3D cap_list[MIGRATION_CAPABILITY_POSTCOPY_RAM]; - - for (cap =3D params; cap; cap =3D cap->next) { - cap_list[cap->value->capability] =3D cap->value->state; - } - #ifndef CONFIG_LIVE_BLOCK_MIGRATION - if (cap_list[MIGRATION_CAPABILITY_BLOCK]) { + if (new_caps[MIGRATION_CAPABILITY_BLOCK]) { error_setg(errp, "QEMU compiled without old-style (blk/-b, inc/-i)= " "block migration"); error_append_hint(errp, "Use drive_mirror+NBD instead.\n"); @@ -1332,7 +1322,7 @@ static bool migrate_caps_check(bool *cap_list, #endif =20 #ifndef CONFIG_REPLICATION - if (cap_list[MIGRATION_CAPABILITY_X_COLO]) { + if (new_caps[MIGRATION_CAPABILITY_X_COLO]) { error_setg(errp, "QEMU compiled without replication module" " can't enable COLO"); error_append_hint(errp, "Please enable replication before COLO.\n"= ); @@ -1340,12 +1330,13 @@ static bool migrate_caps_check(bool *cap_list, } #endif =20 - if (cap_list[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { /* This check is reasonably expensive, so only when it's being * set the first time, also it's only the destination that needs * special support. */ - if (!old_postcopy_cap && runstate_check(RUN_STATE_INMIGRATE) && + if (!old_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM] && + runstate_check(RUN_STATE_INMIGRATE) && !postcopy_ram_supported_by_host(mis)) { /* postcopy_ram_supported_by_host will have emitted a more * detailed message @@ -1354,13 +1345,13 @@ static bool migrate_caps_check(bool *cap_list, return false; } =20 - if (cap_list[MIGRATION_CAPABILITY_X_IGNORE_SHARED]) { + if (new_caps[MIGRATION_CAPABILITY_X_IGNORE_SHARED]) { error_setg(errp, "Postcopy is not compatible with ignore-share= d"); return false; } } =20 - if (cap_list[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]) { + if (new_caps[MIGRATION_CAPABILITY_BACKGROUND_SNAPSHOT]) { WriteTrackingSupport wt_support; int idx; /* @@ -1384,7 +1375,7 @@ static bool migrate_caps_check(bool *cap_list, */ for (idx =3D 0; idx < check_caps_background_snapshot.size; idx++) { int incomp_cap =3D check_caps_background_snapshot.caps[idx]; - if (cap_list[incomp_cap]) { + if (new_caps[incomp_cap]) { error_setg(errp, "Background-snapshot is not compatible with %s", MigrationCapability_str(incomp_cap)); @@ -1394,10 +1385,10 @@ static bool migrate_caps_check(bool *cap_list, } =20 #ifdef CONFIG_LINUX - if (cap_list[MIGRATION_CAPABILITY_ZERO_COPY_SEND] && - (!cap_list[MIGRATION_CAPABILITY_MULTIFD] || - cap_list[MIGRATION_CAPABILITY_COMPRESS] || - cap_list[MIGRATION_CAPABILITY_XBZRLE] || + if (new_caps[MIGRATION_CAPABILITY_ZERO_COPY_SEND] && + (!new_caps[MIGRATION_CAPABILITY_MULTIFD] || + new_caps[MIGRATION_CAPABILITY_COMPRESS] || + new_caps[MIGRATION_CAPABILITY_XBZRLE] || migrate_multifd_compression() || migrate_use_tls())) { error_setg(errp, @@ -1405,15 +1396,15 @@ static bool migrate_caps_check(bool *cap_list, return false; } #else - if (cap_list[MIGRATION_CAPABILITY_ZERO_COPY_SEND]) { + if (new_caps[MIGRATION_CAPABILITY_ZERO_COPY_SEND]) { error_setg(errp, "Zero copy currently only available on Linux"); return false; } #endif =20 - if (cap_list[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]) { - if (!cap_list[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + if (new_caps[MIGRATION_CAPABILITY_POSTCOPY_PREEMPT]) { + if (!new_caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { error_setg(errp, "Postcopy preempt requires postcopy-ram"); return false; } @@ -1424,14 +1415,14 @@ static bool migrate_caps_check(bool *cap_list, * different compression channels, which is not compatible with the * preempt assumptions on channel assignments. */ - if (cap_list[MIGRATION_CAPABILITY_COMPRESS]) { + if (new_caps[MIGRATION_CAPABILITY_COMPRESS]) { error_setg(errp, "Postcopy preempt not compatible with compres= s"); return false; } } =20 - if (cap_list[MIGRATION_CAPABILITY_MULTIFD]) { - if (cap_list[MIGRATION_CAPABILITY_COMPRESS]) { + if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { + if (new_caps[MIGRATION_CAPABILITY_COMPRESS]) { error_setg(errp, "Multifd is not compatible with compress"); return false; } @@ -1487,15 +1478,19 @@ void qmp_migrate_set_capabilities(MigrationCapabili= tyStatusList *params, { MigrationState *s =3D migrate_get_current(); MigrationCapabilityStatusList *cap; - bool cap_list[MIGRATION_CAPABILITY__MAX]; + bool new_caps[MIGRATION_CAPABILITY__MAX]; =20 if (migration_is_running(s->state)) { error_setg(errp, QERR_MIGRATION_ACTIVE); return; } =20 - memcpy(cap_list, s->capabilities, sizeof(cap_list)); - if (!migrate_caps_check(cap_list, params, errp)) { + memcpy(new_caps, s->capabilities, sizeof(new_caps)); + for (cap =3D params; cap; cap =3D cap->next) { + new_caps[cap->value->capability] =3D cap->value->state; + } + + if (!migrate_caps_check(s->capabilities, new_caps, errp)) { return; } =20 @@ -4635,27 +4630,14 @@ static void migration_instance_init(Object *obj) */ static bool migration_object_check(MigrationState *ms, Error **errp) { - MigrationCapabilityStatusList *head =3D NULL; /* Assuming all off */ - bool cap_list[MIGRATION_CAPABILITY__MAX] =3D { 0 }, ret; - int i; + bool old_caps[MIGRATION_CAPABILITY__MAX] =3D { 0 }; =20 if (!migrate_params_check(&ms->parameters, errp)) { return false; } =20 - for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { - if (ms->capabilities[i]) { - QAPI_LIST_PREPEND(head, migrate_cap_add(i, true)); - } - } - - ret =3D migrate_caps_check(cap_list, head, errp); - - /* It works with head =3D=3D NULL */ - qapi_free_MigrationCapabilityStatusList(head); - - return ret; + return migrate_caps_check(old_caps, ms->capabilities, errp); } =20 static const TypeInfo migration_type =3D { --=20 2.39.2