Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1739809
| From | Petr Mladek <pmladek@suse.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/3 v12] printk: Add monotonic, boottime, and realtime timestamps |
| Date | 2017-09-26 14:00 +0200 |
| Message-ID | <utWGR-4jM-3@gated-at.bofh.it> (permalink) |
| References | <ur8uR-13C-5@gated-at.bofh.it> <ur8uR-13C-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon 2017-09-18 13:51:00, Prarit Bhargava wrote:
> printk.time=1/CONFIG_PRINTK_TIME=1 adds a unmodified local hardware clock
> timestamp to printk messages. The local hardware clock loses time each
> day making it difficult to determine exactly when an issue has occurred in
> the kernel log, and making it difficult to determine how kernel and
> hardware issues relate to each other in real time.
>
> Make printk output different timestamps by adding options for no
> timestamp, the local hardware clock, the monotonic clock, the boottime
> clock, and the real clock. Allow a user to pick one of the clocks by
> using the printk.time kernel parameter. Output the type of clock in
> /sys/module/printk/parameters/time so userspace programs can interpret the
> timestamp.
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 512f7c2baedd..5e0bf2ef02f7 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -1201,14 +1204,130 @@ static inline void boot_delay_msec(int level)
> +static int printk_time = CONFIG_PRINTK_TIME_TYPE;
> +
> +static int printk_set_ts_source(enum timestamp_sources ts_source)
> +{
> + int err = 0;
> @@ -1861,6 +1980,7 @@ static size_t msg_print_text(const struct printk_log *msg,
> bool syslog, char *buf, size_t size) { return 0; }
> static bool suppress_message_printing(int level) { return false; }
>
> +static int printk_time;
I worried if the variable should have got initialized. But it seems to
be a relic from an older version. The variable is not longer used and
needed when CONFIG_PRINTK is not defined. It is proved by gcc:
CC kernel/printk/printk.o
kernel/printk/printk.c:1983:12: warning: ‘printk_time’ defined but not used [-Wunused-variable]
static int printk_time;
> #endif /* CONFIG_PRINTK */
>
> #ifdef CONFIG_EARLY_PRINTK
Otherwise that patch looks fine. With the unused variable removed,
feel free to use:
Reviewed-by: Petr Mladek <pmladek@suse.com>
Best Regards,
Petr
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 3/3 v12] printk: Add monotonic, boottime, and realtime timestamps Prarit Bhargava <prarit@redhat.com> - 2017-09-18 20:00 +0200
Re: [PATCH 3/3 v12] printk: Add monotonic, boottime, and realtime timestamps Petr Mladek <pmladek@suse.com> - 2017-09-26 14:00 +0200
Re: [PATCH 3/3 v12] printk: Add monotonic, boottime, and realtime timestamps Prarit Bhargava <prarit@redhat.com> - 2017-09-26 15:00 +0200
Re: [PATCH 3/3 v12] printk: Add monotonic, boottime, and realtime timestamps Pavel Machek <pavel@ucw.cz> - 2017-09-29 14:50 +0200
csiph-web