Skip to content

printk: reimplement LOG_CONT handling

John Ogness kexec lkml 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest6 patches 5 repliesIn review
  2. v46 patches 4 repliesSuperseded
  3. v38 patches 8 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v27 patches14 repliesSuperseded
v14 patches35 repliesSuperseded

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6printk: ringbuffer: relocate get_data()kernel/printk/printk_ringbuffer.c+58 -580 replies
2/6printk: ringbuffer: add BLK_DATALESS() macrokernel/printk/printk_ringbuffer.c+4 -20 replies
3/6printk: ringbuffer: clear initial reserved fieldskernel/printk/printk.c kernel/printk/printk_ringbuffer.c+26 -160 replies
4/6printk: ringbuffer: change representation of statesDocumentation/admin-guide/kdump/gdbmacros.txt kernel/printk/printk_ringbuffer.c kernel/printk/printk_ringbuffer.h +1 more+41 -410 replies
5/6printk: ringbuffer: add finalization/extension supportDocumentation/admin-guide/kdump/gdbmacros.txt kernel/printk/printk_ringbuffer.c kernel/printk/printk_ringbuffer.h +1 more+480 -571 reply
6/6printk: reimplement log_cont using record extensionkernel/printk/printk.c+20 -783 replies

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchPetr Mladek
1/6R-b
2/6R-b
3/6R-b
4/6R-b
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH printk v5 0/6] printk: reimplement LOG_CONT handling

Hello,

Here is v5 for the second series to rework the printk subsystem. (The v4 is here [0].) This series implements a new ringbuffer feature that allows the last record to be extended. Petr Mladek provided the initial proof of concept [1] for this.

Using the record extension feature, LOG_CONT is re-implemented in a way that exactly preserves its behavior, but avoids the need for an extra buffer. In particular, it avoids the need for any synchronization that such a buffer requires.

This series deviates from the agreements [2] made at the meeting during LPC2019 in Lisbon. The test results of the v1 series, which implemented LOG_CONT as agreed upon, showed that the effects on existing userspace tools using /dev/kmsg (journalctl, dmesg) were not acceptable [3].

Patch 5 introduces *four* new memory barrier pairs. Two of them are insignificant additions (data_realloc:A/desc_read:D and data_realloc:A/data_push_tail:B) because they are alternate path memory barriers that exactly match the purpose and context of the two existing memory barrier pairs they provide an alternate path for. The other two new memory barrier pairs are significant additions:

desc_reopen_last:A / _prb_commit:B - When reopening a descriptor,
ensure the state transitions back to desc_reserved before fully trusting the descriptor data.

_prb_commit:B / desc_reserve:D - When committing a descriptor,
ensure the state transitions to desc_committed before checking the head ID to see if the descriptor needs to be finalized.

The test module used to test the ringbuffer is available here [4].

The series is based on the printk-rework branch of the printk git tree:

e60768311af8 ("scripts/gdb: update for lockless printk ringbuffer")

The list of changes since v4:

printk_ringbuffer
=================

- desc_read(): revert setting @state_var when inconsistent (a separate series [5] is addressing this bug)

- desc_reserve(): use DESC_SV() when setting reserved

- data_realloc(): also do nothing if the size is the same

- prb_reserve_in_last(): adjust dataless checks/warnings to match the non-dataless case

- prb_reserve_in_last(): fix length modifier in warnings

- change comments about "state flags" to just talk about "states"

John Ogness

[0] https://lkml.kernel.org/r/[email protected]
[1] https://lkml.kernel.org/r/20200812163908.GH12903@alley
[2] https://lkml.kernel.org/r/[email protected]
[3] https://lkml.kernel.org/r/20200811160551.GC12903@alley
[4] https://github.com/Linutronix/prb-test.git
[5] https://lkml.kernel.org/r/[email protected]

John Ogness (6):
printk: ringbuffer: relocate get_data()
printk: ringbuffer: add BLK_DATALESS() macro
printk: ringbuffer: clear initial reserved fields
printk: ringbuffer: change representation of states
printk: ringbuffer: add finalization/extension support
printk: reimplement log_cont using record extension

 Documentation/admin-guide/kdump/gdbmacros.txt |  13 +-
 kernel/printk/printk.c                        | 110 +--
 kernel/printk/printk_ringbuffer.c             | 683 ++++++++++++++----
 kernel/printk/printk_ringbuffer.h             |  35 +-
 scripts/gdb/linux/dmesg.py                    |  12 +-
 5 files changed, 615 insertions(+), 238 deletions(-)
Signature · 7 lines
2.20.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec