From nobody Sat Nov 23 20:43:52 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=1730214595; cv=none; d=zohomail.com; s=zohoarc; b=ZNCsatTH6YT47E+xarVudTsCsd/AIZG6lx5POtJi7E/cmwDFlwSJLMQQDJBqnyNGdKgTvYBXFwfEgAkJ8P/8mfyX8jmS8BVQo1fOgNJ//Y/6u7e3s/1wGpnUSpC3NIuBU52PVuSqhkbpq091DUp1HOOXfkUmF+PKa/sg4/qmQO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730214595; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EawrAMiqZPHCdfZ9f5osnaUKjQDNMwjBz2dwMHPU2NM=; b=lMrZikJLd3TBNhn4IN5E3G9+BdFynOCWCbDhjOXQqIqFbzOTXupWIECEBCHYs0a+iywTYVAk8Dmgp/76S6PPv7Jia7dK5rVpTCIcwyCK19k5jFMNgH8NFPHsxNkz7B2VSIJqqO3DHvlcoDXs3VTixS8XudRwu/DfGqSXRaySB7k= 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 173021459580658.985399736356726; Tue, 29 Oct 2024 08:09:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5nqj-0006WJ-Oy; Tue, 29 Oct 2024 11:09:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5nqi-0006Vr-Uf for qemu-devel@nongnu.org; Tue, 29 Oct 2024 11:09:36 -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 1t5nqf-0007K3-Es for qemu-devel@nongnu.org; Tue, 29 Oct 2024 11:09:36 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-Sf4MOfgjPmKRKAhmnb6HKQ-1; Tue, 29 Oct 2024 11:09:29 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2228F195609D; Tue, 29 Oct 2024 15:09:28 +0000 (UTC) Received: from kaapi.redhat.com (unknown [10.74.16.130]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B9EF51956086; Tue, 29 Oct 2024 15:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730214572; 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=EawrAMiqZPHCdfZ9f5osnaUKjQDNMwjBz2dwMHPU2NM=; b=RwzE2gh55IAmilFoiSQiDPtthMRMTbw3w6Kej3+5OUUw6gpgITXl49eNe00KqVssw66cGu 0foiVu7wCXrr5so18nx0RO8icU7nBoiWTYt5NwCGLJ3Ru2uN9A31cJb9ozRGaS2UqZug/b GJWuufp+GzV+SsSX4MaRUH2mRs0u8jo= X-MC-Unique: Sf4MOfgjPmKRKAhmnb6HKQ-1 From: Prasad Pandit To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , Prasad Pandit Subject: [PATCH 2/5] migration/postcopy: magic value for postcopy channel Date: Tue, 29 Oct 2024 20:39:05 +0530 Message-ID: <20241029150908.1136894-3-ppandit@redhat.com> In-Reply-To: <20241029150908.1136894-1-ppandit@redhat.com> References: <20241029150908.1136894-1-ppandit@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 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=ppandit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.302, 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, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1730214597450116600 Content-Type: text/plain; charset="utf-8" From: Prasad Pandit During migration, the precopy and the multifd channels send magic value (4-bytes) to the destination side, for it to identify the channel and properly establish connection. But Postcopy channel did not send such value. Introduce a magic value to be sent on the postcopy channel. It helps to identify channels when both multifd and postcopy migration are enabled together. An explicitly defined magic value makes code easier to follow, because it is consistent with the other channels. Signed-off-by: Prasad Pandit --- migration/postcopy-ram.c | 7 +++++++ migration/postcopy-ram.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 83f6160a36..5bc19b541c 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -1580,6 +1580,9 @@ void postcopy_unregister_shared_ufd(struct PostCopyFD= *pcfd) =20 void postcopy_preempt_new_channel(MigrationIncomingState *mis, QEMUFile *f= ile) { + if (mis->postcopy_qemufile_dst) { + return; + } /* * The new loading channel has its own threads, so it needs to be * blocked too. It's by default true, just be explicit. @@ -1612,6 +1615,10 @@ postcopy_preempt_send_channel_done(MigrationState *s, * postcopy_qemufile_src to know whether it failed or not. */ qemu_sem_post(&s->postcopy_qemufile_src_sem); + + /* Send magic value to identify postcopy channel on the destination */ + uint32_t magic =3D cpu_to_be32(POSTCOPY_MAGIC); + qio_channel_write_all(ioc, (char *)&magic, sizeof(magic), NULL); } =20 static void diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h index a6df1b2811..49e2982558 100644 --- a/migration/postcopy-ram.h +++ b/migration/postcopy-ram.h @@ -15,6 +15,9 @@ =20 #include "qapi/qapi-types-migration.h" =20 +/* Magic value to identify postcopy channel on the destination */ +#define POSTCOPY_MAGIC 0x55667788U + /* Return true if the host supports everything we need to do postcopy-ram = */ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis, Error **errp); --=20 2.47.0