* Zero-copy block driver?
@ 2011-01-29 3:55 Darko Petrović
2011-01-29 9:49 ` Stefan Hajnoczi
0 siblings, 1 reply; 4+ messages in thread
From: Darko Petrović @ 2011-01-29 3:55 UTC (permalink / raw)
To: kvm
Hi everyone,
Could you please tell me if it is possible to use a block driver that
completely avoids the guest kernel and copies block data directly
to/from the given buffer in the guest userspace?
If yes, how to activate it? If not... why not? :)
Thanks!
Darko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Zero-copy block driver?
2011-01-29 3:55 Zero-copy block driver? Darko Petrović
@ 2011-01-29 9:49 ` Stefan Hajnoczi
2011-01-29 12:06 ` Darko Petrović
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2011-01-29 9:49 UTC (permalink / raw)
To: Darko Petrović; +Cc: kvm
2011/1/29 Darko Petrović <darko.b.petrovic@gmail.com>:
> Could you please tell me if it is possible to use a block driver that
> completely avoids the guest kernel and copies block data directly to/from
> the given buffer in the guest userspace?
> If yes, how to activate it? If not... why not? :)
Inside the guest, open files using the O_DIRECT flag. This tells the
guest kernel to avoid the page cache when possible, enabling
zero-copy. You need to use aligned memory buffers and perform I/O in
multiples of the block size.
See the open(2) man page for details. Make sure you really want to do
this, most applications don't.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Zero-copy block driver?
2011-01-29 9:49 ` Stefan Hajnoczi
@ 2011-01-29 12:06 ` Darko Petrović
2011-01-29 12:46 ` Stefan Hajnoczi
0 siblings, 1 reply; 4+ messages in thread
From: Darko Petrović @ 2011-01-29 12:06 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: kvm
Thanks for your help. Actually, I am more interested in doing it from
the outside, if possible (I am not allowed to change the application
code). Can the guest be tricked by KVM somehow, using the appropriate
drivers? Just to clear it out, copying to/from a host buffer is fine, I
just want to avoid having guest buffers.
Cheers!
Darko
On 01/29/2011 10:49 AM, Stefan Hajnoczi wrote:
> Inside the guest, open files using the O_DIRECT flag. This tells the
> guest kernel to avoid the page cache when possible, enabling
> zero-copy. You need to use aligned memory buffers and perform I/O in
> multiples of the block size.
>
> See the open(2) man page for details. Make sure you really want to do
> this, most applications don't.
>
> Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Zero-copy block driver?
2011-01-29 12:06 ` Darko Petrović
@ 2011-01-29 12:46 ` Stefan Hajnoczi
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2011-01-29 12:46 UTC (permalink / raw)
To: Darko Petrović; +Cc: kvm
2011/1/29 Darko Petrović <darko.b.petrovic@gmail.com>:
> Thanks for your help. Actually, I am more interested in doing it from the
> outside, if possible (I am not allowed to change the application code). Can
> the guest be tricked by KVM somehow, using the appropriate drivers? Just to
> clear it out, copying to/from a host buffer is fine, I just want to avoid
> having guest buffers.
Not really. If the application is designed to use the page cache then
it will use it.
You might want to look at unmapped page cache control which is not in
mainline Linux yet:
http://lwn.net/Articles/419713/
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-01-29 12:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-29 3:55 Zero-copy block driver? Darko Petrović
2011-01-29 9:49 ` Stefan Hajnoczi
2011-01-29 12:06 ` Darko Petrović
2011-01-29 12:46 ` Stefan Hajnoczi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.