[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 3/3] xen: add helpers to allocate unpopulated memory



On 04.09.20 10:42, Roger Pau Monné wrote:
On Fri, Sep 04, 2020 at 09:00:18AM +0200, Jürgen Groß wrote:
On 03.09.20 18:38, Roger Pau Monné wrote:
On Thu, Sep 03, 2020 at 05:30:07PM +0200, Jürgen Groß wrote:
On 01.09.20 10:33, Roger Pau Monne wrote:
To be used in order to create foreign mappings. This is based on the
ZONE_DEVICE facility which is used by persistent memory devices in
order to create struct pages and kernel virtual mappings for the IOMEM
areas of such devices. Note that on kernels without support for
ZONE_DEVICE Xen will fallback to use ballooned pages in order to
create foreign mappings.

The newly added helpers use the same parameters as the existing
{alloc/free}_xenballooned_pages functions, which allows for in-place
replacement of the callers. Once a memory region has been added to be
used as scratch mapping space it will no longer be released, and pages
returned are kept in a linked list. This allows to have a buffer of
pages and prevents resorting to frequent additions and removals of
regions.

If enabled (because ZONE_DEVICE is supported) the usage of the new
functionality untangles Xen balloon and RAM hotplug from the usage of
unpopulated physical memory ranges to map foreign pages, which is the
correct thing to do in order to avoid mappings of foreign pages depend
on memory hotplug.

Note the driver is currently not enabled on Arm platforms because it
would interfere with the identity mapping required on some platforms.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Sorry, I just got a build error for x86 32-bit build:

WARNING: unmet direct dependencies detected for ZONE_DEVICE
    Depends on [n]: MEMORY_HOTPLUG [=n] && MEMORY_HOTREMOVE [=n] &&
SPARSEMEM_VMEMMAP [=n] && ARCH_HAS_PTE_DEVMAP [=n]
    Selected by [y]:
    - XEN_UNPOPULATED_ALLOC [=y] && XEN [=y] && X86 [=y]
    GEN     Makefile
    CC      kernel/bounds.s
    CALL    /home/gross/korg/src/scripts/atomic/check-atomics.sh
    UPD     include/generated/bounds.h
    CC      arch/x86/kernel/asm-offsets.s
In file included from /home/gross/korg/src/include/linux/mmzone.h:19:0,
                   from /home/gross/korg/src/include/linux/gfp.h:6,
                   from /home/gross/korg/src/include/linux/slab.h:15,
                   from /home/gross/korg/src/include/linux/crypto.h:19,
                   from /home/gross/korg/src/arch/x86/kernel/asm-offsets.c:9:
/home/gross/korg/src/include/linux/page-flags-layout.h:95:2: error: #error
"Not enough bits in page flags"
   #error "Not enough bits in page flags"
    ^~~~~
make[2]: *** [/home/gross/korg/src/scripts/Makefile.build:114:
arch/x86/kernel/asm-offsets.s] Error 1
make[1]: *** [/home/gross/korg/src/Makefile:1175: prepare0] Error 2
make[1]: Leaving directory '/home/gross/korg/x8632'
make: *** [Makefile:185: __sub-make] Error 2

Sorry for this. I've tested a 32bit build but I think it was before
the last Kconfig changes. I'm a little unsure how to solve this, as
ZONE_DEVICE doesn't select the required options for it to run, but
rather depends on them to be available.

You can trigger something similar on x86-64 by doing:

$ make ARCH=x86_64 xen.config
Using .config as base
Merging ./kernel/configs/xen.config
Merging ./arch/x86/configs/xen.config
#
# merged configuration written to .config (needs make)
#
scripts/kconfig/conf  --olddefconfig Kconfig

WARNING: unmet direct dependencies detected for ZONE_DEVICE
    Depends on [n]: MEMORY_HOTPLUG [=y] && MEMORY_HOTREMOVE [=n] && SPARSEMEM_VMEMMAP 
[=y] && ARCH_HAS_PTE_DEVMAP [=y]
    Selected by [y]:
    - XEN_UNPOPULATED_ALLOC [=y] && XEN [=y] && X86_64 [=y]
#
# configuration written to .config
#

I think the only solution is to have XEN_UNPOPULATED_ALLOC depend on
ZONE_DEVICE rather than select it?

Yes, I think so.

I've folded that in and now build is fine.

Thanks, I assume no further action is needed on my side.

Right.


Juergen



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.