From: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>
To: Dave Hansen <haveblue@us.ibm.com>
Cc: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>,
Keir.Fraser@cl.cam.ac.uk, Christian.Limpach@cl.cam.ac.uk,
Ian.Pratt@cl.cam.ac.uk
Subject: Re: [patch 4/4] Xen core patch : /dev/mem calls io_remap_page_range
Date: Thu, 18 Nov 2004 01:05:07 +0000 [thread overview]
Message-ID: <E1CUajU-0005vu-00@mta1.cl.cam.ac.uk> (raw)
In-Reply-To: Your message of "Wed, 17 Nov 2004 16:25:04 PST." <1100737504.12373.259.camel@localhost>
> On Wed, 2004-11-17 at 15:56, Ian Pratt wrote:
> > +#if defined(CONFIG_XEN)
> > + if (io_remap_page_range(vma, vma->vm_start, offset,
> > + vma->vm_end-vma->vm_start, vma->vm_page_prot))
> > + return -EAGAIN;
> > +#else
> > if (remap_page_range(vma, vma->vm_start, offset, vma->vm_end-vma->vm_start,
> > vma->vm_page_prot))
> > return -EAGAIN;
> > +#endif
> > return 0;
> > }
>
> Do *all* calls to remap_page_range() under your arch need to be
> converted like this, or is this the only one? Seems like something that
> should be done with header magic instead.
It's a bit tricky...
As I understand it, /dev/mem on x86 could potentially be used for
three distinct purposes:
1 mapping the bottom 1MB of physical (bus) address space
2 mapping MMIO devices (beyond physical memory)
3 'copy-on-access' mappings of physical pages
This overloading creates a problem for us, as physical addresses
are not the same as bus addresses in Xen. The first two uses
require bus addresses, the third physical addresses.
I'm not actually aware of any applications that use
copy-on-access mappings of physical memory via /dev/mem, but
there are a whole bunch (most notable the X server) that use
/dev/mem for accessing the <1MB (BIOS) and MMIO frame buffer
regions. Hence, it makes sense for us to choose to interpret the
offset passed in when mapping /dev/mem as a bus address, calling
io_remap_page_range.
As to whether there are any uses of remap_page_range within the
kernel that rely on behaviour 3, I'm not sure. Possibly the use
in af_packet.c does? Not sure.
If there really are no uses, an alternative patch would be to
introduce an ARCH_HAS_REMAP_PAGE_RANGE. Would this be preferable?
Since drivers/char/mem.c already isn't exactly a thing of beauty
we were hoping we might get away with an extra CONFIG_XEN ;-)
Cheers,
Ian
next prev parent reply other threads:[~2004-11-18 1:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-17 23:56 Ian Pratt
2004-11-18 0:25 ` Dave Hansen
2004-11-18 1:05 ` Ian Pratt [this message]
2004-11-18 1:20 ` Dave Hansen
2004-11-18 3:01 ` Andrew Morton
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=E1CUajU-0005vu-00@mta1.cl.cam.ac.uk \
--to=ian.pratt@cl.cam.ac.uk \
--cc=Christian.Limpach@cl.cam.ac.uk \
--cc=Keir.Fraser@cl.cam.ac.uk \
--cc=akpm@osdl.org \
--cc=haveblue@us.ibm.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®