Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1234426 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2015-09-28 22:30 +0200 |
| Last post | 2015-10-01 19:10 +0200 |
| Articles | 6 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH 0/5] y2038 conversion for ntp/pps and sfc driver Arnd Bergmann <arnd@arndb.de> - 2015-09-28 22:30 +0200
[PATCH 4/5] ntp/pps: use y2038 safe types in pps_event_time Arnd Bergmann <arnd@arndb.de> - 2015-09-28 22:30 +0200
Re: [PATCH 0/5] y2038 conversion for ntp/pps and sfc driver Richard Cochran <richardcochran@gmail.com> - 2015-09-29 21:20 +0200
Re: [PATCH 0/5] y2038 conversion for ntp/pps and sfc driver David Miller <davem@davemloft.net> - 2015-09-30 06:10 +0200
Re: [PATCH 0/5] y2038 conversion for ntp/pps and sfc driver Thomas Gleixner <tglx@linutronix.de> - 2015-09-30 09:30 +0200
Re: [PATCH 0/5] y2038 conversion for ntp/pps and sfc driver John Stultz <john.stultz@linaro.org> - 2015-10-01 19:10 +0200
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2015-09-28 22:30 +0200 |
| Subject | [PATCH 0/5] y2038 conversion for ntp/pps and sfc driver |
| Message-ID | <qdNdD-1FC-5@gated-at.bofh.it> |
When trying to build a kernel with time_t commented out, I found that the ntp subsystem still relies on timespec for its pps handling. This series addresses this and converts all the code to use timespec64 instead, step by step. There is one device driver that interacts with this code directly (rather than only through the ptp subsystem), so I have to convert that driver at the same time. The patches should ideally stay together as a series, but they do span multiple subsystems, so I'm also looking for the right person to merge them. Please review. Thanks, Arnd Arnd Bergmann (5): ntp/pps: use timespec64 for hardpps() ntp/pps: replace getnstime_raw_and_real with 64-bit version ntp: use timespec64 in sync_cmos_clock ntp/pps: use y2038 safe types in pps_event_time net: sfc: avoid using timespec drivers/net/ethernet/sfc/ptp.c | 30 +++++++++++++++--------------- drivers/pps/kapi.c | 4 ++-- include/linux/pps_kernel.h | 16 ++++++++-------- include/linux/timekeeping.h | 4 ++-- include/linux/timex.h | 2 +- kernel/time/ntp.c | 16 ++++++++-------- kernel/time/ntp_internal.h | 2 +- kernel/time/timekeeping.c | 14 +++++++------- 8 files changed, 44 insertions(+), 44 deletions(-) -- 2.1.0.rc2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2015-09-28 22:30 +0200 |
| Subject | [PATCH 4/5] ntp/pps: use y2038 safe types in pps_event_time |
| Message-ID | <qdNdF-1FC-21@gated-at.bofh.it> |
| In reply to | #1234426 |
The pps_event_time uses two 'timespec' structures internally, which
suffer from the y2038 problem. The uses of this structure are
fairly self-contained in the pps code, so this replaces them all at
once.
Unfortunately, this includes the sfc ethernet driver aside from the
pps subsystem, so we change that one as well. Both touch the
same data structure, and there probably is no good way to split
the patch into smaller units.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/ethernet/sfc/ptp.c | 16 ++++++++--------
drivers/pps/kapi.c | 4 ++--
drivers/pps/kc.c | 4 +---
include/linux/pps_kernel.h | 21 ++++++++-------------
4 files changed, 19 insertions(+), 26 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
index ad62615a93dc..fe849dbf9f80 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
@@ -646,28 +646,28 @@ static void efx_ptp_send_times(struct efx_nic *efx,
struct pps_event_time *last_time)
{
struct pps_event_time now;
- struct timespec limit;
+ struct timespec64 limit;
struct efx_ptp_data *ptp = efx->ptp_data;
- struct timespec start;
+ struct timespec64 start;
int *mc_running = ptp->start.addr;
pps_get_ts(&now);
start = now.ts_real;
limit = now.ts_real;
- timespec_add_ns(&limit, SYNCHRONISE_PERIOD_NS);
+ timespec64_add_ns(&limit, SYNCHRONISE_PERIOD_NS);
/* Write host time for specified period or until MC is done */
- while ((timespec_compare(&now.ts_real, &limit) < 0) &&
+ while ((timespec64_compare(&now.ts_real, &limit) < 0) &&
ACCESS_ONCE(*mc_running)) {
- struct timespec update_time;
+ struct timespec64 update_time;
unsigned int host_time;
/* Don't update continuously to avoid saturating the PCIe bus */
update_time = now.ts_real;
- timespec_add_ns(&update_time, SYNCHRONISATION_GRANULARITY_NS);
+ timespec64_add_ns(&update_time, SYNCHRONISATION_GRANULARITY_NS);
do {
pps_get_ts(&now);
- } while ((timespec_compare(&now.ts_real, &update_time) < 0) &&
+ } while ((timespec64_compare(&now.ts_real, &update_time) < 0) &&
ACCESS_ONCE(*mc_running));
/* Synchronise NIC with single word of time only */
@@ -723,7 +723,7 @@ efx_ptp_process_times(struct efx_nic *efx, MCDI_DECLARE_STRUCT_PTR(synch_buf),
struct efx_ptp_data *ptp = efx->ptp_data;
u32 last_sec;
u32 start_sec;
- struct timespec delta;
+ struct timespec64 delta;
ktime_t mc_time;
if (number_readings == 0)
diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c
index cdad4d95b20e..805c749ac1ad 100644
--- a/drivers/pps/kapi.c
+++ b/drivers/pps/kapi.c
@@ -179,8 +179,8 @@ void pps_event(struct pps_device *pps, struct pps_event_time *ts, int event,
/* check event type */
BUG_ON((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0);
- dev_dbg(pps->dev, "PPS event at %ld.%09ld\n",
- ts->ts_real.tv_sec, ts->ts_real.tv_nsec);
+ dev_dbg(pps->dev, "PPS event at %lld.%09ld\n",
+ (s64)ts->ts_real.tv_sec, ts->ts_real.tv_nsec);
timespec_to_pps_ktime(&ts_real, ts->ts_real);
diff --git a/drivers/pps/kc.c b/drivers/pps/kc.c
index a16cea2ba980..e219db1f1c84 100644
--- a/drivers/pps/kc.c
+++ b/drivers/pps/kc.c
@@ -113,12 +113,10 @@ void pps_kc_event(struct pps_device *pps, struct pps_event_time *ts,
int event)
{
unsigned long flags;
- struct timespec64 real = timespec_to_timespec64(ts->ts_real);
- struct timespec64 raw = timespec_to_timespec64(ts->ts_raw);
/* Pass some events to kernel consumer if activated */
spin_lock_irqsave(&pps_kc_hardpps_lock, flags);
if (pps == pps_kc_hardpps_dev && event & pps_kc_hardpps_mode)
- hardpps(&real, &raw);
+ hardpps(&ts->ts_real, &ts->ts_raw);
spin_unlock_irqrestore(&pps_kc_hardpps_lock, flags);
}
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
index b2fbd62ab18d..54bf1484d41f 100644
--- a/include/linux/pps_kernel.h
+++ b/include/linux/pps_kernel.h
@@ -48,9 +48,9 @@ struct pps_source_info {
struct pps_event_time {
#ifdef CONFIG_NTP_PPS
- struct timespec ts_raw;
+ struct timespec64 ts_raw;
#endif /* CONFIG_NTP_PPS */
- struct timespec ts_real;
+ struct timespec64 ts_real;
};
/* The main struct */
@@ -105,7 +105,7 @@ extern void pps_event(struct pps_device *pps,
struct pps_device *pps_lookup_dev(void const *cookie);
static inline void timespec_to_pps_ktime(struct pps_ktime *kt,
- struct timespec ts)
+ struct timespec64 ts)
{
kt->sec = ts.tv_sec;
kt->nsec = ts.tv_nsec;
@@ -115,29 +115,24 @@ static inline void timespec_to_pps_ktime(struct pps_ktime *kt,
static inline void pps_get_ts(struct pps_event_time *ts)
{
- struct timespec64 raw, real;
-
- ktime_get_raw_and_real_ts64(&raw, &real);
-
- ts->ts_raw = timespec64_to_timespec(raw);
- ts->ts_real = timespec64_to_timespec(real);
+ ktime_get_raw_and_real_ts64(&ts->ts_raw, &ts->ts_real);
}
#else /* CONFIG_NTP_PPS */
static inline void pps_get_ts(struct pps_event_time *ts)
{
- getnstimeofday(&ts->ts_real);
+ ktime_get_real_ts64(&ts->ts_real);
}
#endif /* CONFIG_NTP_PPS */
/* Subtract known time delay from PPS event time(s) */
-static inline void pps_sub_ts(struct pps_event_time *ts, struct timespec delta)
+static inline void pps_sub_ts(struct pps_event_time *ts, struct timespec64 delta)
{
- ts->ts_real = timespec_sub(ts->ts_real, delta);
+ ts->ts_real = timespec64_sub(ts->ts_real, delta);
#ifdef CONFIG_NTP_PPS
- ts->ts_raw = timespec_sub(ts->ts_raw, delta);
+ ts->ts_raw = timespec64_sub(ts->ts_raw, delta);
#endif
}
--
2.1.0.rc2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Richard Cochran <richardcochran@gmail.com> |
|---|---|
| Date | 2015-09-29 21:20 +0200 |
| Message-ID | <qe8Br-78E-9@gated-at.bofh.it> |
| In reply to | #1234426 |
On Mon, Sep 28, 2015 at 10:21:27PM +0200, Arnd Bergmann wrote: > When trying to build a kernel with time_t commented out, I found that > the ntp subsystem still relies on timespec for its pps handling. > > This series addresses this and converts all the code to use timespec64 > instead, step by step. There is one device driver that interacts with > this code directly (rather than only through the ptp subsystem), so > I have to convert that driver at the same time. > > The patches should ideally stay together as a series, but they do > span multiple subsystems, so I'm also looking for the right person > to merge them. > > Please review. (Series was "lightly reviewed" ;) Acked-by: Richard Cochran <richardcochran@gmail.com> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2015-09-30 06:10 +0200 |
| Message-ID | <qegSl-299-1@gated-at.bofh.it> |
| In reply to | #1234426 |
From: Arnd Bergmann <arnd@arndb.de> Date: Mon, 28 Sep 2015 22:21:27 +0200 > When trying to build a kernel with time_t commented out, I found that > the ntp subsystem still relies on timespec for its pps handling. > > This series addresses this and converts all the code to use timespec64 > instead, step by step. There is one device driver that interacts with > this code directly (rather than only through the ptp subsystem), so > I have to convert that driver at the same time. > > The patches should ideally stay together as a series, but they do > span multiple subsystems, so I'm also looking for the right person > to merge them. I'm happy with this going via a tree other than mine, and for the networking bits: Acked-by: David S. Miller <davem@davemloft.net> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2015-09-30 09:30 +0200 |
| Message-ID | <qejZT-6zb-11@gated-at.bofh.it> |
| In reply to | #1235738 |
On Tue, 29 Sep 2015, David Miller wrote: > From: Arnd Bergmann <arnd@arndb.de> > Date: Mon, 28 Sep 2015 22:21:27 +0200 > > > When trying to build a kernel with time_t commented out, I found that > > the ntp subsystem still relies on timespec for its pps handling. > > > > This series addresses this and converts all the code to use timespec64 > > instead, step by step. There is one device driver that interacts with > > this code directly (rather than only through the ptp subsystem), so > > I have to convert that driver at the same time. > > > > The patches should ideally stay together as a series, but they do > > span multiple subsystems, so I'm also looking for the right person > > to merge them. > > I'm happy with this going via a tree other than mine, and for the I think it should go via John Stultz timekeeping tree. Thanks, tglx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | John Stultz <john.stultz@linaro.org> |
|---|---|
| Date | 2015-10-01 19:10 +0200 |
| Message-ID | <qePwK-2pD-27@gated-at.bofh.it> |
| In reply to | #1235827 |
On Wed, Sep 30, 2015 at 12:27 AM, Thomas Gleixner <tglx@linutronix.de> wrote: > On Tue, 29 Sep 2015, David Miller wrote: >> From: Arnd Bergmann <arnd@arndb.de> >> Date: Mon, 28 Sep 2015 22:21:27 +0200 >> >> > When trying to build a kernel with time_t commented out, I found that >> > the ntp subsystem still relies on timespec for its pps handling. >> > >> > This series addresses this and converts all the code to use timespec64 >> > instead, step by step. There is one device driver that interacts with >> > this code directly (rather than only through the ptp subsystem), so >> > I have to convert that driver at the same time. >> > >> > The patches should ideally stay together as a series, but they do >> > span multiple subsystems, so I'm also looking for the right person >> > to merge them. >> >> I'm happy with this going via a tree other than mine, and for the > > I think it should go via John Stultz timekeeping tree. I've queued the set for testing. thanks -john -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web