* [PATCH 2/3] s390: time: Provide read_boot_clock64() and read_persistent_clock64()
2015-04-09 1:04 [PATCH 1/3] time: include math64.h in time64.h Xunlei Pang
@ 2015-04-09 1:04 ` Xunlei Pang
2015-04-09 1:04 ` [PATCH 3/3] time: Remove read_boot_clock() Xunlei Pang
1 sibling, 0 replies; 4+ messages in thread
From: Xunlei Pang @ 2015-04-09 1:04 UTC (permalink / raw)
To: linux-kernel
Cc: John Stultz, Arnd Bergmann, Thomas Gleixner, Martin Schwidefsky,
Heiko Carstens, linux390, Xunlei Pang
From: Xunlei Pang <pang.xunlei@linaro.org>
As part of addressing "y2038 problem" for in-kernel uses, this
patch converts read_boot_clock() to read_boot_clock64() and
read_persistent_clock() to read_persistent_clock64() using
timespec64.
Rename some timespec to timespec64 in time.c and related references.
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
We've already had read_boot_clock64() in timekeeping,
now provide read_boot_clock64() for S390.
arch/s390/include/asm/timex.h | 5 +++--
arch/s390/kernel/debug.c | 11 ++++++-----
arch/s390/kernel/time.c | 6 +++---
3 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
index 98eb2a5..f39220f 100644
--- a/arch/s390/include/asm/timex.h
+++ b/arch/s390/include/asm/timex.h
@@ -10,6 +10,7 @@
#define _ASM_S390_TIMEX_H
#include <asm/lowcore.h>
+#include <linux/time64.h>
/* The value of the TOD clock for 1.1.1970. */
#define TOD_UNIX_EPOCH 0x7d91048bca000000ULL
@@ -108,10 +109,10 @@ int get_sync_clock(unsigned long long *clock);
void init_cpu_timer(void);
unsigned long long monotonic_clock(void);
-void tod_to_timeval(__u64, struct timespec *);
+void tod_to_timeval(__u64, struct timespec64 *);
static inline
-void stck_to_timespec(unsigned long long stck, struct timespec *ts)
+void stck_to_timespec64(unsigned long long stck, struct timespec64 *ts)
{
tod_to_timeval(stck - TOD_UNIX_EPOCH, ts);
}
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index c1f21ac..4f2d11d 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -1457,23 +1457,24 @@ int
debug_dflt_header_fn(debug_info_t * id, struct debug_view *view,
int area, debug_entry_t * entry, char *out_buf)
{
- struct timespec time_spec;
+ struct timespec64 time_spec;
char *except_str;
unsigned long caller;
int rc = 0;
unsigned int level;
level = entry->id.fields.level;
- stck_to_timespec(entry->id.stck, &time_spec);
+ stck_to_timespec64(entry->id.stck, &time_spec);
if (entry->id.fields.exception)
except_str = "*";
else
except_str = "-";
caller = ((unsigned long) entry->caller) & PSW_ADDR_INSN;
- rc += sprintf(out_buf, "%02i %011lu:%06lu %1u %1s %02i %p ",
- area, time_spec.tv_sec, time_spec.tv_nsec / 1000, level,
- except_str, entry->id.fields.cpuid, (void *) caller);
+ rc += sprintf(out_buf, "%02i %011lld:%06lu %1u %1s %02i %p ",
+ area, (long long) time_spec.tv_sec,
+ time_spec.tv_nsec / 1000, level, except_str,
+ entry->id.fields.cpuid, (void *) caller);
return rc;
}
EXPORT_SYMBOL(debug_dflt_header_fn);
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 170ddd2..9e733d9 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -76,7 +76,7 @@ unsigned long long monotonic_clock(void)
}
EXPORT_SYMBOL(monotonic_clock);
-void tod_to_timeval(__u64 todval, struct timespec *xt)
+void tod_to_timeval(__u64 todval, struct timespec64 *xt)
{
unsigned long long sec;
@@ -181,12 +181,12 @@ static void timing_alert_interrupt(struct ext_code ext_code,
static void etr_reset(void);
static void stp_reset(void);
-void read_persistent_clock(struct timespec *ts)
+void read_persistent_clock64(struct timespec64 *ts)
{
tod_to_timeval(get_tod_clock() - TOD_UNIX_EPOCH, ts);
}
-void read_boot_clock(struct timespec *ts)
+void read_boot_clock64(struct timespec64 *ts)
{
tod_to_timeval(sched_clock_base_cc - TOD_UNIX_EPOCH, ts);
}
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 3/3] time: Remove read_boot_clock()
2015-04-09 1:04 [PATCH 1/3] time: include math64.h in time64.h Xunlei Pang
2015-04-09 1:04 ` [PATCH 2/3] s390: time: Provide read_boot_clock64() and read_persistent_clock64() Xunlei Pang
@ 2015-04-09 1:04 ` Xunlei Pang
[not found] ` <OFA4796A71.FC7D341F-ON48257E31.002793F7-48257E31.0028F99A@zte.com.cn>
1 sibling, 1 reply; 4+ messages in thread
From: Xunlei Pang @ 2015-04-09 1:04 UTC (permalink / raw)
To: linux-kernel
Cc: John Stultz, Arnd Bergmann, Thomas Gleixner, Martin Schwidefsky,
Heiko Carstens, linux390, Xunlei Pang
From: Xunlei Pang <pang.xunlei@linaro.org>
Now we have all the read_boot_clock64() for all implementations,
it's time to remove read_boot_clock() completely from the kernel.
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
include/linux/timekeeping.h | 1 -
kernel/time/timekeeping.c | 14 +++-----------
2 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 99176af..88e5f2e 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -266,7 +266,6 @@ extern int persistent_clock_is_local;
extern void read_persistent_clock(struct timespec *ts);
extern void read_persistent_clock64(struct timespec64 *ts);
-extern void read_boot_clock(struct timespec *ts);
extern void read_boot_clock64(struct timespec64 *ts);
extern int update_persistent_clock(struct timespec now);
extern int update_persistent_clock64(struct timespec64 now);
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 946acb7..87f0ea5 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1179,28 +1179,20 @@ void __weak read_persistent_clock64(struct timespec64 *ts64)
}
/**
- * read_boot_clock - Return time of the system start.
+ * read_boot_clock64 - Return time of the system start.
*
* Weak dummy function for arches that do not yet support it.
* Function to read the exact time the system has been started.
- * Returns a timespec with tv_sec=0 and tv_nsec=0 if unsupported.
+ * Returns a timespec64 with tv_sec=0 and tv_nsec=0 if unsupported.
*
* XXX - Do be sure to remove it once all arches implement it.
*/
-void __weak read_boot_clock(struct timespec *ts)
+void __weak read_boot_clock64(struct timespec64 *ts)
{
ts->tv_sec = 0;
ts->tv_nsec = 0;
}
-void __weak read_boot_clock64(struct timespec64 *ts64)
-{
- struct timespec ts;
-
- read_boot_clock(&ts);
- *ts64 = timespec_to_timespec64(ts);
-}
-
/* Flag for if timekeeping_resume() has injected sleeptime */
static bool sleeptime_injected;
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread