All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent ABRIOU <vincent.abriou@st.com>
To: Arnd Bergmann <arnd@arndb.de>,
	"y2038@lists.linaro.org" <y2038@lists.linaro.org>
Cc: David Airlie <airlied@linux.ie>,
	Benjamin Gaignard <benjamin.gaignard@linaro.org>,
	Tina Ruchandani <ruchandani.tina@gmail.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/sti: Use 64-bit timestamps
Date: Mon, 18 Apr 2016 12:02:35 +0200	[thread overview]
Message-ID: <5714B0BB.1020306@st.com> (raw)
In-Reply-To: <7376001.70fALvhWdv@wuerfel>

On 04/17/2016 01:39 AM, Arnd Bergmann wrote:
> On Wednesday 13 April 2016 02:28:02 Tina Ruchandani wrote:
>> 'struct timespec' uses a 32-bit field for seconds, which
>> will overflow in year 2038 and beyond. This patch is part
>> of a larger attempt to remove instances of timeval, timespec
>> and time_t, all of which suffer from the y2038 issue, from the
>> kernel.
>>
>> Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
>
> Looks good in principle. Two small points:
>
>>   void sti_plane_update_fps(struct sti_plane *plane,
>>   			  bool new_frame,
>>   			  bool new_field)
>>   {
>> -	struct timespec now;
>> +	ktime_t now;
>>   	struct sti_fps_info *fps;
>>   	int fpks, fipks, ms_since_last, num_frames, num_fields;
>>
>> -	getrawmonotonic(&now);
>> +	now = ktime_get();
>
> It's unclear why the driver was using getrawmonotonic() here rather
> than ktime_get_ts(). The code is fairly new, so Vincent can
> probably explain this.
>
> If it was intentional, we should use ktime_get_raw() instead of
> ktime_get().
>

getrawmonotonic comes from a legacy code so the use is not intentional.
Honestly, it is not clear to me the difference between monotonic and 
rawmonotonic. But in the debug context in which it is used, ktime_get 
and ktime_get_raw will deliver the same level of information we need. So 
implementation done by Tina is fine for me.

Vincent

>> @@ -76,7 +66,7 @@ void sti_plane_update_fps(struct sti_plane *plane,
>>   		return;
>>
>>   	fps->curr_frame_counter++;
>> -	ms_since_last = sti_plane_timespec_ms_diff(now, fps->last_timestamp);
>> +	ms_since_last = ktime_to_ms(ktime_sub(now, fps->last_timestamp));
>>   	num_frames = fps->curr_frame_counter - fps->last_frame_counter;
>
> This could be expressed in a more compact way using ktime_ms_delta().
>
> 	Arnd
>
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038

WARNING: multiple messages have this Message-ID (diff)
From: Vincent ABRIOU <vincent.abriou@st.com>
To: Arnd Bergmann <arnd@arndb.de>,
	"y2038@lists.linaro.org" <y2038@lists.linaro.org>
Cc: Tina Ruchandani <ruchandani.tina@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	David Airlie <airlied@linux.ie>,
	Benjamin Gaignard <benjamin.gaignard@linaro.org>
Subject: Re: [Y2038] [PATCH] drm/sti: Use 64-bit timestamps
Date: Mon, 18 Apr 2016 12:02:35 +0200	[thread overview]
Message-ID: <5714B0BB.1020306@st.com> (raw)
In-Reply-To: <7376001.70fALvhWdv@wuerfel>

On 04/17/2016 01:39 AM, Arnd Bergmann wrote:
> On Wednesday 13 April 2016 02:28:02 Tina Ruchandani wrote:
>> 'struct timespec' uses a 32-bit field for seconds, which
>> will overflow in year 2038 and beyond. This patch is part
>> of a larger attempt to remove instances of timeval, timespec
>> and time_t, all of which suffer from the y2038 issue, from the
>> kernel.
>>
>> Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
>
> Looks good in principle. Two small points:
>
>>   void sti_plane_update_fps(struct sti_plane *plane,
>>   			  bool new_frame,
>>   			  bool new_field)
>>   {
>> -	struct timespec now;
>> +	ktime_t now;
>>   	struct sti_fps_info *fps;
>>   	int fpks, fipks, ms_since_last, num_frames, num_fields;
>>
>> -	getrawmonotonic(&now);
>> +	now = ktime_get();
>
> It's unclear why the driver was using getrawmonotonic() here rather
> than ktime_get_ts(). The code is fairly new, so Vincent can
> probably explain this.
>
> If it was intentional, we should use ktime_get_raw() instead of
> ktime_get().
>

getrawmonotonic comes from a legacy code so the use is not intentional.
Honestly, it is not clear to me the difference between monotonic and 
rawmonotonic. But in the debug context in which it is used, ktime_get 
and ktime_get_raw will deliver the same level of information we need. So 
implementation done by Tina is fine for me.

Vincent

>> @@ -76,7 +66,7 @@ void sti_plane_update_fps(struct sti_plane *plane,
>>   		return;
>>
>>   	fps->curr_frame_counter++;
>> -	ms_since_last = sti_plane_timespec_ms_diff(now, fps->last_timestamp);
>> +	ms_since_last = ktime_to_ms(ktime_sub(now, fps->last_timestamp));
>>   	num_frames = fps->curr_frame_counter - fps->last_frame_counter;
>
> This could be expressed in a more compact way using ktime_ms_delta().
>
> 	Arnd
>

  reply	other threads:[~2016-04-18 10:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13  9:28 [PATCH] drm/sti: Use 64-bit timestamps Tina Ruchandani
2016-04-13  9:28 ` Tina Ruchandani
2016-04-16 23:39 ` [Y2038] " Arnd Bergmann
2016-04-16 23:39   ` Arnd Bergmann
2016-04-18 10:02   ` Vincent ABRIOU [this message]
2016-04-18 10:02     ` Vincent ABRIOU
2016-04-18 10:32     ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5714B0BB.1020306@st.com \
    --to=vincent.abriou@st.com \
    --cc=airlied@linux.ie \
    --cc=arnd@arndb.de \
    --cc=benjamin.gaignard@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ruchandani.tina@gmail.com \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.