Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 536788fe authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds
Browse files

uml: runtime host VMSPLIT detection



Calculate TASK_SIZE at run-time by figuring out the host's VMSPLIT - this is
needed on i386 if UML is to run on hosts with varying VMSPLITs without
recompilation.

TASK_SIZE is now defined in terms of a variable, task_size.  This gets rid of
an include of pgtable.h from processor.h, which can cause include loops.

On i386, task_size is calculated early in boot by probing the address space in
a binary search to figure out where the boundary between usable and non-usable
memory is.  This tries to make sure that a page that is considered to be in
userspace is, or can be made, read-write.  I'm concerned about a system-global
VDSO page in kernel memory being hit and considered to be a userspace page.

On x86_64, task_size is just the old value of CONFIG_TOP_ADDR.

A bunch of config variable are gone now.  CONFIG_TOP_ADDR is directly replaced
by TASK_SIZE.  NEST_LEVEL is gone since the relocation of the stubs makes it
irrelevant.  All the HOST_VMSPLIT stuff is gone.  All references to these in
arch/um/Makefile are also gone.

I noticed and fixed a missing extern in os.h when adding os_get_task_size.

Note: This has been revised to fix the 32-bit UML on 64-bit host bug that
Miklos ran into.

Signed-off-by: default avatarJeff Dike <jdike@linux.intel.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2f569afd
Loading
Loading
Loading
Loading
+0 −11
Original line number Original line Diff line number Diff line
@@ -203,17 +203,6 @@ config NR_CPUS
	depends on SMP
	depends on SMP
	default "32"
	default "32"


config NEST_LEVEL
	int "Nesting level"
	default "0"
	help
          This is set to the number of layers of UMLs that this UML will be run
          in.  Normally, this is zero, meaning that it will run directly on the
          host.  Setting it to one will build a UML that can run inside a UML
          that is running on the host.  Generally, if you intend this UML to run
          inside another UML, set CONFIG_NEST_LEVEL to one more than the host
          UML.

config HIGHMEM
config HIGHMEM
	bool "Highmem support (EXPERIMENTAL)"
	bool "Highmem support (EXPERIMENTAL)"
	depends on !64BIT && EXPERIMENTAL
	depends on !64BIT && EXPERIMENTAL
+0 −37
Original line number Original line Diff line number Diff line
@@ -23,43 +23,6 @@ config SEMAPHORE_SLEEPERS
	bool
	bool
	default y
	default y


choice
	prompt "Host memory split"
	default HOST_VMSPLIT_3G
	help
        This is needed when the host kernel on which you run has a non-default
	(like 2G/2G) memory split, instead of the customary 3G/1G. If you did
	not recompile your own kernel but use the default distro's one, you can
	safely accept the "Default split" option.

	It can be enabled on recent (>=2.6.16-rc2) vanilla kernels via
	CONFIG_VM_SPLIT_*, or on previous kernels with special patches (-ck
	patchset by Con Kolivas, or other ones) - option names match closely the
	host CONFIG_VM_SPLIT_* ones.

	A lower setting (where 1G/3G is lowest and 3G/1G is higher) will
	tolerate even more "normal" host kernels, but an higher setting will be
	stricter.

	So, if you do not know what to do here, say 'Default split'.

config HOST_VMSPLIT_3G
	bool "Default split (3G/1G user/kernel host split)"
config HOST_VMSPLIT_3G_OPT
	bool "3G/1G user/kernel host split (for full 1G low memory)"
config HOST_VMSPLIT_2G
	bool "2G/2G user/kernel host split"
config HOST_VMSPLIT_1G
	bool "1G/3G user/kernel host split"
endchoice

config TOP_ADDR
	hex
	default 0xB0000000 if HOST_VMSPLIT_3G_OPT
	default 0x78000000 if HOST_VMSPLIT_2G
	default 0x40000000 if HOST_VMSPLIT_1G
	default 0xC0000000

config 3_LEVEL_PGTABLES
config 3_LEVEL_PGTABLES
	bool "Three-level pagetables (EXPERIMENTAL)"
	bool "Three-level pagetables (EXPERIMENTAL)"
	default n
	default n
+0 −4
Original line number Original line Diff line number Diff line
@@ -15,10 +15,6 @@ config SEMAPHORE_SLEEPERS
	bool
	bool
	default y
	default y


config TOP_ADDR
 	hex
	default 0x7fc0000000

config 3_LEVEL_PGTABLES
config 3_LEVEL_PGTABLES
       bool
       bool
       default y
       default y
+0 −11
Original line number Original line Diff line number Diff line
@@ -79,13 +79,6 @@ KERNEL_DEFINES = $(strip -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \
KBUILD_CFLAGS += $(KERNEL_DEFINES)
KBUILD_CFLAGS += $(KERNEL_DEFINES)
KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time,)
KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time,)


# These are needed for clean and mrproper, since in that case .config is not
# included; the values here are meaningless

CONFIG_NEST_LEVEL ?= 0

SIZE = ($(CONFIG_NEST_LEVEL) * 0x20000000)

PHONY += linux
PHONY += linux


all: linux
all: linux
@@ -120,10 +113,6 @@ CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,)
CONFIG_KERNEL_STACK_ORDER ?= 2
CONFIG_KERNEL_STACK_ORDER ?= 2
STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] )
STACK_SIZE := $(shell echo $$[ 4096 * (1 << $(CONFIG_KERNEL_STACK_ORDER)) ] )


ifndef START
  START = $(shell echo $$[ $(TOP_ADDR) - $(SIZE) ] )
endif

CPPFLAGS_vmlinux.lds = -U$(SUBARCH) -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \
CPPFLAGS_vmlinux.lds = -U$(SUBARCH) -DSTART=$(START) -DELF_ARCH=$(ELF_ARCH) \
	-DELF_FORMAT="$(ELF_FORMAT)" -DKERNEL_STACK_SIZE=$(STACK_SIZE)
	-DELF_FORMAT="$(ELF_FORMAT)" -DKERNEL_STACK_SIZE=$(STACK_SIZE)


+0 −3
Original line number Original line Diff line number Diff line
@@ -56,8 +56,6 @@ CONFIG_X86_TSC=y
CONFIG_UML_X86=y
CONFIG_UML_X86=y
# CONFIG_64BIT is not set
# CONFIG_64BIT is not set
CONFIG_SEMAPHORE_SLEEPERS=y
CONFIG_SEMAPHORE_SLEEPERS=y
# CONFIG_HOST_2G_2G is not set
CONFIG_TOP_ADDR=0xc0000000
# CONFIG_3_LEVEL_PGTABLES is not set
# CONFIG_3_LEVEL_PGTABLES is not set
CONFIG_ARCH_HAS_SC_SIGNALS=y
CONFIG_ARCH_HAS_SC_SIGNALS=y
CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y
CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y
@@ -81,7 +79,6 @@ CONFIG_HOSTFS=y
# CONFIG_HPPFS is not set
# CONFIG_HPPFS is not set
CONFIG_MCONSOLE=y
CONFIG_MCONSOLE=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_NEST_LEVEL=0
# CONFIG_HIGHMEM is not set
# CONFIG_HIGHMEM is not set
CONFIG_KERNEL_STACK_ORDER=0
CONFIG_KERNEL_STACK_ORDER=0


Loading