Commit 6b38e2fb authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull s390 updates from Heiko Carstens:

 - Add missing Kconfig option for ftrace direct multi sample, so it can
   be compiled again, and also add s390 support for this sample.

 - Update Christian Borntraeger's email address.

 - Various fixes for memory layout setup. Besides other this makes it
   possible to load shared DCSS segments again.

 - Fix copy to user space of swapped kdump oldmem.

 - Remove -mstack-guard and -mstack-size compile options when building
   vdso binaries. This can happen when CONFIG_VMAP_STACK is disabled and
   results in broken vdso code which causes more or less random
   exceptions. Also remove the not needed -nostdlib option.

 - Fix memory leak on cpu hotplug and return code handling in kexec
   code.

 - Wire up futex_waitv system call.

 - Replace snprintf with sysfs_emit where appropriate.

* tag 's390-5.16-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
  ftrace/samples: add s390 support for ftrace direct multi sample
  ftrace/samples: add missing Kconfig option for ftrace direct multi sample
  MAINTAINERS: update email address of Christian Borntraeger
  s390/kexec: fix memory leak of ipl report buffer
  s390/kexec: fix return code handling
  s390/dump: fix copying to user-space of swapped kdump oldmem
  s390: wire up sys_futex_waitv system call
  s390/vdso: filter out -mstack-guard and -mstack-size
  s390/vdso: remove -nostdlib compiler flag
  s390: replace snprintf in show functions with sysfs_emit
  s390/boot: simplify and fix kernel memory layout setup
  s390/setup: re-arrange memblock setup
  s390/setup: avoid using memblock_enforce_memory_limit
  s390/setup: avoid reserving memory above identity mapping
parents b38bfc74 890e3dc8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -71,6 +71,9 @@ Chao Yu <chao@kernel.org> <chao2.yu@samsung.com>
Chao Yu <chao@kernel.org> <yuchao0@huawei.com>
Chris Chiu <chris.chiu@canonical.com> <chiu@endlessm.com>
Chris Chiu <chris.chiu@canonical.com> <chiu@endlessos.org>
Christian Borntraeger <borntraeger@linux.ibm.com> <borntraeger@de.ibm.com>
Christian Borntraeger <borntraeger@linux.ibm.com> <cborntra@de.ibm.com>
Christian Borntraeger <borntraeger@linux.ibm.com> <borntrae@de.ibm.com>
Christophe Ricard <christophe.ricard@gmail.com>
Christoph Hellwig <hch@lst.de>
Colin Ian King <colin.king@intel.com> <colin.king@canonical.com>
+2 −2
Original line number Diff line number Diff line
@@ -10445,7 +10445,7 @@ F: arch/riscv/include/uapi/asm/kvm*
F:	arch/riscv/kvm/
KERNEL VIRTUAL MACHINE for s390 (KVM/s390)
M:	Christian Borntraeger <borntraeger@de.ibm.com>
M:	Christian Borntraeger <borntraeger@linux.ibm.com>
M:	Janosch Frank <frankja@linux.ibm.com>
R:	David Hildenbrand <david@redhat.com>
R:	Claudio Imbrenda <imbrenda@linux.ibm.com>
@@ -16573,7 +16573,7 @@ F: drivers/video/fbdev/savage/
S390
M:	Heiko Carstens <hca@linux.ibm.com>
M:	Vasily Gorbik <gor@linux.ibm.com>
M:	Christian Borntraeger <borntraeger@de.ibm.com>
M:	Christian Borntraeger <borntraeger@linux.ibm.com>
R:	Alexander Gordeev <agordeev@linux.ibm.com>
L:	linux-s390@vger.kernel.org
S:	Supported
+2 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ config ARCH_SUPPORTS_UPROBES
config KASAN_SHADOW_OFFSET
	hex
	depends on KASAN
	default 0x18000000000000
	default 0x1C000000000000

config S390
	def_bool y
@@ -194,6 +194,7 @@ config S390
	select HAVE_RELIABLE_STACKTRACE
	select HAVE_RSEQ
	select HAVE_SAMPLE_FTRACE_DIRECT
	select HAVE_SAMPLE_FTRACE_DIRECT_MULTI
	select HAVE_SOFTIRQ_ON_OWN_STACK
	select HAVE_SYSCALL_TRACEPOINTS
	select HAVE_VIRT_CPU_ACCOUNTING
+6 −4
Original line number Diff line number Diff line
@@ -77,10 +77,12 @@ KBUILD_AFLAGS_DECOMPRESSOR += $(aflags-y)
KBUILD_CFLAGS_DECOMPRESSOR += $(cflags-y)

ifneq ($(call cc-option,-mstack-size=8192 -mstack-guard=128),)
cflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE)
  CC_FLAGS_CHECK_STACK := -mstack-size=$(STACK_SIZE)
  ifeq ($(call cc-option,-mstack-size=8192),)
cflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD)
    CC_FLAGS_CHECK_STACK += -mstack-guard=$(CONFIG_STACK_GUARD)
  endif
  export CC_FLAGS_CHECK_STACK
  cflags-$(CONFIG_CHECK_STACK) += $(CC_FLAGS_CHECK_STACK)
endif

ifdef CONFIG_EXPOLINE
+31 −57
Original line number Diff line number Diff line
@@ -149,82 +149,56 @@ static void setup_ident_map_size(unsigned long max_physmem_end)

static void setup_kernel_memory_layout(void)
{
	bool vmalloc_size_verified = false;
	unsigned long vmemmap_off;
	unsigned long vspace_left;
	unsigned long vmemmap_start;
	unsigned long rte_size;
	unsigned long pages;
	unsigned long vmax;

	pages = ident_map_size / PAGE_SIZE;
	/* vmemmap contains a multiple of PAGES_PER_SECTION struct pages */
	vmemmap_size = SECTION_ALIGN_UP(pages) * sizeof(struct page);

	/* choose kernel address space layout: 4 or 3 levels. */
	vmemmap_off = round_up(ident_map_size, _REGION3_SIZE);
	vmemmap_start = round_up(ident_map_size, _REGION3_SIZE);
	if (IS_ENABLED(CONFIG_KASAN) ||
	    vmalloc_size > _REGION2_SIZE ||
	    vmemmap_off + vmemmap_size + vmalloc_size + MODULES_LEN > _REGION2_SIZE)
		vmax = _REGION1_SIZE;
	else
		vmax = _REGION2_SIZE;

	/* keep vmemmap_off aligned to a top level region table entry */
	rte_size = vmax == _REGION1_SIZE ? _REGION2_SIZE : _REGION3_SIZE;
	MODULES_END = vmax;
	if (is_prot_virt_host()) {
	    vmemmap_start + vmemmap_size + vmalloc_size + MODULES_LEN >
		    _REGION2_SIZE) {
		MODULES_END = _REGION1_SIZE;
		rte_size = _REGION2_SIZE;
	} else {
		MODULES_END = _REGION2_SIZE;
		rte_size = _REGION3_SIZE;
	}
	/*
	 * forcing modules and vmalloc area under the ultravisor
	 * secure storage limit, so that any vmalloc allocation
	 * we do could be used to back secure guest storage.
	 */
	adjust_to_uv_max(&MODULES_END);
	}

#ifdef CONFIG_KASAN
	if (MODULES_END < vmax) {
	/* force vmalloc and modules below kasan shadow */
	MODULES_END = min(MODULES_END, KASAN_SHADOW_START);
	} else {
		/*
		 * leave vmalloc and modules above kasan shadow but make
		 * sure they don't overlap with it
		 */
		vmalloc_size = min(vmalloc_size, vmax - KASAN_SHADOW_END - MODULES_LEN);
		vmalloc_size_verified = true;
		vspace_left = KASAN_SHADOW_START;
	}
#endif
	MODULES_VADDR = MODULES_END - MODULES_LEN;
	VMALLOC_END = MODULES_VADDR;

	if (vmalloc_size_verified) {
		VMALLOC_START = VMALLOC_END - vmalloc_size;
	} else {
		vmemmap_off = round_up(ident_map_size, rte_size);

		if (vmemmap_off + vmemmap_size > VMALLOC_END ||
		    vmalloc_size > VMALLOC_END - vmemmap_off - vmemmap_size) {
			/*
			 * allow vmalloc area to occupy up to 1/2 of
			 * the rest virtual space left.
			 */
			vmalloc_size = min(vmalloc_size, VMALLOC_END / 2);
		}
	/* allow vmalloc area to occupy up to about 1/2 of the rest virtual space left */
	vmalloc_size = min(vmalloc_size, round_down(VMALLOC_END / 2, _REGION3_SIZE));
	VMALLOC_START = VMALLOC_END - vmalloc_size;
		vspace_left = VMALLOC_START;
	}

	pages = vspace_left / (PAGE_SIZE + sizeof(struct page));
	/* split remaining virtual space between 1:1 mapping & vmemmap array */
	pages = VMALLOC_START / (PAGE_SIZE + sizeof(struct page));
	pages = SECTION_ALIGN_UP(pages);
	vmemmap_off = round_up(vspace_left - pages * sizeof(struct page), rte_size);
	/* keep vmemmap left most starting from a fresh region table entry */
	vmemmap_off = min(vmemmap_off, round_up(ident_map_size, rte_size));
	/* take care that identity map is lower then vmemmap */
	ident_map_size = min(ident_map_size, vmemmap_off);
	/* keep vmemmap_start aligned to a top level region table entry */
	vmemmap_start = round_down(VMALLOC_START - pages * sizeof(struct page), rte_size);
	/* vmemmap_start is the future VMEM_MAX_PHYS, make sure it is within MAX_PHYSMEM */
	vmemmap_start = min(vmemmap_start, 1UL << MAX_PHYSMEM_BITS);
	/* make sure identity map doesn't overlay with vmemmap */
	ident_map_size = min(ident_map_size, vmemmap_start);
	vmemmap_size = SECTION_ALIGN_UP(ident_map_size / PAGE_SIZE) * sizeof(struct page);
	VMALLOC_START = max(vmemmap_off + vmemmap_size, VMALLOC_START);
	vmemmap = (struct page *)vmemmap_off;
	/* make sure vmemmap doesn't overlay with vmalloc area */
	VMALLOC_START = max(vmemmap_start + vmemmap_size, VMALLOC_START);
	vmemmap = (struct page *)vmemmap_start;
}

/*
Loading