xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Dave Scott <Dave.Scott@citrix.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Thomas Leonard <talex5@gmail.com>,
	Stefano Stabellini <Stefano.Stabellini@citrix.com>,
	Anil Madhavapeddy <anil@recoil.org>
Subject: Re: mini-os: arm: grant mapping
Date: Mon, 22 Sep 2014 13:25:51 +0200	[thread overview]
Message-ID: <20140922112551.GO3486@type.bordeaux.inria.fr> (raw)
In-Reply-To: <8C02428F-D87E-4C06-BADD-446636EF44B6@citrix.com>

Dave Scott, le Mon 22 Sep 2014 11:01:48 +0000, a écrit :
> I notice the arch/x86/mm.c version looks for runs of free frames in the page table. I notice that gntmap_munmap doesn’t have any corresponding call to free so I assume the act of unmapping the grant causes Xen to mark the pages as free for you — is this correct?

Yes, since allocate_ondemand browses the page table directly, which is
what unmapping updates.

> I also noticed that the x86 version initialises the “demand mapping area” from “max_pfn” in mm.c.

Yes, that's the start of available virtual addresses to be used for
mapping stuff.

>  *  2. If GNTMAP_host_map is specified then a mapping will be added at
>  *     either a host virtual address in the current address space, or at
>  *     a PTE at the specified machine address.
> 
> I’m not totally sure what a ‘host virtual address’ refers to but I notice the address we’re using in the call is the regular virtual address (the one we can simply deref and read the data). As an experiment I wrapped it via the to_phys macro and suddenly it worked:

I'm not sure what it is supposed to be indeed. In the arm port
create_grant_host_mapping apparently uses it as a gp address. In the x86
port, create_grant_host_mapping uses it as a virtual address.

> Of course this might be the wrong thing to do— it might break x86 where:
> 
> #define VIRT_START                 ((unsigned long)&_text)
> 
> #define to_phys(x)                 ((unsigned long)(x)-VIRT_START)
> 
> I’ve not had a chance to see whether this breaks x86. Certainly x86 worked before my patch.

Actually &_text is 0 there, so it would work. We need to make sure this
isn't just by pure luck, though :)

Samuel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

      parent reply	other threads:[~2014-09-22 11:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-22 11:01 mini-os: arm: grant mapping Dave Scott
2014-09-22 11:09 ` Ian Campbell
2014-09-22 11:31   ` Samuel Thibault
2014-09-22 11:34     ` Ian Campbell
2014-09-22 11:25 ` Samuel Thibault [this message]

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=20140922112551.GO3486@type.bordeaux.inria.fr \
    --to=samuel.thibault@ens-lyon.org \
    --cc=Dave.Scott@citrix.com \
    --cc=Stefano.Stabellini@citrix.com \
    --cc=anil@recoil.org \
    --cc=talex5@gmail.com \
    --cc=xen-devel@lists.xenproject.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 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).