From 9af310ef10dedc2f8d400d26fdc99d771537b2fd Mon Sep 17 00:00:00 2001 From: Vasily Gorbik Date: Thu, 12 Dec 2024 16:39:05 +0100 Subject: [PATCH] s390/boot: Improve decompression error reporting Currently, decompression error messages can be very uninformative: [ 0.029853] startup: read error [ 0.040507] startup: -- System halted Improve these messages to make it clear that the error originates from the decompression code. Additionally, on decompression failures, if bootdebug is enabled, dump the message ring buffer before halting. This provides more context for diagnosing startup issues. Signed-off-by: Vasily Gorbik Acked-by: Heiko Carstens Signed-off-by: Alexander Gordeev --- arch/s390/boot/decompressor.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/s390/boot/decompressor.c b/arch/s390/boot/decompressor.c index f478e8e9cbda4..03500b9d9fb9a 100644 --- a/arch/s390/boot/decompressor.c +++ b/arch/s390/boot/decompressor.c @@ -9,6 +9,7 @@ #include #include +#include #include #include "decompressor.h" #include "boot.h" @@ -63,6 +64,15 @@ static unsigned long free_mem_end_ptr = (unsigned long) _end + BOOT_HEAP_SIZE; #include "../../../../lib/decompress_unzstd.c" #endif +static void decompress_error(char *m) +{ + if (bootdebug) + boot_rb_dump(); + boot_emerg("Decompression error: %s\n", m); + boot_emerg(" -- System halted\n"); + disabled_wait(); +} + unsigned long mem_safe_offset(void) { return ALIGN(free_mem_end_ptr, PAGE_SIZE); @@ -71,5 +81,5 @@ unsigned long mem_safe_offset(void) void deploy_kernel(void *output) { __decompress(_compressed_start, _compressed_end - _compressed_start, - NULL, NULL, output, vmlinux.image_size, NULL, error); + NULL, NULL, output, vmlinux.image_size, NULL, decompress_error); }