RE: [PATCH printk-rework 09/14] printk: introduce a kmsg_dump iterator

From: Michael Kelley
Date: Fri Feb 19 2021 - 11:51:25 EST


From: John Ogness <john.ogness@xxxxxxxxxxxxx> Sent: Thursday, February 18, 2021 12:18 AM
>
> Rather than store the iterator information into the registered
> kmsg_dump structure, create a separate iterator structure. The
> kmsg_dump_iter structure can reside on the stack of the caller,
> thus allowing lockless use of the kmsg_dump functions.
>
> This is in preparation for removal of @logbuf_lock.
>
> Signed-off-by: John Ogness <john.ogness@xxxxxxxxxxxxx>
> ---
> arch/powerpc/kernel/nvram_64.c | 12 ++--
> arch/powerpc/platforms/powernv/opal-kmsg.c | 3 +-
> arch/powerpc/xmon/xmon.c | 6 +-
> arch/um/kernel/kmsg_dump.c | 5 +-
> drivers/hv/vmbus_drv.c | 5 +-
> drivers/mtd/mtdoops.c | 5 +-
> fs/pstore/platform.c | 5 +-
> include/linux/kmsg_dump.h | 43 +++++++-------
> kernel/debug/kdb/kdb_main.c | 10 ++--
> kernel/printk/printk.c | 65 +++++++++++-----------
> 10 files changed, 84 insertions(+), 75 deletions(-)
>

[snip]

> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 4fad3e6745e5..fbeddef90941 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -1359,7 +1359,8 @@ static void vmbus_isr(void)
> * buffer and call into Hyper-V to transfer the data.
> */
> static void hv_kmsg_dump(struct kmsg_dumper *dumper,
> - enum kmsg_dump_reason reason)
> + enum kmsg_dump_reason reason,
> + struct kmsg_dumper_iter *iter)
> {
> size_t bytes_written;
> phys_addr_t panic_pa;
> @@ -1374,7 +1375,7 @@ 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_get_buffer(iter, false, hv_panic_page, HV_HYP_PAGE_SIZE,
> &bytes_written);
> if (bytes_written)
> hyperv_report_panic_msg(panic_pa, bytes_written);

For the Hyper-V portion,

Reviewed-by: Michael Kelley <mikelley@xxxxxxxxxxxxx>