From: James Morse <james.morse@arm.com>
To: KarimAllah Ahmed <karahmed@amazon.de>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] KVM: arm/arm64: Properly check for MMIO regions
Date: Wed, 24 Jul 2019 12:08:05 +0100 [thread overview]
Message-ID: <653177b8-7e74-aef3-3a4c-a45df5bcdab2@arm.com> (raw)
In-Reply-To: <1562919728-642-1-git-send-email-karahmed@amazon.de>
Hi KarimAllah,
On 12/07/2019 09:22, KarimAllah Ahmed wrote:
> Valid RAM can live outside kernel control (e.g. using "mem=" command-line
> parameter). This memory can still be used as valid guest memory for KVM. So
> ensure that we validate that this memory is definitely not "RAM" before
> assuming that it is an MMIO region.
>
> One way to use memory outside kernel control is:
>
> 1- Pass 'mem=' in the kernel command-line to limit the amount of memory managed
> by the kernel.
"mem=" is a debug option, we ignore it if we need something located outside the 'mem=' region.
> 2- Map this physical memory you want to give to the guest with:
> mmap("/dev/mem", physical_address_offset, ..)
/dev/mem is an egregious hack! If you need to use it, you probably didn't want an
operating-system in the first place.
> 3- Use the user-space virtual address as the "userspace_addr" field in
> KVM_SET_USER_MEMORY_REGION ioctl.
... What do you want to do this for?
At a guess: this is to save all that annoying 'memory allocation' overhead at guest
startup. If you get your VMM to use hugetlbfs, you can reserve the memory during boot. I
do this with "hugepagesz=2M hugepages=512" on the kernel command-line.
(if you get a RAS error affecting memory that the kernel doesn't know about, it will
ignore it. Using hugetlbfs instead gives you all the good things: hugepage-splitting,
signals to your VMM, stage2 unmapping etc.)
Thanks,
James
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
prev parent reply other threads:[~2019-07-24 11:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-12 8:22 [PATCH] KVM: arm/arm64: Properly check for MMIO regions KarimAllah Ahmed
2019-07-12 15:58 ` Raslan, KarimAllah
2019-07-24 11:08 ` James Morse [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=653177b8-7e74-aef3-3a4c-a45df5bcdab2@arm.com \
--to=james.morse@arm.com \
--cc=karahmed@amazon.de \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.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 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).