From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v3 5/5] xen/console: Traditional console timestamps including milliseconds Date: Fri, 7 Mar 2014 00:41:40 +0000 Message-ID: <531915C4.6060102@citrix.com> References: <1394134085-22952-1-git-send-email-andrew.cooper3@citrix.com> <1394134085-22952-6-git-send-email-andrew.cooper3@citrix.com> <53190AB0.4020806@terremark.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53190AB0.4020806@terremark.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Don Slutz , Xen-devel Cc: Tim Deegan , Jan Beulich , Keir Fraser , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org 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. 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. ~Andrew