From patchwork Fri Nov 3 19:53:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10041115 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 129656032D for ; Fri, 3 Nov 2017 19:54:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04ED5298A8 for ; Fri, 3 Nov 2017 19:54:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED8E5298AB; Fri, 3 Nov 2017 19:54:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2AFA6298A4 for ; Fri, 3 Nov 2017 19:54:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EAE1A6E0DD; Fri, 3 Nov 2017 19:54:29 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id 454C66E0DD; Fri, 3 Nov 2017 19:54:27 +0000 (UTC) Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0MEKbo-1dvLxq2h6e-00FPRq; Fri, 03 Nov 2017 20:54:10 +0100 From: Arnd Bergmann To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie Date: Fri, 3 Nov 2017 20:53:52 +0100 Message-Id: <20171103195406.1846092-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:GCVtAaGLD684A6/6tuvKrX/FQZ1WthoN6RRa7WEwH19PyaXoWtE CNuCRm5mivvEtsNXk4KvIEBAQOePlQUlqoT49vjSb/61lz4r/Cf/P4tEO7cgiu750AoOqsM xM2/ySde3gYAWN9hgqBFdxGu5ZyhPRZrNIkqZPV1hwtRdlTF3s2HoZ0g2CQ7Q24ZPKUGYg1 EE+JboQzEFIiDEkDAe16Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:8kmIj7Tn65g=:Ffa5BSqnATU8yutWjtC/w8 ejsVijfrcTYg55dkYqlxDfl9Ege8pl5MrQ3Hqe98Yoouo/qc8CSTypHy0jPrF2mNlQEFvK1Xo LWaZg3El7ZmNUyXMpqD8Kkkg8BrfQ2VZgSHVURcSpri3qYRiUregvPsBTbAaW7kyhznfTCRqn tM5tWhx56hXZZhggIqU1MT9V+J4yonO4jl9dH3qCXzjkVte/397jHVE2reVgVFSSTwMxZ+7kb 6T4PLMR793DgAgeqmZjKuWL5PRhYBCeukYb9WaciTcwcjjx5Yriz4Gvq3AYG3ezXMxS0+Zd1d kUWNGalJyQ5SF6xhknK0Kv/MMZs1cRPmlpN3+Q79yJJZP44zYx+4iTFGdhvZVkwXqQoLnIYeK Bn+X9xrmBOFDXGlrIcGjLEtNwjXMzPOASKIKtf3WuRJ4IzWsx3n8OpYbt0rYihLkG4Q1C8X2p 6U7OkT3zKPTUs9Phdn90PHZlIWOn2fXmHIryJqFtcKWlYNCFwfZeShJf0XYGxCOF1tZ2GjTJ9 MOjToOaA+0TNW6xR2rt3IjcXaNB4MvX3IT139oqbBzhPJMQIMM7fepL4nY05kDFAM+WSu3PO1 9LmksprWm6qLr+2VpsaXeStv2IdPx0xt0uyZkOBfM6xfl9gjNCU2tWtQOKUn1UYhlKbJxTvyq fYCzx5WUes0THUHlB+SBokOBD6uBjd6W9PLjCxvXaZpZH2GcOdHEK3G1TZmZ4kYPstSUCRqLp moyGKNQxaYz7tQopQOlt8gT/YvsbA/x7rjhZvw== Cc: Arnd Bergmann , Daniel Vetter , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Matthew Auld Subject: [Intel-gfx] [PATCH] drm: i915: remove timeval users X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/gpu/drm/i915/i915_drv.h | 6 +++--- drivers/gpu/drm/i915/i915_gpu_error.c | 25 ++++++++++++++----------- 2 files changed, 17 insertions(+), 14 deletions(-) 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);