Skip to contentSkip to conversation

timekeeping: avoid adjust kernel time once hwclock kept in UTC time

PATCH In review Dong Zhu 2 participants 5 messages Dec 6, 2012 – Feb 22, 2013

lore
Share & tools
lore

Dong Zhu

author
#0 lore raw

PATCH 1/1 timekeeping: avoid adjust kernel time once hwclock kept in UTC time

Quoted 1 line

From c126376cf1837b0956e0268056db61870fbbc1d4 Mon Sep 17 00:00:00 2001

From: Dong Zhu <[email protected]>
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.

---
 kernel/time.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/time.c +5 -3
index d226c6a..0b592ce 100644
@@ -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);
+	}
 }
 
 /*
Signature · 6 lines
1.7.11.7


-- 
Best Regards,
Dong Zhu
author
#1 lore raw
Quoted 39 lines · Dong Zhu

From c126376cf1837b0956e0268056db61870fbbc1d4 Mon Sep 17 00:00:00 2001
From: Dong Zhu <[email protected]>
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.

---
 kernel/time.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/time.c +5 -3
index d226c6a..0b592ce 100644
@@ -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);
+	}
 }
 
 /*
Signature · 1 line
1.7.11.7

Hi,

Any comments ?

Signature · 2 lines
Best Regards,
Dong Zhu
#2 lore raw
Quoted 36 lines · Dong Zhu
Quoted 35 lines · Dong Zhu

From c126376cf1837b0956e0268056db61870fbbc1d4 Mon Sep 17 00:00:00 2001
From: Dong Zhu <[email protected]>
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.

---
  kernel/time.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
kernel/time.c +5 -3
index d226c6a..0b592ce 100644
@@ -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);
+	}
  }
 
Quoted 7 lines
Quoted 4 lines
kernel/time.c +0 -0
  /*
Signature · 1 line
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

author
#3 lore raw
Quoted 42 lines · John Stultz
Quoted 40 lines · Dong Zhu
Quoted 37 lines · Dong Zhu

From c126376cf1837b0956e0268056db61870fbbc1d4 Mon Sep 17 00:00:00 2001
From: Dong Zhu <[email protected]>
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.

---
 kernel/time.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/time.c +5 -3
index d226c6a..0b592ce 100644
@@ -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);
+	}
 }
 /*
Signature · 1 line
1.7.11.7

Hi,

Quoted 1 line

Any comments ?

Quoted 9 lines

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 ?

Signature · 2 lines
Best Regards,
Dong Zhu
#4 lore raw
In reply to Dong Zhu
Quoted 6 lines · Dong Zhu

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

Quoted 7 lines

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.

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