From c3821f08213fcb06e34bd2d308c95fcb7e6f74e5 Mon Sep 17 00:00:00 2001 From: Mikhail Zaslonko Date: Tue, 10 Apr 2018 16:01:19 +0200 Subject: [PATCH] zipl: Update progress_print() function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adjust progress_print() function to print dump progress message based on the time interval thus printing the message with a regular rate. Signed-off-by: Mikhail Zaslonko Signed-off-by: Jan Höppner --- zipl/boot/stage2dump.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/zipl/boot/stage2dump.c b/zipl/boot/stage2dump.c index 7161dc01..4fa3d153 100644 --- a/zipl/boot/stage2dump.c +++ b/zipl/boot/stage2dump.c @@ -22,8 +22,6 @@ * Static globals */ static uint8_t machine_has_vx; -static unsigned long progress_next_addr; -static unsigned long progress_inc = 0x20000000; /* Issue message each 512M */ /* * IPL info in lowcore @@ -62,29 +60,26 @@ static void init_early(void) machine_has_vx = 1; } -/* - - * Init dump progress messages to sclp console - * - * 8 messages if the memory is 4G or less, otherwise one message for each - * 512M chunk of dumped memory - */ -static void progress_init(void) -{ - if (dump_hdr->mem_size <= (4 * 1024 * 1024 * 1024ULL)) - progress_inc = dump_hdr->mem_size >> 3; - progress_next_addr = progress_inc; -} - /* * Print progress message */ void progress_print(unsigned long addr) { - if (addr < progress_next_addr && addr != dump_hdr->mem_size) + /* Print a message approximately every 5 sec */ + static unsigned long delta = 5 * (1UL << 32); + static unsigned long next; + unsigned long time = get_tod_clock(); + + if (next == 0) { + next = time + delta; return; - printf("%08lu / %08lu MB", addr >> 20, dump_hdr->mem_size >> 20); - progress_next_addr += progress_inc; + } + if (time < next && addr != dump_hdr->mem_size) + return; + + printf("%08lu / %08lu MB (Dump file size %08lu MB)", addr >> 20, + dump_hdr->mem_size >> 20, total_dump_size >> 20); + next = time + delta; } /* @@ -434,7 +429,6 @@ void start(void) printf("Dumping 64 bit OS"); mem_and_cpu_init(); store_status(); - progress_init(); dt_dump_mem(); printf("Dump successful"); dump_exit(0);