Skip to content

Commit b731bc5

Browse files
committed
Merge tag 's390-6.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull more s390 updates from Alexander Gordeev: - The rework that uncoupled physical and virtual address spaces inadvertently prevented KASAN shadow mappings from using large pages. Restore large page mappings for KASAN shadows - Add decompressor routine physmem_alloc() that may fail, unlike physmem_alloc_or_die(). This allows callers to implement fallback paths - Allow falling back from large pages to smaller pages (1MB or 4KB) if the allocation of 2GB pages in the decompressor can not be fulfilled - Add to the decompressor boot print support of "%%" format string, width and padding hadnling, length modifiers and decimal conversion specifiers - Add to the decompressor message severity levels similar to kernel ones. Support command-line options that control console output verbosity - Replaces boot_printk() calls with appropriate loglevel- specific helpers such as boot_emerg(), boot_warn(), and boot_debug(). - Collect all boot messages into a ring buffer independent of the current log level. This is particularly useful for early crash analysis - If 'earlyprintk' command line parameter is not specified, store decompressor boot messages in a ring buffer to be printed later by the kernel, once the console driver is registered - Add 'bootdebug' command line parameter to enable printing of decompressor debug messages when needed. That parameters allows message suppressing and filtering - Dump boot messages on a decompressor crash, but only if 'bootdebug' command line parameter is enabled - When CONFIG_PRINTK_TIME is enabled, add timestamps to boot messages in the same format as regular printk() - Dump physical memory tracking information on boot: online ranges, reserved areas and vmem allocations - Dump virtual memory layout and randomization details - Improve decompression error reporting and dump the message ring buffer in case the boot failed and system halted - Add an exception handler which handles exceptions when FPU control register is attempted to be set to an invalid value. Remove '.fixup' section as result of this change - Use 'A', 'O', and 'R' inline assembly format flags, which allows recent Clang compilers to generate better FPU code - Rework uaccess code so it reads better and generates more efficient code - Cleanup futex inline assembly code - Disable KMSAN instrumention for futex inline assemblies, which contain dereferenced user pointers. Otherwise, shadows for the user pointers would be accessed - PFs which are not initially configured but in standby create only a single-function PCI domain. If they are configured later on, sibling PFs and their child VFs will not be added to their PCI domain breaking SR-IOV expectations. Fix that by allowing initially configured but in standby PFs create multi-function PCI domains - Add '-std=gnu11' to decompressor and purgatory CFLAGS to avoid compile errors caused by kernel's own definitions of 'bool', 'false', and 'true' conflicting with the C23 reserved keywords - Fix sclp subsystem failure when a sclp console is not present - Fix misuse of non-NULL terminated strings in vmlogrdr driver - Various other small improvements, cleanups and fixes * tag 's390-6.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (53 commits) s390/vmlogrdr: Use array instead of string initializer s390/vmlogrdr: Use internal_name for error messages s390/sclp: Initialize sclp subsystem via arch_cpu_finalize_init() s390/tools: Use array instead of string initializer s390/vmem: Fix null-pointer-arithmetic warning in vmem_map_init() s390: Add '-std=gnu11' to decompressor and purgatory CFLAGS s390/bitops: Use correct constraint for arch_test_bit() inline assembly s390/pci: Fix SR-IOV for PFs initially in standby s390/futex: Avoid KMSAN instrumention for user pointers s390/uaccess: Rename get_put_user_noinstr_attributes to uaccess_kmsan_or_inline s390/futex: Cleanup futex_atomic_cmpxchg_inatomic() s390/futex: Generate futex atomic op functions s390/uaccess: Remove INLINE_COPY_FROM_USER and INLINE_COPY_TO_USER s390/uaccess: Use asm goto for put_user()/get_user() s390/uaccess: Remove usage of the oac specifier s390/uaccess: Replace EX_TABLE_UA_LOAD_MEM exception handling s390/uaccess: Cleanup noinstr __put_user()/__get_user() inline assembly constraints s390/uaccess: Remove __put_user_fn()/__get_user_fn() wrappers s390/uaccess: Move put_user() / __put_user() close to put_user() asm code s390/uaccess: Use asm goto for __mvc_kernel_nofault() ...
2 parents 90cb220 + 87f017d commit b731bc5

34 files changed

+1109
-668
lines changed

arch/s390/Kconfig

+8-1
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,19 @@ config KASAN_SHADOW_OFFSET
5252
depends on KASAN
5353
default 0x1C000000000000
5454

55-
config GCC_ASM_FLAG_OUTPUT_BROKEN
55+
config CC_ASM_FLAG_OUTPUT_BROKEN
5656
def_bool CC_IS_GCC && GCC_VERSION < 140200
5757
help
5858
GCC versions before 14.2.0 may die with an internal
5959
compiler error in some configurations if flag output
6060
operands are used within inline assemblies.
6161

62+
config CC_HAS_ASM_AOR_FORMAT_FLAGS
63+
def_bool !(CC_IS_CLANG && CLANG_VERSION < 190100)
64+
help
65+
Clang versions before 19.1.0 do not support A,
66+
O, and R inline assembly format flags.
67+
6268
config S390
6369
def_bool y
6470
#
@@ -72,6 +78,7 @@ config S390
7278
select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM
7379
select ARCH_ENABLE_MEMORY_HOTREMOVE
7480
select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
81+
select ARCH_HAS_CPU_FINALIZE_INIT
7582
select ARCH_HAS_CRC32
7683
select ARCH_HAS_CURRENT_STACK_POINTER
7784
select ARCH_HAS_DEBUG_VIRTUAL

arch/s390/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__
2222
ifndef CONFIG_AS_IS_LLVM
2323
KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
2424
endif
25-
KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack
25+
KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack -std=gnu11
2626
KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
2727
KBUILD_CFLAGS_DECOMPRESSOR += -D__DECOMPRESSOR
2828
KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain

arch/s390/boot/als.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,26 @@ void print_missing_facilities(void)
4646
* z/VM adds a four character prefix.
4747
*/
4848
if (strlen(als_str) > 70) {
49-
boot_printk("%s\n", als_str);
49+
boot_emerg("%s\n", als_str);
5050
*als_str = '\0';
5151
}
5252
u16_to_decimal(val_str, i * BITS_PER_LONG + j);
5353
strcat(als_str, val_str);
5454
first = 0;
5555
}
5656
}
57-
boot_printk("%s\n", als_str);
57+
boot_emerg("%s\n", als_str);
5858
}
5959

6060
static void facility_mismatch(void)
6161
{
6262
struct cpuid id;
6363

6464
get_cpu_id(&id);
65-
boot_printk("The Linux kernel requires more recent processor hardware\n");
66-
boot_printk("Detected machine-type number: %4x\n", id.machine);
65+
boot_emerg("The Linux kernel requires more recent processor hardware\n");
66+
boot_emerg("Detected machine-type number: %4x\n", id.machine);
6767
print_missing_facilities();
68-
boot_printk("See Principles of Operations for facility bits\n");
68+
boot_emerg("See Principles of Operations for facility bits\n");
6969
disabled_wait();
7070
}
7171

arch/s390/boot/boot.h

+23-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#ifndef __ASSEMBLY__
1010

11+
#include <linux/printk.h>
1112
#include <asm/physmem_info.h>
1213

1314
struct machine_info {
@@ -47,13 +48,16 @@ void physmem_set_usable_limit(unsigned long limit);
4748
void physmem_reserve(enum reserved_range_type type, unsigned long addr, unsigned long size);
4849
void physmem_free(enum reserved_range_type type);
4950
/* for continuous/multiple allocations per type */
50-
unsigned long physmem_alloc_top_down(enum reserved_range_type type, unsigned long size,
51-
unsigned long align);
51+
unsigned long physmem_alloc_or_die(enum reserved_range_type type, unsigned long size,
52+
unsigned long align);
53+
unsigned long physmem_alloc(enum reserved_range_type type, unsigned long size,
54+
unsigned long align, bool die_on_oom);
5255
/* for single allocations, 1 per type */
5356
unsigned long physmem_alloc_range(enum reserved_range_type type, unsigned long size,
5457
unsigned long align, unsigned long min, unsigned long max,
5558
bool die_on_oom);
5659
unsigned long get_physmem_alloc_pos(void);
60+
void dump_physmem_reserved(void);
5761
bool ipl_report_certs_intersects(unsigned long addr, unsigned long size,
5862
unsigned long *intersection_start);
5963
bool is_ipl_block_dump(void);
@@ -69,12 +73,28 @@ void print_pgm_check_info(void);
6973
unsigned long randomize_within_range(unsigned long size, unsigned long align,
7074
unsigned long min, unsigned long max);
7175
void setup_vmem(unsigned long kernel_start, unsigned long kernel_end, unsigned long asce_limit);
72-
void __printf(1, 2) boot_printk(const char *fmt, ...);
76+
int __printf(1, 2) boot_printk(const char *fmt, ...);
7377
void print_stacktrace(unsigned long sp);
7478
void error(char *m);
7579
int get_random(unsigned long limit, unsigned long *value);
80+
void boot_rb_dump(void);
81+
82+
#ifndef boot_fmt
83+
#define boot_fmt(fmt) fmt
84+
#endif
85+
86+
#define boot_emerg(fmt, ...) boot_printk(KERN_EMERG boot_fmt(fmt), ##__VA_ARGS__)
87+
#define boot_alert(fmt, ...) boot_printk(KERN_ALERT boot_fmt(fmt), ##__VA_ARGS__)
88+
#define boot_crit(fmt, ...) boot_printk(KERN_CRIT boot_fmt(fmt), ##__VA_ARGS__)
89+
#define boot_err(fmt, ...) boot_printk(KERN_ERR boot_fmt(fmt), ##__VA_ARGS__)
90+
#define boot_warn(fmt, ...) boot_printk(KERN_WARNING boot_fmt(fmt), ##__VA_ARGS__)
91+
#define boot_notice(fmt, ...) boot_printk(KERN_NOTICE boot_fmt(fmt), ##__VA_ARGS__)
92+
#define boot_info(fmt, ...) boot_printk(KERN_INFO boot_fmt(fmt), ##__VA_ARGS__)
93+
#define boot_debug(fmt, ...) boot_printk(KERN_DEBUG boot_fmt(fmt), ##__VA_ARGS__)
7694

7795
extern struct machine_info machine;
96+
extern int boot_console_loglevel;
97+
extern bool boot_ignore_loglevel;
7898

7999
/* Symbols defined by linker scripts */
80100
extern const char kernel_version[];

arch/s390/boot/decompressor.c

+11-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <linux/kernel.h>
1111
#include <linux/string.h>
12+
#include <asm/boot_data.h>
1213
#include <asm/page.h>
1314
#include "decompressor.h"
1415
#include "boot.h"
@@ -63,6 +64,15 @@ static unsigned long free_mem_end_ptr = (unsigned long) _end + BOOT_HEAP_SIZE;
6364
#include "../../../../lib/decompress_unzstd.c"
6465
#endif
6566

67+
static void decompress_error(char *m)
68+
{
69+
if (bootdebug)
70+
boot_rb_dump();
71+
boot_emerg("Decompression error: %s\n", m);
72+
boot_emerg(" -- System halted\n");
73+
disabled_wait();
74+
}
75+
6676
unsigned long mem_safe_offset(void)
6777
{
6878
return ALIGN(free_mem_end_ptr, PAGE_SIZE);
@@ -71,5 +81,5 @@ unsigned long mem_safe_offset(void)
7181
void deploy_kernel(void *output)
7282
{
7383
__decompress(_compressed_start, _compressed_end - _compressed_start,
74-
NULL, NULL, output, vmlinux.image_size, NULL, error);
84+
NULL, NULL, output, vmlinux.image_size, NULL, decompress_error);
7585
}

arch/s390/boot/ipl_parm.c

+19-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ static void check_cleared_facilities(void)
215215

216216
for (i = 0; i < ARRAY_SIZE(als); i++) {
217217
if ((stfle_fac_list[i] & als[i]) != als[i]) {
218-
boot_printk("Warning: The Linux kernel requires facilities cleared via command line option\n");
218+
boot_emerg("The Linux kernel requires facilities cleared via command line option\n");
219219
print_missing_facilities();
220220
break;
221221
}
@@ -313,5 +313,23 @@ void parse_boot_command_line(void)
313313
#endif
314314
if (!strcmp(param, "relocate_lowcore") && test_facility(193))
315315
relocate_lowcore = 1;
316+
if (!strcmp(param, "earlyprintk"))
317+
boot_earlyprintk = true;
318+
if (!strcmp(param, "debug"))
319+
boot_console_loglevel = CONSOLE_LOGLEVEL_DEBUG;
320+
if (!strcmp(param, "bootdebug")) {
321+
bootdebug = true;
322+
if (val)
323+
strncpy(bootdebug_filter, val, sizeof(bootdebug_filter) - 1);
324+
}
325+
if (!strcmp(param, "quiet"))
326+
boot_console_loglevel = CONSOLE_LOGLEVEL_QUIET;
327+
if (!strcmp(param, "ignore_loglevel"))
328+
boot_ignore_loglevel = true;
329+
if (!strcmp(param, "loglevel")) {
330+
boot_console_loglevel = simple_strtoull(val, NULL, 10);
331+
if (boot_console_loglevel < CONSOLE_LOGLEVEL_MIN)
332+
boot_console_loglevel = CONSOLE_LOGLEVEL_MIN;
333+
}
316334
}
317335
}

arch/s390/boot/ipl_report.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ static unsigned long get_cert_comp_list_size(void)
3030
{
3131
struct ipl_rb_certificate_entry *cert;
3232
struct ipl_rb_component_entry *comp;
33-
size_t size;
3433

3534
/*
3635
* Find the length for the IPL report boot data
@@ -155,7 +154,7 @@ void save_ipl_cert_comp_list(void)
155154
return;
156155

157156
size = get_cert_comp_list_size();
158-
early_ipl_comp_list_addr = physmem_alloc_top_down(RR_CERT_COMP_LIST, size, sizeof(int));
157+
early_ipl_comp_list_addr = physmem_alloc_or_die(RR_CERT_COMP_LIST, size, sizeof(int));
159158
ipl_cert_list_addr = early_ipl_comp_list_addr + early_ipl_comp_list_size;
160159

161160
copy_components_bootdata();

arch/s390/boot/kaslr.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct prng_parm {
3232
static int check_prng(void)
3333
{
3434
if (!cpacf_query_func(CPACF_KMC, CPACF_KMC_PRNG)) {
35-
boot_printk("KASLR disabled: CPU has no PRNG\n");
35+
boot_warn("KASLR disabled: CPU has no PRNG\n");
3636
return 0;
3737
}
3838
if (cpacf_query_func(CPACF_PRNO, CPACF_PRNO_TRNG))
@@ -168,7 +168,7 @@ static unsigned long iterate_valid_positions(unsigned long size, unsigned long a
168168
* cannot have chains.
169169
*
170170
* On the other hand, "dynamic" or "repetitive" allocations are done via
171-
* physmem_alloc_top_down(). These allocations are tightly packed together
171+
* physmem_alloc_or_die(). These allocations are tightly packed together
172172
* top down from the end of online memory. physmem_alloc_pos represents
173173
* current position where those allocations start.
174174
*

arch/s390/boot/pgm_check_info.c

+27-26
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ void print_stacktrace(unsigned long sp)
1717
(unsigned long)_stack_end };
1818
bool first = true;
1919

20-
boot_printk("Call Trace:\n");
20+
boot_emerg("Call Trace:\n");
2121
while (!(sp & 0x7) && on_stack(&boot_stack, sp, sizeof(struct stack_frame))) {
2222
struct stack_frame *sf = (struct stack_frame *)sp;
2323

24-
boot_printk(first ? "(sp:%016lx [<%016lx>] %pS)\n" :
25-
" sp:%016lx [<%016lx>] %pS\n",
26-
sp, sf->gprs[8], (void *)sf->gprs[8]);
24+
if (first)
25+
boot_emerg("(sp:%016lx [<%016lx>] %pS)\n", sp, sf->gprs[8], (void *)sf->gprs[8]);
26+
else
27+
boot_emerg(" sp:%016lx [<%016lx>] %pS\n", sp, sf->gprs[8], (void *)sf->gprs[8]);
2728
if (sf->back_chain <= sp)
2829
break;
2930
sp = sf->back_chain;
@@ -36,30 +37,30 @@ void print_pgm_check_info(void)
3637
unsigned long *gpregs = (unsigned long *)get_lowcore()->gpregs_save_area;
3738
struct psw_bits *psw = &psw_bits(get_lowcore()->psw_save_area);
3839

39-
boot_printk("Linux version %s\n", kernel_version);
40+
if (bootdebug)
41+
boot_rb_dump();
42+
boot_emerg("Linux version %s\n", kernel_version);
4043
if (!is_prot_virt_guest() && early_command_line[0])
41-
boot_printk("Kernel command line: %s\n", early_command_line);
42-
boot_printk("Kernel fault: interruption code %04x ilc:%x\n",
43-
get_lowcore()->pgm_code, get_lowcore()->pgm_ilc >> 1);
44+
boot_emerg("Kernel command line: %s\n", early_command_line);
45+
boot_emerg("Kernel fault: interruption code %04x ilc:%d\n",
46+
get_lowcore()->pgm_code, get_lowcore()->pgm_ilc >> 1);
4447
if (kaslr_enabled()) {
45-
boot_printk("Kernel random base: %lx\n", __kaslr_offset);
46-
boot_printk("Kernel random base phys: %lx\n", __kaslr_offset_phys);
48+
boot_emerg("Kernel random base: %lx\n", __kaslr_offset);
49+
boot_emerg("Kernel random base phys: %lx\n", __kaslr_offset_phys);
4750
}
48-
boot_printk("PSW : %016lx %016lx (%pS)\n",
49-
get_lowcore()->psw_save_area.mask,
50-
get_lowcore()->psw_save_area.addr,
51-
(void *)get_lowcore()->psw_save_area.addr);
52-
boot_printk(
53-
" R:%x T:%x IO:%x EX:%x Key:%x M:%x W:%x P:%x AS:%x CC:%x PM:%x RI:%x EA:%x\n",
54-
psw->per, psw->dat, psw->io, psw->ext, psw->key, psw->mcheck,
55-
psw->wait, psw->pstate, psw->as, psw->cc, psw->pm, psw->ri,
56-
psw->eaba);
57-
boot_printk("GPRS: %016lx %016lx %016lx %016lx\n", gpregs[0], gpregs[1], gpregs[2], gpregs[3]);
58-
boot_printk(" %016lx %016lx %016lx %016lx\n", gpregs[4], gpregs[5], gpregs[6], gpregs[7]);
59-
boot_printk(" %016lx %016lx %016lx %016lx\n", gpregs[8], gpregs[9], gpregs[10], gpregs[11]);
60-
boot_printk(" %016lx %016lx %016lx %016lx\n", gpregs[12], gpregs[13], gpregs[14], gpregs[15]);
51+
boot_emerg("PSW : %016lx %016lx (%pS)\n",
52+
get_lowcore()->psw_save_area.mask,
53+
get_lowcore()->psw_save_area.addr,
54+
(void *)get_lowcore()->psw_save_area.addr);
55+
boot_emerg(" R:%x T:%x IO:%x EX:%x Key:%x M:%x W:%x P:%x AS:%x CC:%x PM:%x RI:%x EA:%x\n",
56+
psw->per, psw->dat, psw->io, psw->ext, psw->key, psw->mcheck,
57+
psw->wait, psw->pstate, psw->as, psw->cc, psw->pm, psw->ri, psw->eaba);
58+
boot_emerg("GPRS: %016lx %016lx %016lx %016lx\n", gpregs[0], gpregs[1], gpregs[2], gpregs[3]);
59+
boot_emerg(" %016lx %016lx %016lx %016lx\n", gpregs[4], gpregs[5], gpregs[6], gpregs[7]);
60+
boot_emerg(" %016lx %016lx %016lx %016lx\n", gpregs[8], gpregs[9], gpregs[10], gpregs[11]);
61+
boot_emerg(" %016lx %016lx %016lx %016lx\n", gpregs[12], gpregs[13], gpregs[14], gpregs[15]);
6162
print_stacktrace(get_lowcore()->gpregs_save_area[15]);
62-
boot_printk("Last Breaking-Event-Address:\n");
63-
boot_printk(" [<%016lx>] %pS\n", (unsigned long)get_lowcore()->pgm_last_break,
64-
(void *)get_lowcore()->pgm_last_break);
63+
boot_emerg("Last Breaking-Event-Address:\n");
64+
boot_emerg(" [<%016lx>] %pS\n", (unsigned long)get_lowcore()->pgm_last_break,
65+
(void *)get_lowcore()->pgm_last_break);
6566
}

0 commit comments

Comments
 (0)