Skip to content

Commit 4cfc725

Browse files
jognesspmladek
authored andcommitted
printk: ringbuffer: add finalization/extension support
Add support for extending the newest data block. For this, introduce a new finalization state (desc_finalized) denoting a committed descriptor that cannot be extended. Until a record is finalized, a writer can reopen that record to append new data. Reopening a record means transitioning from the desc_committed state back to the desc_reserved state. A writer can explicitly finalize a record if there is no intention of extending it. Also, records are automatically finalized when a new record is reserved. This relieves writers of needing to explicitly finalize while also making such records available to readers sooner. (Readers can only traverse finalized records.) Four new memory barrier pairs are introduced. 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, pairing, 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. Signed-off-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20200914123354.832-6-john.ogness@linutronix.de
1 parent 10dcb06 commit 4cfc725

4 files changed

Lines changed: 480 additions & 57 deletions

File tree

‎Documentation/admin-guide/kdump/gdbmacros.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ end
297297
define dmesg
298298
# definitions from kernel/printk/printk_ringbuffer.h
299299
set var $desc_committed = 1
300+
set var $desc_finalized = 2
300301
set var $desc_sv_bits = sizeof(long) * 8
301302
set var $desc_flags_shift = $desc_sv_bits - 2
302303
set var $desc_flags_mask = 3 << $desc_flags_shift
@@ -313,7 +314,7 @@ define dmesg
313314

314315
# skip non-committed record
315316
set var $state = 3 & ($desc->state_var.counter >> $desc_flags_shift)
316-
if ($state == $desc_committed)
317+
if ($state == $desc_committed || $state == $desc_finalized)
317318
dump_record $desc $prev_flags
318319
set var $prev_flags = $desc->info.flags
319320
end

0 commit comments

Comments
 (0)