xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Don Slutz <dslutz@verizon.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Keir Fraser <keir@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>, Tim Deegan <tim@xen.org>,
	Don Slutz <dslutz@verizon.com>,
	Xen-devel <xen-devel@lists.xen.org>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: Re: [PATCH v3 5/5] xen/console: Traditional console timestamps including milliseconds
Date: Fri, 07 Mar 2014 18:33:16 -0500	[thread overview]
Message-ID: <531A573C.6050807@terremark.com> (raw)
In-Reply-To: <531915C4.6060102@citrix.com>

On 03/06/14 19:41, Andrew Cooper wrote:
> On 06/03/2014 23:54, Don Slutz wrote:
>> On 03/06/14 14:28, Andrew Cooper wrote:
>>>    }
>>>    -struct tm wallclock_time(void)
>>> +struct tm wallclock_time(uint64_t *ns)
>>>    {
>> Adding:
>>
>>     if ( ns )
>>        *ns = 0;
>>
>> Makes sense here.
>>
>>>        return (struct tm) { 0 };
>>>    }
>>> diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
>>> index 4f4de22..1156ccc 100644
>>> --- a/xen/arch/x86/time.c
>>> +++ b/xen/arch/x86/time.c
>>> @@ -1646,15 +1646,19 @@ int dom0_pit_access(struct ioreq *ioreq)
>>>        return 0;
>>>    }
>>>    -struct tm wallclock_time(void)
>>> +struct tm wallclock_time(uint64_t *ns)
>>>    {
>>> -    uint64_t seconds;
>>> +    uint64_t seconds, nsec;
>>>          if ( !wc_sec )
>> And here.
>>
>>>            return (struct tm) { 0 };
>>>          seconds = NOW() + SECONDS(wc_sec) + wc_nsec;
>>> -    do_div(seconds, 1000000000);
>>> +    nsec = do_div(seconds, 1000000000);
>>> +
>>> +    if ( *ns )
>> This should be just
>>
>>     if ( ns )
> Oops - so it should.
>
> As for the other changes, I am a bit ambivalent.  printk_start_of_line()
> is the sole caller of wallclock_time(), which means that tm.tm_day being
> 0 means *ns will never get looked at.

This is not 100% true.  Last I knew (struct tm) { 0 } is

struct tm {
     int     tm_sec;         /* seconds */ = 0
     int     tm_min;         /* minutes */ <undef>
     int     tm_hour;        /* hours */ <undef>
     int     tm_mday;        /* day of the month */ <undef>
     int     tm_mon;         /* month */ <undef>
     int     tm_year;        /* year */ <undef>
     int     tm_wday;        /* day of the week */ <undef>
     int     tm_yday;        /* day in the year */ <undef>
     int     tm_isdst;       /* daylight saving time */ <undef>
};

But not having looked at the code, and the compilers could have changed 
what this means (i.e. if not provided they are zero in which case this 
should be {}.  { 0, 0, 0, 0 } or { .tm_mday = 0 } is the way I know of 
to say "tm_mday" is zero).

So the test for tm.tm_mday == 0 may just be working because the 
undefined value is zero...

> While it is not exactly a hot codepath, unconditionally clearing it
> seems silly, especially as it is not exactly the most likely candidate
> to get a new caller in the near future.

There is no clear right answer here.  So I have no issue with not doing 
the "extra" work.

    -Don Slutz

> ~Andrew
>

  reply	other threads:[~2014-03-07 23:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06 19:28 [PATCH v3 0/5] Improvements to console timestamps Andrew Cooper
2014-03-06 19:28 ` [PATCH v3 1/5] xen/time: Move wallclock_time() declaration into common code Andrew Cooper
2014-03-06 19:28 ` [PATCH v3 2/5] x86/time: Always count s_time from Xen boot Andrew Cooper
2014-03-06 19:28 ` [PATCH v3 3/5] x86/time: Initialise time earlier during start_secondary() Andrew Cooper
2014-03-06 19:28 ` [PATCH v3 4/5] xen/console: Provide timestamps as an offset since boot Andrew Cooper
2014-03-07  9:47   ` Jan Beulich
2014-03-07 10:27     ` Andrew Cooper
2014-03-06 19:28 ` [PATCH v3 5/5] xen/console: Traditional console timestamps including milliseconds Andrew Cooper
2014-03-06 23:54   ` Don Slutz
2014-03-07  0:41     ` Andrew Cooper
2014-03-07 23:33       ` Don Slutz [this message]
2014-03-11 10:43         ` Ian Campbell
2014-03-11 11:32           ` Andrew Cooper
2014-03-11 11:39             ` Tim Deegan
2014-03-11 12:47             ` Jan Beulich

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=531A573C.6050807@terremark.com \
    --to=dslutz@verizon.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).