From patchwork Tue May 23 11:31:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Perevalov X-Patchwork-Id: 9742383 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6A04C6032C for ; Tue, 23 May 2017 11:49:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5637F287BF for ; Tue, 23 May 2017 11:49:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AF22287CD; Tue, 23 May 2017 11:49:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C6CCC287BF for ; Tue, 23 May 2017 11:49:27 +0000 (UTC) Received: from localhost ([::1]:47932 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dD8Jb-0004Uq-3H for patchwork-qemu-devel@patchwork.kernel.org; Tue, 23 May 2017 07:49:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dD82M-0006mf-DQ for qemu-devel@nongnu.org; Tue, 23 May 2017 07:31:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dD82I-0003gX-3G for qemu-devel@nongnu.org; Tue, 23 May 2017 07:31:38 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:29807) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dD82H-0003eu-QN for qemu-devel@nongnu.org; Tue, 23 May 2017 07:31:34 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OQE00088LCGQB70@mailout3.w1.samsung.com> for qemu-devel@nongnu.org; Tue, 23 May 2017 12:31:28 +0100 (BST) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170523113128eucas1p145de69af044ae3eb3873eed185fb2df7~BOOB9Tesj1979719797eucas1p1K; Tue, 23 May 2017 11:31:28 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 3A.54.04459.F8D14295; Tue, 23 May 2017 12:31:27 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170523113127eucas1p22dba0fddcc9bcf70e554bf659272f947~BOOBUmp8A0956409564eucas1p2O; Tue, 23 May 2017 11:31:27 +0000 (GMT) X-AuditID: cbfec7f1-f796e6d00000116b-be-59241d8f3a46 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 80.D1.20206.F8D14295; Tue, 23 May 2017 12:31:27 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OQE003QBLC1VWB0@eusync3.samsung.com>; Tue, 23 May 2017 12:31:27 +0100 (BST) From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Tue, 23 May 2017 14:31:03 +0300 Message-id: <1495539071-12995-3-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1495539071-12995-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsWy7djP87r9siqRBlv2G1nMvXuexaJ32z12 i4lv17NaXGn/yW6xZf83dovjvTtYHNg8nlzbzOTxft9VNo++LasYA5ijuGxSUnMyy1KL9O0S uDKOrTrIWPBNpmLRN98GxgbxLkZODgkBE4k3J2awQthiEhfurWfrYuTiEBJYyihx8/1aVgjn M6PEwQln2GE6Dvx5CVW1jFFi08JlLBBON5PEsue/gao4ONgEDCT23bMFaRARkJT43XWaGaSG WaCZUeLQ45/MIAlhgSSJ8/Pugu1mEVCVWH74L9gGXgF3iZurn0Ftk5M4eWwyWA2ngIfEu8P3 wJZJCNxnk9i2+AkbyDIJAVmJTQeYIepdJM6/mAdlC0u8Or4Fao6MxOXJ3VC97YwS3Ts7WSGc CYwSZ6b/haqylzh18yoTiM0swCcxadt0ZogFvBIdbUIQJR4Sa7tXMULYjhIznvxigvh+NqPE ovVnWCYwyixgZFjFKJJaWpybnlpspFecmFtcmpeul5yfu4kRGKen/x3/uIPx/QmrQ4wCHIxK PLwaj5UihVgTy4orcw8xSnAwK4nw+gipRArxpiRWVqUW5ccXleakFh9ilOZgURLn5Tp1LUJI ID2xJDU7NbUgtQgmy8TBKdXAWKf97vES+e+PROalMJ+JbXksWHzj0VbuN75s/suuLvhpvV5S RJpV+PHG9a8/zj32SHR93uFCI/XfKq37hOcd0Oc349jO3NZSueI6M9vE5bwrkk4ov5vfvu0h EzfjgVfRdxo8OHO2rd4Vznry6eEN7DyRtdmPmYxrv0yt+/yEL0jemavWcJ3kUSWW4oxEQy3m ouJEAJ8a3KPPAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJLMWRmVeSWpSXmKPExsVy+t/xq7r9siqRBttucFrMvXuexaJ32z12 i4lv17NaXGn/yW6xZf83dovjvTtYHNg8nlzbzOTxft9VNo++LasYA5ij3GwyUhNTUosUUvOS 81My89JtlUJD3HQtlBTyEnNTbZUidH1DgpQUyhJzSoE8IwM04OAc4B6spG+X4JZxbNVBxoJv MhWLvvk2MDaIdzFyckgImEgc+POSDcIWk7hwbz2QzcUhJLCEUWLHxgeMIAkhgV4mibOrPLsY OTjYBAwk9t2zBQmLCEhK/O46zQxSzyzQzCjRuroNbJCwQJLE+Xl3WUFsFgFVieWH/7KD2LwC 7hI3Vz9jh1gmJ3Hy2GSwGk4BD4l3h++xQOxylzg98TrrBEbeBYwMqxhFUkuLc9Nzi430ihNz i0vz0vWS83M3MQKDdduxn1t2MHa9Cz7EKMDBqMTDq/FYKVKINbGsuDL3EKMEB7OSCK+PkEqk EG9KYmVValF+fFFpTmrxIUZToKMmMkuJJucDIymvJN7QxNDc0tDI2MLC3MhISZx36ocr4UIC 6YklqdmpqQWpRTB9TBycUg2M290uCPExdyqwfpt7oVVIxOlNyXY2u8vqtUcSAxUiP1aZ8sWv VmG2+6T5qn9JyKG135k8nO9evbWLq/GsTqh5bfRK2xT3FDVjWenaKDEpieNv9bsZpd4Up/F8 fPKW239u1WPrsxP85XpvTzv2bGfbHJ7vCR8OO/+xzm1dd/+BzhSJ6l8TZ5QqsRRnJBpqMRcV JwIAvWRQSmwCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170523113127eucas1p22dba0fddcc9bcf70e554bf659272f947 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: 20170523113127eucas1p22dba0fddcc9bcf70e554bf659272f947 X-RootMTR: 20170523113127eucas1p22dba0fddcc9bcf70e554bf659272f947 References: <1495539071-12995-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.13 Subject: [Qemu-devel] [PATCH V6 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: i.maximets@samsung.com, dgilbert@redhat.com, peterx@redhat.com, Alexey Perevalov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 | 2 +- migration/postcopy-ram.c | 10 +++++----- migration/postcopy-ram.h | 2 +- migration/savevm.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 0304c01..d735976 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -789,7 +789,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *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 a0489f6..4adab36 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -59,7 +59,7 @@ struct PostcopyDiscardState { #include #include -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; @@ -112,7 +112,7 @@ static int test_range_shared(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 = getpagesize(); int ufd = -1; @@ -135,7 +135,7 @@ bool postcopy_ram_supported_by_host(void) } /* Version and features check */ - if (!ufd_version_check(ufd)) { + if (!ufd_version_check(ufd, mis)) { goto out; } @@ -512,7 +512,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; } @@ -650,7 +650,7 @@ void *postcopy_get_tmp_page(MigrationIncomingState *mis) #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 /* 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); /* * 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 f5e8194..61a6df7 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1356,7 +1356,7 @@ static int loadvm_postcopy_handle_advise(MigrationIncomingState *mis) return -1; } - if (!postcopy_ram_supported_by_host()) { + if (!postcopy_ram_supported_by_host(mis)) { postcopy_state_set(POSTCOPY_INCOMING_NONE); return -1; }