From: Abhilash Jindal <klock.android@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: sudarsana.kalluru@qlogic.com, anil.gurumurthy@qlogic.com,
Abhilash Jindal <klock.android@gmail.com>
Subject: [PATCH] [SCSI] bfa: Use monotonic clock
Date: Tue, 11 Aug 2015 12:06:45 -0400 [thread overview]
Message-ID: <1439309205-9337-1-git-send-email-klock.android@gmail.com> (raw)
Wall time obtained from do_gettimeofday is susceptible to sudden jumps due to
user setting the time or due to NTP.
Monotonic time is constantly increasing time better suited for comparing two
timestamps.
Signed-off-by: Abhilash Jindal <klock.android@gmail.com>
---
drivers/scsi/bfa/bfa_port.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/bfa/bfa_port.c b/drivers/scsi/bfa/bfa_port.c
index 8ea7697..179ab23 100644
--- a/drivers/scsi/bfa/bfa_port.c
+++ b/drivers/scsi/bfa/bfa_port.c
@@ -95,13 +95,13 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status)
port->stats_busy = BFA_FALSE;
if (status == BFA_STATUS_OK) {
- struct timeval tv;
+ struct timespec tv;
memcpy(port->stats, port->stats_dma.kva,
sizeof(union bfa_port_stats_u));
bfa_port_stats_swap(port, port->stats);
- do_gettimeofday(&tv);
+ ktime_get_ts(&tv);
port->stats->fc.secs_reset = tv.tv_sec - port->stats_reset_time;
}
@@ -123,7 +123,7 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status)
static void
bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status)
{
- struct timeval tv;
+ struct timespec tv;
port->stats_status = status;
port->stats_busy = BFA_FALSE;
@@ -131,7 +131,7 @@ bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status)
/*
* re-initialize time stamp for stats reset
*/
- do_gettimeofday(&tv);
+ ktime_get_ts(&tv);
port->stats_reset_time = tv.tv_sec;
if (port->stats_cbfn) {
@@ -470,7 +470,7 @@ void
bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc,
void *dev, struct bfa_trc_mod_s *trcmod)
{
- struct timeval tv;
+ struct timespec tv;
WARN_ON(!port);
@@ -493,7 +493,7 @@ bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc,
/*
* initialize time stamp for stats reset
*/
- do_gettimeofday(&tv);
+ ktime_get_ts(&tv);
port->stats_reset_time = tv.tv_sec;
bfa_trc(port, 0);
--
1.7.9.5
reply other threads:[~2015-08-11 16:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1439309205-9337-1-git-send-email-klock.android@gmail.com \
--to=klock.android@gmail.com \
--cc=anil.gurumurthy@qlogic.com \
--cc=linux-scsi@vger.kernel.org \
--cc=sudarsana.kalluru@qlogic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.