From nobody Sat Feb 7 05:14:55 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.zohomail.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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 15072021206801019.5254451503646; Thu, 5 Oct 2017 04:15:20 -0700 (PDT) Received: from localhost ([::1]:39103 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e047W-0002m5-Ko for importer@patchew.org; Thu, 05 Oct 2017 07:15:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0460-0001tl-7a for qemu-devel@nongnu.org; Thu, 05 Oct 2017 07:13:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e045w-00064V-T4 for qemu-devel@nongnu.org; Thu, 05 Oct 2017 07:13:40 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:56645) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e045w-00061S-Jf for qemu-devel@nongnu.org; Thu, 05 Oct 2017 07:13:36 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20171005111333euoutp0255a68d6d7464a8f4e24439d0ebfe7605~qqD7YdHmO2813728137euoutp02Z; Thu, 5 Oct 2017 11:13:33 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171005111332eucas1p137e19bf34a4db69be27cc2aecbe12198~qqD699-RR1810618106eucas1p1q; Thu, 5 Oct 2017 11:13:32 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 27.F2.12743.CD316D95; Thu, 5 Oct 2017 12:13:32 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171005111331eucas1p101ded202416dd25d9246876264938d55~qqD6G7Zum1838118381eucas1p1w; Thu, 5 Oct 2017 11:13:31 +0000 (GMT) Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id D2.33.20118.BD316D95; Thu, 5 Oct 2017 12:13:31 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OXC00MZ6KIBXN90@eusync4.samsung.com>; Thu, 05 Oct 2017 12:13:31 +0100 (BST) X-AuditID: cbfec7f5-f79d06d0000031c7-c7-59d613dc3d80 From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Thu, 05 Oct 2017 14:13:18 +0300 Message-id: <1507202000-22469-2-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1507202000-22469-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRmVeSWpSXmKPExsWy7djP87p3hK9FGsztkbWYe/c8i0Xvtnvs FtM+32a3uNL+k91iy/5v7BbHe3ewWNzZ0sfkwO7x5NpmJo/3+66yefRtWcUYwBzFZZOSmpNZ llqkb5fAlXF3/kL2gj6FikWrFrE2MPaKdTFyckgImEh8/tbIDmGLSVy4t56ti5GLQ0hgKaPE +yObmCGcz4wSF390scJ0LJq5DapqGaPEky3voZxuJomNjQ9Zuhg5ONgEDCT23bMFaRARkJT4 3XUabBKzwEJGiQcXe8D2C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S1OzU1ILUIpgs EwenVAPjzljmtUILGya8kf2eEjmhfp7B713mZ9kN1JpuiEx8qbDhxS2txpvRSzUPzUnsKV8x Ya/aDJHX7Skli2xaeEzfPp4s8b6G8UvEpSndu0VNrHJYvPjtzzSk5n1/cNZ1Q8iaab8+H2Ne 9Habuf2dCfP+szWVJa1Zt9F3y7yKl/J7Ttdk1h4x79Z1V2Ipzkg01GIuKk4EAMHp1O4cAgAA X-CMS-MailID: 20171005111331eucas1p101ded202416dd25d9246876264938d55 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-CMS-RootMailID: 20171005111331eucas1p101ded202416dd25d9246876264938d55 X-RootMTR: 20171005111331eucas1p101ded202416dd25d9246876264938d55 References: <1507202000-22469-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 210.118.77.12 Subject: [Qemu-devel] [PATCH v10 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: heetae82.ahn@samsung.com, quintela@redhat.com, Alexey Perevalov , peterx@redhat.com, dgilbert@redhat.com, i.maximets@samsung.com 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" 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: Dr. David Alan Gilbert Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Alexey Perevalov --- migration/postcopy-ram.c | 13 +++++++------ migration/postcopy-ram.h | 4 ++-- migration/ram.c | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 0de68e8..d3073b9 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -646,9 +646,10 @@ int postcopy_ram_enable_notify(MigrationIncomingState = *mis) * returns 0 on success */ int postcopy_place_page(MigrationIncomingState *mis, void *host, void *fro= m, - size_t pagesize) + RAMBlock *rb) { struct uffdio_copy copy_struct; + size_t pagesize =3D qemu_ram_pagesize(rb); =20 copy_struct.dst =3D (uint64_t)(uintptr_t)host; copy_struct.src =3D (uint64_t)(uintptr_t)from; @@ -677,11 +678,11 @@ 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) { trace_postcopy_place_page_zero(host); =20 - if (pagesize =3D=3D getpagesize()) { + if (qemu_ram_pagesize(rb) =3D=3D getpagesize()) { struct uffdio_zeropage zero_struct; zero_struct.range.start =3D (uint64_t)(uintptr_t)host; zero_struct.range.len =3D getpagesize(); @@ -711,7 +712,7 @@ int postcopy_place_page_zero(MigrationIncomingState *mi= s, void *host, memset(mis->postcopy_tmp_zero_page, '\0', mis->largest_page_si= ze); } return postcopy_place_page(mis, host, mis->postcopy_tmp_zero_page, - pagesize); + rb); } =20 return 0; @@ -774,14 +775,14 @@ int postcopy_ram_enable_notify(MigrationIncomingState= *mis) } =20 int postcopy_place_page(MigrationIncomingState *mis, void *host, void *fro= m, - size_t pagesize) + RAMBlock *rb) { assert(0); return -1; } =20 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 587a8b8..77ea0fd 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 *fro= m, - size_t pagesize); + RAMBlock *rb); =20 /* * 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); =20 /* 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 b83f897..304ac59 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2680,10 +2680,10 @@ static int ram_load_postcopy(QEMUFile *f) =20 if (all_zero) { ret =3D postcopy_place_page_zero(mis, place_dest, - block->page_size); + block); } else { ret =3D postcopy_place_page(mis, place_dest, - place_source, block->page_size); + place_source, block); } } if (!ret) { --=20 2.7.4