Skip to content

RFC printk: new ringbuffer implementation

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 RFC Latest3 patches 30 repliesIn review
  2. v4 RFC9 patches 120 repliesSuperseded
  3. v3 RFC2 patches 1 replySuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v2 RFC2 patches51 repliesSuperseded
v1 RFC25 patches121 repliesSuperseded

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3printk-rb: new printk ringbuffer implementation (writer)kernel/printk/printk_ringbuffer.c kernel/printk/printk_ringbuffer.h+915 -018 replies
2/3printk-rb: new printk ringbuffer implementation (reader)kernel/printk/printk_ringbuffer.c kernel/printk/printk_ringbuffer.h+245 -17 replies
3/3printk-rb: add test modulekernel/printk/Makefile kernel/printk/test_prb.c+350 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [RFC PATCH v5 0/3] printk: new ringbuffer implementation

Hello,

This is a follow-up RFC on the work to re-implement much of the core of printk. The threads for the previous RFC versions are here[0][1][2][3].

This RFC includes only the ringbuffer and a test module. This is a rewrite of the proposed ringbuffer, now based on the proof of concept[4] from Petr Mladek as agreed at the meeting[5] during LPC2019 in Lisbon.

The internal structure has been reworked such that the printk strings are in their own array, each separated by a 32-bit integer.

A 2nd array contains the dictionary strings (also with each separated by a 32-bit integer).

A 3rd array is made up of descriptors that contain all the meta-data for each printk record (sequence number, timestamp, loglevel, caller, etc.) as well as pointers into the other data arrays for the text and dictionary data.

The writer interface is somewhat similar to v4, but the reader interface has changed significantly. Rather than using an iterator object, readers just specify the sequence number they want to read. In effect, the sequence number acts as the iterator.

I have been communicating with Petr the last couple months to make sure this implementation fits his expectations. This RFC is mainly to get some feedback from anyone else that may see something that Petr and I have missed.

This series also includes my test module. On a 16-core ARM64 test machine, the module runs without any errors. I am seeing the 15 writing cores each writing about 34500 records per second, while the 1 reading core misses only about 15% of the total records.

John Ogness

[0] https://lkml.kernel.org/r/[email protected]
[1] https://lkml.kernel.org/r/[email protected]
[2] https://lkml.kernel.org/r/[email protected]
[3] https://lkml.kernel.org/r/[email protected]
[4] https://lkml.kernel.org/r/[email protected]
[5] https://lkml.kernel.org/r/[email protected]

John Ogness (3):
printk-rb: new printk ringbuffer implementation (writer)
printk-rb: new printk ringbuffer implementation (reader)
printk-rb: add test module

 kernel/printk/Makefile            |   3 +
 kernel/printk/printk_ringbuffer.c | 910 ++++++++++++++++++++++++++++++
 kernel/printk/printk_ringbuffer.h | 249 ++++++++
 kernel/printk/test_prb.c          | 347 ++++++++++++
 4 files changed, 1509 insertions(+)
 create mode 100644 kernel/printk/printk_ringbuffer.c
 create mode 100644 kernel/printk/printk_ringbuffer.h
 create mode 100644 kernel/printk/test_prb.c
Signature · 1 line
2.20.1