From: Karel Zak <kzak@redhat.com>
To: Sami Kerola <kerolasa@iki.fi>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH 00/15] pull: sfdisk and dmesg resubmission, plus bits and bobs
Date: Mon, 17 Jun 2013 14:31:20 +0200 [thread overview]
Message-ID: <20130617123120.GC20507@x2.net.home> (raw)
In-Reply-To: <1371408836-16663-1-git-send-email-kerolasa@iki.fi>
On Sun, Jun 16, 2013 at 07:53:41PM +0100, Sami Kerola wrote:
> Unfortunately the most troubling dmesg patch is now dropped by me. I had
> a look how systemd determines boot time, and it seem very early at
> execution clock_gettime() is called, and results are saved. If dmesg
> should agree with systemd when startup happen I see two possible options;
>
> 1. Make dmesg to get system startup time from systemd using dbus.
>
> 2. Make both dmesg and systemd to ask start up time from kernel.
>
> I feel first option is not great. The systemd boot time stamp is similar
> sort of approximation as reading fstat from /proc/1. Also asking when
> system started from system itself feels more neutral than consulting a
> software the system started.
>
> If the second option is favored a kernel patch, such as the one below, is
> needed and a bit coordination to make various programs to use the
> boottime from kernel. Meanwhile it migth be fine that differnt programs
> using differnet time stamps for klog messages.
Note that the current dmesg(1) code uses sysinfo(2) which provides
uptime in seconds. It would be probably better to use /proc/uptime
where is uptime in sec.xx precision.
> Any opinions about klog time stamps?
>
>
> --- a/kernel/ksysfs.c
> +++ b/kernel/ksysfs.c
> @@ -157,6 +157,16 @@ static ssize_t rcu_expedited_store(struct kobject
> *kobj,
> }
> KERNEL_ATTR_RW(rcu_expedited);
>
> +/* High precision timestamp of the system boot. */
> +static ssize_t boottime_show(struct kobject *kobj,
> + struct kobj_attribute *attr, char *buf)
> +{
> + struct timespec ts;
> + getboottime(&ts);
> + return sprintf(buf, "%ld.%ld\n", ts.tv_sec, ts.tv_nsec);
> +}
> +KERNEL_ATTR_RO(hp_uptime);
> +
> /*
> * Make /sys/kernel/notes give the raw contents of our kernel .notes
> * section.
> */
> @@ -197,6 +207,7 @@ static struct attribute * kernel_attrs[] = {
> &vmcoreinfo_attr.attr,
> #endif
> &rcu_expedited_attr.attr,
> + &hp_uptime_attr.attr,
> NULL
> };
Would be better to use /proc (where is 'uptime' file) rather than
/sys/kernel ?
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
next prev parent reply other threads:[~2013-06-17 12:31 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-16 18:53 [PATCH 00/15] pull: sfdisk and dmesg resubmission, plus bits and bobs Sami Kerola
2013-06-16 18:53 ` [PATCH 01/15] renice: exit with non-zero value when arguments cause warnings Sami Kerola
2013-06-16 18:53 ` [PATCH 02/15] sfdisk: use libc error printing function, and symbolic exit values Sami Kerola
2013-06-16 18:53 ` [PATCH 03/15] sfdisk: clean up usage() functions Sami Kerola
2013-06-16 18:53 ` [PATCH 04/15] sfdisk: use program_invocation_short_name to determine program name Sami Kerola
2013-06-16 18:53 ` [PATCH 05/15] docs: correct sfdisk --activate instructions Sami Kerola
2013-06-16 18:53 ` [PATCH 06/15] sfdisk: remove --unhide and related functions Sami Kerola
2013-06-16 18:53 ` [PATCH 07/15] sfdisk: replace my_warn() with warnx() Sami Kerola
2013-06-16 18:53 ` [PATCH 08/15] dmesg: convert time format bitfield to enum Sami Kerola
2013-07-01 9:36 ` Karel Zak
2013-06-16 18:53 ` [PATCH 09/15] dmesg: add --time-format option Sami Kerola
2013-06-16 18:53 ` [PATCH 10/15] dmesg: add iso-8601 time format Sami Kerola
2013-07-01 9:25 ` Karel Zak
2013-07-01 10:54 ` Sami Kerola
2013-06-16 18:53 ` [PATCH 11/15] docs: add --time-format option and ISO-8601 format to manual Sami Kerola
2013-06-16 18:53 ` [PATCH 12/15] dmesg: regroup time related options close to each other Sami Kerola
2013-06-16 18:53 ` [PATCH 13/15] sd-daemon: update files taken from systemd project Sami Kerola
2013-06-16 18:53 ` [PATCH 14/15] hexdump: remove unnecessary global variables Sami Kerola
2013-09-02 23:22 ` Dave Reisner
2013-09-03 7:15 ` Sami Kerola
2013-09-03 8:29 ` Karel Zak
2013-06-16 18:53 ` [PATCH 15/15] hexdump: use simple printing functions when possible Sami Kerola
2013-07-01 9:01 ` Karel Zak
2013-07-01 10:58 ` Sami Kerola
2013-06-17 12:31 ` Karel Zak [this message]
2013-06-17 20:14 ` [PATCH 00/15] pull: sfdisk and dmesg resubmission, plus bits and bobs Sami Kerola
2013-07-01 9:39 ` Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130617123120.GC20507@x2.net.home \
--to=kzak@redhat.com \
--cc=kerolasa@iki.fi \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox