public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Muli Ben-Yehuda <muli@il.ibm.com>
To: Avi Kivity <avi@qumranet.com>
Cc: kvm-devel@lists.sourceforge.net, allen.m.kay@intel.com,
	andrea@qumranet.com, Ben-Ami Yassour1 <BENAMI@il.ibm.com>
Subject: Re: [PATCH 1/1] Enble a guest to access a device's	memory mapped I/O regions directly.
Date: Sat, 19 Apr 2008 17:35:05 +0300	[thread overview]
Message-ID: <20080419143505.GS28181@il.ibm.com> (raw)
In-Reply-To: <4808C32B.2030307@qumranet.com>

On Fri, Apr 18, 2008 at 06:50:03PM +0300, Avi Kivity wrote:
> benami@il.ibm.com wrote:
> > From: Ben-Ami Yassour <benami@il.ibm.com>
> >
> > Signed-off-by: Ben-Ami Yassour <benami@il.ibm.com>
> > Signed-off-by: Muli Ben-Yehuda <muli@il.ibm.com>
> > ---
> >  arch/x86/kvm/mmu.c         |   59 +++++++++++++++++++++++++++++--------------
> >  arch/x86/kvm/paging_tmpl.h |   19 +++++++++----
> >  include/linux/kvm_host.h   |    2 +-
> >  virt/kvm/kvm_main.c        |   17 +++++++++++-
> >  4 files changed, 69 insertions(+), 28 deletions(-)
> >
> > diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> > index 078a7f1..c89029d 100644
> > --- a/arch/x86/kvm/mmu.c
> > +++ b/arch/x86/kvm/mmu.c
> > @@ -112,6 +112,8 @@ static int dbg = 1;
> >  #define PT_FIRST_AVAIL_BITS_SHIFT 9
> >  #define PT64_SECOND_AVAIL_BITS_SHIFT 52
> >  
> > +#define PT_SHADOW_IO_MARK (1ULL << PT_FIRST_AVAIL_BITS_SHIFT)
> > +
> >   
> 
> Please rename this PT_SHADOW_MMIO_MASK.

Sure thing.

> >  #define VALID_PAGE(x) ((x) != INVALID_PAGE)
> >  
> >  #define PT64_LEVEL_BITS 9
> > @@ -237,6 +239,9 @@ static int is_dirty_pte(unsigned long pte)
> >  
> >  static int is_rmap_pte(u64 pte)
> >  {
> > +	if (pte & PT_SHADOW_IO_MARK)
> > +		return false;
> > +
> >  	return is_shadow_present_pte(pte);
> >  }
> >   
> 
> Why avoid rmap on mmio pages?  Sure it's unnecessary work, but
> having less cases improves overall reliability.

The rmap functions already have a check to bail out if the pte is not
an rmap pte, so in that sense, we aren't adding a new case for the
code to handle, just adding direct MMIO ptes to the existing list of
non-rmap ptes.

> You can use pfn_valid() in gfn_to_pfn() and kvm_release_pfn_*() to
> conditionally update the page refcounts.

Since rmap isn't useful for direct MMIO ptes, doesn't it make more
sense to "bail out" early rather than in the bowls of the rmap code?

Chag Same'ach
Muli


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

  reply	other threads:[~2008-04-19 14:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-16 13:25 direct mmio for passthrough - kernel part benami
2008-04-16 13:25 ` [PATCH 1/1] Enble a guest to access a device's memory mapped I/O regions directly benami
2008-04-16 13:25   ` benami
2008-04-18 15:50   ` Avi Kivity
2008-04-19 14:35     ` Muli Ben-Yehuda [this message]
2008-04-20 10:29       ` Avi Kivity
2008-04-18 16:02 ` direct mmio for passthrough - kernel part Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2008-04-16 13:26 [PATCH 1/1] Enble a guest to access a device's memory mapped I/O regions directly benami
2008-04-16 13:26 ` benami
2008-04-18 15:56 ` Avi Kivity
2008-04-19 14:56   ` Muli Ben-Yehuda

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=20080419143505.GS28181@il.ibm.com \
    --to=muli@il.ibm.com \
    --cc=BENAMI@il.ibm.com \
    --cc=allen.m.kay@intel.com \
    --cc=andrea@qumranet.com \
    --cc=avi@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    /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