From patchwork Thu Jun 15 16:36:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Perevalov X-Patchwork-Id: 9789219 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 1B63E60384 for ; Thu, 15 Jun 2017 16:37:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D002286BB for ; Thu, 15 Jun 2017 16:37:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01A2D286BE; Thu, 15 Jun 2017 16:37:54 +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 CC67B286BB for ; Thu, 15 Jun 2017 16:37:53 +0000 (UTC) Received: from localhost ([::1]:55051 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLXmI-0008Dr-ST for patchwork-qemu-devel@patchwork.kernel.org; Thu, 15 Jun 2017 12:37:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLXlA-00087e-97 for qemu-devel@nongnu.org; Thu, 15 Jun 2017 12:36:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLXl5-0001ZZ-2f for qemu-devel@nongnu.org; Thu, 15 Jun 2017 12:36:40 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:40100) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLXl4-0001Xq-RH for qemu-devel@nongnu.org; Thu, 15 Jun 2017 12:36:35 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ORL00548KSU2D20@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Thu, 15 Jun 2017 17:36:30 +0100 (BST) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170615163629eucas1p2f1c28e5fd776c2b6cb46d2ca1cdf8985~IWN7EoPuI1661516615eucas1p2i; Thu, 15 Jun 2017 16:36:29 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 4C.45.17464.D87B2495; Thu, 15 Jun 2017 17:36:29 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170615163629eucas1p1f0abc79e0d893f6b442a380630821e5d~IWN6gfWeK1514815148eucas1p1U; Thu, 15 Jun 2017 16:36:29 +0000 (GMT) X-AuditID: cbfec7f2-f797e6d000004438-54-5942b78dbc0e Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 94.8A.17452.D87B2495; Thu, 15 Jun 2017 17:36:29 +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 <0ORL009RKKSLTR30@eusync2.samsung.com>; Thu, 15 Jun 2017 17:36:29 +0100 (BST) From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Thu, 15 Jun 2017 19:36:13 +0300 Message-id: <1497544575-18628-2-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1497544575-18628-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsWy7djPc7q9250iDd70aFjMvXuexaJ32z12 iyvtP9kttuz/xm5xvHcHi8WdLX1MDmweT65tZvJ4v+8qm0ffllWMAcxRXDYpqTmZZalF+nYJ XBkzb55jLWiUrzi0vYGlgXGyaBcjJ4eEgInE3PebmSFsMYkL99azgdhCAksZJVY0l3cxcgHZ nxklXv44zATT0H1tCTNEYhmjxNyLGxkhnG4miVWLlrN3MXJwsAkYSOy7ZwvSICIgKfG76zRY A7NAK6NEe98jsHXCAi4S7RfPgdksAqoSxxc+YQWxeQXcJebNbmCB2CYncfLYZLA4p4CHxMMF fWwggyQE7rNJTH70kBlkmYSArMSmA1AvuEgcWTeFFcIWlnh1fAs7hC0j0dlxkAmit51Rontn JyuEM4FR4sz0v1BV9hKnbl4F+5NZgE9i0rbpUAt4JTrahCBKgI6Y3gW1zFFi0rrDLBDfz2aU uLNwBusERpkFjAyrGEVSS4tz01OLjfWKE3OLS/PS9ZLzczcxAuP09L/jn3Ywfj1hdYhRgINR iYdXocEpUog1say4MvcQowQHs5II79Q5QCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8XKeuRQgJ pCeWpGanphakFsFkmTg4pRoYGfjKNE+L/cvfvvNQbfmBiwUaPfvVJ7ru6Ddbn1B9cp6ajcaL 32XpM0TyZ2773j/Hc7JspLzW+Z1zeDyzvfs+lR4omX55i3eM2Xa3TpsVb1nPWqxZt6+47+mD MJGjy7/x2XsUWojZ/9+lGPzkdNat6Q2ZlW8EJQMfXkmwznBtfnjQYV1UxFc1JZbijERDLeai 4kQAn17Ywc8CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsVy+t/xK7q9250iDbp/CVjMvXuexaJ32z12 iyvtP9kttuz/xm5xvHcHi8WdLX1MDmweT65tZvJ4v+8qm0ffllWMAcxRbjYZqYkpqUUKqXnJ +SmZeem2SqEhbroWSgp5ibmptkoRur4hQUoKZYk5pUCekQEacHAOcA9W0rdLcMuYefMca0Gj fMWh7Q0sDYyTRbsYOTkkBEwkuq8tYYawxSQu3FvP1sXIxSEksIRR4v3TCUwQTi+TxN+v14Gq ODjYBAwk9t2zBWkQEZCU+N11mhmkhlmglVHiSeMsdpCEsICLRPvFc2BTWQRUJY4vfMIKYvMK uEvMm93AArFNTuLksclgcU4BD4mHC/rYQGwhoJr3MxeyTWDkXcDIsIpRJLW0ODc9t9hQrzgx t7g0L10vOT93EyMwYLcd+7l5B+OljcGHGAU4GJV4eBUanCKFWBPLiitzDzFKcDArifBOnQMU 4k1JrKxKLcqPLyrNSS0+xGgKdNREZinR5HxgNOWVxBuaGJpbGhoZW1iYGxkpifOWfLgSLiSQ nliSmp2aWpBaBNPHxMEp1cAY29794VbFN5O4wBbTHbsNjzJaRa+O2HRyxgfhaV+iDqXtWyr9 bNE0zm6/yUwcG/yWVp08MouPM+IIz71Q9cL29k/32Pkb5u9VVu+7ZH7oZ/rlq2vvzCq9KvFW xG5F7PGu2U+XqBX4fNvL/JunRul/mdg7m8e3v15q5XBqZffcsyhMKXfXOQsrJZbijERDLeai 4kQAU/hC5G4CAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170615163629eucas1p1f0abc79e0d893f6b442a380630821e5d 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: 20170615163629eucas1p1f0abc79e0d893f6b442a380630821e5d X-RootMTR: 20170615163629eucas1p1f0abc79e0d893f6b442a380630821e5d References: <1497544575-18628-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.14 Subject: [Qemu-devel] [PATCH v2 1/3] migration: postcopy_place_page factoring out 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, Alexey Perevalov , peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Need to mark copied pages as closer as possible to the place where it tracks down. That will be necessary in futher patch. Reviewed-by: Juan Quintela Signed-off-by: Alexey Perevalov Reviewed-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert --- migration/postcopy-ram.c | 13 ++++++++----- migration/postcopy-ram.h | 4 ++-- migration/ram.c | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index c8c4500..743ca6c 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -566,9 +566,10 @@ int postcopy_ram_enable_notify(MigrationIncomingState *mis) * returns 0 on success */ int postcopy_place_page(MigrationIncomingState *mis, void *host, void *from, - size_t pagesize) + RAMBlock *rb) { struct uffdio_copy copy_struct; + size_t pagesize = qemu_ram_pagesize(rb); copy_struct.dst = (uint64_t)(uintptr_t)host; copy_struct.src = (uint64_t)(uintptr_t)from; @@ -597,10 +598,12 @@ int postcopy_place_page(MigrationIncomingState *mis, void *host, void *from, * returns 0 on success */ int postcopy_place_page_zero(MigrationIncomingState *mis, void *host, - size_t pagesize) + RAMBlock *rb) { + size_t pagesize; trace_postcopy_place_page_zero(host); + pagesize = qemu_ram_pagesize(rb); if (pagesize == getpagesize()) { struct uffdio_zeropage zero_struct; zero_struct.range.start = (uint64_t)(uintptr_t)host; @@ -631,7 +634,7 @@ int postcopy_place_page_zero(MigrationIncomingState *mis, void *host, memset(mis->postcopy_tmp_zero_page, '\0', mis->largest_page_size); } return postcopy_place_page(mis, host, mis->postcopy_tmp_zero_page, - pagesize); + rb); } return 0; @@ -694,14 +697,14 @@ int postcopy_ram_enable_notify(MigrationIncomingState *mis) } int postcopy_place_page(MigrationIncomingState *mis, void *host, void *from, - size_t pagesize) + RAMBlock *rb) { assert(0); return -1; } int postcopy_place_page_zero(MigrationIncomingState *mis, void *host, - size_t pagesize) + RAMBlock *rb) { assert(0); return -1; diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h index 52d51e8..78a3591 100644 --- a/migration/postcopy-ram.h +++ b/migration/postcopy-ram.h @@ -72,14 +72,14 @@ void postcopy_discard_send_finish(MigrationState *ms, * returns 0 on success */ int postcopy_place_page(MigrationIncomingState *mis, void *host, void *from, - size_t pagesize); + RAMBlock *rb); /* * Place a zero page at (host) atomically * returns 0 on success */ int postcopy_place_page_zero(MigrationIncomingState *mis, void *host, - size_t pagesize); + RAMBlock *rb); /* The current postcopy state is read/set by postcopy_state_get/set * which update it atomically. diff --git a/migration/ram.c b/migration/ram.c index 8dbdfdb..f50479d 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2465,10 +2465,10 @@ static int ram_load_postcopy(QEMUFile *f) if (all_zero) { ret = postcopy_place_page_zero(mis, place_dest, - block->page_size); + block); } else { ret = postcopy_place_page(mis, place_dest, - place_source, block->page_size); + place_source, block); } } if (!ret) {