linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] timekeeping: avoid adjust kernel time once hwclock kept in UTC time
@ 2012-12-06 14:03 Dong Zhu
  2012-12-19  5:15 ` Dong Zhu
  2013-02-22 20:37 ` John Stultz
  0 siblings, 2 replies; 5+ messages in thread
From: Dong Zhu @ 2012-12-06 14:03 UTC (permalink / raw)
  To: John Stultz, Thomas Gleixner; +Cc: linux-kernel

>From c126376cf1837b0956e0268056db61870fbbc1d4 Mon Sep 17 00:00:00 2001
From: Dong Zhu <bluezhudong@gmail.com>
Date: Thu, 6 Dec 2012 21:45:00 +0800
Subject: [PATCH] timekeeping: avoid adjust kernel time once hwclock kept in
 UTC time

If the Hardware Clock kept in local time,kernel will adjust the time
to be UTC time.But if Hardware Clock kept in UTC time,system will make
a dummy settimeofday call first (sys_tz.tz_minuteswest = 0) to make sure
the time is not shifted,so at this point I think maybe it is not necessary
to set the kernel time once the sys_tz.tz_minuteswest is zero.

Signed-off-by: Dong Zhu <bluezhudong@gmail.com>
---
 kernel/time.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/time.c b/kernel/time.c
index d226c6a..0b592ce 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -134,9 +134,11 @@ static inline void warp_clock(void)
 {
 	struct timespec adjust;
 
-	adjust = current_kernel_time();
-	adjust.tv_sec += sys_tz.tz_minuteswest * 60;
-	do_settimeofday(&adjust);
+	if (sys_tz.tz_minuteswest) {
+		adjust = current_kernel_time();
+		adjust.tv_sec += sys_tz.tz_minuteswest * 60;
+		do_settimeofday(&adjust);
+	}
 }
 
 /*
-- 
1.7.11.7


-- 
Best Regards,
Dong Zhu

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] timekeeping: avoid adjust kernel time once hwclock kept in UTC time
  2012-12-06 14:03 [PATCH] timekeeping: avoid adjust kernel time once hwclock kept in UTC time Dong Zhu
@ 2012-12-19  5:15 ` Dong Zhu
  2012-12-19  6:37   ` John Stultz
  2013-02-22 20:37 ` John Stultz
  1 sibling, 1 reply; 5+ messages in thread
From: Dong Zhu @ 2012-12-19  5:15 UTC (permalink / raw)
  To: John Stultz, Thomas Gleixner; +Cc: linux-kernel

On Thu, Dec 06, 2012 at 10:03:34PM +0800, Dong Zhu wrote:
> From c126376cf1837b0956e0268056db61870fbbc1d4 Mon Sep 17 00:00:00 2001
> From: Dong Zhu <bluezhudong@gmail.com>
> Date: Thu, 6 Dec 2012 21:45:00 +0800
> Subject: [PATCH] timekeeping: avoid adjust kernel time once hwclock kept in
>  UTC time
> 
> If the Hardware Clock kept in local time,kernel will adjust the time
> to be UTC time.But if Hardware Clock kept in UTC time,system will make
> a dummy settimeofday call first (sys_tz.tz_minuteswest = 0) to make sure
> the time is not shifted,so at this point I think maybe it is not necessary
> to set the kernel time once the sys_tz.tz_minuteswest is zero.
> 
> Signed-off-by: Dong Zhu <bluezhudong@gmail.com>
> ---
>  kernel/time.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/time.c b/kernel/time.c
> index d226c6a..0b592ce 100644
> --- a/kernel/time.c
> +++ b/kernel/time.c
> @@ -134,9 +134,11 @@ static inline void warp_clock(void)
>  {
>  	struct timespec adjust;
>  
> -	adjust = current_kernel_time();
> -	adjust.tv_sec += sys_tz.tz_minuteswest * 60;
> -	do_settimeofday(&adjust);
> +	if (sys_tz.tz_minuteswest) {
> +		adjust = current_kernel_time();
> +		adjust.tv_sec += sys_tz.tz_minuteswest * 60;
> +		do_settimeofday(&adjust);
> +	}
>  }
>  
>  /*
> -- 
> 1.7.11.7
> 

Hi,

Any comments ? 

-- 
Best Regards,
Dong Zhu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] timekeeping: avoid adjust kernel time once hwclock kept in UTC time
  2012-12-19  5:15 ` Dong Zhu
@ 2012-12-19  6:37   ` John Stultz
  2013-02-20  8:13     ` Dong Zhu
  0 siblings, 1 reply; 5+ messages in thread
From: John Stultz @ 2012-12-19  6:37 UTC (permalink / raw)
  To: Dong Zhu; +Cc: Thomas Gleixner, linux-kernel

On 12/18/2012 09:15 PM, Dong Zhu wrote:
> On Thu, Dec 06, 2012 at 10:03:34PM +0800, Dong Zhu wrote:
>>  From c126376cf1837b0956e0268056db61870fbbc1d4 Mon Sep 17 00:00:00 2001
>> From: Dong Zhu <bluezhudong@gmail.com>
>> Date: Thu, 6 Dec 2012 21:45:00 +0800
>> Subject: [PATCH] timekeeping: avoid adjust kernel time once hwclock kept in
>>   UTC time
>>
>> If the Hardware Clock kept in local time,kernel will adjust the time
>> to be UTC time.But if Hardware Clock kept in UTC time,system will make
>> a dummy settimeofday call first (sys_tz.tz_minuteswest = 0) to make sure
>> the time is not shifted,so at this point I think maybe it is not necessary
>> to set the kernel time once the sys_tz.tz_minuteswest is zero.
>>
>> Signed-off-by: Dong Zhu <bluezhudong@gmail.com>
>> ---
>>   kernel/time.c | 8 +++++---
>>   1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/kernel/time.c b/kernel/time.c
>> index d226c6a..0b592ce 100644
>> --- a/kernel/time.c
>> +++ b/kernel/time.c
>> @@ -134,9 +134,11 @@ static inline void warp_clock(void)
>>   {
>>   	struct timespec adjust;
>>   
>> -	adjust = current_kernel_time();
>> -	adjust.tv_sec += sys_tz.tz_minuteswest * 60;
>> -	do_settimeofday(&adjust);
>> +	if (sys_tz.tz_minuteswest) {
>> +		adjust = current_kernel_time();
>> +		adjust.tv_sec += sys_tz.tz_minuteswest * 60;
>> +		do_settimeofday(&adjust);
>> +	}
>>   }
>>   
>>   /*
>> -- 
>> 1.7.11.7
>>
> Hi,
>
> Any comments ?
Sorry for the slow response, been a little busy.   Honestly the 
warp_clock() code path is always been a bit odd to me, so I've not 
really been able to get my head around the implications of this change.

Really, I'm not sure if I'll get to this before the new year.
Its on my list, but don't be afraid to ping me early Jan if I haven't 
queued it for 3.9 by then.

thanks
-john


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] timekeeping: avoid adjust kernel time once hwclock kept in UTC time
  2012-12-19  6:37   ` John Stultz
@ 2013-02-20  8:13     ` Dong Zhu
  0 siblings, 0 replies; 5+ messages in thread
From: Dong Zhu @ 2013-02-20  8:13 UTC (permalink / raw)
  To: John Stultz; +Cc: Thomas Gleixner, linux-kernel

On Tue, Dec 18, 2012 at 10:37:08PM -0800, John Stultz wrote:
> On 12/18/2012 09:15 PM, Dong Zhu wrote:
> >On Thu, Dec 06, 2012 at 10:03:34PM +0800, Dong Zhu wrote:
> >> From c126376cf1837b0956e0268056db61870fbbc1d4 Mon Sep 17 00:00:00 2001
> >>From: Dong Zhu <bluezhudong@gmail.com>
> >>Date: Thu, 6 Dec 2012 21:45:00 +0800
> >>Subject: [PATCH] timekeeping: avoid adjust kernel time once hwclock kept in
> >>  UTC time
> >>
> >>If the Hardware Clock kept in local time,kernel will adjust the time
> >>to be UTC time.But if Hardware Clock kept in UTC time,system will make
> >>a dummy settimeofday call first (sys_tz.tz_minuteswest = 0) to make sure
> >>the time is not shifted,so at this point I think maybe it is not necessary
> >>to set the kernel time once the sys_tz.tz_minuteswest is zero.
> >>
> >>Signed-off-by: Dong Zhu <bluezhudong@gmail.com>
> >>---
> >>  kernel/time.c | 8 +++++---
> >>  1 file changed, 5 insertions(+), 3 deletions(-)
> >>
> >>diff --git a/kernel/time.c b/kernel/time.c
> >>index d226c6a..0b592ce 100644
> >>--- a/kernel/time.c
> >>+++ b/kernel/time.c
> >>@@ -134,9 +134,11 @@ static inline void warp_clock(void)
> >>  {
> >>  	struct timespec adjust;
> >>-	adjust = current_kernel_time();
> >>-	adjust.tv_sec += sys_tz.tz_minuteswest * 60;
> >>-	do_settimeofday(&adjust);
> >>+	if (sys_tz.tz_minuteswest) {
> >>+		adjust = current_kernel_time();
> >>+		adjust.tv_sec += sys_tz.tz_minuteswest * 60;
> >>+		do_settimeofday(&adjust);
> >>+	}
> >>  }
> >>  /*
> >>-- 
> >>1.7.11.7
> >>
> >Hi,
> >
> >Any comments ?
> Sorry for the slow response, been a little busy.   Honestly the
> warp_clock() code path is always been a bit odd to me, so I've not
> really been able to get my head around the implications of this
> change.
> 
> Really, I'm not sure if I'll get to this before the new year.
> Its on my list, but don't be afraid to ping me early Jan if I
> haven't queued it for 3.9 by then.
> 

Hi,

Distance my submit over a long time,whether my patch can be applied ?


-- 
Best Regards,
Dong Zhu

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] timekeeping: avoid adjust kernel time once hwclock kept in UTC time
  2012-12-06 14:03 [PATCH] timekeeping: avoid adjust kernel time once hwclock kept in UTC time Dong Zhu
  2012-12-19  5:15 ` Dong Zhu
@ 2013-02-22 20:37 ` John Stultz
  1 sibling, 0 replies; 5+ messages in thread
From: John Stultz @ 2013-02-22 20:37 UTC (permalink / raw)
  To: Dong Zhu; +Cc: Thomas Gleixner, linux-kernel

On 12/06/2012 06:03 AM, Dong Zhu wrote:
>  From c126376cf1837b0956e0268056db61870fbbc1d4 Mon Sep 17 00:00:00 2001
> From: Dong Zhu <bluezhudong@gmail.com>
> Date: Thu, 6 Dec 2012 21:45:00 +0800
> Subject: [PATCH] timekeeping: avoid adjust kernel time once hwclock kept in
>   UTC time
>
> If the Hardware Clock kept in local time,kernel will adjust the time
> to be UTC time.But if Hardware Clock kept in UTC time,system will make
> a dummy settimeofday call first (sys_tz.tz_minuteswest = 0) to make sure
> the time is not shifted,so at this point I think maybe it is not necessary
> to set the kernel time once the sys_tz.tz_minuteswest is zero.
>
> Signed-off-by: Dong Zhu <bluezhudong@gmail.com>

Sorry for the long delay here, and thank you for the reminder!

I've merged this patch in my tree (reworking it to merge with other 
changes in that area). And I'm likely to make a follow on patch that 
will use timekeeping_inject_offset() so we don't add any extra time 
error unnecessarily. Both will be queued for 3.10.

thanks
-john


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-02-22 20:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-06 14:03 [PATCH] timekeeping: avoid adjust kernel time once hwclock kept in UTC time Dong Zhu
2012-12-19  5:15 ` Dong Zhu
2012-12-19  6:37   ` John Stultz
2013-02-20  8:13     ` Dong Zhu
2013-02-22 20:37 ` John Stultz

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).