From 8db16d19111b33bda95f9f0ef02d814d8a49b023 Mon Sep 17 00:00:00 2001 From: Martin Schwidefsky Date: Tue, 7 May 2019 13:56:45 +0200 Subject: [PATCH 1/8] s390/boot: fix compiler error due to missing awk strtonum The strtonum awk function is a GNU extension and is not available with all versions of awk. The link of bzImage fails with this error message: >> awk: line 2: function or never defined >> awk: line 2: function strtonum never defined objcopy: --pad-to: bad number: arch/s390/boot/compressed/vmlinux Drop the awk script and the --pad-to objcopy parameter it generated and use a FILL pattern with an appropriate alignment in the linker script for the arch/s390/boot/compressed/vmlinux file. Fixes: f6780686525c ("s390/boot: pad bzImage to 4K") Reported-by: kbuild test robot Suggested-by: Vasily Gorbik Signed-off-by: Martin Schwidefsky --- arch/s390/boot/Makefile | 1 - arch/s390/boot/compressed/vmlinux.lds.S | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile index c51496bbac190..7cba96e7587bc 100644 --- a/arch/s390/boot/Makefile +++ b/arch/s390/boot/Makefile @@ -58,7 +58,6 @@ define cmd_section_cmp touch $@ endef -OBJCOPYFLAGS_bzImage := --pad-to $$(readelf -s $(obj)/compressed/vmlinux | awk '/\<_end\>/ {print or(strtonum("0x"$$2),4095)+1}') $(obj)/bzImage: $(obj)/compressed/vmlinux $(obj)/section_cmp.boot.data $(obj)/section_cmp.boot.preserved.data FORCE $(call if_changed,objcopy) diff --git a/arch/s390/boot/compressed/vmlinux.lds.S b/arch/s390/boot/compressed/vmlinux.lds.S index 112b8d9f1e4cd..635217eb3d91b 100644 --- a/arch/s390/boot/compressed/vmlinux.lds.S +++ b/arch/s390/boot/compressed/vmlinux.lds.S @@ -77,6 +77,8 @@ SECTIONS _compressed_start = .; *(.vmlinux.bin.compressed) _compressed_end = .; + FILL(0xff); + . = ALIGN(4096); } . = ALIGN(256); .bss : { From 7e756f423af808b6571fed3144747db2ef7fa1c5 Mon Sep 17 00:00:00 2001 From: Vasily Gorbik Date: Tue, 7 May 2019 16:28:15 +0200 Subject: [PATCH 2/8] latent_entropy: avoid build error when plugin cflags are not set Some architectures set up CFLAGS for linux decompressor phase from scratch and do not include GCC_PLUGINS_CFLAGS. Since "latent_entropy" variable declaration is generated by the plugin code itself including linux/random.h in decompressor code then would cause a build error. E.g. on s390: In file included from ./include/linux/net.h:22, from ./include/linux/skbuff.h:29, from ./include/linux/if_ether.h:23, from ./arch/s390/include/asm/diag.h:12, from arch/s390/boot/startup.c:8: ./include/linux/random.h: In function 'add_latent_entropy': ./include/linux/random.h:26:39: error: 'latent_entropy' undeclared (first use in this function); did you mean 'add_latent_entropy'? 26 | add_device_randomness((const void *)&latent_entropy, | ^~~~~~~~~~~~~~ | add_latent_entropy ./include/linux/random.h:26:39: note: each undeclared identifier is reported only once for each function it appears in The build error is triggered by commit a80313ff91ab ("s390/kernel: introduce .dma sections") which made it into 5.2 merge window. To address that avoid using CONFIG_GCC_PLUGIN_LATENT_ENTROPY in favour of LATENT_ENTROPY_PLUGIN definition which is defined as a part of gcc plugins cflags and hence reflect more accurately when gcc plugin is active. Besides that it is also used for similar purpose in linux/compiler-gcc.h for latent_entropy attribute definition. Signed-off-by: Vasily Gorbik Acked-by: Kees Cook Signed-off-by: Martin Schwidefsky --- include/linux/random.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/random.h b/include/linux/random.h index 445a0ea4ff49a..d4eb9b3789ad2 100644 --- a/include/linux/random.h +++ b/include/linux/random.h @@ -20,7 +20,7 @@ struct random_ready_callback { extern void add_device_randomness(const void *, unsigned int); -#if defined(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) && !defined(__CHECKER__) +#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__) static inline void add_latent_entropy(void) { add_device_randomness((const void *)&latent_entropy, From 184c460fbab4d3bf23d31ac5adba21540f756b6d Mon Sep 17 00:00:00 2001 From: Vasily Gorbik Date: Wed, 8 May 2019 13:36:06 +0200 Subject: [PATCH 3/8] s390/kasan: adapt disabled_wait usage to avoid build error Fix the following build error when the kernel is built with CONFIG_KASAN broken since commit 98587c2d894c ("s390: simplify disabled_wait"): arch/s390/mm/kasan_init.c: In function 'kasan_early_panic': arch/s390/mm/kasan_init.c:31:2: error: too many arguments to function 'disabled_wait' 31 | disabled_wait(0); Fixes: 98587c2d894c ("s390: simplify disabled_wait") Reported-by: Benjamin Block Signed-off-by: Vasily Gorbik Signed-off-by: Martin Schwidefsky --- arch/s390/mm/kasan_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/mm/kasan_init.c b/arch/s390/mm/kasan_init.c index 01892dcf40292..0c1f257be4222 100644 --- a/arch/s390/mm/kasan_init.c +++ b/arch/s390/mm/kasan_init.c @@ -28,7 +28,7 @@ static void __init kasan_early_panic(const char *reason) { sclp_early_printk("The Linux kernel failed to boot with the KernelAddressSanitizer:\n"); sclp_early_printk(reason); - disabled_wait(0); + disabled_wait(); } static void * __init kasan_early_alloc_segment(void) From 22e2fe8551f83d43619211623c739e98dfa8ff08 Mon Sep 17 00:00:00 2001 From: Farhan Ali Date: Thu, 4 Apr 2019 17:00:21 -0400 Subject: [PATCH 4/8] s390/cio: Remove tracing for rchp instruction Since commit d485235b00 "s390: assume diag308 set always works", the kernel does not use the rchp instruction anymore. So let's remove the tracing for it. Signed-off-by: Farhan Ali Acked-by: Sebastian Ott Signed-off-by: Martin Schwidefsky --- drivers/s390/cio/trace.c | 1 - drivers/s390/cio/trace.h | 23 ----------------------- 2 files changed, 24 deletions(-) diff --git a/drivers/s390/cio/trace.c b/drivers/s390/cio/trace.c index e331cd97e83bb..882ee538ca302 100644 --- a/drivers/s390/cio/trace.c +++ b/drivers/s390/cio/trace.c @@ -21,5 +21,4 @@ EXPORT_TRACEPOINT_SYMBOL(s390_cio_csch); EXPORT_TRACEPOINT_SYMBOL(s390_cio_hsch); EXPORT_TRACEPOINT_SYMBOL(s390_cio_xsch); EXPORT_TRACEPOINT_SYMBOL(s390_cio_rsch); -EXPORT_TRACEPOINT_SYMBOL(s390_cio_rchp); EXPORT_TRACEPOINT_SYMBOL(s390_cio_chsc); diff --git a/drivers/s390/cio/trace.h b/drivers/s390/cio/trace.h index 0ebb29b6fd6df..4803139bce149 100644 --- a/drivers/s390/cio/trace.h +++ b/drivers/s390/cio/trace.h @@ -274,29 +274,6 @@ DEFINE_EVENT(s390_class_schid, s390_cio_rsch, TP_ARGS(schid, cc) ); -/** - * s390_cio_rchp - Reset Channel Path (RCHP) instruction was performed - * @chpid: Channel-Path Identifier - * @cc: Condition code - */ -TRACE_EVENT(s390_cio_rchp, - TP_PROTO(struct chp_id chpid, int cc), - TP_ARGS(chpid, cc), - TP_STRUCT__entry( - __field(u8, cssid) - __field(u8, id) - __field(int, cc) - ), - TP_fast_assign( - __entry->cssid = chpid.cssid; - __entry->id = chpid.id; - __entry->cc = cc; - ), - TP_printk("chpid=%x.%02x cc=%d", __entry->cssid, __entry->id, - __entry->cc - ) -); - #define CHSC_MAX_REQUEST_LEN 64 #define CHSC_MAX_RESPONSE_LEN 64 From 3060781f2664d34af641247aeac62696405a3fde Mon Sep 17 00:00:00 2001 From: Julian Wiedmann Date: Mon, 1 Apr 2019 10:08:08 +0200 Subject: [PATCH 5/8] s390/qdio: allow to scan all Output SBALs in one go Old code restricted the number of inspected SBALs to QDIO_MAX_BUFFERS_PER_Q - 1, as otherwise the first_to_check and first_to_kick cursors could overlap. Subsequent code would then assume that there was no progress on the queue, when in fact _all_ SBALs on the queue were ready-to-process. This limitation no longer applies, so allow the queue-scan code to inspect all SBALs on the queue. Note that qeth requires an additional patch ("s390/qeth: stop/wake TX queues based on their fill level"), to avoid potential queue stalls when all 128 SBALs are reported as ready-to-process. Signed-off-by: Julian Wiedmann Signed-off-by: Martin Schwidefsky --- drivers/s390/cio/qdio_main.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index cfce255521ac4..957c2a8dfc138 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c @@ -719,11 +719,7 @@ static int get_outbound_buffer_frontier(struct qdio_q *q, unsigned int start) multicast_outbound(q))) qdio_siga_sync_q(q); - /* - * Don't check 128 buffers, as otherwise qdio_inbound_q_moved - * would return 0. - */ - count = min(atomic_read(&q->nr_buf_used), QDIO_MAX_BUFFERS_MASK); + count = atomic_read(&q->nr_buf_used); if (!count) return 0; From 5a19d67027283c77f51b971485c3e579d94b5a2f Mon Sep 17 00:00:00 2001 From: Julian Wiedmann Date: Fri, 26 Apr 2019 09:30:11 +0200 Subject: [PATCH 6/8] s390/qdio: use get_buf_state() in debug_get_buf_state() For a 1-SBAL state inspection, use the corresponding helper. No functional change, just reducing the number of immediate callers to get_buf_states(). Signed-off-by: Julian Wiedmann Reviewed-by: Jens Remus Signed-off-by: Martin Schwidefsky --- drivers/s390/cio/qdio_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index 957c2a8dfc138..be93172555ec0 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c @@ -382,7 +382,7 @@ int debug_get_buf_state(struct qdio_q *q, unsigned int bufnr, { if (need_siga_sync(q)) qdio_siga_sync_q(q); - return get_buf_states(q, bufnr, state, 1, 0, 0); + return get_buf_state(q, bufnr, state, 0); } static inline void qdio_stop_polling(struct qdio_q *q) From a698e1372800b7e5dde2e461c1d3948c2e06032a Mon Sep 17 00:00:00 2001 From: Julian Wiedmann Date: Fri, 26 Apr 2019 09:37:41 +0200 Subject: [PATCH 7/8] s390/qdio: optimize state inspection of HW-owned SBALs When get_buf_states() gets called with count > 1, it scans the corresponding number of SBAL states until it encounters a mismatch. But when these SBALs are in a HW-owned state, the callers don't actually care _how many_ such SBALs are on the queue. If we can't process the first SBAL, we can't process any of the following SBALs either. So when the first SBAL is HW-owned, skip the scan of the remaining SBALs and thus save some CPU time. Signed-off-by: Julian Wiedmann Reviewed-by: Jens Remus Signed-off-by: Martin Schwidefsky --- drivers/s390/cio/qdio_main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index be93172555ec0..7b7620de2acdf 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c @@ -205,17 +205,22 @@ static inline int get_buf_states(struct qdio_q *q, unsigned int bufnr, int auto_ack, int merge_pending) { unsigned char __state = 0; - int i; + int i = 1; if (is_qebsm(q)) return qdio_do_eqbs(q, state, bufnr, count, auto_ack); /* get initial state: */ __state = q->slsb.val[bufnr]; + + /* Bail out early if there is no work on the queue: */ + if (__state & SLSB_OWNER_CU) + goto out; + if (merge_pending && __state == SLSB_P_OUTPUT_PENDING) __state = SLSB_P_OUTPUT_EMPTY; - for (i = 1; i < count; i++) { + for (; i < count; i++) { bufnr = next_buf(bufnr); /* merge PENDING into EMPTY: */ @@ -228,6 +233,8 @@ static inline int get_buf_states(struct qdio_q *q, unsigned int bufnr, if (q->slsb.val[bufnr] != __state) break; } + +out: *state = __state; return i; } From f3e20ad67b4c8365df9818fd3c8026e105d6b53a Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 13 May 2019 11:11:16 +0900 Subject: [PATCH 8/8] s390: move arch/s390/defconfig to arch/s390/configs/defconfig As of Linux 5.1, alpha and s390 are the last architectures that have defconfig in arch/*/ instead of arch/*/configs/. $ find arch -name defconfig | sort arch/alpha/defconfig arch/arm64/configs/defconfig arch/csky/configs/defconfig arch/nds32/configs/defconfig arch/riscv/configs/defconfig arch/s390/defconfig The arch/$(ARCH)/defconfig is the hard-coded default in Kconfig, and I want to deprecate it after evacuating the remaining defconfig into the standard location, arch/*/configs/. Define KBUILD_DEFCONFIG like other architectures, and move defconfig into the configs/ subdirectory. Signed-off-by: Masahiro Yamada Signed-off-by: Martin Schwidefsky --- arch/s390/Makefile | 2 ++ arch/s390/{ => configs}/defconfig | 0 2 files changed, 2 insertions(+) rename arch/s390/{ => configs}/defconfig (100%) diff --git a/arch/s390/Makefile b/arch/s390/Makefile index df1d6a150f300..de8521fc9de58 100644 --- a/arch/s390/Makefile +++ b/arch/s390/Makefile @@ -10,6 +10,8 @@ # Copyright (C) 1994 by Linus Torvalds # +KBUILD_DEFCONFIG := defconfig + LD_BFD := elf64-s390 KBUILD_LDFLAGS := -m elf64_s390 KBUILD_AFLAGS_MODULE += -fPIC diff --git a/arch/s390/defconfig b/arch/s390/configs/defconfig similarity index 100% rename from arch/s390/defconfig rename to arch/s390/configs/defconfig