* [PATCH] drm/msm: avoid using 'timespec'
@ 2018-06-18 15:39 ` Arnd Bergmann
0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2018-06-18 15:39 UTC (permalink / raw)
To: Rob Clark, David Airlie
Cc: Arnd Bergmann, y2038, linux-arm-msm, linux-kernel, dri-devel, freedreno
The timespec structure and associated interfaces are deprecated and will
be removed in the future because of the y2038 overflow.
The use of ktime_to_timespec() in timeout_to_jiffies() does not
suffer from that overflow, but is easy to avoid by just converting
the ktime_t into jiffies directly.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/gpu/drm/msm/msm_drv.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index b2da1fbf81e0..cc8977476a41 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -353,8 +353,7 @@ static inline unsigned long timeout_to_jiffies(const ktime_t *timeout)
remaining_jiffies = 0;
} else {
ktime_t rem = ktime_sub(*timeout, now);
- struct timespec ts = ktime_to_timespec(rem);
- remaining_jiffies = timespec_to_jiffies(&ts);
+ remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ);
}
return remaining_jiffies;
--
2.9.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] drm/msm: avoid using 'timespec'
@ 2018-06-18 15:39 ` Arnd Bergmann
0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2018-06-18 15:39 UTC (permalink / raw)
To: Rob Clark, David Airlie
Cc: y2038, Arnd Bergmann, Jordan Crouse, Sean Paul, linux-arm-msm,
dri-devel, freedreno, linux-kernel
The timespec structure and associated interfaces are deprecated and will
be removed in the future because of the y2038 overflow.
The use of ktime_to_timespec() in timeout_to_jiffies() does not
suffer from that overflow, but is easy to avoid by just converting
the ktime_t into jiffies directly.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/gpu/drm/msm/msm_drv.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index b2da1fbf81e0..cc8977476a41 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -353,8 +353,7 @@ static inline unsigned long timeout_to_jiffies(const ktime_t *timeout)
remaining_jiffies = 0;
} else {
ktime_t rem = ktime_sub(*timeout, now);
- struct timespec ts = ktime_to_timespec(rem);
- remaining_jiffies = timespec_to_jiffies(&ts);
+ remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ);
}
return remaining_jiffies;
--
2.9.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/msm: avoid using 'timespec'
2018-06-18 15:39 ` Arnd Bergmann
@ 2018-07-10 20:47 ` Sean Paul
-1 siblings, 0 replies; 6+ messages in thread
From: Sean Paul @ 2018-07-10 20:47 UTC (permalink / raw)
To: Arnd Bergmann
Cc: David Airlie, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
Jordan Crouse, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
y2038-cunTk1MwBs8s++Sfvej+rw, Rob Clark, Sean Paul,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
On Mon, Jun 18, 2018 at 05:39:42PM +0200, Arnd Bergmann wrote:
> The timespec structure and associated interfaces are deprecated and will
> be removed in the future because of the y2038 overflow.
>
> The use of ktime_to_timespec() in timeout_to_jiffies() does not
> suffer from that overflow, but is easy to avoid by just converting
> the ktime_t into jiffies directly.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/gpu/drm/msm/msm_drv.h | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
> index b2da1fbf81e0..cc8977476a41 100644
> --- a/drivers/gpu/drm/msm/msm_drv.h
> +++ b/drivers/gpu/drm/msm/msm_drv.h
> @@ -353,8 +353,7 @@ static inline unsigned long timeout_to_jiffies(const ktime_t *timeout)
> remaining_jiffies = 0;
> } else {
> ktime_t rem = ktime_sub(*timeout, now);
> - struct timespec ts = ktime_to_timespec(rem);
> - remaining_jiffies = timespec_to_jiffies(&ts);
> + remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ);
Do you need to wrap rem in ktime_to_ns() just to be safe?
Sean
> }
>
> return remaining_jiffies;
> --
> 2.9.0
>
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/msm: avoid using 'timespec'
@ 2018-07-10 20:47 ` Sean Paul
0 siblings, 0 replies; 6+ messages in thread
From: Sean Paul @ 2018-07-10 20:47 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Rob Clark, David Airlie, y2038, Jordan Crouse, Sean Paul,
linux-arm-msm, dri-devel, freedreno, linux-kernel
On Mon, Jun 18, 2018 at 05:39:42PM +0200, Arnd Bergmann wrote:
> The timespec structure and associated interfaces are deprecated and will
> be removed in the future because of the y2038 overflow.
>
> The use of ktime_to_timespec() in timeout_to_jiffies() does not
> suffer from that overflow, but is easy to avoid by just converting
> the ktime_t into jiffies directly.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/gpu/drm/msm/msm_drv.h | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
> index b2da1fbf81e0..cc8977476a41 100644
> --- a/drivers/gpu/drm/msm/msm_drv.h
> +++ b/drivers/gpu/drm/msm/msm_drv.h
> @@ -353,8 +353,7 @@ static inline unsigned long timeout_to_jiffies(const ktime_t *timeout)
> remaining_jiffies = 0;
> } else {
> ktime_t rem = ktime_sub(*timeout, now);
> - struct timespec ts = ktime_to_timespec(rem);
> - remaining_jiffies = timespec_to_jiffies(&ts);
> + remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ);
Do you need to wrap rem in ktime_to_ns() just to be safe?
Sean
> }
>
> return remaining_jiffies;
> --
> 2.9.0
>
--
Sean Paul, Software Engineer, Google / Chromium OS
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/msm: avoid using 'timespec'
2018-07-10 20:47 ` Sean Paul
(?)
@ 2018-07-10 21:27 ` Arnd Bergmann
2018-07-11 14:00 ` Sean Paul
-1 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2018-07-10 21:27 UTC (permalink / raw)
To: Sean Paul
Cc: Rob Clark, David Airlie, y2038 Mailman List, Jordan Crouse,
linux-arm-msm, dri-devel, freedreno, Linux Kernel Mailing List
On Tue, Jul 10, 2018 at 10:47 PM, Sean Paul <seanpaul@chromium.org> wrote:
> On Mon, Jun 18, 2018 at 05:39:42PM +0200, Arnd Bergmann wrote:
>> The timespec structure and associated interfaces are deprecated and will
>> be removed in the future because of the y2038 overflow.
>>
>> The use of ktime_to_timespec() in timeout_to_jiffies() does not
>> suffer from that overflow, but is easy to avoid by just converting
>> the ktime_t into jiffies directly.
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> drivers/gpu/drm/msm/msm_drv.h | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
>> index b2da1fbf81e0..cc8977476a41 100644
>> --- a/drivers/gpu/drm/msm/msm_drv.h
>> +++ b/drivers/gpu/drm/msm/msm_drv.h
>> @@ -353,8 +353,7 @@ static inline unsigned long timeout_to_jiffies(const ktime_t *timeout)
>> remaining_jiffies = 0;
>> } else {
>> ktime_t rem = ktime_sub(*timeout, now);
>> - struct timespec ts = ktime_to_timespec(rem);
>> - remaining_jiffies = timespec_to_jiffies(&ts);
>> + remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ);
>
> Do you need to wrap rem in ktime_to_ns() just to be safe?
The ktime_t interfaces are still defined to use an opaque type,
as previously it was a union that could be a seconds/nanoseconds
pair depending on the architecture. These days, ktime_t is just
a 64-bit integer, so div_u64() would work just as well as ktime_divns(),
but this is the documented way to do it.
Arnd
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] drm/msm: avoid using 'timespec'
2018-07-10 21:27 ` Arnd Bergmann
@ 2018-07-11 14:00 ` Sean Paul
0 siblings, 0 replies; 6+ messages in thread
From: Sean Paul @ 2018-07-11 14:00 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Sean Paul, Rob Clark, David Airlie, y2038 Mailman List,
Jordan Crouse, linux-arm-msm, dri-devel, freedreno,
Linux Kernel Mailing List
On Tue, Jul 10, 2018 at 11:27:00PM +0200, Arnd Bergmann wrote:
> On Tue, Jul 10, 2018 at 10:47 PM, Sean Paul <seanpaul@chromium.org> wrote:
> > On Mon, Jun 18, 2018 at 05:39:42PM +0200, Arnd Bergmann wrote:
> >> The timespec structure and associated interfaces are deprecated and will
> >> be removed in the future because of the y2038 overflow.
> >>
> >> The use of ktime_to_timespec() in timeout_to_jiffies() does not
> >> suffer from that overflow, but is easy to avoid by just converting
> >> the ktime_t into jiffies directly.
> >>
> >> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >> ---
> >> drivers/gpu/drm/msm/msm_drv.h | 3 +--
> >> 1 file changed, 1 insertion(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
> >> index b2da1fbf81e0..cc8977476a41 100644
> >> --- a/drivers/gpu/drm/msm/msm_drv.h
> >> +++ b/drivers/gpu/drm/msm/msm_drv.h
> >> @@ -353,8 +353,7 @@ static inline unsigned long timeout_to_jiffies(const ktime_t *timeout)
> >> remaining_jiffies = 0;
> >> } else {
> >> ktime_t rem = ktime_sub(*timeout, now);
> >> - struct timespec ts = ktime_to_timespec(rem);
> >> - remaining_jiffies = timespec_to_jiffies(&ts);
> >> + remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ);
> >
> > Do you need to wrap rem in ktime_to_ns() just to be safe?
>
> The ktime_t interfaces are still defined to use an opaque type,
> as previously it was a union that could be a seconds/nanoseconds
> pair depending on the architecture. These days, ktime_t is just
> a 64-bit integer, so div_u64() would work just as well as ktime_divns(),
> but this is the documented way to do it.
Hey Arnd,
Ahh, ok, I think I realize my confusion now. If ktime_t was not ns,
ktime_divns() would do the conversion for us. Since it is ns, the conversion
is a no-op (which is why I didn't see ktime_to_ns() in ktime_divns()).
Thanks for breaking that down for me,
Reviewed-by: Sean Paul <seanpaul@chromium.org>
>
> Arnd
--
Sean Paul, Software Engineer, Google / Chromium OS
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-07-11 14:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18 15:39 [PATCH] drm/msm: avoid using 'timespec' Arnd Bergmann
2018-06-18 15:39 ` Arnd Bergmann
[not found] ` <20180618153959.2169325-1-arnd-r2nGTMty4D4@public.gmane.org>
2018-07-10 20:47 ` Sean Paul
2018-07-10 20:47 ` Sean Paul
2018-07-10 21:27 ` Arnd Bergmann
2018-07-11 14:00 ` Sean Paul
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.