Skip to content

Commit 9f0844d

Browse files
jognesspmladek
authored andcommitted
printk: get caller_id/timestamp after migration disable
Currently the local CPU timestamp and caller_id for the record are collected while migration is enabled. Since this information is CPU-specific, it should be collected with migration disabled. Migration is disabled immediately after collecting this information anyway, so just move the information collection to after the migration disabling. Signed-off-by: John Ogness <[email protected]> Reviewed-by: Sergey Senozhatsky <[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 5341b93 commit 9f0844d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

kernel/printk/printk.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,7 @@ static inline void printk_delay(void)
20632063
static inline u32 printk_caller_id(void)
20642064
{
20652065
return in_task() ? task_pid_nr(current) :
2066-
0x80000000 + raw_smp_processor_id();
2066+
0x80000000 + smp_processor_id();
20672067
}
20682068

20692069
/**
@@ -2145,7 +2145,6 @@ int vprintk_store(int facility, int level,
21452145
const struct dev_printk_info *dev_info,
21462146
const char *fmt, va_list args)
21472147
{
2148-
const u32 caller_id = printk_caller_id();
21492148
struct prb_reserved_entry e;
21502149
enum printk_info_flags flags = 0;
21512150
struct printk_record r;
@@ -2155,10 +2154,14 @@ int vprintk_store(int facility, int level,
21552154
u8 *recursion_ptr;
21562155
u16 reserve_size;
21572156
va_list args2;
2157+
u32 caller_id;
21582158
u16 text_len;
21592159
int ret = 0;
21602160
u64 ts_nsec;
21612161

2162+
if (!printk_enter_irqsave(recursion_ptr, irqflags))
2163+
return 0;
2164+
21622165
/*
21632166
* Since the duration of printk() can vary depending on the message
21642167
* and state of the ringbuffer, grab the timestamp now so that it is
@@ -2167,8 +2170,7 @@ int vprintk_store(int facility, int level,
21672170
*/
21682171
ts_nsec = local_clock();
21692172

2170-
if (!printk_enter_irqsave(recursion_ptr, irqflags))
2171-
return 0;
2173+
caller_id = printk_caller_id();
21722174

21732175
/*
21742176
* The sprintf needs to come first since the syslog prefix might be

0 commit comments

Comments
 (0)