From patchwork Wed Jan 17 15:16:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10169473 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 515A3603B5 for ; Wed, 17 Jan 2018 15:17:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4207D283DA for ; Wed, 17 Jan 2018 15:17:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3649F2855D; Wed, 17 Jan 2018 15:17:38 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80E8F283DA for ; Wed, 17 Jan 2018 15:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753561AbeAQPRY (ORCPT ); Wed, 17 Jan 2018 10:17:24 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:56413 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753505AbeAQPRV (ORCPT ); Wed, 17 Jan 2018 10:17:21 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0McWI4-1eKA3J2jNA-00HbwI; Wed, 17 Jan 2018 16:17:09 +0100 From: Arnd Bergmann To: Satish Kharat , Sesidhar Baddela , Karan Tilak Kumar , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , Vasyl Gomonovych , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [RESEND] scsi: fnic: use 64-bit timestamps Date: Wed, 17 Jan 2018 16:16:48 +0100 Message-Id: <20180117151708.3359303-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:hCFtOqdC/NSz2XbVGkPRfF9g6Ig/j/af/zzzTd+8mmd34/q1Moo QDxBHFIK+cFyNK1JW7fK2j3vUr+M1R//6t5/cvprnjpntSaY//nWE25GeKRwX5aSdf0Oztz Y6KkyUKQzkchyRptMxiw7HooYnavDtnNX+Rxz1pf7j2Y5uBlmHx2Yh82rFsp6LljOsXJ/l0 SXkp4UefDaanmmc5hF43Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:3SJAe1ZBxmE=:KZvzoAyxTNNiojhLxfLBFo ivmpgIjcrYUvUmJLBUwV0aSlp/fTV9X4DXIKSn+eGUAAo5MVokMPjw2hiXizoKOaX8D1J4Ip5 go2Ckvqfs+KJeJDVv+2r+K9oX6GUVmIdTAwSFaSU8ytW9wl77I2zf36+4V44t7mud+h0m53FG bAqabRHSA7SxV9B1Dq/A3ASbZg1zEuUKAsZqBTApvoIR6nX2+THB9mSoRLO9Td6dtJZz3burp s8DsmPR14dWIj/1QzTuSpZBJMv8LwS653yI5zk8Ugano0GY6fDEY2zuu115XihDmCAdOOysu+ 6QgWDknYNH3d9IewdLjo05kalxPRX4mipzXWTfl2iEWZ3PXRQUw0BIPARUvjeY1L9NgtZjapH l1/edeS9w9js9B+NJYgp0b++UJN5SWz/p0vcyIm3Mn4GPcPaS/lQ6tM/HLJkSLSUwLjVv92IV jfiH2OmSlTHpQPXzlCK+zW9oHSqCmafcDoYfJm/qdLAEOl+CPROxERd8A9rweyXbK6Egy97hO DIcYsOBNgbtD4+oYm57IGWcFZzDHlgiM4yeu8aCH1eWLOhXTwQYYTid98yL9p6I/aiy0U/Buh 3nCmEkCDIJoE52hRM+84ggA2SeOgA4Jm0rCOJ0YgPT2xNObr3P+QBpF2hrQ91+iu/0mWHETIV RsNQrQDvI9TMYgqdtdsdcfpqg9RtobgIiKk5hFLVM2XHzYjb9/7ngjAPklNpYF/0327+EcQRv wJ5eaNgOPDsOAVwUYFTtSc5IQ1XkV+LbCZ21zg== Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- Originally submitted in November 2017. Martin asked Satish to review my patch, but I never heard back after that, so I'm trying again now. --- 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(-) diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c index 9858484dd126..6d3e1cb4fea6 100644 --- a/drivers/scsi/fnic/fnic_debugfs.c +++ b/drivers/scsi/fnic/fnic_debugfs.c @@ -614,7 +614,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),