From nobody Sun May 5 22:31:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554713386186460.3171450236704; Mon, 8 Apr 2019 01:49:46 -0700 (PDT) Received: from localhost ([127.0.0.1]:49532 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDPyI-0001F4-SS for importer@patchew.org; Mon, 08 Apr 2019 04:49:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDPtU-0006eb-Tu for qemu-devel@nongnu.org; Mon, 08 Apr 2019 04:44:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDPtT-0000OT-TX for qemu-devel@nongnu.org; Mon, 08 Apr 2019 04:44:44 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:34604) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hDPtR-0000KS-MK for qemu-devel@nongnu.org; Mon, 08 Apr 2019 04:44:42 -0400 Received: by mail-qt1-x842.google.com with SMTP id k2so14481914qtm.1 for ; Mon, 08 Apr 2019 01:44:39 -0700 (PDT) Received: from localhost.localdomain (104.129.187.94.16clouds.com. [104.129.187.94]) by smtp.gmail.com with ESMTPSA id o50sm19119115qtc.23.2019.04.08.01.44.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Apr 2019 01:44:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b1J9lYUPkNvcX/DlYU4//A0TQE3hpTJXHwWt8zl3ydo=; b=heDviwCcDVEeXekma4oVO6+D5wn0KVET7UChwzBse4NHDN8KQY49jx3E3d1uYCshHV y6U5T+sTH1GAfz2wS/XANg4gF0IdkoCMEGs6cSQe8jjJNk8KrXzVLLSDPGmNefkT2uHx +miaHBhE+LbHeRfUJ4Mwv8+QJcHfLav4jhBkJKZStolkoSUKpZEsqyRBv3sW6F23f91Q It/ghBiDGOi8XBmHM9Sf1RjyMVMpqBxCdIU/Ph4QkzDu5cHvRjY1gahnUqlWM8/10Iv8 POYtXRLfX99lRCXVqLayHXDVCWivCoAn1JZus46ctirWshAkhOR7P6RZ3ZdzYqCEL2KF Uazw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=b1J9lYUPkNvcX/DlYU4//A0TQE3hpTJXHwWt8zl3ydo=; b=jMqll8oum8zTZWbF1h55OO8/L/X8rPAMCdeDk38220lfRkUmCH5HC8ux9v67KFARat 867Id7wiFekSr/xiUYJuplYFXfp+3ATJTWQ8CABKBYys18xi7RzPcVbJNPE5tsTBwf6I Lrimj7KLRH2iQNz9RpuNJLFGbVYTpKSp5AVSDQeLlOCjfU+aanetgMY0kNXQhG5fXZQ0 RNzNL3RgLqVXlYFGqaUbqDjz82d+lK4XHaiaeIHiKAFm4aQtnJaNlaOWYsnTsabaNOxy 0ZjWEOYKExZSew+ruhIf4VxGR40gAlcg1JqoPL7cepfNP22SNagvxpq1D0isf+Ryg5nC nvIw== X-Gm-Message-State: APjAAAWfr+jw9xSVhUHtku0jP0q2s2eCUBYzTPIpGC5AcUlDDfbfuP// nFlkk9YiEx6ryXidhf21Z8fyqR9CD2M= X-Google-Smtp-Source: APXvYqxPLVCwfJKCbxpLWpT87sKB4qYwYC2r7qoBTY0Ti9I5RqbjIsTRCJ0ctdBiyAdaQkFmHyF0cQ== X-Received: by 2002:ac8:355c:: with SMTP id z28mr21935767qtb.286.1554713079175; Mon, 08 Apr 2019 01:44:39 -0700 (PDT) From: Catherine Ho To: Paolo Bonzini , Richard Henderson , "Dr. David Alan Gilbert" Date: Mon, 8 Apr 2019 04:43:00 -0400 Message-Id: <1554712980-18714-1-git-send-email-catherine.hecx@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1554689945-18619-1-git-send-email-catherine.hecx@gmail.com> References: <1554689945-18619-1-git-send-email-catherine.hecx@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::842 Subject: [Qemu-devel] [PATCH v2] hostmem-file: warn when memory-backend-file, share=on and in incoming migration X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Catherine Ho , Markus Armbruster , Peter Xu , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently it is not forbidden to use "-object memory-backend-file,share=3Do= n" and together with "-incoming". But after incoming migration is finished, the memory-backend-file will be definitely written if share=3Don. So the memory-backend-file can only be used once, but failed in the 2nd time incoming. Thus it gives a warning and the users can run the qemu if they really want to do it. Signed-off-by: Catherine Ho --- backends/hostmem-file.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index 37ac6445d2..ce03dc0a18 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -16,6 +16,7 @@ #include "sysemu/hostmem.h" #include "sysemu/sysemu.h" #include "qom/object_interfaces.h" +#include "migration/migration.h" =20 /* hostmem-file.c */ /** @@ -79,6 +80,17 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Er= ror **errp) } } =20 + /* + * In ignore shared incoming migration, if share=3Don for host memory + * backend file, the ram might be modified after incoming process. + * The user should know this potential risk. + */ + if (backend->share && migrate_ignore_shared() + && runstate_check(RUN_STATE_INMIGRATE)) + warn_report("NOTE: Please make sure the data on the shared memory " + "backend file and the data from the incoming migration" + " stream contains matching contents, otherwise..."); + backend->force_prealloc =3D mem_prealloc; name =3D host_memory_backend_get_name(backend); memory_region_init_ram_from_file(&backend->mr, OBJECT(backend), --=20 2.17.1