qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Paul Brook <paul@codesourcery.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: [PATCH 2/3] virtio network device
Date: Wed, 05 Dec 2007 14:20:39 -0600	[thread overview]
Message-ID: <47570817.9090908@us.ibm.com> (raw)
In-Reply-To: <200712051744.03916.paul@codesourcery.com>

Paul Brook wrote:
>>> Actually according to qemu's standard, one should use
>>> cpu_physical_memory_write/ cpu_physical_memory_read functions.
>>> This is true also for reading the ring values.
>>>       
>> Yes, and unfortunately, cpu_physical_memory_{read,write} are copy
>> interfaces.  We really don't want that for high speed I/O.
>>     
>
> I really don't like doing direct access to guest ram without implementing a 
> proper API for zero-copy/scatter-gather access. There was a list thread about 
> this not so long ago.
>   

I agree that we need a proper API for sg ram access.  I'm going to look 
into that real soon since it's necessary to optimize the network/disk 
transports.

virtio makes things a bit trickier though.  There's a shared ring queue 
between the host and guest.  The ring queue is lock-less and depends on 
the ability to atomically increment ring queue indices to be SMP safe.  
Using a copy-API wouldn't be a problem for QEMU since the host and guest 
are always running in lock-step.  A copy API is actually needed to deal 
with differing host/guest alignment and endianness.

Once you introduce KVM though, this is no longer true since KVM supports 
true SMP.  The solution may be to implement some sort of 
atomic_increment function and then have that use a if (kvm) guard to do 
a direct access verses a copy.

Regards,

Anthony Liguori

> Paul
>   

  reply	other threads:[~2007-12-05 20:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-04 21:54 [Qemu-devel] [PATCH 2/3] virtio network device Anthony Liguori
2007-12-04 22:12 ` Anthony Liguori
2007-12-04 23:49 ` [Qemu-devel] " Dor Laor
2007-12-05 17:18   ` Anthony Liguori
2007-12-05 17:44     ` Paul Brook
2007-12-05 20:20       ` Anthony Liguori [this message]
2007-12-06  9:27         ` Jamie Lokier
2007-12-08 13:22         ` Paul Brook
2007-12-08 14:09           ` Jamie Lokier
2007-12-08 16:45             ` Paul Brook
2007-12-08 19:52               ` Blue Swirl
2007-12-08 21:55               ` Jamie Lokier
2007-12-08 22:02                 ` Anthony Liguori
2007-12-12  1:24                   ` Rusty Russell
2007-12-12  1:40                     ` Anthony Liguori
2007-12-18  2:31                       ` Rusty Russell
2007-12-08 21:59           ` Anthony Liguori

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=47570817.9090908@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rusty@rustcorp.com.au \
    /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).