diff mbox

drm: i915: remove timeval users

Message ID 20171103195406.1846092-1-arnd@arndb.de (mailing list archive)
State New, archived
Headers show

Commit Message

Arnd Bergmann Nov. 3, 2017, 7:53 p.m. UTC
struct timeval is deprecated because it cannot represent times
past 2038. In this driver, the only use of this structure is
to capture debug information. This is easily changed to ktime_t,
which we then format as needed when printing it later.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/i915/i915_drv.h       |  6 +++---
 drivers/gpu/drm/i915/i915_gpu_error.c | 25 ++++++++++++++-----------
 2 files changed, 17 insertions(+), 14 deletions(-)

Comments

Arnd Bergmann Nov. 8, 2017, 1:01 p.m. UTC | #1
On Wed, Nov 8, 2017 at 1:31 PM, Patchwork
<patchwork@emeril.freedesktop.org> wrote:
> == Series Details ==
>
> Series: drm: i915: remove timeval users
> URL   : https://patchwork.freedesktop.org/series/33147/
> State : failure
> For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6971/

Can someone explain to me what to make of the test results for my patch?

I received three mails that all sound like there is something seriously wrong
with my patch. It's possible that this is the case, but I don't see anything I
did related to what I find in the test report.

Are there known false-positives that would explain it, or do I have to look
harder?

        Arnd
Daniel Vetter Nov. 8, 2017, 1:08 p.m. UTC | #2
On Wed, Nov 08, 2017 at 02:01:12PM +0100, Arnd Bergmann wrote:
> On Wed, Nov 8, 2017 at 1:31 PM, Patchwork
> <patchwork@emeril.freedesktop.org> wrote:
> > == Series Details ==
> >
> > Series: drm: i915: remove timeval users
> > URL   : https://patchwork.freedesktop.org/series/33147/
> > State : failure
> > For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6971/
> 
> Can someone explain to me what to make of the test results for my patch?
> 
> I received three mails that all sound like there is something seriously wrong
> with my patch. It's possible that this is the case, but I don't see anything I
> did related to what I find in the test report.
> 
> Are there known false-positives that would explain it, or do I have to look
> harder?

CI on fire, sorry about the noise. It unfortunately still happens too
often, which is why we don't inflict it on the general unsuspecting
public, but just people who submit stuff to intel-gfx.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 72bb5b51035a..a407c673dd10 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -896,9 +896,9 @@  struct intel_display_error_state;
 
 struct i915_gpu_state {
 	struct kref ref;
-	struct timeval time;
-	struct timeval boottime;
-	struct timeval uptime;
+	ktime_t time;
+	ktime_t boottime;
+	ktime_t uptime;
 
 	struct drm_i915_private *i915;
 
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 653fb69e7ecb..65f781e3b63f 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -594,6 +594,7 @@  int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 {
 	struct drm_i915_private *dev_priv = m->i915;
 	struct drm_i915_error_object *obj;
+	struct timespec64 ts;
 	int i, j;
 
 	if (!error) {
@@ -604,12 +605,15 @@  int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 	if (*error->error_msg)
 		err_printf(m, "%s\n", error->error_msg);
 	err_printf(m, "Kernel: " UTS_RELEASE "\n");
-	err_printf(m, "Time: %ld s %ld us\n",
-		   error->time.tv_sec, error->time.tv_usec);
-	err_printf(m, "Boottime: %ld s %ld us\n",
-		   error->boottime.tv_sec, error->boottime.tv_usec);
-	err_printf(m, "Uptime: %ld s %ld us\n",
-		   error->uptime.tv_sec, error->uptime.tv_usec);
+	ts = ktime_to_timespec64(error->time);
+	err_printf(m, "Time: %lld s %ld us\n",
+		   (s64)ts.tv_sec, ts.tv_nsec / NSEC_PER_USEC);
+	ts = ktime_to_timespec64(error->boottime);
+	err_printf(m, "Boottime: %lld s %ld us\n",
+		   (s64)ts.tv_sec, ts.tv_nsec / NSEC_PER_USEC);
+	ts = ktime_to_timespec64(error->uptime);
+	err_printf(m, "Uptime: %lld s %ld us\n",
+		   (s64)ts.tv_sec, ts.tv_nsec / NSEC_PER_USEC);
 
 	for (i = 0; i < ARRAY_SIZE(error->engine); i++) {
 		if (error->engine[i].hangcheck_stalled &&
@@ -1699,11 +1703,10 @@  static int capture(void *data)
 {
 	struct i915_gpu_state *error = data;
 
-	do_gettimeofday(&error->time);
-	error->boottime = ktime_to_timeval(ktime_get_boottime());
-	error->uptime =
-		ktime_to_timeval(ktime_sub(ktime_get(),
-					   error->i915->gt.last_init_time));
+	error->time = ktime_get_real();
+	error->boottime = ktime_get_boottime();
+	error->uptime = ktime_sub(ktime_get(),
+				  error->i915->gt.last_init_time);
 
 	error->params = i915_modparams;
 #define DUP(T, x, ...) dup_param(#T, &error->params.x);