From patchwork Wed Apr 19 16:17:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13217112 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1278AC6FD18 for ; Wed, 19 Apr 2023 16:19:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAVI-0004uf-5u; Wed, 19 Apr 2023 12:17:56 -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 1ppAVC-0004tr-As for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:17:50 -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 1ppAV9-0004zh-P1 for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:17:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921066; 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=mA6pp+vQCW8Hb5Iclg6SNJ15lnYctRVp38DJGWj5fhY=; b=I+aeU46KRRycz4hPqYihaHOP+QJOZELyYC25jOBT80RM7Fmvmf0/lwt2zWLJxyVXgdgep6 pIXfBfSUTTz2320ylY8kyVXz0d+AP1i+arSwm5ICWVNEZ4usDCUqjz9gzPB7um+trtJGI7 FIb5FjbEUbp9j9b/Pbrp0iU8JzWvEGY= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-_CjkED3zNbCNJQMvrAIC9w-1; Wed, 19 Apr 2023 12:17:45 -0400 X-MC-Unique: _CjkED3zNbCNJQMvrAIC9w-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-74deffa28efso1952985a.1 for ; Wed, 19 Apr 2023 09:17:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681921064; x=1684513064; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mA6pp+vQCW8Hb5Iclg6SNJ15lnYctRVp38DJGWj5fhY=; b=bWopprWBY/rI9/CxZNYKL2S3ZSJXxkGYnf6HRm9WTBM4vL4kcpfnRYW41QCmFAjCwq xj6rAciySXfQ3zcJo/mJ9qb3c6XeXXoq0F34x9IUFCGo+IpnSlNtYLnzF4kKBD03dYRq tqkUcbigg4JjIipi/JhQn0ewThXMHt5AF897Ln9aCzsDJsn3L3VeJ6RZOkwQNpk7/ZLU Eg/6IV2umFgU44Iw0tqS44Rgfaf3lk4853QmhJzXi0NiRgYBzHD9FPXkwvi2nmF7GwBZ AqiGEf3hmwBvWaxG0BFCmGmdgsPl4+pUGbJy1Sya61W7tQ6H6FDK3WaqGxyRCH32t9dt 1ZgQ== X-Gm-Message-State: AAQBX9cHYYHImWdV5ap6QDkAxKf4gWEq5cq4p6rS1HHW1jzaeotW9yN4 6brmG/dNHgxvgOf2r41XtAn8yrPbPlVjwdu1okQ1wt34JBZQSa9uZtpde4gQ0a1gPc/ysEcJxdy 3jgTnk2UtWoDqkpDPNEGEDCcBmB9VWVbTriN6HxEKQw2z9pJEshk1IZ2Ifbt4eCYsHvQchvJF X-Received: by 2002:a05:6214:5095:b0:5ef:55d8:7164 with SMTP id kk21-20020a056214509500b005ef55d87164mr27129894qvb.5.1681921064215; Wed, 19 Apr 2023 09:17:44 -0700 (PDT) X-Google-Smtp-Source: AKy350aGq6yiCVVvI3FKrZ3g4JSBLM9hafVsuOJ2GPEm6J1FzZQ3o9FhsCeOd5Ts7ZuneUwowk+TJg== X-Received: by 2002:a05:6214:5095:b0:5ef:55d8:7164 with SMTP id kk21-20020a056214509500b005ef55d87164mr27129846qvb.5.1681921063884; Wed, 19 Apr 2023 09:17:43 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-40-70-52-229-124.dsl.bell.ca. [70.52.229.124]) by smtp.gmail.com with ESMTPSA id t12-20020a05620a0b0c00b007468b183a65sm351481qkg.30.2023.04.19.09.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 09:17:43 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Paolo Bonzini , peterx@redhat.com, =?utf-8?q?Daniel?= =?utf-8?q?_P_=2E_Berrang=C3=A9?= , Juan Quintela , Leonardo Bras Soares Passos , David Hildenbrand Subject: [PATCH v2 1/4] util/mmap-alloc: qemu_fd_getfs() Date: Wed, 19 Apr 2023 12:17:36 -0400 Message-Id: <20230419161739.1129988-2-peterx@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230419161739.1129988-1-peterx@redhat.com> References: <20230419161739.1129988-1-peterx@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This new helper fetches file system type for a fd. Only Linux is implemented so far. Currently only tmpfs and hugetlbfs is defined, but it can grow per need. Signed-off-by: Peter Xu Reviewed-by: David Hildenbrand Reviewed-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 +typedef enum { + QEMU_FS_TYPE_UNKNOWN = 0, + QEMU_FS_TYPE_TMPFS, + QEMU_FS_TYPE_HUGETLBFS, + QEMU_FS_TYPE_NUM, +} QemuFsType; size_t qemu_fd_getpagesize(int fd); +QemuFsType qemu_fd_getfs(int fd); /** * 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 @@ #ifdef CONFIG_LINUX #include +#include #endif +QemuFsType qemu_fd_getfs(int fd) +{ +#ifdef CONFIG_LINUX + struct statfs fs; + int ret; + + if (fd < 0) { + return QEMU_FS_TYPE_UNKNOWN; + } + + do { + ret = fstatfs(fd, &fs); + } while (ret != 0 && errno == 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 From patchwork Wed Apr 19 16:17:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13217113 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F471C77B78 for ; Wed, 19 Apr 2023 16:19:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAVI-0004uj-6p; Wed, 19 Apr 2023 12:17:56 -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 1ppAVD-0004u4-W4 for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:17:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppAVC-00050P-IB for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:17:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921069; 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=fgVm4ot3oncYZxZF5RHIGcFRboA9mEQIrrDpxafvVz0=; b=YNs3LO4I2P82MRoa0ey8wCEqfFk/i4/M9e1Zd7IdkyLGwK45C+zpYD9UhZmU1xSsM5vG/y bHMkM6BpRpEpIU102pJmwvdZVGY8Tm2s3yFDFU1ncQpeVU4Cg80yobYDMdT9+eoQ+vGFmR yYN0npiFDEaxRI9wf8YoS9IWAHcCEQ4= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-203-0NKied3bNOO7gQ644S0X-g-1; Wed, 19 Apr 2023 12:17:48 -0400 X-MC-Unique: 0NKied3bNOO7gQ644S0X-g-1 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-3ecc0c4b867so13083411cf.1 for ; Wed, 19 Apr 2023 09:17:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681921067; x=1684513067; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fgVm4ot3oncYZxZF5RHIGcFRboA9mEQIrrDpxafvVz0=; b=iSYh0L6DsWVIGw59T/YKftwhO0JxsTaUf3kOHVoGbm/0dVBMRAw+KmWIwjgiU3dbiy hrxLkdQR8dDal+Jmf0vDaRYAiq2rXIhWQ0LBLsHjNprc7dXGA0kcrRw/hr9E0wKZy2He 6Xlnv6pNG7cVdMqE17/kxUi9+Eo1uSKvEWHJJZQwKzqhLBsl8TKtbrNS8+AwUgZjvsGb ghOsFQ4/POK85A1Dgnw4aao0VlGudaDTciJHsdEDAeT43deipuYGKdA8ucooBolFC/ei pYyGVmvLk8kZ1Y6KmHRvTKLCfLY39OKRZTdcS8xFcvfnoyzvfc8oKwpVF5a0oO6YdW6G v2og== X-Gm-Message-State: AAQBX9fuLzw2V+mc1vurNP7f38DbSNiabIrSQ6ceT5XTuWygbY0tVQh/ ZEWHkGbAB3x0d38n/SJQgJoYLnjduNyypnxCLkw+EUSoac5WPVw/RcoCjwzmMYzRWdKZgpCBIhw 3STcX3Sz577QwvsrrsfFCGhxuOW+/Kdr2qgtsGKBwx3c6ttWQjcEDCCGFMo8JuqD9qDQuWgVT X-Received: by 2002:a05:622a:1894:b0:3ef:4614:d0e9 with SMTP id v20-20020a05622a189400b003ef4614d0e9mr4029508qtc.5.1681921066917; Wed, 19 Apr 2023 09:17:46 -0700 (PDT) X-Google-Smtp-Source: AKy350a+TZVnHgbhimiZDOFJhqzl+aKj+73n86RSKn7fITD7YUu07Y1/dPrZhI7NizeCjO1p7TLVCw== X-Received: by 2002:a05:622a:1894:b0:3ef:4614:d0e9 with SMTP id v20-20020a05622a189400b003ef4614d0e9mr4029471qtc.5.1681921066666; Wed, 19 Apr 2023 09:17:46 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-40-70-52-229-124.dsl.bell.ca. [70.52.229.124]) by smtp.gmail.com with ESMTPSA id t12-20020a05620a0b0c00b007468b183a65sm351481qkg.30.2023.04.19.09.17.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 09:17:46 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Paolo Bonzini , peterx@redhat.com, =?utf-8?q?Daniel?= =?utf-8?q?_P_=2E_Berrang=C3=A9?= , Juan Quintela , Leonardo Bras Soares Passos , David Hildenbrand Subject: [PATCH v2 2/4] vl.c: Create late backends before migration object Date: Wed, 19 Apr 2023 12:17:37 -0400 Message-Id: <20230419161739.1129988-3-peterx@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230419161739.1129988-1-peterx@redhat.com> References: <20230419161739.1129988-1-peterx@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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: David Hildenbrand Reviewed-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_reason); } + /* + * 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(); - qemu_create_late_backends(); - /* parse features once if machine provides default cpu_type */ current_machine->cpu_type = machine_class->default_cpu_type; if (cpu_option) { From patchwork Wed Apr 19 16:17:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13217114 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9A1B6C6FD18 for ; Wed, 19 Apr 2023 16:19:21 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAVU-0004xp-Gt; Wed, 19 Apr 2023 12:18:08 -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 1ppAVR-0004xa-RJ for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:18:07 -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 1ppAVH-00052E-Hb for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:18:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921072; 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=u/FOp5RoEvZsdKDojoZTalUYPOQEiXwIeboDhJsCmqw=; b=hkVmBAY0HUnemexpYqkIrpTV260J1AAuNLnqcfFOOagx4tfMfaxiFFWhSVDBhcLnRIxDYS K/Oe5u0cbFc5hZc0qYY7GkcUk9DKAQ6jmxssqWs8HJo3gay1ph1GsuCsY05j0x57aSZONK JAAvsQKLkfE7y5hQBNuHqxYhSndyP6M= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-155-fra7LjG6OaSHjrRQXXggqw-1; Wed, 19 Apr 2023 12:17:51 -0400 X-MC-Unique: fra7LjG6OaSHjrRQXXggqw-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-74a7c661208so1735685a.1 for ; Wed, 19 Apr 2023 09:17:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681921069; x=1684513069; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u/FOp5RoEvZsdKDojoZTalUYPOQEiXwIeboDhJsCmqw=; b=bRJkxr5pX2GDjkKafAX9HPWhQK6oV+jNihvHQz57rgQv5lnJWvTlFQgnWdFLnrOD1T 2miABKvZvrBPnjuJe1sc6pqE++cdiLxU+mei7RJ2cEop4CbpQ5BDhtM97oIuyXpSMtJw t1HHVrEH1WDfYuke35Mg72Y9SMqQAyvLmunvYrn+qni+GmRrPvYj3MY0AMl0YpkO3AKG F4Ql9XurpcYp2fKn+c+RUv0jjojndsdYyQH7qmk6BhrHMoVRVuH8RyzqmWu3xEmJ3cpH FRpetT8B0Zj0MXKgq/tJL27B0WEcoIG1/61ClTeY7wLzLCEa6A4r4PNf9WU28QbQqo4X RshA== X-Gm-Message-State: AAQBX9c+6acFOA6qcBJCksB87l6q9gTHLaY+VeTmuElnCC7RThx21Bei yMhXYfVYmwU+p+qBu9WEoxSiH+stW+yCsjjkgulfOXA91tLctnv36jkZ7wyQ1HhgDcU2wV50ZJP hwI8390PP4Rz2fTlFBEyHjjaTJ63/NRGFEeZaQ/yaaX7OI079Y78ZPYcCTrkYE1T2B+tPK9Xd X-Received: by 2002:a05:622a:316:b0:3ef:4a7c:d7c5 with SMTP id q22-20020a05622a031600b003ef4a7cd7c5mr702669qtw.4.1681921069653; Wed, 19 Apr 2023 09:17:49 -0700 (PDT) X-Google-Smtp-Source: AKy350Yc0fuxYD88+++mDM/MipGg762Bxi42HCm3LiSXHdI9SZN2dCLc9l/Lc6iDLtI7MEtBd7ApyQ== X-Received: by 2002:a05:622a:316:b0:3ef:4a7c:d7c5 with SMTP id q22-20020a05622a031600b003ef4a7cd7c5mr702613qtw.4.1681921069188; Wed, 19 Apr 2023 09:17:49 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-40-70-52-229-124.dsl.bell.ca. [70.52.229.124]) by smtp.gmail.com with ESMTPSA id t12-20020a05620a0b0c00b007468b183a65sm351481qkg.30.2023.04.19.09.17.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 09:17:48 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Paolo Bonzini , peterx@redhat.com, =?utf-8?q?Daniel?= =?utf-8?q?_P_=2E_Berrang=C3=A9?= , Juan Quintela , Leonardo Bras Soares Passos , David Hildenbrand Subject: [PATCH v2 3/4] migration/postcopy: Detect file system on dest host Date: Wed, 19 Apr 2023 12:17:38 -0400 Message-Id: <20230419161739.1129988-4-peterx@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230419161739.1129988-1-peterx@redhat.com> References: <20230419161739.1129988-1-peterx@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 --- 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 93f39f8e06..bbb8af61ae 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" /* 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, MigrationIncomingState *mis) /* 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 = qemu_ram_get_idstr(rb); ram_addr_t length = qemu_ram_get_used_length(rb); size_t pagesize = qemu_ram_pagesize(rb); + QemuFsType fs; if (length % pagesize) { error_report("Postcopy requires RAM blocks to be a page size multiple," @@ -348,6 +350,15 @@ static int test_ramblock_postcopiable(RAMBlock *rb, void *opaque) "page size of 0x%zx", block_name, length, pagesize); return 1; } + + if (rb->fd >= 0) { + fs = qemu_fd_getfs(rb->fd); + if (fs != QEMU_FS_TYPE_TMPFS && fs != QEMU_FS_TYPE_HUGETLBFS) { + error_report("Host backend files need to be TMPFS or HUGETLBFS only"); + return 1; + } + } + return 0; } @@ -366,6 +377,7 @@ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) struct uffdio_range range_struct; uint64_t feature_mask; Error *local_err = NULL; + RAMBlock *block; 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(MigrationIncomingState *mis) goto out; } - /* 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; + } } /* From patchwork Wed Apr 19 16:17:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13217115 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF963C6FD18 for ; Wed, 19 Apr 2023 16:19:39 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppAVL-0004vj-OE; Wed, 19 Apr 2023 12:17:59 -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 1ppAVK-0004vH-3e for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:17:58 -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 1ppAVG-00054K-Uq for qemu-devel@nongnu.org; Wed, 19 Apr 2023 12:17:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681921074; 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=W25etzIGKC7y8UWxpjpw9PYTe8JfLidmdz7SbNUF1G0=; b=Zmerk4G9i7O4fqAKM+11dVmU44OAy92cs/LZgPyjBTQXOnPv393msYOWDInys7zQJ450cf IVBA9z/JBLjy74XoS3k5odx2eRxTaHzYyLy6HIvcdwcSG1JmZdzahTAXOJEY71KR2QL4HW yP646CkkpLmj1VZq97niQLwLd3qwRUk= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-448-qQgRu5BnO4eW-aE-xr8kGg-1; Wed, 19 Apr 2023 12:17:52 -0400 X-MC-Unique: qQgRu5BnO4eW-aE-xr8kGg-1 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-3ecc0c4b867so13083541cf.1 for ; Wed, 19 Apr 2023 09:17:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681921071; x=1684513071; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W25etzIGKC7y8UWxpjpw9PYTe8JfLidmdz7SbNUF1G0=; b=evfKkLo0SgCoMGx8crSAdJoWmioz0LaMjTyHbrNToy1bgWfoogSHORXoqwd7nUrFMB kAqNgvlEz5zo0GyOR79vozGplJBsl5FXw8Jz700LQxIxBmR4Ei03mHmt6BozYHm6W/sD 9Qc7hnFibNIbY4y82JVOdLpZh9L7voeRfNn6bHh8WqGGRtVMjQCJEmt/Hr/3harfbHZm Vm/F/P0JdE+6axMI1IfHIz5bjDpjlhwzmLxVevshboqrQaZ88GX10vLDHnvoj/qJ6B6J hYR4Fo1Udsyqocby3XImluBAUVt5q3g5j76e7rDVcIGyxOeJqAvzQ0OIuF2djpOQy2XZ B4Ig== X-Gm-Message-State: AAQBX9cjmiXc4NX/yUqKkcvi8no9FvlDHM2b+nJpYeUyxqjA74rrKg5a AZAK6Q+5l6pas0R8w1VCTeM7+NupZ1GWplWjAuxX97m5UcJdpRTtcecREHu+y1PFkZLyVys7ADt 2sFqUQg9qeZVwzbf8j/fYhrgDSr0BEJLbsRtVBjLxYkRVLrtNqm7TDnRUBbBIOG6/S3ZU7I/H X-Received: by 2002:a05:622a:316:b0:3ef:4a7c:d7c5 with SMTP id q22-20020a05622a031600b003ef4a7cd7c5mr702781qtw.4.1681921070730; Wed, 19 Apr 2023 09:17:50 -0700 (PDT) X-Google-Smtp-Source: AKy350afryS4i6Z038XBu6j6UnGF6Uo99pCTFZlcXOh/6ucmdgWxBx4/XtH6/qTGJoPstOPfHcoWPQ== X-Received: by 2002:a05:622a:316:b0:3ef:4a7c:d7c5 with SMTP id q22-20020a05622a031600b003ef4a7cd7c5mr702732qtw.4.1681921070307; Wed, 19 Apr 2023 09:17:50 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-40-70-52-229-124.dsl.bell.ca. [70.52.229.124]) by smtp.gmail.com with ESMTPSA id t12-20020a05620a0b0c00b007468b183a65sm351481qkg.30.2023.04.19.09.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 09:17:49 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Paolo Bonzini , peterx@redhat.com, =?utf-8?q?Daniel?= =?utf-8?q?_P_=2E_Berrang=C3=A9?= , Juan Quintela , Leonardo Bras Soares Passos , David Hildenbrand Subject: [PATCH v2 4/4] migration: Allow postcopy_ram_supported_by_host() to report err Date: Wed, 19 Apr 2023 12:17:39 -0400 Message-Id: <20230419161739.1129988-5-peterx@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230419161739.1129988-1-peterx@redhat.com> References: <20230419161739.1129988-1-peterx@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Instead of print it to STDERR, bring the error upwards so that it can be reported via QMP responses. E.g.: { "execute": "migrate-set-capabilities" , "arguments": { "capabilities": [ { "capability": "postcopy-ram", "state": true } ] } } { "error": { "class": "GenericError", "desc": "Postcopy is not supported: Host backend files need to be TMPFS or HUGETLBFS only" } } Signed-off-by: Peter Xu --- migration/migration.c | 9 +++--- migration/postcopy-ram.c | 61 ++++++++++++++++++++++------------------ migration/postcopy-ram.h | 3 +- migration/savevm.c | 3 +- 4 files changed, 42 insertions(+), 34 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index bda4789193..ac15fa6092 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1313,6 +1313,7 @@ static bool migrate_caps_check(bool *cap_list, MigrationCapabilityStatusList *cap; bool old_postcopy_cap; MigrationIncomingState *mis = migration_incoming_get_current(); + Error *local_err = NULL; old_postcopy_cap = cap_list[MIGRATION_CAPABILITY_POSTCOPY_RAM]; @@ -1344,11 +1345,9 @@ static bool migrate_caps_check(bool *cap_list, * special support. */ if (!old_postcopy_cap && runstate_check(RUN_STATE_INMIGRATE) && - !postcopy_ram_supported_by_host(mis)) { - /* postcopy_ram_supported_by_host will have emitted a more - * detailed message - */ - error_setg(errp, "Postcopy is not supported"); + !postcopy_ram_supported_by_host(mis, &local_err)) { + error_propagate_prepend(errp, local_err, + "Postcopy is not supported: "); return false; } diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index bbb8af61ae..0713ddeeef 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -282,11 +282,14 @@ static bool request_ufd_features(int ufd, uint64_t features) return true; } -static bool ufd_check_and_apply(int ufd, MigrationIncomingState *mis) +static bool ufd_check_and_apply(int ufd, MigrationIncomingState *mis, + Error **errp) { uint64_t asked_features = 0; static uint64_t supported_features; + assert(errp); + /* * it's not possible to * request UFFD_API twice per one fd @@ -294,7 +297,7 @@ static bool ufd_check_and_apply(int ufd, MigrationIncomingState *mis) */ if (!supported_features) { if (!receive_ufd_features(&supported_features)) { - error_report("%s failed", __func__); + error_setg(errp, "Userfault feature detection failed"); return false; } } @@ -316,8 +319,7 @@ static bool ufd_check_and_apply(int ufd, MigrationIncomingState *mis) * userfault file descriptor */ if (!request_ufd_features(ufd, asked_features)) { - error_report("%s failed: features %" PRIu64, __func__, - asked_features); + error_setg(errp, "Failed features %" PRIu64, asked_features); return false; } @@ -328,7 +330,8 @@ static bool ufd_check_and_apply(int ufd, MigrationIncomingState *mis) have_hp = supported_features & UFFD_FEATURE_MISSING_HUGETLBFS; #endif if (!have_hp) { - error_report("Userfault on this host does not support huge pages"); + error_setg(errp, + "Userfault on this host does not support huge pages"); return false; } } @@ -337,7 +340,7 @@ static bool ufd_check_and_apply(int ufd, MigrationIncomingState *mis) /* Callback from postcopy_ram_supported_by_host block iterator. */ -static int test_ramblock_postcopiable(RAMBlock *rb) +static int test_ramblock_postcopiable(RAMBlock *rb, Error **errp) { const char *block_name = qemu_ram_get_idstr(rb); ram_addr_t length = qemu_ram_get_used_length(rb); @@ -345,16 +348,18 @@ static int test_ramblock_postcopiable(RAMBlock *rb) QemuFsType fs; if (length % pagesize) { - error_report("Postcopy requires RAM blocks to be a page size multiple," - " block %s is 0x" RAM_ADDR_FMT " bytes with a " - "page size of 0x%zx", block_name, length, pagesize); + error_setg(errp, + "Postcopy requires RAM blocks to be a page size multiple," + " block %s is 0x" RAM_ADDR_FMT " bytes with a " + "page size of 0x%zx", block_name, length, pagesize); return 1; } if (rb->fd >= 0) { fs = qemu_fd_getfs(rb->fd); if (fs != QEMU_FS_TYPE_TMPFS && fs != QEMU_FS_TYPE_HUGETLBFS) { - error_report("Host backend files need to be TMPFS or HUGETLBFS only"); + error_setg(errp, + "Host backend files need to be TMPFS or HUGETLBFS only"); return 1; } } @@ -367,7 +372,8 @@ static int test_ramblock_postcopiable(RAMBlock *rb) * normally fine since if the postcopy succeeds it gets turned back on at the * end. */ -bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) +bool postcopy_ram_supported_by_host(MigrationIncomingState *mis, + Error **errp) { long pagesize = qemu_real_host_page_size(); int ufd = -1; @@ -376,29 +382,28 @@ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) struct uffdio_register reg_struct; struct uffdio_range range_struct; uint64_t feature_mask; - Error *local_err = NULL; RAMBlock *block; + assert(errp); + if (qemu_target_page_size() > pagesize) { - error_report("Target page size bigger than host page size"); + error_setg(errp, "Target page size bigger than host page size"); goto out; } ufd = uffd_open(O_CLOEXEC); if (ufd == -1) { - error_report("%s: userfaultfd not available: %s", __func__, - strerror(errno)); + error_setg(errp, "Userfaultfd not available: %s", strerror(errno)); goto out; } /* Give devices a chance to object */ - if (postcopy_notify(POSTCOPY_NOTIFY_PROBE, &local_err)) { - error_report_err(local_err); + if (postcopy_notify(POSTCOPY_NOTIFY_PROBE, errp)) { goto out; } /* Version and features check */ - if (!ufd_check_and_apply(ufd, mis)) { + if (!ufd_check_and_apply(ufd, mis, errp)) { goto out; } @@ -416,7 +421,7 @@ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) * affect in reality, or we can revisit. */ RAMBLOCK_FOREACH(block) { - if (test_ramblock_postcopiable(block)) { + if (test_ramblock_postcopiable(block, errp)) { goto out; } } @@ -426,7 +431,7 @@ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) * it was enabled. */ if (munlockall()) { - error_report("%s: munlockall: %s", __func__, strerror(errno)); + error_setg(errp, "munlockall() failed: %s", strerror(errno)); goto out; } @@ -438,8 +443,7 @@ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) testarea = mmap(NULL, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (testarea == MAP_FAILED) { - error_report("%s: Failed to map test area: %s", __func__, - strerror(errno)); + error_setg(errp, "Failed to map test area: %s", strerror(errno)); goto out; } g_assert(QEMU_PTR_IS_ALIGNED(testarea, pagesize)); @@ -449,14 +453,14 @@ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) reg_struct.mode = UFFDIO_REGISTER_MODE_MISSING; if (ioctl(ufd, UFFDIO_REGISTER, ®_struct)) { - error_report("%s userfault register: %s", __func__, strerror(errno)); + error_setg(errp, "UFFDIO_REGISTER failed: %s", strerror(errno)); goto out; } range_struct.start = (uintptr_t)testarea; range_struct.len = pagesize; if (ioctl(ufd, UFFDIO_UNREGISTER, &range_struct)) { - error_report("%s userfault unregister: %s", __func__, strerror(errno)); + error_setg(errp, "UFFDIO_UNREGISTER failed: %s", strerror(errno)); goto out; } @@ -464,8 +468,8 @@ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) (__u64)1 << _UFFDIO_COPY | (__u64)1 << _UFFDIO_ZEROPAGE; if ((reg_struct.ioctls & feature_mask) != feature_mask) { - error_report("Missing userfault map features: %" PRIx64, - (uint64_t)(~reg_struct.ioctls & feature_mask)); + error_setg(errp, "Missing userfault map features: %" PRIx64, + (uint64_t)(~reg_struct.ioctls & feature_mask)); goto out; } @@ -1187,6 +1191,8 @@ static int postcopy_temp_pages_setup(MigrationIncomingState *mis) int postcopy_ram_incoming_setup(MigrationIncomingState *mis) { + Error *local_err = NULL; + /* Open the fd for the kernel to give us userfaults */ mis->userfault_fd = uffd_open(O_CLOEXEC | O_NONBLOCK); if (mis->userfault_fd == -1) { @@ -1199,7 +1205,8 @@ int postcopy_ram_incoming_setup(MigrationIncomingState *mis) * Although the host check already tested the API, we need to * do the check again as an ABI handshake on the new fd. */ - if (!ufd_check_and_apply(mis->userfault_fd, mis)) { + if (!ufd_check_and_apply(mis->userfault_fd, mis, &local_err)) { + error_report_err(local_err); return -1; } diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h index b4867a32d5..442ab89752 100644 --- a/migration/postcopy-ram.h +++ b/migration/postcopy-ram.h @@ -14,7 +14,8 @@ #define QEMU_POSTCOPY_RAM_H /* Return true if the host supports everything we need to do postcopy-ram */ -bool postcopy_ram_supported_by_host(MigrationIncomingState *mis); +bool postcopy_ram_supported_by_host(MigrationIncomingState *mis, + Error **errp); /* * Make all of RAM sensitive to accesses to areas that haven't yet been written diff --git a/migration/savevm.c b/migration/savevm.c index aa54a67fda..0d61ab6c19 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1752,7 +1752,8 @@ static int loadvm_postcopy_handle_advise(MigrationIncomingState *mis, return -EINVAL; } - if (!postcopy_ram_supported_by_host(mis)) { + if (!postcopy_ram_supported_by_host(mis, &local_err)) { + error_report_err(local_err); postcopy_state_set(POSTCOPY_INCOMING_NONE); return -1; }