[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <653177b8-7e74-aef3-3a4c-a45df5bcdab2@arm.com>
Date: Wed, 24 Jul 2019 12:08:05 +0100
From: James Morse <james.morse@....com>
To: KarimAllah Ahmed <karahmed@...zon.de>
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Marc Zyngier <marc.zyngier@....com>,
Julien Thierry <julien.thierry@....com>,
Suzuki K Pouloze <suzuki.poulose@....com>,
kvmarm@...ts.cs.columbia.edu
Subject: Re: [PATCH] KVM: arm/arm64: Properly check for MMIO regions
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
Powered by blists - more mailing lists