From patchwork Tue Nov 7 10:41:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 118147 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp3812622qgn; Tue, 7 Nov 2017 02:43:30 -0800 (PST) X-Google-Smtp-Source: ABhQp+TA16wUhFvrU0FzVGVmRB3IFUQKgyY0i6JhpJsDutD7jp2HnOaWO7fvI1N9/P2f5nuDzoYW X-Received: by 10.99.154.66 with SMTP id e2mr17835037pgo.287.1510051410282; Tue, 07 Nov 2017 02:43:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510051410; cv=none; d=google.com; s=arc-20160816; b=AqOWPGn7G2CFmmeqcWc5rHxx6rl2vzBCga4Es5n5lOOrLyGfMBMRZhgce53K3z4Bvb u4WWfdP4U9UPGnRiYc+IyWXZL2aLZ/GPMeX6+v6zXnWQABZNjESki0KZiFQE5DSlKUb8 cf6jcVBP5MB8G5SL05BVo9aFHY9oPsTiCABM+0Ojv6JRFqfAybh5TLd24obZEKb07D2m 0h9tgfHIsbd8OjDyZTnxOgwuhj1WvQLAX/nybq7beNTD4f6MhAlruyR6fACz7qxc5Xxa Ruym/JfoSYmiXU/Spo3X+tEAvXZ01x6YBkR4OGprR5c6jDBrfp5ojrxarSd4OwqYGqRq QnoQ== 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=K9XGPHbROOUlfRAaHh6ph7STKa9VAuSYVqQqTKZviqU=; b=cvP3gzC2IvE0hpQENM87fqURR+xrN3r+QgIW7tLclV2tHmGi4EEQT5SWYAcervFU0o 1+mpZPcrmnPxN10iOLV2ysMmUa1+6FKSJH1o373HmwiZHDB8WB9f+Ay7oh/dXlCpPvQk no7PCThI9X8GC+tq3Pb5ur0O9LdoqIWBcVeWQOQ2XZHfOazTlR47zEPn7XRTKKIpNMcT OiVTsdlJ/ItlXm1CxI5UBgh1FIvnfOWPpXGosH0SU1oqe5wy9UuvYaefh1Zayz+L8v2O YjNfPSfcSPlKoRafZBpHdyC62rVinPBV4YAEjpG2j8QxJI5ZQIknECP0AcsTfniLLok9 iiwQ== 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 y11si869446plg.483.2017.11.07.02.43.30; Tue, 07 Nov 2017 02:43:30 -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 S1757269AbdKGKn0 (ORCPT + 26 others); Tue, 7 Nov 2017 05:43:26 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:58589 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750770AbdKGKnX (ORCPT ); Tue, 7 Nov 2017 05:43:23 -0500 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.129]) with ESMTPA (Nemesis) id 0MIAwM-1eFr622rLq-003uCt; Tue, 07 Nov 2017 11:43:08 +0100 From: Arnd Bergmann To: Satish Kharat , Sesidhar Baddela , Karan Tilak Kumar , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , Johannes Thumshirn , Deepa Dinamani , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] fnic: use 64-bit timestamps Date: Tue, 7 Nov 2017 11:41:39 +0100 Message-Id: <20171107104305.2952640-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:5CVqoNTXpV/1Yo9rwpL1dcPvlm3/g8jypY8gErxVkjhmhvLGHOQ DE/E0fU25SSKRc53bHU7OqDA8MBS41bz5g64FdzDU6vho0nBED1M6MJ8HZEPiShbqayX35K MwC74+UdO2lUDnWLNojHQvQnginDC2OIkLy865jKIjW8gZPsDnRtRl9uVSzinxyX1snkqRN ekXba1b0/yTDL2cq3tycw== X-UI-Out-Filterresults: notjunk:1; V01:K0:llJoaIMIbck=:paCtx5Sd5iOnjyb59gHmul YUCZxJQVYgxhjh7eI3kn6t1wHEi8Q/+Qf9pEYHrkNeZ5nfhFRUEHjT/Po6kLi0/fETeVHMlZ8 JA9bDxgjWbllEOy+xIeawx/eii5rMFyt1gXjNkk0Gtwv9v95ok1wcVB0BBOII6s5bFDyHAlBG CHOh8AV8TyNjPNJbJTA936cef+GUERLAU0/CY3JlubFy2rBNZTzVSWrgteKog9qzN2kFDQmY+ nHk24o411NED2CkWuVF2MoKWWSTklGdFiQp7axprfz3CH145KSRd03vNtwmrGRzTd1Ji9MSLs +49swjTG7K80wvzQshDzaYUK1yLkFFd29QR7u24fsaihu8uhw/iNHNzFGVMfeUCHW9LK5MZeu DxhSMraRNkOQiqnLnkzvjVqQhzO6bgivpDBo9DMrzi6yxORcdEExS2y/KAHmE0wosM7WYQZut G9pkhxAO5JP/n7vAL8rFq0YBrdg76Uz+gt5RyeOPs3f7nR+aT2bpOdFCz4Hlp5mXvEVj0Ha35 9S0GfuGnlu5ibyOE0M7fVMbmFcdsdXdD3tnt5P/DyCKynlKlO/cJU8cGlDyyHPjZpnIs0Fwpz a31NrjcHQOrs9mWdRK5tHc1Nb7dz33hb783UP8xpZDP3DFkKGa8L0oFzLEPABRYhQF8544LQw iapwVH4Yy3pcgRkuk5+PGZAE4faQ8PdwO3b1H9DUTPbNsNet8ZU5R5sOGec4UiAj7eMWF2Zw5 WcrgDZIeY/rlOGBCuS1/q9pWyHPPzGlJ2cQZKw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org struct timespec is deprecated since it overflows in 2038 on 32-bit architectures, so we should use timespec64 consistently. I'm slightly adapting the format strings here, to make sure we print the nanoseconds with the correct number of leading zeroes. Signed-off-by: Arnd Bergmann --- drivers/scsi/fnic/fnic_debugfs.c | 2 +- drivers/scsi/fnic/fnic_stats.h | 4 +-- drivers/scsi/fnic/fnic_trace.c | 58 ++++++++++++++++++++-------------------- 3 files changed, 32 insertions(+), 32 deletions(-) -- 2.9.0 diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c index 5e3d909cfc53..db44e1bf1ecd 100644 --- a/drivers/scsi/fnic/fnic_debugfs.c +++ b/drivers/scsi/fnic/fnic_debugfs.c @@ -632,7 +632,7 @@ static ssize_t fnic_reset_stats_write(struct file *file, sizeof(struct io_path_stats) - sizeof(u64)); memset(fw_stats_p+1, 0, sizeof(struct fw_stats) - sizeof(u64)); - getnstimeofday(&stats->stats_timestamps.last_reset_time); + ktime_get_real_ts64(&stats->stats_timestamps.last_reset_time); } (*ppos)++; diff --git a/drivers/scsi/fnic/fnic_stats.h b/drivers/scsi/fnic/fnic_stats.h index e007feedbf72..9daa6ada6fa0 100644 --- a/drivers/scsi/fnic/fnic_stats.h +++ b/drivers/scsi/fnic/fnic_stats.h @@ -18,8 +18,8 @@ #define _FNIC_STATS_H_ struct stats_timestamps { - struct timespec last_reset_time; - struct timespec last_read_time; + struct timespec64 last_reset_time; + struct timespec64 last_read_time; }; struct io_path_stats { diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c index 4826f596cb31..abddde11982b 100644 --- a/drivers/scsi/fnic/fnic_trace.c +++ b/drivers/scsi/fnic/fnic_trace.c @@ -111,7 +111,7 @@ int fnic_get_trace_data(fnic_dbgfs_t *fnic_dbgfs_prt) int len = 0; unsigned long flags; char str[KSYM_SYMBOL_LEN]; - struct timespec val; + struct timespec64 val; fnic_trace_data_t *tbp; spin_lock_irqsave(&fnic_trace_lock, flags); @@ -129,10 +129,10 @@ int fnic_get_trace_data(fnic_dbgfs_t *fnic_dbgfs_prt) /* Convert function pointer to function name */ if (sizeof(unsigned long) < 8) { sprint_symbol(str, tbp->fnaddr.low); - jiffies_to_timespec(tbp->timestamp.low, &val); + jiffies_to_timespec64(tbp->timestamp.low, &val); } else { sprint_symbol(str, tbp->fnaddr.val); - jiffies_to_timespec(tbp->timestamp.val, &val); + jiffies_to_timespec64(tbp->timestamp.val, &val); } /* * Dump trace buffer entry to memory file @@ -140,8 +140,8 @@ int fnic_get_trace_data(fnic_dbgfs_t *fnic_dbgfs_prt) */ len += snprintf(fnic_dbgfs_prt->buffer + len, (trace_max_pages * PAGE_SIZE * 3) - len, - "%16lu.%16lu %-50s %8x %8x %16llx %16llx " - "%16llx %16llx %16llx\n", val.tv_sec, + "%16llu.%09lu %-50s %8x %8x %16llx %16llx " + "%16llx %16llx %16llx\n", (u64)val.tv_sec, val.tv_nsec, str, tbp->host_no, tbp->tag, tbp->data[0], tbp->data[1], tbp->data[2], tbp->data[3], tbp->data[4]); @@ -171,10 +171,10 @@ int fnic_get_trace_data(fnic_dbgfs_t *fnic_dbgfs_prt) /* Convert function pointer to function name */ if (sizeof(unsigned long) < 8) { sprint_symbol(str, tbp->fnaddr.low); - jiffies_to_timespec(tbp->timestamp.low, &val); + jiffies_to_timespec64(tbp->timestamp.low, &val); } else { sprint_symbol(str, tbp->fnaddr.val); - jiffies_to_timespec(tbp->timestamp.val, &val); + jiffies_to_timespec64(tbp->timestamp.val, &val); } /* * Dump trace buffer entry to memory file @@ -182,8 +182,8 @@ int fnic_get_trace_data(fnic_dbgfs_t *fnic_dbgfs_prt) */ len += snprintf(fnic_dbgfs_prt->buffer + len, (trace_max_pages * PAGE_SIZE * 3) - len, - "%16lu.%16lu %-50s %8x %8x %16llx %16llx " - "%16llx %16llx %16llx\n", val.tv_sec, + "%16llu.%09lu %-50s %8x %8x %16llx %16llx " + "%16llx %16llx %16llx\n", (u64)val.tv_sec, val.tv_nsec, str, tbp->host_no, tbp->tag, tbp->data[0], tbp->data[1], tbp->data[2], tbp->data[3], tbp->data[4]); @@ -217,29 +217,29 @@ int fnic_get_stats_data(struct stats_debug_info *debug, { int len = 0; int buf_size = debug->buf_size; - struct timespec val1, val2; + struct timespec64 val1, val2; - getnstimeofday(&val1); + ktime_get_real_ts64(&val1); len = snprintf(debug->debug_buffer + len, buf_size - len, "------------------------------------------\n" "\t\tTime\n" "------------------------------------------\n"); len += snprintf(debug->debug_buffer + len, buf_size - len, - "Current time : [%ld:%ld]\n" - "Last stats reset time: [%ld:%ld]\n" - "Last stats read time: [%ld:%ld]\n" - "delta since last reset: [%ld:%ld]\n" - "delta since last read: [%ld:%ld]\n", - val1.tv_sec, val1.tv_nsec, - stats->stats_timestamps.last_reset_time.tv_sec, + "Current time : [%lld:%ld]\n" + "Last stats reset time: [%lld:%09ld]\n" + "Last stats read time: [%lld:%ld]\n" + "delta since last reset: [%lld:%ld]\n" + "delta since last read: [%lld:%ld]\n", + (s64)val1.tv_sec, val1.tv_nsec, + (s64)stats->stats_timestamps.last_reset_time.tv_sec, stats->stats_timestamps.last_reset_time.tv_nsec, - stats->stats_timestamps.last_read_time.tv_sec, + (s64)stats->stats_timestamps.last_read_time.tv_sec, stats->stats_timestamps.last_read_time.tv_nsec, - timespec_sub(val1, stats->stats_timestamps.last_reset_time).tv_sec, - timespec_sub(val1, stats->stats_timestamps.last_reset_time).tv_nsec, - timespec_sub(val1, stats->stats_timestamps.last_read_time).tv_sec, - timespec_sub(val1, stats->stats_timestamps.last_read_time).tv_nsec); + (s64)timespec64_sub(val1, stats->stats_timestamps.last_reset_time).tv_sec, + timespec64_sub(val1, stats->stats_timestamps.last_reset_time).tv_nsec, + (s64)timespec64_sub(val1, stats->stats_timestamps.last_read_time).tv_sec, + timespec64_sub(val1, stats->stats_timestamps.last_read_time).tv_nsec); stats->stats_timestamps.last_read_time = val1; @@ -403,12 +403,12 @@ int fnic_get_stats_data(struct stats_debug_info *debug, "\t\tOther Important Statistics\n" "------------------------------------------\n"); - jiffies_to_timespec(stats->misc_stats.last_isr_time, &val1); - jiffies_to_timespec(stats->misc_stats.last_ack_time, &val2); + jiffies_to_timespec64(stats->misc_stats.last_isr_time, &val1); + jiffies_to_timespec64(stats->misc_stats.last_ack_time, &val2); len += snprintf(debug->debug_buffer + len, buf_size - len, - "Last ISR time: %llu (%8lu.%8lu)\n" - "Last ACK time: %llu (%8lu.%8lu)\n" + "Last ISR time: %llu (%8llu.%09lu)\n" + "Last ACK time: %llu (%8llu.%09lu)\n" "Number of ISRs: %lld\n" "Maximum CQ Entries: %lld\n" "Number of ACK index out of range: %lld\n" @@ -425,9 +425,9 @@ int fnic_get_stats_data(struct stats_debug_info *debug, "Number of rport not ready: %lld\n" "Number of receive frame errors: %lld\n", (u64)stats->misc_stats.last_isr_time, - val1.tv_sec, val1.tv_nsec, + (s64)val1.tv_sec, val1.tv_nsec, (u64)stats->misc_stats.last_ack_time, - val2.tv_sec, val2.tv_nsec, + (s64)val2.tv_sec, val2.tv_nsec, (u64)atomic64_read(&stats->misc_stats.isr_count), (u64)atomic64_read(&stats->misc_stats.max_cq_entries), (u64)atomic64_read(&stats->misc_stats.ack_index_out_of_range),