Skip to content

Commit bf56987

Browse files
rdmsrpmladek
authored andcommitted
printk: ringbuffer: fix errors in comments
The printk ringbuffer implementation is described in the comment as using three ringbuffers, but the current implementation uses two (desc and data). Update the comment so it matches the code. Fix few more known issues in the comments. Signed-off-by: Loïc Grégoire <[email protected]> Reviewed-by: John Ogness <[email protected]> Link: https://patch.msgid.link/[email protected] [[email protected]: Fixed few more issues in the comments by John Ogness.] Signed-off-by: John Ogness <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Signed-off-by: Petr Mladek <[email protected]>
1 parent 407f666 commit bf56987

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

kernel/printk/printk_ringbuffer.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* Data Structure
1616
* --------------
17-
* The printk_ringbuffer is made up of 3 internal ringbuffers:
17+
* The printk_ringbuffer is made up of 2 internal ringbuffers:
1818
*
1919
* desc_ring
2020
* A ring of descriptors and their meta data (such as sequence number,
@@ -224,7 +224,7 @@
224224
*
225225
* prb_rec_init_rd(&r, &info, &text_buf[0], sizeof(text_buf));
226226
*
227-
* prb_for_each_record(0, &test_rb, &seq, &r) {
227+
* prb_for_each_record(0, &test_rb, seq, &r) {
228228
* if (info.seq != seq)
229229
* pr_warn("lost %llu records\n", info.seq - seq);
230230
*
@@ -1368,7 +1368,7 @@ static struct prb_desc *desc_reopen_last(struct prb_desc_ring *desc_ring,
13681368
*
13691369
* WMB from _prb_commit:A to _prb_commit:B
13701370
* matching
1371-
* MB If desc_reopen_last:A to prb_reserve_in_last:A
1371+
* MB from desc_reopen_last:A to prb_reserve_in_last:A
13721372
*/
13731373
if (!atomic_long_try_cmpxchg(&d->state_var, &prev_state_val,
13741374
DESC_SV(id, desc_reserved))) { /* LMM(desc_reopen_last:A) */
@@ -1773,9 +1773,9 @@ static void _prb_commit(struct prb_reserved_entry *e, unsigned long state_val)
17731773
*
17741774
* Relies on:
17751775
*
1776-
* MB _prb_commit:B to prb_commit:A
1776+
* MB from _prb_commit:B to prb_commit:A
17771777
* matching
1778-
* MB desc_reserve:D to desc_make_final:A
1778+
* MB from desc_reserve:D to desc_make_final:A
17791779
*/
17801780
if (!atomic_long_try_cmpxchg(&d->state_var, &prev_state_val,
17811781
DESC_SV(e->id, state_val))) { /* LMM(_prb_commit:B) */
@@ -2038,7 +2038,7 @@ u64 prb_first_seq(struct printk_ringbuffer *rb)
20382038
*
20392039
* MB from desc_push_tail:B to desc_reserve:F
20402040
* matching
2041-
* RMB prb_first_seq:B to prb_first_seq:A
2041+
* RMB from prb_first_seq:B to prb_first_seq:A
20422042
*/
20432043
smp_rmb(); /* LMM(prb_first_seq:C) */
20442044
}

kernel/printk/printk_ringbuffer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ for ((s) = from; prb_read_valid(rb, s, r); (s) = (r)->info->seq + 1)
383383
*
384384
* This is a macro for conveniently iterating over a ringbuffer.
385385
* Note that @s may not be the sequence number of the record on each
386-
* iteration. For the sequence number, @r->info->seq should be checked.
386+
* iteration. For the sequence number, @i->seq should be checked.
387387
*
388388
* Context: Any context.
389389
*/

0 commit comments

Comments
 (0)