From nobody Mon Feb 9 20:31:29 2026 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.zohomail.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 1505841931573105.99670278288067; Tue, 19 Sep 2017 10:25:31 -0700 (PDT) Received: from localhost ([::1]:44265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duMH4-0008Fz-D0 for importer@patchew.org; Tue, 19 Sep 2017 13:25:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duLhF-0001Cm-25 for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duLhB-0006OF-VH for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:29 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:33237) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1duLhB-0006MD-LH for qemu-devel@nongnu.org; Tue, 19 Sep 2017 12:48:25 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20170919164823euoutp0147d9ea48105c9e60861d707272282543~l0TtRZlHv2660026600euoutp01M; Tue, 19 Sep 2017 16:48:23 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170919164822eucas1p1b56ea80125ae6452b068b0088db125aa~l0TsZThuB3070230702eucas1p14; Tue, 19 Sep 2017 16:48:22 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id BF.1F.12867.55A41C95; Tue, 19 Sep 2017 17:48:21 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170919164821eucas1p2c3d141e6ae576901e95212d1136b0453~l0Trv-qjn0223102231eucas1p2a; Tue, 19 Sep 2017 16:48:21 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 73.6C.18832.55A41C95; Tue, 19 Sep 2017 17:48:21 +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 <0OWJ003OHDC8XU40@eusync1.samsung.com>; Tue, 19 Sep 2017 17:48:21 +0100 (BST) X-AuditID: cbfec7f2-f793b6d000003243-f6-59c14a5544a0 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Tue, 19 Sep 2017 19:47:56 +0300 Message-id: <1505839684-10046-3-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsWy7djPc7qhXgcjDVb/MLeYe/c8i0Xvtnvs FhPfrme1mPb5NrvFlfaf7BZb9n9jtzjeu4PF4s6WPiYHDo8n1zYzebzfd5XNo2/LKsYA5igu m5TUnMyy1CJ9uwSujEktM9kLWuQrns7+z97AeFOii5GTQ0LARGLrtJlsELaYxIV764FsLg4h gaWMEj0f77FCOJ8ZJSZO62HqYuQA61hzwB0ivoxR4tSc/YwQTjeTRPPSX2BFbAIGEvvu2YJM FRGQlPjddZoZpIZZYA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KLDzFKc7AoifP27lkdKSSQnliS mp2aWpBaBJNl4uCUamCs2PzmW/f7/1+02p+8e3DvZMtU8ZbFLCHyjAteHfz45Ki9eliVCbvb XK/5l03sg38aLBZy+sIsf69s76+Od7+sNp6qvZoT3871NCA3VaJJW2D92XXMm/WObO5wzJX9 kzBVq3a3yc2r5qvOH/Cd+OVFcHj3jpMyr1Z9m+BybbrFn+zOX+eNo2SvK7EUZyQaajEXFScC AH2TKRwgAgAA X-CMS-MailID: 20170919164821eucas1p2c3d141e6ae576901e95212d1136b0453 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 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-CMS-RootMailID: 20170919164821eucas1p2c3d141e6ae576901e95212d1136b0453 X-RootMTR: 20170919164821eucas1p2c3d141e6ae576901e95212d1136b0453 References: <1505839684-10046-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 210.118.77.11 Subject: [Qemu-devel] [PATCH v10 02/10] 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: heetae82.ahn@samsung.com, quintela@redhat.com, Alexey Perevalov , peterx@redhat.com, dgilbert@redhat.com, i.maximets@samsung.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 Reviewed-by: Juan Quintela --- 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 959e8ec..e820d47 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -603,6 +603,7 @@ static bool migrate_caps_check(bool *cap_list, { MigrationCapabilityStatusList *cap; bool old_postcopy_cap; + MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 old_postcopy_cap =3D cap_list[MIGRATION_CAPABILITY_POSTCOPY_RAM]; =20 @@ -636,7 +637,7 @@ static bool migrate_caps_check(bool *cap_list, * 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 7a414eb..4350dd0 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -61,7 +61,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; @@ -124,7 +124,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; @@ -147,7 +147,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 @@ -523,7 +523,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 @@ -677,7 +677,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 78a3591..77ea0fd 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 7a55023..6ed6d57 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1352,7 +1352,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