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: 124816 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp89108lja; Wed, 17 Jan 2018 07:49:48 -0800 (PST) X-Google-Smtp-Source: ACJfBou10RiBDMBK5Yot+1J89kF9Fz92pWlnNNcbS+INoJsvZ3XXv85FLaszUolbtg//REnfCWxn X-Received: by 10.98.11.17 with SMTP id t17mr1961071pfi.201.1516204187866; Wed, 17 Jan 2018 07:49:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516204187; cv=none; d=google.com; s=arc-20160816; b=oMHqvA99L4KV8cFYcnNcxId8pTs3Q0HbO+ekfxhfWny205QgOzrauShjkpxK9vh7GZ ZzJ9wXPcYFtSnOk0z+PKlDpWFOVXhox1x592Y5nI5azM+wsdr9GrZlWLuchKD0SJGcDM SxI4Yj8u5z0mBsdZgOCZiAqdl8zBi1JM+70J1ZnP24ZqaMlDce++P0dVhRtI2U9sPchL 3uenBrQVpsLZ4ADUKK5/r0zucVPfxkoF8/i8In0xJE+wgDhmdH+VpcCs7UucHnSautfZ dqF9AvarkppNIyyFsMuZcfwrQnELgPWGAgXA73NXill9tyXOuuwVXwm4DG0xYmbUmcLY 8XHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+Ga2oru5t/vADEryfBikpNzrz41jLAZzMPkQ6c8tJfc=; b=AoxLJLcgYg6EvsTglzDhxUfNn2/Gq81k2CtYqJMH3jB3ErFJ7AKaLHnziGNd9qeG3b uXqOIn3PD4ebqjK9NM1MXJ9E9R5DiVIyQ2Orktpkv/ubYdWpuzOUu7I9HpQPQ8JuPP5h B1dKqCDqkMq8QRIdBArFYuzCaQjudOXm6uvkReDQxdCPwxfzmfJQ+20saoIfl5dcbBNb N11871ge0P33h6V7PFZtsWoxK8wfehBclWpLpZIIeHAknnJA6nm0ZXTHB5kSEvhb5gCI y8mvsPNfXmIDoCnzpzvFogMmOXt9moDLxzCgRZ+CObneW1arR/UYPRQhXWVIaMwZrGE9 zYxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10si256066ply.824.2018.01.17.07.49.47; Wed, 17 Jan 2018 07:49:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753756AbeAQPtp (ORCPT + 28 others); Wed, 17 Jan 2018 10:49:45 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:64091 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753427AbeAQPto (ORCPT ); Wed, 17 Jan 2018 10:49:44 -0500 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 Cc: Arnd Bergmann , Chris Wilson , Daniel Vetter , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Michal Wajdeczko , Mahesh Kumar , Lionel Landwerlin , Mika Kuoppala , Michel Thierry , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org 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== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.9.0 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);