From nobody Wed Nov 5 17:48:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496829445627266.62592200448444; Wed, 7 Jun 2017 02:57:25 -0700 (PDT) Received: from localhost ([::1]:42367 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIXiO-0002IM-3h for importer@patchew.org; Wed, 07 Jun 2017 05:57:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIXYv-0001B3-8i for qemu-devel@nongnu.org; Wed, 07 Jun 2017 05:47:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIXYr-0000Fj-1d for qemu-devel@nongnu.org; Wed, 07 Jun 2017 05:47:37 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:26023) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dIXYq-0000Ex-PW for qemu-devel@nongnu.org; Wed, 07 Jun 2017 05:47:32 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OR6007GJ8J4C200@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Wed, 07 Jun 2017 10:47:28 +0100 (BST) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170607094727eucas1p1605e5102c116bbd0ce8471ac2259dbdd~FzegIoFHS2189821898eucas1p1X; Wed, 7 Jun 2017 09:47:27 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges4.samsung.com (EUCPMTA) with SMTP id 59.47.04729.FABC7395; Wed, 7 Jun 2017 10:47:27 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170607094727eucas1p13b2228fead9fc5a49d953985c777b719~Fzefjgfkg2789927899eucas1p1t; Wed, 7 Jun 2017 09:47:27 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 1D.22.20206.EABC7395; Wed, 7 Jun 2017 10:47:26 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OR600I3B8ILMHB0@eusync1.samsung.com>; Wed, 07 Jun 2017 10:47:26 +0100 (BST) X-AuditID: cbfec7f4-f79806d000001279-f6-5937cbafdba0 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Wed, 07 Jun 2017 12:46:29 +0300 Message-id: <1496828798-27548-3-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1496828798-27548-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRmVeSWpSXmKPExsWy7djP87rrT5tHGry5KWYx9+55FovebffY La60/2S32LL/G7vF8d4dLA6sHk+ubWbyeL/vKptH35ZVjAHMUVw2Kak5mWWpRfp2CVwZp8// Yyt4LV+x5uovlgbGOZJdjJwcEgImEu/7VrBC2GISF+6tZwOxhQSWMkr8mBzZxcgFZH9mlNjy sJEVpmH1jv1sEIlljBKd7V1QTjeTxPWH09i7GDk42AQMJPbdswVpEBGQlPjddZoZxGYWKJ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IllxZW5hxglOJiVRHgnHjWPFOJNSays Si3Kjy8qzUktPsRoCnTURGYp0eR8YPTklcQbmhiaWxoaGVtYmBsZKYnzTv1wJVxIID2xJDU7 NbUgtQimj4mDU6qBUW1zmU2lvF7gl5PR315p/77BrlXtPeFA+PTHHgqcrGIfMnnjFq6tKPHc plTa2V5csINHUvbb2pSNzNoXZWc/OCC1m4Wfr+D0kpXXX65TrD2nLzhty/tE1pob5zakttnd uvXmUuDXDy8W6WxIKTsllLmlV0sqdXsje6+eVL//+tgZ35zOJDOuV2Ipzkg01GIuKk4EADmQ IDhmAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170607094727eucas1p13b2228fead9fc5a49d953985c777b719 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG+yCvOyEseyghOyekBtTZW5pb3IgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170607094727eucas1p13b2228fead9fc5a49d953985c777b719 X-RootMTR: 20170607094727eucas1p13b2228fead9fc5a49d953985c777b719 References: <1496828798-27548-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 210.118.77.14 Subject: [Qemu-devel] [PATCH v8 02/11] migration: pass MigrationIncomingState* into migration check functions 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: i.maximets@samsung.com, Alexey Perevalov , peterx@redhat.com, dgilbert@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" That tiny refactoring is necessary to be able to set UFFD_FEATURE_THREAD_ID while requesting features, and then to create downtime context in case when kernel supports it. Signed-off-by: Alexey Perevalov --- migration/migration.c | 3 ++- migration/postcopy-ram.c | 10 +++++----- migration/postcopy-ram.h | 2 +- migration/savevm.c | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 48c94c9..2a77636 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -726,6 +726,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilitySt= atusList *params, Error **errp) { MigrationState *s =3D migrate_get_current(); + MigrationIncomingState *mis =3D migration_incoming_get_current(); MigrationCapabilityStatusList *cap; bool old_postcopy_cap =3D migrate_postcopy_ram(); =20 @@ -772,7 +773,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilitySt= atusList *params, * special support. */ if (!old_postcopy_cap && runstate_check(RUN_STATE_INMIGRATE) && - !postcopy_ram_supported_by_host()) { + !postcopy_ram_supported_by_host(mis)) { /* postcopy_ram_supported_by_host will have emitted a more * detailed message */ diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 9c41887..10d39a0 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -63,7 +63,7 @@ struct PostcopyDiscardState { #include #include =20 -static bool ufd_version_check(int ufd) +static bool ufd_version_check(int ufd, MigrationIncomingState *mis) { struct uffdio_api api_struct; uint64_t ioctl_mask; @@ -126,7 +126,7 @@ static int test_ramblock_postcopiable(const char *block= _name, void *host_addr, * normally fine since if the postcopy succeeds it gets turned back on at = the * end. */ -bool postcopy_ram_supported_by_host(void) +bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) { long pagesize =3D getpagesize(); int ufd =3D -1; @@ -149,7 +149,7 @@ bool postcopy_ram_supported_by_host(void) } =20 /* Version and features check */ - if (!ufd_version_check(ufd)) { + if (!ufd_version_check(ufd, mis)) { goto out; } =20 @@ -525,7 +525,7 @@ int postcopy_ram_enable_notify(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_version_check(mis->userfault_fd)) { + if (!ufd_version_check(mis->userfault_fd, mis)) { return -1; } =20 @@ -663,7 +663,7 @@ void *postcopy_get_tmp_page(MigrationIncomingState *mis) =20 #else /* No target OS support, stubs just fail */ -bool postcopy_ram_supported_by_host(void) +bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) { error_report("%s: No OS support", __func__); return false; diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h index 52d51e8..587a8b8 100644 --- a/migration/postcopy-ram.h +++ b/migration/postcopy-ram.h @@ -14,7 +14,7 @@ #define QEMU_POSTCOPY_RAM_H =20 /* Return true if the host supports everything we need to do postcopy-ram = */ -bool postcopy_ram_supported_by_host(void); +bool postcopy_ram_supported_by_host(MigrationIncomingState *mis); =20 /* * Make all of RAM sensitive to accesses to areas that haven't yet been wr= itten diff --git a/migration/savevm.c b/migration/savevm.c index 9c320f5..8b7bab8 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1380,7 +1380,7 @@ static int loadvm_postcopy_handle_advise(MigrationInc= omingState *mis) return -1; } =20 - if (!postcopy_ram_supported_by_host()) { + if (!postcopy_ram_supported_by_host(mis)) { postcopy_state_set(POSTCOPY_INCOMING_NONE); return -1; } --=20 1.9.1