From nobody Mon Feb 9 23:40:05 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.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 1493183464653832.8661188970113; Tue, 25 Apr 2017 22:11:04 -0700 (PDT) Received: from localhost ([::1]:52661 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3FEF-000592-Iw for importer@patchew.org; Wed, 26 Apr 2017 01:11:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3FA2-0001xY-Ot for qemu-devel@nongnu.org; Wed, 26 Apr 2017 01:06:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3F9x-0002uM-Rh for qemu-devel@nongnu.org; Wed, 26 Apr 2017 01:06:42 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:23505) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3F9x-0002tp-Jy for qemu-devel@nongnu.org; Wed, 26 Apr 2017 01:06:37 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OP00098W3IYT000@mailout1.w1.samsung.com> for qemu-devel@nongnu.org; Wed, 26 Apr 2017 06:06:34 +0100 (BST) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170426050634eucas1p14f5e5bdea1802ff5cdb78667b28e56f9~42jQ0vgqu2695226952eucas1p1m; Wed, 26 Apr 2017 05:06:34 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges4.samsung.com (EUCPMTA) with SMTP id C5.F1.04729.9DA20095; Wed, 26 Apr 2017 06:06:33 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170426050633eucas1p131e8089df08fbd540d24b2d2a960012c~42jPwhdw02695226952eucas1p1l; Wed, 26 Apr 2017 05:06:33 +0000 (GMT) Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id F9.E5.17452.F5B20095; Wed, 26 Apr 2017 06:08:47 +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 <0OP000MTF3IPGF20@eusync1.samsung.com>; Wed, 26 Apr 2017 06:06:33 +0100 (BST) X-AuditID: cbfec7f4-f79806d000001279-ef-59002ad99252 From: Alexey Perevalov To: dgilbert@redhat.com Date: Wed, 26 Apr 2017 08:06:16 +0300 Message-id: <1493183181-21962-3-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1493183181-21962-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrAIsWRmVeSWpSXmKPExsWy7djPc7o3tRgiDdZ1W1vMvXuexaJ32z12 ixObDjJbXGn/yW6xZf83dovjvTtYHNg8DrxYyO7x5NpmJo/3+66yefRtWcUYwBLFZZOSmpNZ llqkb5fAldHScp69YItsxZRXP9kaGJeJdzFyckgImEica/nOBmGLSVy4tx7I5uIQEljKKHF7 0QFmCOczo0Trg03sMB2v9jYxQiSWMUr0vtzACuF0M0ncWTwLKMPBwSZgILHvni1Ig4iAuMS7 f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DD7EKMDBqMTDG+DxP0KINbGsuDL3EKMEB7OS CG+4BkOkEG9KYmVValF+fFFpTmrxIUZToJsmMkuJJucDoyqvJN7QxNDc0tDI2MLC3MhISZy3 5MOVcCGB9MSS1OzU1ILUIpg+Jg5OqQZGxZD3f3RLAxMvP5ySJL/MSWJW3vq0S3KJNzr8m7Ms pqTZebLLK80UkW/lWhhwTn6+976bhsGZC742+cnb61x/K+Jfs7oxkatK1PoU+++m5DtPpE8c /WPFef7wtKDpVRuPa2ZHTrQNuaKfv3nqlcwTvWy7v5xf+u7H1OfeFsKNtyov32A/ffi1Ektx RqKhFnNRcSIA2or6r3ICAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170426050633eucas1p131e8089df08fbd540d24b2d2a960012c 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-HopCount: 7 X-CMS-RootMailID: 20170426050633eucas1p131e8089df08fbd540d24b2d2a960012c X-RootMTR: 20170426050633eucas1p131e8089df08fbd540d24b2d2a960012c References: <1493183181-21962-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.11 Subject: [Qemu-devel] [PATCH V3 2/6] migration: pass ptr to MigrationIncomingState into migration ufd_version_check & postcopy_ram_supported_by_host 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, qemu-devel@nongnu.org, a.perevalov@samsung.com, peterx@redhat.com, f4bug@amsat.org 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 --- include/migration/postcopy-ram.h | 2 +- migration/migration.c | 2 +- migration/postcopy-ram.c | 10 +++++----- migration/savevm.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/migration/postcopy-ram.h b/include/migration/postcopy-= ram.h index 8e036b9..809f6db 100644 --- a/include/migration/postcopy-ram.h +++ b/include/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/migration.c b/migration/migration.c index ad4036f..79f6425 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -802,7 +802,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(NULL)) { /* 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 dc80dbb..dcf2ed1 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -60,7 +60,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; @@ -113,7 +113,7 @@ static int test_range_shared(const char *block_name, vo= id *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; @@ -136,7 +136,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 @@ -515,7 +515,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 @@ -653,7 +653,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/savevm.c b/migration/savevm.c index 3b19a4a..f01e418 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1360,7 +1360,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