From patchwork Fri Apr 14 13:17:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Perevalov X-Patchwork-Id: 9681251 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 AA9BA60326 for ; Fri, 14 Apr 2017 13:19:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CDD92863E for ; Fri, 14 Apr 2017 13:19:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 919292864D; Fri, 14 Apr 2017 13:19:07 +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 B53FB2863E for ; Fri, 14 Apr 2017 13:19:06 +0000 (UTC) Received: from localhost ([::1]:53271 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cz17x-0007Vp-Oz for patchwork-qemu-devel@patchwork.kernel.org; Fri, 14 Apr 2017 09:19:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cz16i-0007Rl-Kq for qemu-devel@nongnu.org; Fri, 14 Apr 2017 09:17:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cz16f-0008E5-FP for qemu-devel@nongnu.org; Fri, 14 Apr 2017 09:17:48 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:61604) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cz16f-0008DI-6i for qemu-devel@nongnu.org; Fri, 14 Apr 2017 09:17:45 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OOE00IN2I9GX100@mailout2.w1.samsung.com> for qemu-devel@nongnu.org; Fri, 14 Apr 2017 14:17:40 +0100 (BST) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170414131740eucas1p2c9af5901dc94d65cf80a9d02271f4762~1Rgn_WrlF1643616436eucas1p2l; Fri, 14 Apr 2017 13:17:40 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 45.07.04459.3FBC0F85; Fri, 14 Apr 2017 14:17:40 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170414131739eucas1p27a3eed795ae545efff380d7c5f8358c3~1RgnVkGNd2461824618eucas1p2H; Fri, 14 Apr 2017 13:17:39 +0000 (GMT) X-AuditID: cbfec7f1-f796e6d00000116b-94-58f0cbf3e1b9 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id D9.2D.17452.17CC0F85; Fri, 14 Apr 2017 14:19:45 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OOE00KVHI9AY150@eusync2.samsung.com>; Fri, 14 Apr 2017 14:17:39 +0100 (BST) From: Alexey Perevalov To: dgilbert@redhat.com, qemu-devel@nongnu.org Date: Fri, 14 Apr 2017 16:17:17 +0300 Message-id: <1492175840-5021-4-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1492175840-5021-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHIsWRmVeSWpSXmKPExsWy7djP87pfTn+IMDg4m8li7t3zLBa92+6x W1xp/8lucbx3B4sDi8eTa5uZPN7vu8rm0bdlFWMAcxSXTUpqTmZZapG+XQJXxqO/sQXz5Cu+ LnvA2MB4RqKLkZNDQsBE4tThd6wQtpjEhXvr2boYuTiEBJYySrQtOw3lfGaU2NjziRGm48qx p+wQiWWMEh+2TmGCcLqZJI792sTSxcjBwSZgILHvni1Ig4iAnsSVb51gzcwCxhItP5+zg9jC Al4S0/+eYAMpZxFQlbjwORXE5BVwk/i9IBBilZzEyWOTwY7jFHCXePVjJQvIJgmBE2wSz1ZB tEoIyEpsOsAMYbpILGgOhmgVlnh1fAs7hC0j0dlxkAmitZ1RontnJyuEM4FR4sz0v1BV9hKn bl5lgjiTT2LStulQQ3klOtqEIEo8JF6cPA5V7iix++wyFojPZzFKbFn6mHkCo8wCRoZVjCKp pcW56anFRnrFibnFpXnpesn5uZsYgbF4+t/xjzsY35+wOsQowMGoxMN74fiHCCHWxLLiytxD jBIczEoivNGngEK8KYmVValF+fFFpTmpxYcYpTlYlMR5uU5dixASSE8sSc1OTS1ILYLJMnFw SjUwcnmq2+89eePiQR3LbYKc5bEXn89cee9eMtNlqb/v1sw5+YHniGzu3uLutl1Wk1MD5ttN t6/X+8fleZBHWLbhXby1yrf3U7yOSpbmr+uc9VbsRVtzi0pgqHvkU7YpDw2PqRn7Kizv/blT Wv/z+6c8OWfTFF2C3RUlL8e8nhnEKln9h/3fH6dCJZbijERDLeai4kQATP5ZW8ECAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLLMWRmVeSWpSXmKPExsVy+t/xK7qFZz5EGNxfxG4x9+55FovebffY La60/2S3ON67g8WBxePJtc1MHu/3XWXz6NuyijGAOcrNJiM1MSW1SCE1Lzk/JTMv3VYpNMRN 10JJIS8xN9VWKULXNyRISaEsMacUyDMyQAMOzgHuwUr6dgluGY/+xhbMk6/4uuwBYwPjGYku Rk4OCQETiSvHnrJD2GISF+6tZ+ti5OIQEljCKDHzykYop5dJYuX3e0BVHBxsAgYS++7ZgjSI COhJXPnWyQhiMwsYS7T8fA42SFjAS2L63xNsIOUsAqoSFz6ngpi8Am4SvxcEQqySkzh5bDIr iM0p4C7x6sdKFhBbCKhk5en3TBMYeRcwMqxiFEktLc5Nzy021CtOzC0uzUvXS87P3cQIDMpt x35u3sF4aWPwIUYBDkYlHt6Kox8ihFgTy4orcw8xSnAwK4nwRp8CCvGmJFZWpRblxxeV5qQW H2I0BTppIrOUaHI+MGLySuINTQzNLQ2NjC0szI2MlMR5Sz5cCRcSSE8sSc1OTS1ILYLpY+Lg lGpgnCfyhSN1tt81OY9crxfJ8zxe31giNU/4iYzYxWopQbYrGSqLL9b89OFfahpc2aGwrlxW 9VX2/fkF3gtfBYUEf4486XG7iGFG+6z7r51fWMdobnrw6crtJU+OHnrVKqBzzbtIrKv8Y5BE 4uKbnLNED/Mt0UksfhQUOCH2nvzuKzYn1n+5vfKJuxJLcUaioRZzUXEiAJ+Jh9JgAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170414131739eucas1p27a3eed795ae545efff380d7c5f8358c3 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: 20170414131739eucas1p27a3eed795ae545efff380d7c5f8358c3 X-RootMTR: 20170414131739eucas1p27a3eed795ae545efff380d7c5f8358c3 References: <1492175840-5021-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.12 Subject: [Qemu-devel] [PATCH 3/6] migration: add UFFD_FEATURE_THREAD_ID feature support 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, 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 Userfaultfd mechanism is able to provide process thread id, in case when client request it with UFDD_API ioctl. Signed-off-by: Alexey Perevalov --- include/migration/postcopy-ram.h | 2 +- migration/migration.c | 2 +- migration/postcopy-ram.c | 12 ++++++------ migration/savevm.c | 2 +- 4 files changed, 9 insertions(+), 9 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 ad4036f..79f6425 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -802,7 +802,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 dc80dbb..70f0480 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -60,13 +60,13 @@ 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; api_struct.api = UFFD_API; - api_struct.features = 0; + api_struct.features = UFFD_FEATURE_THREAD_ID; if (ioctl(ufd, UFFDIO_API, &api_struct)) { error_report("postcopy_ram_supported_by_host: UFFDIO_API failed: %s", strerror(errno)); @@ -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; } @@ -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; } @@ -653,7 +653,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 3b19a4a..f01e418 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; }