All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Pekka Enberg <penberg@kernel.org>
Cc: Sasha Levin <levinsasha928@gmail.com>,
	mingo@elte.hu, asias.hejun@gmail.com, prasadjoshi124@gmail.com,
	gorcunov@gmail.com, kvm@vger.kernel.org
Subject: Re: [PATCH 1/2] kvm tools: Add memory gap for larger RAM sizes
Date: Wed, 11 May 2011 11:30:15 +0300	[thread overview]
Message-ID: <4DCA4917.9020802@redhat.com> (raw)
In-Reply-To: <BANLkTi=Y6cZ_LvpadrWtx2vVXiNz36ECag@mail.gmail.com>

On 05/11/2011 08:37 AM, Pekka Enberg wrote:
> On Wed, May 11, 2011 at 12:05 AM, Sasha Levin<levinsasha928@gmail.com>  wrote:
> >  +       if (kvm->ram_size<  0xe0000000) {
>
> Please use the ULL postfix for constants to ensure the types are sane.
> Also, please come up with a sane name for these.
>
> >  @@ -60,7 +60,14 @@ static inline u32 segment_to_flat(u16 selector, u16 offset)
> >
> >    static inline void *guest_flat_to_host(struct kvm *self, unsigned long offset)
> >    {
> >  -       return self->ram_start + offset;
> >  +       /*
> >  +        * We have a gap between 0xe0000000 and 0x100000000.
> >  +        * Consider it when translating an address above 0x100000000.
> >  +        */
> >  +       if (offset<  0xe0000000)
> >  +               return self->ram_start + offset;
> >  +       else
> >  +               return self->ram_start + 0xe0000000 + (offset - 0x100000000);
> >    }
>
> Would it not be simpler to mmap() a "ram_size + gap_size" contiguous
> region and mprotect(PROT_NONE) the gap? We'd still tell KVM and E820
> maps about two separate regions but guest_flat_to_host() would
> work-as-is.

It doesn't work in general - if you have a PCI device with a BAR (like a 
video card framebuffer), then you need allocations for main memory (0+) 
and pci (0xe000000+).  You can't have a contiguous mapping on i386 
containing both.

-- 
error compiling committee.c: too many arguments to function


  parent reply	other threads:[~2011-05-11 15:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-10 21:05 [PATCH 1/2] kvm tools: Add memory gap for larger RAM sizes Sasha Levin
2011-05-10 21:05 ` [PATCH 2/2] kvm tools: Prevent PFN wraparound Sasha Levin
2011-05-10 21:09   ` Pekka Enberg
2011-05-11  5:37 ` [PATCH 1/2] kvm tools: Add memory gap for larger RAM sizes Pekka Enberg
2011-05-11  6:21   ` Sasha Levin
2011-05-11  6:26     ` Pekka Enberg
2011-05-11  7:10       ` Ingo Molnar
2011-05-11  8:30   ` Avi Kivity [this message]
2011-05-11  8:44     ` Ingo Molnar
2011-05-11  9:06       ` Avi Kivity
2011-05-11  9:28         ` Pekka Enberg

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=4DCA4917.9020802@redhat.com \
    --to=avi@redhat.com \
    --cc=asias.hejun@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=levinsasha928@gmail.com \
    --cc=mingo@elte.hu \
    --cc=penberg@kernel.org \
    --cc=prasadjoshi124@gmail.com \
    /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.