qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RFC] qemu-file: output data directly if possible


From: Juan Quintela
Subject: Re: [Qemu-devel] [PATCH RFC] qemu-file: output data directly if possible
Date: Tue, 11 Oct 2011 11:19:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

"Michael S. Tsirkin" <address@hidden> wrote:
> On Mon, Oct 10, 2011 at 09:42:51AM +0200, Paolo Bonzini wrote:
>> On 10/10/2011 01:56 AM, Michael S. Tsirkin wrote:
>> >qemu file currently always buffers up data before writing it out.
>> >At least for memory this is probably not a good idea:
>> >writing out to file would be cheaper. Let's do
>> >that if we can, which should be the common case. If we can't, buffer.
>> >
>> >Signed-off-by: Michael S. Tsirkin<address@hidden>
>> >
>> >---
>> >
>> >Completely untested, this is just thinking aloud.
>> >Shouldn't the below save us a data copy in the
>> >common case, helping speed up migration?
>> 
>> The problem here is qemu_put_byte and friends, where the indirection
>> of a function call would probably slow things down.  In the common
>> case, qemu_put_byte is called a lot and f->buf_index would not be
>> zero.
>
> True, maybe the right thing to do is use a size cutoff,
> avoid a copy if buffer is large enough.
> I note the buffer in qemu file is 32K - is that
> based on some specific measurements or just
> a random large number? Any objections to making
> it smaller, like 4K?

We can't until we move to a thread or similar.  Basically we have to be
able to end a "section write", there is no way to stop in the midle of a
section, we can only split on whole sections.

I think that for this, it should be easier to just make ram_save_live to
bypass QEMUFile layering and just write directly to the fd (header is
really small (between 4bytes and something less that 256 if we have bad
luck).


>>  The way to go would probably be to merge QEMUFile and
>> QEMUBufferedFile's two buffering layers, which also removes a copy.
>> 
>> Paolo
>
> Yes, it does look sane. QEMUFile doesn't seem to ever be used without
> QEMUBufferedFile - is that true?

As Paolo says, savevm uses QEMUFile directly.  I think that the way to
go is to make savevm to also use QEMUBufferedFile, and then do same
trick to avoid the buffering.  It is on my ToDo list, but there are 4-5
things before that.

Later, Juan.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]