From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Nikolay Borisov <nborisov@suse.com>
Cc: qemu-devel@nongnu.org, dgilbert@redhat.com, jfehlig@suse.com,
Claudio.Fontana@suse.com, quintela@redhat.com
Subject: Re: [PATCH] migration: support file: uri for source migration
Date: Mon, 12 Sep 2022 17:43:22 +0100 [thread overview]
Message-ID: <Yx9hqjMHYufYOlg3@redhat.com> (raw)
In-Reply-To: <a0ba7e7c-f5c4-4772-154a-7e09d540ff9d@suse.com>
On Mon, Sep 12, 2022 at 07:30:50PM +0300, Nikolay Borisov wrote:
>
>
> On 12.09.22 г. 18:41 ч., Daniel P. Berrangé wrote:
> > On Thu, Sep 08, 2022 at 01:26:32PM +0300, Nikolay Borisov wrote:
> > > This is a prototype of supporting a 'file:' based uri protocol for
> > > writing out the migration stream of qemu. Currently the code always
> > > opens the file in DIO mode and adheres to an alignment of 64k to be
> > > generic enough. However this comes with a problem - it requires copying
> > > all data that we are writing (qemu metadata + guest ram pages) to a
> > > bounce buffer so that we adhere to this alignment.
> >
> > The adhoc device metadata clearly needs bounce buffers since it
> > is splattered all over RAM with no concern of alignemnt. THe use
> > of bounce buffers for this shouldn't be a performance issue though
> > as metadata is small relative to the size of the snapshot as a whole.
>
> Bounce buffers can be eliminated altogether so long as we simply switch
> between buffered/DIO mode via fcntl.
>
> >
> > The guest RAM pages should not need bounce buffers at all when using
> > huge pages, as alignment will already be way larger than we required.
> > Guests with huge pages are the ones which are likely to have huge
> > RAM sizes and thus need the DIO mode, so we should be sorted for that.
> >
> > When using small pages for guest RAM, if it is not already allocated
> > with suitable alignment, I feel like we should be able to make it
> > so that we allocate the RAM block with good alignemnt to avoid the
> > need for bounce buffers. This would address the less common case of
> > a guest with huge RAM size but not huge pages.
>
> Ram blocks are generally allocated with good alignment due to them being
> mmaped(), however as I was toying with eliminating bounce buffers for ram I
> hit an issue where the page headers being written (8 bytes each) aren't
> aligned (naturally). Imo I think the on-disk format can be changed the
> following way:
>
>
> <ramblock header, containing base address of ramblock>, each subsequent page
> is then written at an offset from the base address of the ramblock, that is
> it's index would be :
>
> page_offset = page_addr - ramblock_base, Then the page is written at
> ramblock_base (in the file) + page_offset. This would eliminate the page
> headers altogether. This leaves aligning the initial ramblock header
> initially. However, this would lead to us potentially having to issue 1
> lseek per page to write - to adjust the the file position, which might not
> be a problem in itself but who knows. How dooes that sound to you?
Yes, definitely. We don't want the headers on front of each page,
just one single large block. Looking forward to multi-fd, we don't
want to be using lseek at all, because that changes the file offset
for all threads using the FD. Instead we need to be able to use
pread/pwrite for writing the RAM blocks.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
prev parent reply other threads:[~2022-09-12 16:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-11 13:47 towards a workable O_DIRECT outmigration to a file Nikolay Borisov
2022-08-11 14:10 ` Nikolay Borisov
2022-08-18 12:38 ` Dr. David Alan Gilbert
2022-08-18 12:52 ` Claudio Fontana
2022-08-18 16:31 ` Dr. David Alan Gilbert
2022-08-18 18:09 ` Claudio Fontana
2022-08-18 18:45 ` Claudio Fontana
2022-08-18 18:49 ` Dr. David Alan Gilbert
2022-08-18 19:14 ` Claudio Fontana
2022-08-18 18:13 ` Claudio Fontana
2022-09-08 10:26 ` [PATCH] migration: support file: uri for source migration Nikolay Borisov
2022-09-12 15:41 ` Daniel P. Berrangé
2022-09-12 16:30 ` Nikolay Borisov
2022-09-12 16:43 ` Daniel P. Berrangé [this message]
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=Yx9hqjMHYufYOlg3@redhat.com \
--to=berrange@redhat.com \
--cc=Claudio.Fontana@suse.com \
--cc=dgilbert@redhat.com \
--cc=jfehlig@suse.com \
--cc=nborisov@suse.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.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).