From: David Hildenbrand <david@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: Yong Huang <yong.huang@smartx.com>,
qemu-devel@nongnu.org, Fabiano Rosas <farosas@suse.de>,
Wei Wang <wei.w.wang@intel.com>,
"Michael S . Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH v1 2/2] migration: Do not perform RAMBlock dirty sync during the first iteration
Date: Thu, 14 Nov 2024 10:02:37 +0100 [thread overview]
Message-ID: <8ee7d398-0139-4628-9276-f6a89fa35245@redhat.com> (raw)
In-Reply-To: <ZzUIOFPtvHKDJPei@x1n>
On 13.11.24 21:12, Peter Xu wrote:
> On Wed, Nov 13, 2024 at 07:49:44PM +0100, David Hildenbrand wrote:
>> I think I had precisely that, and I recall you suggested to have it only
>> after the initial sync. Would work for me, but I'd still like to understand
>> why essentially none of the "discard" was effective -- all of guest RAM got
>> touched.
>
> Yes it'll be interesting to know..
>
> One thing I'm wildly guessing is dirty_memory_extend(), so maybe after the
> ramblock is created nobody yet to clear the "1"s there for each of the
> client, including DIRTY_MEMORY_MIGRATION. Then it'll be synced to ramblock
> bmap only in the initial sync, once for each qemu lifecycle.
In ram_block_add() we do the
cpu_physical_memory_set_dirty_range(new_block->offset,
new_block->used_length,
DIRTY_CLIENTS_ALL);
ramblock_dirty_bitmap_clear_discarded_pages()->...->migration_clear_memory_region_dirty_bitmap_range()->migration_clear_memory_region_dirty_bitmap()
won't end up clearing the bits in the dirty bitmap.
First I thought because of:
if (!rb->clear_bmap || !clear_bmap_test_and_clear(rb, page)) {
return;
}
But then I realized that even memory_region_clear_dirty_bitmap() will
not clear the ramblock_dirty_bitmap_ bits! It's only concerned about
listener->log_clear() calls.
Looking for DIRTY_MEMORY_BLOCK_SIZE users, only
cpu_physical_memory_sync_dirty_bitmap() and
cpu_physical_memory_clear_dirty_range() clear them, whereby the latter
is only used when resizing RAMblocks.
At first I wondered whether
ramblock_dirty_bitmap_clear_discarded_pages() should also call
cpu_physical_memory_clear_dirty_range(), but then I am not so sure if
that is really the right approach.
virtio-balloon() calls qemu_guest_free_page_hint() which calls
migration_clear_memory_region_dirty_bitmap_range()
bitmap_clear()
So it would maybe have the same issue.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2024-11-14 9:03 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-09 4:59 [PATCH v1 0/2] migration: Skip the first dirty sync Hyman Huang
2024-11-09 4:59 ` [PATCH v1 1/2] virtio-balloon: Enable free page hinting during PRECOPY_NOTIFY_SETUP Hyman Huang
2024-11-12 10:10 ` David Hildenbrand
2024-11-09 4:59 ` [PATCH v1 2/2] migration: Do not perform RAMBlock dirty sync during the first iteration Hyman Huang
2024-11-11 9:07 ` Wang, Wei W
2024-11-11 10:20 ` Yong Huang
2024-11-11 9:27 ` David Hildenbrand
2024-11-11 10:08 ` Yong Huang
2024-11-11 10:42 ` David Hildenbrand
2024-11-11 11:14 ` Yong Huang
2024-11-11 11:37 ` Yong Huang
2024-11-12 10:08 ` David Hildenbrand
2024-11-13 17:40 ` Peter Xu
2024-11-13 18:49 ` David Hildenbrand
2024-11-13 20:12 ` Peter Xu
2024-11-14 9:02 ` David Hildenbrand [this message]
2024-11-14 19:28 ` Peter Xu
2024-11-14 21:16 ` David Hildenbrand
2024-11-14 22:40 ` Peter Xu
2024-11-15 9:11 ` David Hildenbrand
2024-11-15 15:41 ` Peter Xu
2024-11-15 15:49 ` David Hildenbrand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ee7d398-0139-4628-9276-f6a89fa35245@redhat.com \
--to=david@redhat.com \
--cc=farosas@suse.de \
--cc=mst@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=wei.w.wang@intel.com \
--cc=yong.huang@smartx.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).