Skip to content

Commit

Permalink
s390/boot: Improve decompression error reporting
Browse files Browse the repository at this point in the history
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 <gor@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
  • Loading branch information
Vasily Gorbik authored and Alexander Gordeev committed Jan 26, 2025
1 parent ec6f9f7 commit 9af310e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion arch/s390/boot/decompressor.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <linux/kernel.h>
#include <linux/string.h>
#include <asm/boot_data.h>
#include <asm/page.h>
#include "decompressor.h"
#include "boot.h"
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}

0 comments on commit 9af310e

Please sign in to comment.