Skip to content

Commit 5f6c764

Browse files
jognesspmladek
authored andcommitted
printk: kmsg_dumper: remove @Active field
All 6 kmsg_dumpers do not benefit from the @Active flag: (provide their own synchronization) - arch/powerpc/kernel/nvram_64.c - arch/um/kernel/kmsg_dump.c - drivers/mtd/mtdoops.c - fs/pstore/platform.c (only dump on KMSG_DUMP_PANIC, which does not require synchronization) - arch/powerpc/platforms/powernv/opal-kmsg.c - drivers/hv/vmbus_drv.c The other 2 kmsg_dump users also do not rely on @Active: (hard-code @Active to always be true) - arch/powerpc/xmon/xmon.c - kernel/debug/kdb/kdb_main.c Therefore, @Active can be removed. Signed-off-by: John Ogness <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 636babd commit 5f6c764

File tree

4 files changed

+3
-13
lines changed

4 files changed

+3
-13
lines changed

arch/powerpc/xmon/xmon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3005,7 +3005,7 @@ print_address(unsigned long addr)
30053005
static void
30063006
dump_log_buf(void)
30073007
{
3008-
struct kmsg_dumper dumper = { .active = 1 };
3008+
struct kmsg_dumper dumper;
30093009
unsigned char buf[128];
30103010
size_t len;
30113011

include/linux/kmsg_dump.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,13 @@ enum kmsg_dump_reason {
3636
* through the record iterator
3737
* @max_reason: filter for highest reason number that should be dumped
3838
* @registered: Flag that specifies if this is already registered
39-
* @active: Flag that specifies if this is currently dumping
4039
* @cur_seq: Points to the oldest message to dump
4140
* @next_seq: Points after the newest message to dump
4241
*/
4342
struct kmsg_dumper {
4443
struct list_head list;
4544
void (*dump)(struct kmsg_dumper *dumper, enum kmsg_dump_reason reason);
4645
enum kmsg_dump_reason max_reason;
47-
bool active;
4846
bool registered;
4947

5048
/* private state of the kmsg iterator */

kernel/debug/kdb/kdb_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2101,7 +2101,7 @@ static int kdb_dmesg(int argc, const char **argv)
21012101
int adjust = 0;
21022102
int n = 0;
21032103
int skip = 0;
2104-
struct kmsg_dumper dumper = { .active = 1 };
2104+
struct kmsg_dumper dumper;
21052105
size_t len;
21062106
char buf[201];
21072107

kernel/printk/printk.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3408,18 +3408,13 @@ void kmsg_dump(enum kmsg_dump_reason reason)
34083408
continue;
34093409

34103410
/* initialize iterator with data about the stored records */
3411-
dumper->active = true;
3412-
34133411
logbuf_lock_irqsave(flags);
34143412
dumper->cur_seq = latched_seq_read_nolock(&clear_seq);
34153413
dumper->next_seq = prb_next_seq(prb);
34163414
logbuf_unlock_irqrestore(flags);
34173415

34183416
/* invoke dumper which will iterate over records */
34193417
dumper->dump(dumper, reason);
3420-
3421-
/* reset iterator */
3422-
dumper->active = false;
34233418
}
34243419
rcu_read_unlock();
34253420
}
@@ -3454,9 +3449,6 @@ bool kmsg_dump_get_line_nolock(struct kmsg_dumper *dumper, bool syslog,
34543449

34553450
prb_rec_init_rd(&r, &info, line, size);
34563451

3457-
if (!dumper->active)
3458-
goto out;
3459-
34603452
/* Read text or count text lines? */
34613453
if (line) {
34623454
if (!prb_read_valid(prb, dumper->cur_seq, &r))
@@ -3542,7 +3534,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
35423534
bool ret = false;
35433535
bool time = printk_time;
35443536

3545-
if (!dumper->active || !buf || !size)
3537+
if (!buf || !size)
35463538
goto out;
35473539

35483540
logbuf_lock_irqsave(flags);

0 commit comments

Comments
 (0)