mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
printk: add cpu id in printk message
PD#138714: add cpu id in printk message Change-Id: Ic3efb64b8675d2e03129c5a646f53e60fbf8c78d Signed-off-by: Jianxin Pan <jianxin.pan@amlogic.com>
This commit is contained in:
@@ -338,6 +338,9 @@ struct printk_log {
|
||||
u8 facility; /* syslog facility */
|
||||
u8 flags:5; /* internal record flags */
|
||||
u8 level:3; /* syslog level */
|
||||
#ifdef CONFIG_AMLOGIC_DRIVER
|
||||
int cpu;
|
||||
#endif
|
||||
}
|
||||
#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
|
||||
__packed __aligned(4)
|
||||
@@ -353,6 +356,9 @@ DEFINE_RAW_SPINLOCK(logbuf_lock);
|
||||
|
||||
#ifdef CONFIG_PRINTK
|
||||
DECLARE_WAIT_QUEUE_HEAD(log_wait);
|
||||
#ifdef CONFIG_AMLOGIC_DRIVER
|
||||
static int current_cpu;
|
||||
#endif
|
||||
/* the next printk record to read by syslog(READ) or /proc/kmsg */
|
||||
static u64 syslog_seq;
|
||||
static u32 syslog_idx;
|
||||
@@ -574,6 +580,9 @@ static int log_store(int facility, int level,
|
||||
msg->facility = facility;
|
||||
msg->level = level & 7;
|
||||
msg->flags = flags & 0x1f;
|
||||
#ifdef CONFIG_AMLOGIC_DRIVER
|
||||
msg->cpu = smp_processor_id();
|
||||
#endif
|
||||
if (ts_nsec > 0)
|
||||
msg->ts_nsec = ts_nsec;
|
||||
else
|
||||
@@ -1183,8 +1192,13 @@ static size_t print_time(u64 ts, char *buf)
|
||||
if (!buf)
|
||||
return snprintf(NULL, 0, "[%5lu.000000] ", (unsigned long)ts);
|
||||
|
||||
#if defined(CONFIG_SMP) && defined(CONFIG_AMLOGIC_DRIVER)
|
||||
return sprintf(buf, "[%5lu.%06lu@%d] ",
|
||||
(unsigned long)ts, rem_nsec / 1000, current_cpu);
|
||||
#else
|
||||
return sprintf(buf, "[%5lu.%06lu] ",
|
||||
(unsigned long)ts, rem_nsec / 1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
static size_t print_prefix(const struct printk_log *msg, bool syslog, char *buf)
|
||||
@@ -1205,7 +1219,9 @@ static size_t print_prefix(const struct printk_log *msg, bool syslog, char *buf)
|
||||
len++;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_AMLOGIC_DRIVER
|
||||
current_cpu = msg->cpu;
|
||||
#endif
|
||||
len += print_time(msg->ts_nsec, buf ? buf + len : NULL);
|
||||
return len;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user