[PATCH v3 0/3] printk: replace ringbuffer
From: John Ogness
Date: Thu Jun 18 2020 - 10:49:50 EST
Hello,
Here is a v3 for the first series to rework the printk
subsystem. The v2 and history are here [0]. This first series
only replaces the existing ringbuffer implementation. No locking
is removed. No semantics/behavior of printk are changed.
Reviews on the ringbuffer are still ongoing, but I was asked to
post this new version since several changes from v2 have been
already agreed upon.
The series is based on v5.8-rc1.
The list of changes since v2:
printk.c
========
- console_unlock(): fix extended console printing [1]
printk_ringbuffer
=================
- data_push_tail(): fixed handling when another CPU already
pushed the tail [2]
- desc_push_tail(): added a full memory barrier before the
descriptor tail push [3]
- data_make_reusable()/data_alloc(): changed block ID
reading/writing from READ_ONCE()/WRITE_ONCE() to regular
assignments [4]
- data_make_reusable(): removed unnecessary data tail
re-check [5]
- general: folded all smp_mb() and smp_wmb() calls into their
neighboring cmpxchg_relaxed(), changing them to full cmpxchg()
calls [6]
- desc_read(): changed descriptor content reading from
READ_ONCE() to memcpy() since it served no purpose for the
legal data race
- general: cleaned up memory barrier comments; in particular
made sure that the reader and writer sides of the memory
barrier pairs match in their descriptions
- added a new section in the memory barrier documentation (near
the top of printk_ringbuffer.c) that lists all 10 memory
barrier pairs and briefly describes what they are ordering
- _prb_read_valid(): changed the helper function to static
- general: changed block size argument type from "unsigned long"
to "unsigned int" since a record's *_buf_size fields are of
type "unsigned int"
- general: allow some lines to go beyond 80 characters
John Ogness
[0] https://lkml.kernel.org/r/20200501094010.17694-1-john.ogness@xxxxxxxxxxxxx
[1] https://lkml.kernel.org/r/87ftcd86d2.fsf@xxxxxxxxxxxxxxxxxxxx
[2] https://lkml.kernel.org/r/87v9ktcs3q.fsf@xxxxxxxxxxxxxxxxxxxx
[3] https://lkml.kernel.org/r/87bllpyzgr.fsf@xxxxxxxxxxxxxxxxxxxx
[4] https://lkml.kernel.org/r/87tuzkuxtw.fsf@xxxxxxxxxxxxxxxxxxxx
[5] https://lkml.kernel.org/r/87pna5mjtp.fsf@xxxxxxxxxxxxxxxxxxxx
John Ogness (3):
crash: add VMCOREINFO macro to define offset in a struct declared by
typedef
printk: add lockless ringbuffer
printk: use the lockless ringbuffer
include/linux/crash_core.h | 3 +
include/linux/kmsg_dump.h | 2 -
kernel/printk/Makefile | 1 +
kernel/printk/printk.c | 944 ++++++++--------
kernel/printk/printk_ringbuffer.c | 1674 +++++++++++++++++++++++++++++
kernel/printk/printk_ringbuffer.h | 352 ++++++
6 files changed, 2527 insertions(+), 449 deletions(-)
create mode 100644 kernel/printk/printk_ringbuffer.c
create mode 100644 kernel/printk/printk_ringbuffer.h
--
2.20.1