All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
To: Gregory Haskins <ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: help with understanding GPA/GVA issues
Date: Fri, 10 Aug 2007 09:32:41 -0500	[thread overview]
Message-ID: <46BC7709.4030807@codemonkey.ws> (raw)
In-Reply-To: <1186718958.4866.15.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>

Gregory Haskins wrote:
> Hi All,
>   I am working on some PV stuff and had some questions about the ability
> to share memory across the Guest/Host boundary.
>
> It seems that most examples of how to do this always involve starting
> with a *page, converting it to a gfn via page_to_gfn(), and using that
> as a gpa to pass across the boundary.
>   

Do you mean page_to_pfn?  I assume you're talking about a page within 
the guest right?

> I understand that this method avoids a software traipse through the
> page-walker, so it's nice.  What I can't quite figure out is what are
> the other types of memory (if any) that can be passed across.
>
> For instance, is a pointer from kmalloc() considered a gpa, a gva,
> neither?

gpa = guest physical address.  It's a pa or a pfn << PAGE_SHIFT.

gva = guest virtual address.  It's returned from pretty much anything 
that allocates memory (kmalloc for instance).  This is all within the 
guest of course.

>   Or are gva's only pointers that come from guest-userspace,
> etc.  Is it possible to pass something like a skb->data pointer (I
> understand that I may have to run the page-walker for some of these)?
>   

Yes, you can pass through any gva.  There are couple of things to be 
aware of though.  When passing a gva, you have to be sure that the gva 
is actually mapped in memory as KVM cannot cause Linux to fault in a 
page.  Also, for something like skb->data, you should probably just pass 
the gpa since they'll usually fall within a single page anyway.

> If so, how would I do this:  E.g. can I just pass the pointer, and then
> do gva_to_hpa() on the host?  Or do I need to prep the pointer before
> sending it?
>   

There's no need to prep provided that you know the va is mapped into 
memory in the guest.

Regards,

Anthony Liguori

> TIA
> -Greg
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> kvm-devel mailing list
> kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
>
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

  parent reply	other threads:[~2007-08-10 14:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-10  4:09 help with understanding GPA/GVA issues Gregory Haskins
     [not found] ` <1186718958.4866.15.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-08-10 14:32   ` Anthony Liguori [this message]
     [not found]     ` <46BC7709.4030807-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-08-10 14:40       ` Gregory Haskins
     [not found]         ` <1186756859.4866.31.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-08-10 16:59           ` Avi Kivity
     [not found]             ` <46BC9978.3060801-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-10 19:47               ` Gregory Haskins
     [not found]                 ` <1186775254.4866.52.camel-5CR4LY5GPkvLDviKLk5550HKjMygAv58XqFh9Ls21Oc@public.gmane.org>
2007-08-10 20:12                   ` Anthony Liguori
2007-08-10 15:16 ` Hollis Blanchard

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=46BC7709.4030807@codemonkey.ws \
    --to=anthony-rdkfgonbjusknkdkm+me6a@public.gmane.org \
    --cc=ghaskins-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /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 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.