From patchwork Sat Nov 4 21:26: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: 117981 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1193936qgn; Sat, 4 Nov 2017 14:27:47 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QMfgBVXByMblor0t9viB+MP5krXECO0YDED4GANuoyUOstFOzuLk5rdUi44XG5zRsx2xhe X-Received: by 10.84.241.207 with SMTP id t15mr10490259plm.158.1509830867506; Sat, 04 Nov 2017 14:27:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509830867; cv=none; d=google.com; s=arc-20160816; b=rNgsTCsuLpVdsIBosXA7BxzIRX32AIuFD3uVIvDGfOOUR1bS9+1tjAXz+miaElultm K6ofGRSNP/E5rokKcQPzLLdc6zP6XCPpZZcP2XGnTL04neAFKgaH9/QY4kv/j/vqlUOl QveuPf7e56pOIhtSRAAL3eFRhdr87lXYH35lQ7QK3hQVNZ34frMQE6kjBhRWuGQGruYx 7TrXdw0OMmjLBrp8ZsJIe2D6tytIMbh2PkRVx9W7eX4JrAhOIbHQc+y/+oQjvMrEipAe KMxxYPnzPOtNuNjD0lppbXlhklTtEi6x2Bm9hKmPj8lr2zH49x0CXX46+howiylCinji YsoQ== 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=CIRjj+wl9lxsMF+AZqk76Kb/vb5tCLlRa/tQOYfssD4=; b=HkAMzX3mMtkNGs1tlT4PURidc+BhMkRDdRBX7/BbQxPgq3XDM8voCwAZxXG3IzkrqK S/C5LM4I0N8/L19WJ8e30P6OEwou8XImqSnWeChz/N5HQSKlXV4PTDPVe0j8G+9l4FND /pS8Y0U6V5EOsJd8RbTvxFVCEbbZawyBT6MhrgcRY/3VxxOcE/67LyUTnVE2EdCm7DaG MHasWzeaHb15si+hrojVEtMywHwWWGnkL3xNYMBn0vHfANGHuJI8yQ1wYMFdm0NQ652F Hfe+ly6lm/A0zAFI5pqq3TlhG7aqNkgan+1a4jUQs6HVi6FDUSqU9Rai4pYE8+9qX8Nx 5QqA== 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 z18si9318775pfl.68.2017.11.04.14.27.47; Sat, 04 Nov 2017 14:27:47 -0700 (PDT) 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 S1751994AbdKDV1p (ORCPT + 26 others); Sat, 4 Nov 2017 17:27:45 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:64789 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751474AbdKDV1n (ORCPT ); Sat, 4 Nov 2017 17:27:43 -0400 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0LsQye-1d9TmF0dsu-011w29; Sat, 04 Nov 2017 22:27:31 +0100 From: Arnd Bergmann To: Russell Currey , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: y2038@lists.linaro.org, Arnd Bergmann , Alexey Kardashevskiy , Andrew Donnellan , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] powerpc: eeh: stop using do_gettimeofday() Date: Sat, 4 Nov 2017 22:26:52 +0100 Message-Id: <20171104212727.3228606-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:v9PWvgq+Dc3Aj7idKk9TVW8MU6WmY5HaLJsXMBWHoXCaqs1nuXE Skv36er204zZbfVuGiiUIfz8GFPuLQh/bxTQNIJqe5WmNeYUc2jrcSiJBwmvX8gwLS+rq1R i/PBRcQ3NNcXXm6yJDjJFq+9N4h5O6YiSkbMLlTe24Oogfo6BcB9HljUO4KWcK5xUJHg7iw +PcTZyH6Lf6Vqp/1dq50Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:nV7CwJw2k60=:cXioMaVdb9HwspXeW686Kd qog++Q2hmy+NCx8hQSbSy0Uh2SpsDL1qPnYVoQQVw9+bs4TbOwC98Vz0Ih76u7MHAMu2Vo3yS yti1/wC4QoAWzFoP4ek0ZcfwwpfGGAdKbu6oumZfEnhBgLZeWxYemxos3Jc5j/orAFug4ZRIj fM5aOWvuphfqNvm7Gp1zXDq5kc4E+Px3iv7ZMT7VyLB2x+kDevkye79S+8Dp/vvsbA2lQmE1O eMEfLcYqYbtX9f+Qd+MaavjJnOkNVba1g0j+fTmiJHjAdPE+KynYtHR2X4+1lzS8FD/xhoq1c Kv8aZoIjkp0MJRL7MeEykOU0qGY0QfoP2H17s8oVwq1LNmXSHdbL3WA7blMcKkvtfo+d9TD+v kgMqPYa6CnpkuKSzT5r4qK0JrQfiH0x50gaj3ueXgSQ2Bie9ysP+Ymdv2mv6obJdF3hnwt2eK uOS14T07CSy3mvntoRXpxBF9ShSiIVtATCq+L8U2X/VRDwWOpu5HrWcyEzygCy3uh8Auhn8Em E3Ro0RWHwEec5Byai9pUlqHFX8dVyweZOKgt1We5bZ8HOvQ40/Unn4NT3kGiqKEc47/FUTuTy ZFWngdUwDgrr87lY0ABzfqcbiZ/3Gds+hR4ShBc2DGSY444V3cP7jv7TU52/35e+XvCDz3yIx EaBZg2c5ow7T+JSIHg0B68FX4ngsFtfdEy0AI/+DXnj/yNllLOqrG0PCC2hSWVOnKbeKQooju BH2sIpqOzzashAZxM6icM2L8WoYsBKqH/+c2qw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This interface is inefficient and deprecated because of the y2038 overflow. ktime_get_seconds() is an appropriate replacement here, since it has sufficient granularity but is more efficient and uses monotonic time. Signed-off-by: Arnd Bergmann --- arch/powerpc/include/asm/eeh.h | 2 +- arch/powerpc/kernel/eeh_driver.c | 2 +- arch/powerpc/kernel/eeh_pe.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) -- 2.9.0 Reviewed-by: Andrew Donnellan Acked-by: Russell Currey diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h index cd1df96335e5..5161c37dd039 100644 --- a/arch/powerpc/include/asm/eeh.h +++ b/arch/powerpc/include/asm/eeh.h @@ -93,7 +93,7 @@ struct eeh_pe { struct pci_bus *bus; /* Top PCI bus for bus PE */ int check_count; /* Times of ignored error */ int freeze_count; /* Times of froze up */ - struct timeval tstamp; /* Time on first-time freeze */ + time64_t tstamp; /* Time on first-time freeze */ int false_positives; /* Times of reported #ff's */ atomic_t pass_dev_cnt; /* Count of passed through devs */ struct eeh_pe *parent; /* Parent PE */ diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c index 4e1b433f6cb5..4f71e4c9beb7 100644 --- a/arch/powerpc/kernel/eeh_driver.c +++ b/arch/powerpc/kernel/eeh_driver.c @@ -623,7 +623,7 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus, struct eeh_rmv_data *rmv_data) { struct pci_bus *frozen_bus = eeh_pe_bus_get(pe); - struct timeval tstamp; + time64_t tstamp; int cnt, rc; struct eeh_dev *edev; diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c index 2e8d1b2b5af4..2d4956e97aa9 100644 --- a/arch/powerpc/kernel/eeh_pe.c +++ b/arch/powerpc/kernel/eeh_pe.c @@ -526,16 +526,16 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev) */ void eeh_pe_update_time_stamp(struct eeh_pe *pe) { - struct timeval tstamp; + time64_t tstamp; if (!pe) return; if (pe->freeze_count <= 0) { pe->freeze_count = 0; - do_gettimeofday(&pe->tstamp); + pe->tstamp = ktime_get_seconds(); } else { - do_gettimeofday(&tstamp); - if (tstamp.tv_sec - pe->tstamp.tv_sec > 3600) { + tstamp = ktime_get_seconds(); + if (tstamp - pe->tstamp > 3600) { pe->tstamp = tstamp; pe->freeze_count = 0; }