From 5b5538e9e728292f1cb5501228a13b8f4787dd97 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Wed, 21 Feb 2018 13:22:02 -0500 Subject: [PATCH] LU-10672 lnet: pass in only time64_t to lnet_notify With the migration to 64 bit second time some calls to lnet_notify did not get updated to use time64_t. Update those calling points. Also for the ioctl IOC_LIBCFS_NOTIFY_ROUTER we pass in the number of seconds since the epoch. We subtract the current epoch time but we missed adding in the current number of seconds since booting since the lnet ping code expects the seconds since boot to be used. Change-Id: I5a92df08cdaf3b747fd17721a92038df05669a81 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/31339 Reviewed-by: Doug Oucharek Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Dmitry Eremin Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- lnet/klnds/gnilnd/gnilnd.c | 8 +++++--- lnet/klnds/gnilnd/gnilnd.h | 2 +- lnet/klnds/gnilnd/gnilnd_conn.c | 7 ++++--- lnet/klnds/gnilnd/gnilnd_proc.c | 4 ++-- lnet/klnds/socklnd/socklnd.c | 2 +- lnet/lnet/api-ni.c | 5 +++++ 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/lnet/klnds/gnilnd/gnilnd.c b/lnet/klnds/gnilnd/gnilnd.c index 98f4b37..9171fcd 100644 --- a/lnet/klnds/gnilnd/gnilnd.c +++ b/lnet/klnds/gnilnd/gnilnd.c @@ -505,7 +505,9 @@ kgnilnd_destroy_conn(kgn_conn_t *conn) void kgnilnd_peer_alive(kgn_peer_t *peer) { - set_mb(peer->gnp_last_alive, jiffies); + time64_t now = ktime_get_seconds(); + + set_mb(peer->gnp_last_alive, now); } void @@ -601,9 +603,9 @@ kgnilnd_peer_notify(kgn_peer_t *peer, int error, int alive) peer_nid = kgnilnd_lnd2lnetnid(net->gnn_ni->ni_nid, peer->gnp_nid); - CDEBUG(D_NET, "peer 0x%p->%s last_alive %lu (%lus ago)\n", + CDEBUG(D_NET, "peer 0x%p->%s last_alive %lld (%llds ago)\n", peer, libcfs_nid2str(peer_nid), peer->gnp_last_alive, - cfs_duration_sec(jiffies - peer->gnp_last_alive)); + ktime_get_seconds() - peer->gnp_last_alive); lnet_notify(net->gnn_ni, peer_nid, alive, peer->gnp_last_alive); diff --git a/lnet/klnds/gnilnd/gnilnd.h b/lnet/klnds/gnilnd/gnilnd.h index bad8d6e..4a05d98 100644 --- a/lnet/klnds/gnilnd/gnilnd.h +++ b/lnet/klnds/gnilnd/gnilnd.h @@ -789,7 +789,7 @@ typedef struct kgn_peer { short gnp_connecting; /* connection forming */ short gnp_pending_unlink; /* need last conn close to trigger unlink */ int gnp_last_errno; /* last error conn saw */ - unsigned long gnp_last_alive; /* last time I had valid comms */ + time64_t gnp_last_alive; /* last time I had valid comms */ int gnp_last_dgram_errno; /* last error dgrams saw */ unsigned long gnp_last_dgram_time; /* last time I tried to connect */ unsigned long gnp_reconnect_time; /* get_seconds() when reconnect OK */ diff --git a/lnet/klnds/gnilnd/gnilnd_conn.c b/lnet/klnds/gnilnd/gnilnd_conn.c index aa48010..a3f7c75 100644 --- a/lnet/klnds/gnilnd/gnilnd_conn.c +++ b/lnet/klnds/gnilnd/gnilnd_conn.c @@ -1952,9 +1952,10 @@ kgnilnd_finish_connect(kgn_dgram_t *dgram) write_unlock(&kgnilnd_data.kgn_peer_conn_lock); /* Notify LNET that we now have a working connection to this peer. - * This is a Cray extension to the "standard" LND behavior. */ - lnet_notify(peer->gnp_net->gnn_ni, peer->gnp_nid, - 1, cfs_time_current()); + * This is a Cray extension to the "standard" LND behavior. + */ + lnet_notify(peer->gnp_net->gnn_ni, peer->gnp_nid, 1, + ktime_get_seconds()); /* drop our 'hold' ref */ kgnilnd_conn_decref(conn); diff --git a/lnet/klnds/gnilnd/gnilnd_proc.c b/lnet/klnds/gnilnd/gnilnd_proc.c index 71c1305..eb99fd2 100644 --- a/lnet/klnds/gnilnd/gnilnd_proc.c +++ b/lnet/klnds/gnilnd/gnilnd_proc.c @@ -1267,7 +1267,7 @@ kgnilnd_peer_seq_show(struct seq_file *s, void *iter) read_unlock(&kgnilnd_data.kgn_peer_conn_lock); - seq_printf(s, "%p->%s [%d] %s NIC 0x%x q %d conn %c purg %d last %d@%dms dgram %d@%dms reconn %dms to %lus \n", + seq_printf(s, "%p->%s [%d] %s NIC 0x%x q %d conn %c purg %d last %d@%lldms dgram %d@%dms reconn %dms to %lus \n", peer, libcfs_nid2str(peer->gnp_nid), atomic_read(&peer->gnp_refcount), (peer->gnp_state == GNILND_PEER_DOWN) ? "down" : @@ -1277,7 +1277,7 @@ kgnilnd_peer_seq_show(struct seq_file *s, void *iter) conn_str, purg_count, peer->gnp_last_errno, - jiffies_to_msecs(jiffies - peer->gnp_last_alive), + (ktime_get_seconds() - peer->gnp_last_alive) * MSEC_PER_SEC, peer->gnp_last_dgram_errno, jiffies_to_msecs(jiffies - peer->gnp_last_dgram_time), peer->gnp_reconnect_interval != 0 diff --git a/lnet/klnds/socklnd/socklnd.c b/lnet/klnds/socklnd/socklnd.c index e993199..1e36746 100644 --- a/lnet/klnds/socklnd/socklnd.c +++ b/lnet/klnds/socklnd/socklnd.c @@ -1536,7 +1536,7 @@ ksocknal_peer_failed(struct ksock_peer_ni *peer_ni) if (notify) lnet_notify(peer_ni->ksnp_ni, peer_ni->ksnp_id.nid, 0, - cfs_time_seconds(last_alive)); /* to jiffies */ + last_alive); } void diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 59171f3..43d178a 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -3282,6 +3282,11 @@ LNetCtl(unsigned int cmd, void *arg) case IOC_LIBCFS_NOTIFY_ROUTER: { time64_t deadline = ktime_get_real_seconds() - data->ioc_u64[0]; + /* The deadline passed in by the user should be some time in + * seconds in the future since the UNIX epoch. We have to map + * that deadline to the wall clock. + */ + deadline += ktime_get_seconds(); return lnet_notify(NULL, data->ioc_nid, data->ioc_flags, deadline); } -- 1.8.3.1