From patchwork Fri Apr 28 06:57:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Perevalov X-Patchwork-Id: 9703955 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 33BA2602BF for ; Fri, 28 Apr 2017 07:02:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 244DA2624A for ; Fri, 28 Apr 2017 07:02:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1904828304; Fri, 28 Apr 2017 07:02:00 +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 377132624A for ; Fri, 28 Apr 2017 07:01:59 +0000 (UTC) Received: from localhost ([::1]:35469 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3zug-0003TC-8p for patchwork-qemu-devel@patchwork.kernel.org; Fri, 28 Apr 2017 03:01:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3zqr-0001Jj-LS for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:58:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3zqo-00035c-JQ for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:58:01 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:63296) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3zqo-00033A-DS for qemu-devel@nongnu.org; Fri, 28 Apr 2017 02:57:58 -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 <0OP300BA7Y0I4D20@mailout1.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 28 Apr 2017 07:57:54 +0100 (BST) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170428065754eucas1p160dd006ab0fed9d3fa82351b95e738b9~5fXCZH4nq0312903129eucas1p1F; Fri, 28 Apr 2017 06:57:54 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 90.6B.25577.1F7E2095; Fri, 28 Apr 2017 07:57:53 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170428065753eucas1p1639528c4df0b459db96579fd5bee281c~5fXBvFAeB1555615556eucas1p1E; Fri, 28 Apr 2017 06:57:53 +0000 (GMT) X-AuditID: cbfec7f5-f792f6d0000063e9-db-5902e7f11074 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 70.7A.17452.978E2095; Fri, 28 Apr 2017 08:00:09 +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 <0OP300L3YY07A050@eusync3.samsung.com>; Fri, 28 Apr 2017 07:57:53 +0100 (BST) From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Fri, 28 Apr 2017 09:57:34 +0300 Message-id: <1493362658-8179-3-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1493362658-8179-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRmVeSWpSXmKPExsWy7djP87ofnzNFGiyepGcx9+55FovebffY LU5sOshscaX9J7vFlv3f2C2O9+5gcWDzOPBiIbvHk2ubmTze77vK5tG3ZRVjAEsUl01Kak5m WWqRvl0CV8b3NaEFW2QrZj3laWBcJt7FyMkhIWAicfn3UzYIW0ziwr31QDYXh5DAUkaJAwem sEA4nxkljl/fwgbT8erufFaIxDJGienrbrCAJIQEupkklp0x6GLk4GATMJDYd88WJCwiICnx u+s0M4jNLJAn8WjyeWaQXmGBCYwSy47MZQapZxFQlfjZYQ5SwyvgJtHe+4cJYpecxMljk1lB bE4Bd4ndj2+BXSch8JxN4vvc1awgvRICshKbDjBDmC4S87YlQbQKS7w6voUdwpaR6Ow4yATR 2s4o0b2zkxXCAbrhzPS/UFX2EqduXmWCOJRPYtK26VBDeSU62oQgTA+JWT+zIUxHia8/fSGh MItRom3ef7YJjDILGBlWMYqklhbnpqcWm+oVJ+YWl+al6yXn525iBEbp6X/Hv+5gXHrM6hCj AAejEg8vwwfGSCHWxLLiytxDjBIczEoivJKJTJFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeblO XYsQEkhPLEnNTk0tSC2CyTJxcEo1MKpLbpnvmDLNmqHpx853mr++B/NIciwPm3tpssC10wIT mZ2+3eE8Xxjf+05QboHoE/sTOf6MmoUNfRNWL7h/9/5NjYJ625NSH+Zw9dW+2c3m+Wd94U2d T1vWrvjYGyXb9kKmpJSlKKVv+9X277Nj29ZN/+uwrq6w4nLnEZ9PW01P5Hi6/frY8EmJpTgj 0VCLuag4EQAh7auzzgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLLMWRmVeSWpSXmKPExsVy+t/xq7qVL5giDdYcVLSYe/c8i0Xvtnvs Fic2HWS2uNL+k91iy/5v7BbHe3ewOLB5HHixkN3jybXNTB7v911l8+jbsooxgCXKzSYjNTEl tUghNS85PyUzL91WKTTETddCSSEvMTfVVilC1zckSEmhLDGnFMgzMkADDs4B7sFK+nYJbhnf 14QWbJGtmPWUp4FxmXgXIyeHhICJxKu781khbDGJC/fWs3UxcnEICSxhlHjRtJIFwullkli9 sRsow8HBJmAgse+eLUiDiICkxO+u08wgNrNAnsTKGf8ZQeqFBSYwSiw7MpcZpJ5FQFXiZ4c5 SA2vgJtEe+8fJohlchInj00GW8wp4C6x+/EtNhBbCKhmyetpzBMYeRcwMqxiFEktLc5Nzy02 1CtOzC0uzUvXS87P3cQIDNptx35u3sF4aWPwIUYBDkYlHl6GD4yRQqyJZcWVuYcYJTiYlUR4 JROZIoV4UxIrq1KL8uOLSnNSiw8xmgLdNJFZSjQ5HxhReSXxhiaG5paGRsYWFuZGRkrivCUf roQLCaQnlqRmp6YWpBbB9DFxcEo1MHbZXtt1V/BTot/fhdMjcrN1Uqu2/LjzYV/BSoMNUnpJ f6dM7vqpu9HH/JJEypfwx1MX+J9uP7iNP8+37/erlnkZRm9KH9upJh6a6uOn+uvP09nZVg8W 8/2pvlkllVB7xXRJ8c6Zk0JnHvoUe6Lapu5/z/maaSuV0176n+8P6/b1vu4647rhNxslluKM REMt5qLiRABenOLScAIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170428065753eucas1p1639528c4df0b459db96579fd5bee281c 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: 20170428065753eucas1p1639528c4df0b459db96579fd5bee281c X-RootMTR: 20170428065753eucas1p1639528c4df0b459db96579fd5bee281c References: <1493362658-8179-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 RESEND 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, f4bug@amsat.org, dgilbert@redhat.com, peterx@redhat.com, a.perevalov@samsung.com 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 --- 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 /* 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/migration.c b/migration/migration.c index 353f272..569a7f6 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -804,7 +804,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 85fd8d7..4c859b4 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -60,7 +60,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; @@ -113,7 +113,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; @@ -136,7 +136,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; } @@ -513,7 +513,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; } @@ -651,7 +651,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/savevm.c b/migration/savevm.c index 03ae1bd..2aff64c 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1360,7 +1360,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; }