Loading arch/powerpc/kernel/nvram_64.c +5 −3 Original line number Diff line number Diff line Loading @@ -647,6 +647,7 @@ static void oops_to_nvram(struct kmsg_dumper *dumper, { struct oops_log_info *oops_hdr = (struct oops_log_info *)oops_buf; static unsigned int oops_count = 0; static struct kmsg_dump_iter iter; static bool panicking = false; static DEFINE_SPINLOCK(lock); unsigned long flags; Loading Loading @@ -681,13 +682,14 @@ static void oops_to_nvram(struct kmsg_dumper *dumper, return; if (big_oops_buf) { kmsg_dump_get_buffer(dumper, false, kmsg_dump_rewind(&iter); kmsg_dump_get_buffer(&iter, false, big_oops_buf, big_oops_buf_sz, &text_len); rc = zip_oops(text_len); } if (rc != 0) { kmsg_dump_rewind(dumper); kmsg_dump_get_buffer(dumper, false, kmsg_dump_rewind(&iter); kmsg_dump_get_buffer(&iter, false, oops_data, oops_data_sz, &text_len); err_type = ERR_TYPE_KERNEL_PANIC; oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION); Loading arch/powerpc/xmon/xmon.c +3 −3 Original line number Diff line number Diff line Loading @@ -3005,7 +3005,7 @@ print_address(unsigned long addr) static void dump_log_buf(void) { struct kmsg_dumper dumper = { .active = 1 }; struct kmsg_dump_iter iter; unsigned char buf[128]; size_t len; Loading @@ -3017,9 +3017,9 @@ dump_log_buf(void) catch_memory_errors = 1; sync(); kmsg_dump_rewind_nolock(&dumper); kmsg_dump_rewind(&iter); xmon_start_pagination(); while (kmsg_dump_get_line_nolock(&dumper, false, buf, sizeof(buf), &len)) { while (kmsg_dump_get_line(&iter, false, buf, sizeof(buf), &len)) { buf[len] = '\0'; printf("%s", buf); } Loading arch/um/kernel/kmsg_dump.c +12 −1 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0 #include <linux/kmsg_dump.h> #include <linux/spinlock.h> #include <linux/console.h> #include <linux/string.h> #include <shared/init.h> Loading @@ -9,8 +10,11 @@ static void kmsg_dumper_stdout(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason) { static struct kmsg_dump_iter iter; static DEFINE_SPINLOCK(lock); static char line[1024]; struct console *con; unsigned long flags; size_t len = 0; /* only dump kmsg when no console is available */ Loading @@ -29,11 +33,18 @@ static void kmsg_dumper_stdout(struct kmsg_dumper *dumper, if (con) return; if (!spin_trylock_irqsave(&lock, flags)) return; kmsg_dump_rewind(&iter); printf("kmsg_dump:\n"); while (kmsg_dump_get_line(dumper, true, line, sizeof(line), &len)) { while (kmsg_dump_get_line(&iter, true, line, sizeof(line), &len)) { line[len] = '\0'; printf("%s", line); } spin_unlock_irqrestore(&lock, flags); } static struct kmsg_dumper kmsg_dumper = { Loading drivers/hv/vmbus_drv.c +3 −1 Original line number Diff line number Diff line Loading @@ -1391,6 +1391,7 @@ static void vmbus_isr(void) static void hv_kmsg_dump(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason) { struct kmsg_dump_iter iter; size_t bytes_written; phys_addr_t panic_pa; Loading @@ -1404,7 +1405,8 @@ static void hv_kmsg_dump(struct kmsg_dumper *dumper, * Write dump contents to the page. No need to synchronize; panic should * be single-threaded. */ kmsg_dump_get_buffer(dumper, false, hv_panic_page, HV_HYP_PAGE_SIZE, kmsg_dump_rewind(&iter); kmsg_dump_get_buffer(&iter, false, hv_panic_page, HV_HYP_PAGE_SIZE, &bytes_written); if (bytes_written) hyperv_report_panic_msg(panic_pa, bytes_written); Loading drivers/mtd/mtdoops.c +15 −2 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ static struct mtdoops_context { int nextcount; unsigned long *oops_page_used; unsigned long oops_buf_busy; void *oops_buf; } oops_cxt; Loading Loading @@ -180,6 +181,9 @@ static void mtdoops_write(struct mtdoops_context *cxt, int panic) u32 *hdr; int ret; if (test_and_set_bit(0, &cxt->oops_buf_busy)) return; /* Add mtdoops header to the buffer */ hdr = cxt->oops_buf; hdr[0] = cxt->nextcount; Loading @@ -190,7 +194,7 @@ static void mtdoops_write(struct mtdoops_context *cxt, int panic) record_size, &retlen, cxt->oops_buf); if (ret == -EOPNOTSUPP) { printk(KERN_ERR "mtdoops: Cannot write from panic without panic_write\n"); return; goto out; } } else ret = mtd_write(mtd, cxt->nextpage * record_size, Loading @@ -203,6 +207,8 @@ static void mtdoops_write(struct mtdoops_context *cxt, int panic) memset(cxt->oops_buf, 0xff, record_size); mtdoops_inc_counter(cxt); out: clear_bit(0, &cxt->oops_buf_busy); } static void mtdoops_workfunc_write(struct work_struct *work) Loading Loading @@ -271,13 +277,19 @@ static void mtdoops_do_dump(struct kmsg_dumper *dumper, { struct mtdoops_context *cxt = container_of(dumper, struct mtdoops_context, dump); struct kmsg_dump_iter iter; /* Only dump oopses if dump_oops is set */ if (reason == KMSG_DUMP_OOPS && !dump_oops) return; kmsg_dump_get_buffer(dumper, true, cxt->oops_buf + MTDOOPS_HEADER_SIZE, kmsg_dump_rewind(&iter); if (test_and_set_bit(0, &cxt->oops_buf_busy)) return; kmsg_dump_get_buffer(&iter, true, cxt->oops_buf + MTDOOPS_HEADER_SIZE, record_size - MTDOOPS_HEADER_SIZE, NULL); clear_bit(0, &cxt->oops_buf_busy); if (reason != KMSG_DUMP_OOPS) { /* Panics must be written immediately */ Loading Loading @@ -394,6 +406,7 @@ static int __init mtdoops_init(void) return -ENOMEM; } memset(cxt->oops_buf, 0xff, record_size); cxt->oops_buf_busy = 0; INIT_WORK(&cxt->work_erase, mtdoops_workfunc_erase); INIT_WORK(&cxt->work_write, mtdoops_workfunc_write); Loading Loading
arch/powerpc/kernel/nvram_64.c +5 −3 Original line number Diff line number Diff line Loading @@ -647,6 +647,7 @@ static void oops_to_nvram(struct kmsg_dumper *dumper, { struct oops_log_info *oops_hdr = (struct oops_log_info *)oops_buf; static unsigned int oops_count = 0; static struct kmsg_dump_iter iter; static bool panicking = false; static DEFINE_SPINLOCK(lock); unsigned long flags; Loading Loading @@ -681,13 +682,14 @@ static void oops_to_nvram(struct kmsg_dumper *dumper, return; if (big_oops_buf) { kmsg_dump_get_buffer(dumper, false, kmsg_dump_rewind(&iter); kmsg_dump_get_buffer(&iter, false, big_oops_buf, big_oops_buf_sz, &text_len); rc = zip_oops(text_len); } if (rc != 0) { kmsg_dump_rewind(dumper); kmsg_dump_get_buffer(dumper, false, kmsg_dump_rewind(&iter); kmsg_dump_get_buffer(&iter, false, oops_data, oops_data_sz, &text_len); err_type = ERR_TYPE_KERNEL_PANIC; oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION); Loading
arch/powerpc/xmon/xmon.c +3 −3 Original line number Diff line number Diff line Loading @@ -3005,7 +3005,7 @@ print_address(unsigned long addr) static void dump_log_buf(void) { struct kmsg_dumper dumper = { .active = 1 }; struct kmsg_dump_iter iter; unsigned char buf[128]; size_t len; Loading @@ -3017,9 +3017,9 @@ dump_log_buf(void) catch_memory_errors = 1; sync(); kmsg_dump_rewind_nolock(&dumper); kmsg_dump_rewind(&iter); xmon_start_pagination(); while (kmsg_dump_get_line_nolock(&dumper, false, buf, sizeof(buf), &len)) { while (kmsg_dump_get_line(&iter, false, buf, sizeof(buf), &len)) { buf[len] = '\0'; printf("%s", buf); } Loading
arch/um/kernel/kmsg_dump.c +12 −1 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0 #include <linux/kmsg_dump.h> #include <linux/spinlock.h> #include <linux/console.h> #include <linux/string.h> #include <shared/init.h> Loading @@ -9,8 +10,11 @@ static void kmsg_dumper_stdout(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason) { static struct kmsg_dump_iter iter; static DEFINE_SPINLOCK(lock); static char line[1024]; struct console *con; unsigned long flags; size_t len = 0; /* only dump kmsg when no console is available */ Loading @@ -29,11 +33,18 @@ static void kmsg_dumper_stdout(struct kmsg_dumper *dumper, if (con) return; if (!spin_trylock_irqsave(&lock, flags)) return; kmsg_dump_rewind(&iter); printf("kmsg_dump:\n"); while (kmsg_dump_get_line(dumper, true, line, sizeof(line), &len)) { while (kmsg_dump_get_line(&iter, true, line, sizeof(line), &len)) { line[len] = '\0'; printf("%s", line); } spin_unlock_irqrestore(&lock, flags); } static struct kmsg_dumper kmsg_dumper = { Loading
drivers/hv/vmbus_drv.c +3 −1 Original line number Diff line number Diff line Loading @@ -1391,6 +1391,7 @@ static void vmbus_isr(void) static void hv_kmsg_dump(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason) { struct kmsg_dump_iter iter; size_t bytes_written; phys_addr_t panic_pa; Loading @@ -1404,7 +1405,8 @@ static void hv_kmsg_dump(struct kmsg_dumper *dumper, * Write dump contents to the page. No need to synchronize; panic should * be single-threaded. */ kmsg_dump_get_buffer(dumper, false, hv_panic_page, HV_HYP_PAGE_SIZE, kmsg_dump_rewind(&iter); kmsg_dump_get_buffer(&iter, false, hv_panic_page, HV_HYP_PAGE_SIZE, &bytes_written); if (bytes_written) hyperv_report_panic_msg(panic_pa, bytes_written); Loading
drivers/mtd/mtdoops.c +15 −2 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ static struct mtdoops_context { int nextcount; unsigned long *oops_page_used; unsigned long oops_buf_busy; void *oops_buf; } oops_cxt; Loading Loading @@ -180,6 +181,9 @@ static void mtdoops_write(struct mtdoops_context *cxt, int panic) u32 *hdr; int ret; if (test_and_set_bit(0, &cxt->oops_buf_busy)) return; /* Add mtdoops header to the buffer */ hdr = cxt->oops_buf; hdr[0] = cxt->nextcount; Loading @@ -190,7 +194,7 @@ static void mtdoops_write(struct mtdoops_context *cxt, int panic) record_size, &retlen, cxt->oops_buf); if (ret == -EOPNOTSUPP) { printk(KERN_ERR "mtdoops: Cannot write from panic without panic_write\n"); return; goto out; } } else ret = mtd_write(mtd, cxt->nextpage * record_size, Loading @@ -203,6 +207,8 @@ static void mtdoops_write(struct mtdoops_context *cxt, int panic) memset(cxt->oops_buf, 0xff, record_size); mtdoops_inc_counter(cxt); out: clear_bit(0, &cxt->oops_buf_busy); } static void mtdoops_workfunc_write(struct work_struct *work) Loading Loading @@ -271,13 +277,19 @@ static void mtdoops_do_dump(struct kmsg_dumper *dumper, { struct mtdoops_context *cxt = container_of(dumper, struct mtdoops_context, dump); struct kmsg_dump_iter iter; /* Only dump oopses if dump_oops is set */ if (reason == KMSG_DUMP_OOPS && !dump_oops) return; kmsg_dump_get_buffer(dumper, true, cxt->oops_buf + MTDOOPS_HEADER_SIZE, kmsg_dump_rewind(&iter); if (test_and_set_bit(0, &cxt->oops_buf_busy)) return; kmsg_dump_get_buffer(&iter, true, cxt->oops_buf + MTDOOPS_HEADER_SIZE, record_size - MTDOOPS_HEADER_SIZE, NULL); clear_bit(0, &cxt->oops_buf_busy); if (reason != KMSG_DUMP_OOPS) { /* Panics must be written immediately */ Loading Loading @@ -394,6 +406,7 @@ static int __init mtdoops_init(void) return -ENOMEM; } memset(cxt->oops_buf, 0xff, record_size); cxt->oops_buf_busy = 0; INIT_WORK(&cxt->work_erase, mtdoops_workfunc_erase); INIT_WORK(&cxt->work_write, mtdoops_workfunc_write); Loading