From patchwork Wed Jan 17 15:48:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10169651 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 92F5C601D3 for ; Wed, 17 Jan 2018 15:49:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8187528676 for ; Wed, 17 Jan 2018 15:49:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75FAA28688; Wed, 17 Jan 2018 15:49:46 +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=unavailable 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 35A8228676 for ; Wed, 17 Jan 2018 15:49:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5761F895B6; Wed, 17 Jan 2018 15:49:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.187]) by gabe.freedesktop.org (Postfix) with ESMTPS id C6BCF89415; Wed, 17 Jan 2018 15:49:41 +0000 (UTC) Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue006 [212.227.15.129]) with ESMTPA (Nemesis) id 0MW4Oi-1eMKGd3Dce-00X1kg; Wed, 17 Jan 2018 16:49:19 +0100 From: Arnd Bergmann To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie Subject: [PATCH] [RESEND] drm: i915: remove timeval users Date: Wed, 17 Jan 2018 16:48:53 +0100 Message-Id: <20180117154916.219273-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:S4C0vVymGal+8R6Kr3L4TL/z0CQphhCX+pl7AXmkd/d8bswZIbx 87Mk4+SDLivIy9ISjaoUyPXJKuCPPMWElw0SWw6DXMU57LkCPc0MV7d9DZUALjh/R0EyKRO 3uyxgpezEjuDbGaj8aJdx4MLudNmCWtTiQYUFnuRLJcTLSoy3j9wF8lcGwkYc3MJCJWFrq4 KjWBO1lPH3jSYQF82zNwA== X-UI-Out-Filterresults: notjunk:1; V01:K0:8PfzhxNb6UU=:NnN6E0t/n2CJXDMRwTb4c7 /SNWobPiTnGi3BiIAx0g3RGCIrACozHMu3sSDWPD/Xm+QbXZyUCMizDhj2CQmAKLLjgjGZEep zsw7z6jMyoL/oyIQYVyslfy3X+wyMEm74jW9i5viV1mWBLHzFFLD2ch24Pp0cI4K9iSanh3Lb 1aNMG03uasJAL7f2Q6etEs7oYCBSrD38odbVpnrdRh9knQK4Wu/8GeSt7gUQJ6dlpToeduw5k 13V/4sms+dcYzL2wtaAGx71zTpzD5bA6Tr6suKC2e9is1PM5dfX3oLd82qg0hNrFUUXMJXajq wVN/G8if5CbzBumbt9f715vL4Y7TnM+AN26ZO9W+mBeu6rsajxZnocaCThgJBcPI5MaEbSGgO Syi04ObFyaSflQZiZWZweiF5z/7uVcSU3JKO5yRsDEs5E6pU3K4ayYAal8mSTOi3XQQ3QC0j/ vfl8AgrhDk73zBBNanP50xVcCk9Gza2ZVhewe/Bccz5IrM7gIAu9Of5qQ32HLBgQq+s0Ca0QL 6eoefyQjCy+Nr2NvGAEtx4jKvE7yLEl0ooyAwvqFw1W2VDL8GL2hnEixMkxUZeKvSCf21fA3K Pw7T9aKeaZxH4qFoyhKHWLiLLD8Gh20C2/bhE/XjLB3RzM23F9KH3OAG8VXqyYqdUeLiJtHW4 +gv/vhqJhbyIeKhGyiOPP/ilXkpBjGYLPMQhgDQz5t13lsNQ20MAuLBYADJefkGD0tROmEb67 UhwUzGrXLY8GETPkDYc4Z3snGaCSzSqyRgSauQ== Cc: Arnd Bergmann , Michel Thierry , Daniel Vetter , intel-gfx@lists.freedesktop.org, Mahesh Kumar , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Mika Kuoppala , Michal Wajdeczko X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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. Reviewed-by: Chris Wilson Signed-off-by: Arnd Bergmann --- Sent in November 2017, got the review from Chis, but the patch so far hasn't been merged. Resending it unchanged, please apply for 4.16 or 4.17. --- 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 caebd5825279..8d860fcd8c43 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -453,9 +453,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 944059322daa..06577574296b 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -610,6 +610,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) { @@ -620,12 +621,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 && @@ -1737,11 +1741,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); capture_params(error); capture_uc_state(error);