lustre: remainder of multi-rail series.
cover lustre: remainder of multi-rail series.
Hi,
following is the remainder of the Multi-Rail series, ported to drivers/staging.
The previous series was only the first patch from upstream. This series is mostly the individual patches from upstream, though I did split some up a bit, and merged at least one bugfix back to where the bug was introduced.
Comments, review, and explanations of bits I didn't understand, are most welcome. I confess that I haven't looked at the code very closely, just a superficially scan for things that look odd (there weren't many).
Thanks,
NeilBrown
---
Amir Shehata (22):
LU-7734 lnet: Multi-Rail peer split
LU-7734 lnet: Multi-Rail local_ni/peer_ni selection LU-7734 lnet: configure peers from DLC
LU-7734 lnet: configure local NI from DLC
LU-7734 lnet: NUMA support
LU-7734 lnet: Primary NID and traffic distribution LU-7734 lnet: handle non-MR peers
LU-7734 lnet: handle N NIs to 1 LND peer
LU-7734 lnet: rename LND peer to peer_ni
LU-7734 lnet: peer/peer_ni handling adjustments LU-7734 lnet: proper cpt locking
LU-7734 lnet: protect peer_ni credits
LU-7734 lnet: simplify and fix lnet_select_pathway() LU-7734 lnet: configuration fixes
LU-7734 lnet: fix lnet_select_pathway()
LU-7734 lnet: Routing fixes part 1
LU-7734 lnet: Routing fixes part 2
LU-7734 lnet: fix routing selection
LU-7734 lnet: Fix crash in router_proc.c
LU-7734 lnet: fix NULL access in lnet_peer_aliveness_enabled LU-7734 lnet: rename peer key_nid to prim_nid LU-7734 lnet: cpt locking
Doug Oucharek (1):
LU-7734 lnet: Add peer_ni and NI stats for DLC
NeilBrown (8):
lnet: replace all lp_ fields with lpni_
lnet: change struct lnet_peer to struct lnet_peer_ni
lnet: Change lpni_refcount to atomic_t
lnet: change some function names - add 'ni'.
lnet: make lnet_nid_cpt_hash non-static.
lnet: introduce lnet_find_peer_ni_locked()
lnet: lnet_peer_tables_cleanup: use an exclusive lock.
lnet: use BIT() macro for LNET_MD_* flags
Olaf Weber (3):
LU-7734 lnet: fix lnet_peer_table_cleanup_locked() LU-7734 lnet: double free in lnet_add_net_common() LU-7734 lnet: set primary NID in ptlrpc_connection_get()
.../lustre/include/linux/libcfs/libcfs_string.h | 12 drivers/staging/lustre/include/linux/lnet/api.h | 1 .../staging/lustre/include/linux/lnet/lib-lnet.h | 151 ++- .../staging/lustre/include/linux/lnet/lib-types.h | 157 ++- .../lustre/include/uapi/linux/lnet/libcfs_ioctl.h | 11 .../lustre/include/uapi/linux/lnet/lnet-dlc.h | 104 ++ .../lustre/include/uapi/linux/lnet/lnet-types.h | 34 - .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 237 ++-- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 118 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 516 ++++----- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 678 ++++++------ .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 66 + .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 207 ++-- .../lustre/lnet/klnds/socklnd/socklnd_lib.c | 4 .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 14 drivers/staging/lustre/lnet/lnet/api-ni.c | 650 ++++++++++- drivers/staging/lustre/lnet/lnet/config.c | 107 +- drivers/staging/lustre/lnet/lnet/lib-md.c | 31 + drivers/staging/lustre/lnet/lnet/lib-move.c | 957 +++++++++++++--- drivers/staging/lustre/lnet/lnet/lib-msg.c | 18 drivers/staging/lustre/lnet/lnet/lib-ptl.c | 3 drivers/staging/lustre/lnet/lnet/module.c | 70 + drivers/staging/lustre/lnet/lnet/peer.c | 1169 +++++++++++++++++--- drivers/staging/lustre/lnet/lnet/router.c | 341 +++--- drivers/staging/lustre/lnet/lnet/router_proc.c | 66 + drivers/staging/lustre/lustre/include/lustre_net.h | 2 drivers/staging/lustre/lustre/ptlrpc/connection.c | 1 drivers/staging/lustre/lustre/ptlrpc/events.c | 5 drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 40 - drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 2 drivers/staging/lustre/lustre/ptlrpc/service.c | 4 31 files changed, 4056 insertions(+), 1720 deletions(-)
--
Signature
PATCH 1/34 lnet: replace all lp_ fields with lpni_
sed -i 's/\blp_/lpni_/g' git grep -l '\blp_' drivers/staging/lustre/lnet | grep '\.[ch]$' followed by some long-line cleanups.
This is part of
Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")from upstream lustre, where it is marked:
WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Reviewed-on: http://review.whamcloud.com/18293
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 24 +- .../staging/lustre/include/linux/lnet/lib-types.h | 63 +++--- drivers/staging/lustre/lnet/lnet/lib-move.c | 146 +++++++------ drivers/staging/lustre/lnet/lnet/peer.c | 125 ++++++----- drivers/staging/lustre/lnet/lnet/router.c | 218 ++++++++++---------- drivers/staging/lustre/lnet/lnet/router_proc.c | 52 ++--- 6 files changed, 316 insertions(+), 312 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +12 -12
@@ -79,10 +79,10 @@ extern struct lnet the_lnet; /* THE network */static inline int lnet_is_route_alive (struct lnet_route *route) {/* gateway is down */ -if (!route->lr_gateway->lp_alive) +if (!route->lr_gateway->lpni_alive)return 0 ;/* no NI status, assume it's alive */ -if ((route->lr_gateway->lp_ping_feats & +if ((route->lr_gateway->lpni_ping_feats &LNET_PING_FEAT_NI_STATUS ) ==0 )return 1 ;/* has NI status, check # down NIs */
@@ -313,8 +313,8 @@ lnet_handle2me(struct lnet_handle_me *handle)static inline void lnet_peer_addref_locked (struct lnet_peer *lp) { -LASSERT (lp->lp_refcount >0 ); - lp->lp_refcount++; +LASSERT (lp->lpni_refcount >0 ); + lp->lpni_refcount++; }void lnet_destroy_peer_locked (struct lnet_peer *lp);
@@ -322,16 +322,16 @@ void lnet_destroy_peer_locked(struct lnet_peer *lp);static inline void lnet_peer_decref_locked (struct lnet_peer *lp) { -LASSERT (lp->lp_refcount >0 ); - lp->lp_refcount--; -if (!lp->lp_refcount) +LASSERT (lp->lpni_refcount >0 ); + lp->lpni_refcount--; +if (!lp->lpni_refcount)lnet_destroy_peer_locked (lp); }static inline int lnet_isrouter (struct lnet_peer *lp) { -return lp->lp_rtr_refcount ?1 :0 ; +return lp->lpni_rtr_refcount ?1 :0 ; } static inline void
@@ -652,10 +652,10 @@ int lnet_get_peer_info(__u32 peer_index, __u64 *nid,static inline void lnet_peer_set_alive (struct lnet_peer *lp) { - lp->lp_last_query =ktime_get_seconds (); - lp->lp_last_alive = lp->lp_last_query; -if (!lp->lp_alive) -lnet_notify_locked (lp,0 ,1 , lp->lp_last_alive); + lp->lpni_last_query =ktime_get_seconds (); + lp->lpni_last_alive = lp->lpni_last_query; +if (!lp->lpni_alive) +lnet_notify_locked (lp,0 ,1 , lp->lpni_last_alive); }#endif
drivers/staging/lustre/include/linux/lnet/lib-types.h +32 -31
101 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lib-move.c +73 -73
342 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/peer.c +63 -62
218 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/router.c +110 -108
485 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/router_proc.c +26 -26
109 lines not on this page · raw message
PATCH 1/34 lnet: replace all lp_ fields with lpni_
Quoted 4 lines
sed -i 's/\blp_/lpni_/g'
git grep -l '\blp_' drivers/staging/lustre/lnet | grep '\.[ch]$'followed by some long-line cleanups.
Quoted 8 lines
This is part of
Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")from upstream lustre, where it is marked:
Signed-off-by Amir Shehata <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Reviewed-on: http://review.whamcloud.com/18293Reviewed-by Olaf Weber <[email protected]>Reviewed-by Doug Oucharek <[email protected]>
Quoted 1,421 lines
Signed-off-by NeilBrown <[email protected]>--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 24 +- .../staging/lustre/include/linux/lnet/lib-types.h | 63 +++--- drivers/staging/lustre/lnet/lnet/lib-move.c | 146 +++++++------ drivers/staging/lustre/lnet/lnet/peer.c | 125 ++++++----- drivers/staging/lustre/lnet/lnet/router.c | 218 ++++++++++---------- drivers/staging/lustre/lnet/lnet/router_proc.c | 52 ++--- 6 files changed, 316 insertions(+), 312 deletions(-)drivers/staging/lustre/include/linux/lnet/lib-lnet.h +12
-12@@ -79,10 +79,10 @@ extern struct lnet the_lnet; /* THE network */static inline int lnet_is_route_alive (struct lnet_route *route) {/* gateway is down */ -if (!route->lr_gateway->lp_alive) +if (!route->lr_gateway->lpni_alive)return 0 ;/* no NI status, assume it's alive */ -if ((route->lr_gateway->lp_ping_feats & +if ((route->lr_gateway->lpni_ping_feats &LNET_PING_FEAT_NI_STATUS ) ==0 )return 1 ;/* has NI status, check # down NIs */ @@ -313,8 +313,8 @@ lnet_handle2me(struct lnet_handle_me *handle)static inline void lnet_peer_addref_locked (struct lnet_peer *lp) { -LASSERT (lp->lp_refcount >0 ); - lp->lp_refcount++; +LASSERT (lp->lpni_refcount >0 ); + lp->lpni_refcount++; }void lnet_destroy_peer_locked (struct lnet_peer *lp);@@ -322,16 +322,16 @@ void lnet_destroy_peer_locked(struct lnet_peer *lp);static inline void lnet_peer_decref_locked (struct lnet_peer *lp) { -LASSERT (lp->lp_refcount >0 ); - lp->lp_refcount--; -if (!lp->lp_refcount) +LASSERT (lp->lpni_refcount >0 ); + lp->lpni_refcount--; +if (!lp->lpni_refcount)lnet_destroy_peer_locked (lp); }static inline int lnet_isrouter (struct lnet_peer *lp) { -return lp->lp_rtr_refcount ?1 :0 ; +return lp->lpni_rtr_refcount ?1 :0 ; } static inline void@@ -652,10 +652,10 @@ int lnet_get_peer_info(__u32 peer_index, __u64 *nid,static inline void lnet_peer_set_alive (struct lnet_peer *lp) { - lp->lp_last_query =ktime_get_seconds (); - lp->lp_last_alive = lp->lp_last_query; -if (!lp->lp_alive) -lnet_notify_locked (lp,0 ,1 , lp->lp_last_alive); + lp->lpni_last_query =ktime_get_seconds (); + lp->lpni_last_alive = lp->lpni_last_query; +if (!lp->lpni_alive) +lnet_notify_locked (lp,0 ,1 , lp->lpni_last_alive); }#endif drivers/staging/lustre/include/linux/lnet/lib-types.h +32
-31@@ -385,61 +385,61 @@ struct lnet_rc_data {struct lnet_peer {/* chain on peer hash */ -struct list_head lp_hashlist; +struct list_head lpni_hashlist;/* messages blocking for tx credits */ -struct list_head lp_txq; +struct list_head lpni_txq;/* messages blocking for router credits */ -struct list_head lp_rtrq; +struct list_head lpni_rtrq;/* chain on router list */ -struct list_head lp_rtr_list; +struct list_head lpni_rtr_list;/* # tx credits available */ -int lp_txcredits; +int lpni_txcredits;/* low water mark */ -int lp_mintxcredits; +int lpni_mintxcredits;/* # router credits */ -int lp_rtrcredits; +int lpni_rtrcredits;/* low water mark */ -int lp_minrtrcredits; +int lpni_minrtrcredits;/* alive/dead? */ -unsigned int lp_alive:1 ; +unsigned int lpni_alive:1 ;/* notification outstanding? */ -unsigned int lp_notify:1 ; +unsigned int lpni_notify:1 ;/* outstanding notification for LND? */ -unsigned int lp_notifylnd:1 ; +unsigned int lpni_notifylnd:1 ;/* some thread is handling notification */ -unsigned int lp_notifying:1 ; +unsigned int lpni_notifying:1 ;/* SEND event outstanding from ping */ -unsigned int lp_ping_notsent; +unsigned int lpni_ping_notsent;/* # times router went dead<->alive */ -int lp_alive_count; +int lpni_alive_count;/* ytes queued for sending */ -long lp_txqnob; +long lpni_txqnob;/* time of last aliveness news */ -time64_t lp_timestamp; +time64_t lpni_timestamp;/* time of last ping attempt */ -time64_t lp_ping_timestamp; +time64_t lpni_ping_timestamp;/* != 0 if ping reply expected */ -time64_t lp_ping_deadline; +time64_t lpni_ping_deadline;/* when I was last alive */ -time64_t lp_last_alive; -/* when lp_ni was queried last time */ -time64_t lp_last_query; +time64_t lpni_last_alive; +/* when lpni_ni was queried last time */ +time64_t lpni_last_query;/* network peer is on */ -struct lnet_net *lp_net; +struct lnet_net *lpni_net;/* peer's NID */ -lnet_nid_t lp_nid; +lnet_nid_t lpni_nid;/* # refs */ -int lp_refcount; +int lpni_refcount;/* CPT this peer attached on */ -int lp_cpt; +int lpni_cpt;/* # refs from lnet_route::lr_gateway */ -int lp_rtr_refcount; +int lpni_rtr_refcount;/* returned RC ping features */ -unsigned int lp_ping_feats; +unsigned int lpni_ping_feats;/* routers on this peer */ -struct list_head lp_routes; +struct list_head lpni_routes;/* router checker state */ -struct lnet_rc_data *lp_rcd; +struct lnet_rc_data *lpni_rcd; };/* peer hash size */ @@ -464,8 +464,9 @@ struct lnet_peer_table {* peer aliveness is enabled only on routers for peers in a network where the * lnet_ni::ni_peertimeout has been set to a positive value */ -#define lnet_peer_aliveness_enabled (lp) (the_lnet.ln_routing && \ - (lp)->lp_net->net_tunables.lct_peer_timeout > 0) +#define lnet_peer_aliveness_enabled (lp) \ + (the_lnet.ln_routing && \ + (lp)->lpni_net->net_tunables.lct_peer_timeout > 0)struct lnet_route {/* chain on net */ drivers/staging/lustre/lnet/lnet/lib-move.c +73
-73@@ -481,7 +481,7 @@ lnet_ni_eager_recv(struct lnet_ni *ni, struct lnet_msg *msg) &msg->msg_private);if (rc) {CERROR ("recv from %s / send to %s aborted: eager_recv failed %d\n" , -libcfs_nid2str (msg->msg_rxpeer->lp_nid), +libcfs_nid2str (msg->msg_rxpeer->lpni_nid),libcfs_id2str (msg->msg_target), rc);LASSERT (rc <0 );/* required by my callers */ }@@ -498,14 +498,14 @@ lnet_ni_query_locked(struct lnet_ni *ni, struct lnet_peer *lp)LASSERT (lnet_peer_aliveness_enabled (lp));LASSERT (ni->ni_net->net_lnd->lnd_query); -lnet_net_unlock (lp->lp_cpt); - ni->ni_net->net_lnd->lnd_query (ni, lp->lp_nid, &last_alive); -lnet_net_lock (lp->lp_cpt); +lnet_net_unlock (lp->lpni_cpt); + ni->ni_net->net_lnd->lnd_query (ni, lp->lpni_nid, &last_alive); +lnet_net_lock (lp->lpni_cpt); - lp->lp_last_query =ktime_get_seconds (); + lp->lpni_last_query =ktime_get_seconds ();if (last_alive)/* NI has updated timestamp */ - lp->lp_last_alive = last_alive; + lp->lpni_last_alive = last_alive; }/* NB: always called with lnet_net_lock held */ @@ -520,21 +520,21 @@ lnet_peer_is_alive(struct lnet_peer *lp, unsigned long now)/* Trust lnet_notify() if it has more recent aliveness news, but * ignore the initial assumed death (see lnet_peers_start_down()). */ -if (!lp->lp_alive && lp->lp_alive_count >0 && - lp->lp_timestamp >= lp->lp_last_alive) +if (!lp->lpni_alive && lp->lpni_alive_count >0 && + lp->lpni_timestamp >= lp->lpni_last_alive)return 0 ; - deadline = lp->lp_last_alive + - lp->lp_net->net_tunables.lct_peer_timeout; + deadline = lp->lpni_last_alive + + lp->lpni_net->net_tunables.lct_peer_timeout; alive = deadline > now; -/* Update obsolete lp_alive except for routers assumed to be dead +/* Update obsolete lpni_alive except for routers assumed to be dead * initially, because router checker would update aliveness in this -* case, and moreover lp_last_alive at peer creation is assumed. +* case, and moreover lpni_last_alive at peer creation is assumed. */ -if (alive && !lp->lp_alive && - !(lnet_isrouter (lp) && !lp->lp_alive_count)) -lnet_notify_locked (lp,0 ,1 , lp->lp_last_alive); +if (alive && !lp->lpni_alive && + !(lnet_isrouter (lp) && !lp->lpni_alive_count)) +lnet_notify_locked (lp,0 ,1 , lp->lpni_last_alive);return alive; }@@ -558,19 +558,19 @@ lnet_peer_alive_locked(struct lnet_ni *ni, struct lnet_peer *lp)* Peer appears dead, but we should avoid frequent NI queries (at * most once per lnet_queryinterval seconds). */ -if (lp->lp_last_query) { +if (lp->lpni_last_query) {static const int lnet_queryinterval =1 ;time64_t next_query; - next_query = lp->lp_last_query + lnet_queryinterval; + next_query = lp->lpni_last_query + lnet_queryinterval;if (now < next_query) { -if (lp->lp_alive) +if (lp->lpni_alive)CWARN ("Unexpected aliveness of peer %s: %lld < %lld (%d/%d)\n" , -libcfs_nid2str (lp->lp_nid), +libcfs_nid2str (lp->lpni_nid), now, next_query, lnet_queryinterval, - lp->lp_net->net_tunables.lct_peer_timeout); + lp->lpni_net->net_tunables.lct_peer_timeout);return 0 ; } }@@ -581,7 +581,7 @@ lnet_peer_alive_locked(struct lnet_ni *ni, struct lnet_peer *lp)if (lnet_peer_is_alive (lp, now))return 1 ; -lnet_notify_locked (lp,0 ,0 , lp->lp_last_alive); +lnet_notify_locked (lp,0 ,0 , lp->lpni_last_alive);return 0 ; }@@ -639,19 +639,19 @@ lnet_post_send_locked(struct lnet_msg *msg, int do_send) }if (!msg->msg_peertxcredit) { -LASSERT ((lp->lp_txcredits <0 ) == - !list_empty (&lp->lp_txq)); +LASSERT ((lp->lpni_txcredits <0 ) == + !list_empty (&lp->lpni_txq)); msg->msg_peertxcredit =1 ; - lp->lp_txqnob += msg->msg_len +sizeof (struct lnet_hdr ); - lp->lp_txcredits--; + lp->lpni_txqnob += msg->msg_len +sizeof (struct lnet_hdr ); + lp->lpni_txcredits--; -if (lp->lp_txcredits < lp->lp_mintxcredits) - lp->lp_mintxcredits = lp->lp_txcredits; +if (lp->lpni_txcredits < lp->lpni_mintxcredits) + lp->lpni_mintxcredits = lp->lpni_txcredits; -if (lp->lp_txcredits <0 ) { +if (lp->lpni_txcredits <0 ) { msg->msg_tx_delayed =1 ; -list_add_tail (&msg->msg_list, &lp->lp_txq); +list_add_tail (&msg->msg_list, &lp->lpni_txq);return LNET_CREDIT_WAIT ; } }@@ -725,19 +725,19 @@ lnet_post_routed_recv_locked(struct lnet_msg *msg, int do_recv)LASSERT (!do_recv || msg->msg_rx_delayed);if (!msg->msg_peerrtrcredit) { -LASSERT ((lp->lp_rtrcredits <0 ) == - !list_empty (&lp->lp_rtrq)); +LASSERT ((lp->lpni_rtrcredits <0 ) == + !list_empty (&lp->lpni_rtrq)); msg->msg_peerrtrcredit =1 ; - lp->lp_rtrcredits--; -if (lp->lp_rtrcredits < lp->lp_minrtrcredits) - lp->lp_minrtrcredits = lp->lp_rtrcredits; + lp->lpni_rtrcredits--; +if (lp->lpni_rtrcredits < lp->lpni_minrtrcredits) + lp->lpni_minrtrcredits = lp->lpni_rtrcredits; -if (lp->lp_rtrcredits <0 ) { +if (lp->lpni_rtrcredits <0 ) {/* must have checked eager_recv before here */ LASSERT (msg->msg_rx_ready_delay); msg->msg_rx_delayed =1 ; -list_add_tail (&msg->msg_list, &lp->lp_rtrq); +list_add_tail (&msg->msg_list, &lp->lpni_rtrq);return LNET_CREDIT_WAIT ; } }@@ -811,15 +811,15 @@ lnet_return_tx_credits_locked(struct lnet_msg *msg)/* give back peer txcredits */ msg->msg_peertxcredit =0 ; -LASSERT ((txpeer->lp_txcredits <0 ) == - !list_empty (&txpeer->lp_txq)); +LASSERT ((txpeer->lpni_txcredits <0 ) == + !list_empty (&txpeer->lpni_txq)); - txpeer->lp_txqnob -= msg->msg_len +sizeof (struct lnet_hdr ); -LASSERT (txpeer->lp_txqnob >=0 ); + txpeer->lpni_txqnob -= msg->msg_len +sizeof (struct lnet_hdr ); +LASSERT (txpeer->lpni_txqnob >=0 ); - txpeer->lp_txcredits++; -if (txpeer->lp_txcredits <=0 ) { - msg2 =list_entry (txpeer->lp_txq.next, + txpeer->lpni_txcredits++; +if (txpeer->lpni_txcredits <=0 ) { + msg2 =list_entry (txpeer->lpni_txq.next, struct lnet_msg, msg_list);list_del (&msg2->msg_list);@@ -939,19 +939,19 @@ lnet_return_rx_credits_locked(struct lnet_msg *msg)/* give back peer router credits */ msg->msg_peerrtrcredit =0 ; -LASSERT ((rxpeer->lp_rtrcredits <0 ) == - !list_empty (&rxpeer->lp_rtrq)); +LASSERT ((rxpeer->lpni_rtrcredits <0 ) == + !list_empty (&rxpeer->lpni_rtrq)); - rxpeer->lp_rtrcredits++; + rxpeer->lpni_rtrcredits++;/* * drop all messages which are queued to be routed on that * peer. */ if (!the_lnet.ln_routing) { -lnet_drop_routed_msgs_locked (&rxpeer->lp_rtrq, +lnet_drop_routed_msgs_locked (&rxpeer->lpni_rtrq, msg->msg_rx_cpt); - }else if (rxpeer->lp_rtrcredits <=0 ) { - msg2 =list_entry (rxpeer->lp_rtrq.next, + }else if (rxpeer->lpni_rtrcredits <=0 ) { + msg2 =list_entry (rxpeer->lpni_rtrq.next, struct lnet_msg, msg_list);list_del (&msg2->msg_list);@@ -988,16 +988,16 @@ lnet_compare_routes(struct lnet_route *r1, struct lnet_route *r2)if (r1_hops > r2_hops)return -ERANGE ; -if (p1->lp_txqnob < p2->lp_txqnob) +if (p1->lpni_txqnob < p2->lpni_txqnob)return 1 ; -if (p1->lp_txqnob > p2->lp_txqnob) +if (p1->lpni_txqnob > p2->lpni_txqnob)return -ERANGE ; -if (p1->lp_txcredits > p2->lp_txcredits) +if (p1->lpni_txcredits > p2->lpni_txcredits)return 1 ; -if (p1->lp_txcredits < p2->lp_txcredits) +if (p1->lpni_txcredits < p2->lpni_txcredits)return -ERANGE ;if (r1->lr_seq - r2->lr_seq <=0 )@@ -1014,7 +1014,7 @@ lnet_find_route_locked(struct lnet_net *net, lnet_nid_t target,struct lnet_route *route;struct lnet_route *best_route;struct lnet_route *last_route; -struct lnet_peer *lp_best; +struct lnet_peer *lpni_best;struct lnet_peer *lp;int rc;@@ -1026,7 +1026,7 @@ lnet_find_route_locked(struct lnet_net *net, lnet_nid_t target,if (!rnet)return NULL ; - lp_best =NULL ; + lpni_best =NULL ; best_route =NULL ; last_route =NULL ;list_for_each_entry (route, &rnet->lrn_routes, lr_list) {@@ -1035,16 +1035,16 @@ lnet_find_route_locked(struct lnet_net *net, lnet_nid_t target,if (!lnet_is_route_alive (route))continue ; -if (net && lp->lp_net != net) +if (net && lp->lpni_net != net)continue ; -if (lp->lp_nid == rtr_nid)/* it's pre-determined router */ +if (lp->lpni_nid == rtr_nid)/* it's pre-determined router */ return lp; -if (!lp_best) { +if (!lpni_best) { best_route = route; last_route = route; - lp_best = lp; + lpni_best = lp;continue ; }@@ -1057,7 +1057,7 @@ lnet_find_route_locked(struct lnet_net *net, lnet_nid_t target,continue ; best_route = route; - lp_best = lp; + lpni_best = lp; }/* @@ -1067,7 +1067,7 @@ lnet_find_route_locked(struct lnet_net *net, lnet_nid_t target,*/ if (best_route) best_route->lr_seq = last_route->lr_seq +1 ; -return lp_best; +return lpni_best; }int @@ -1156,7 +1156,7 @@ lnet_send(lnet_nid_t src_nid, struct lnet_msg *msg, lnet_nid_t rtr_nid)/* ENOMEM or shutting down */ return rc; } -LASSERT (lp->lp_net == src_ni->ni_net); +LASSERT (lp->lpni_net == src_ni->ni_net); }else {/* sending to a remote network */ lp = lnet_find_route_locked(src_ni ? src_ni->ni_net : NULL,@@ -1176,27 +1176,27 @@ lnet_send(lnet_nid_t src_nid, struct lnet_msg *msg, lnet_nid_t rtr_nid)* pre-determined router, this can happen if router table * was changed when we release the lock */ -if (rtr_nid != lp->lp_nid) { - cpt2 = lp->lp_cpt; +if (rtr_nid != lp->lpni_nid) { + cpt2 = lp->lpni_cpt;if (cpt2 != cpt) {lnet_net_unlock (cpt); - rtr_nid = lp->lp_nid; + rtr_nid = lp->lpni_nid; cpt = cpt2; goto again; } }CDEBUG (D_NET ,"Best route to %s via %s for %s %d\n" , -libcfs_nid2str (dst_nid),libcfs_nid2str (lp->lp_nid), +libcfs_nid2str (dst_nid),libcfs_nid2str (lp->lpni_nid),lnet_msgtyp2str (msg->msg_type), msg->msg_len);if (!src_ni) { - src_ni =lnet_get_next_ni_locked (lp->lp_net,NULL ); + src_ni =lnet_get_next_ni_locked (lp->lpni_net,NULL );LASSERT (src_ni); src_nid = src_ni->ni_nid; }else { -LASSERT (src_ni->ni_net == lp->lp_net); +LASSERT (src_ni->ni_net == lp->lpni_net); }lnet_peer_addref_locked (lp);@@ -1210,7 +1210,7 @@ lnet_send(lnet_nid_t src_nid, struct lnet_msg *msg, lnet_nid_t rtr_nid) } msg->msg_target_is_router =1 ; - msg->msg_target.nid = lp->lp_nid; + msg->msg_target.nid = lp->lpni_nid; msg->msg_target.pid =LNET_PID_LUSTRE ; }@@ -1289,7 +1289,7 @@ lnet_parse_put(struct lnet_ni *ni, struct lnet_msg *msg) info.mi_rlength = hdr->payload_length; info.mi_roffset = hdr->msg.put.offset; info.mi_mbits = hdr->msg.put.match_bits; - info.mi_cpt = msg->msg_rxpeer->lp_cpt; + info.mi_cpt = msg->msg_rxpeer->lpni_cpt; msg->msg_rx_ready_delay = !ni->ni_net->net_lnd->lnd_eager_recv; ready_delay = msg->msg_rx_ready_delay;@@ -1520,7 +1520,7 @@ lnet_parse_forward_locked(struct lnet_ni *ni, struct lnet_msg *msg)if (!the_lnet.ln_routing)return -ECANCELED ; -if (msg->msg_rxpeer->lp_rtrcredits <=0 || +if (msg->msg_rxpeer->lpni_rtrcredits <=0 ||lnet_msg2bufpool (msg)->rbp_credits <=0 ) {if (!ni->ni_net->net_lnd->lnd_eager_recv) { msg->msg_rx_ready_delay =1 ;@@ -1909,7 +1909,7 @@ lnet_drop_delayed_msg_list(struct list_head *head, char *reason)* until that's done */ lnet_drop_message (msg->msg_rxni, - msg->msg_rxpeer->lp_cpt, + msg->msg_rxpeer->lpni_cpt, msg->msg_private, msg->msg_len);/* * NB: message will not generate event because w/o attached MD, @@ -2376,7 +2376,7 @@ LNetDist(lnet_nid_t dstnid, lnet_nid_t *srcnidp, __u32 *orderp) hops = shortest_hops;if (srcnidp) { ni =lnet_get_next_ni_locked ( - shortest->lr_gateway->lp_net, + shortest->lr_gateway->lpni_net,NULL ); *srcnidp = ni->ni_nid; }drivers/staging/lustre/lnet/lnet/peer.c +63
-62@@ -111,10 +111,10 @@ lnet_peer_table_cleanup_locked(struct lnet_ni *ni,for (i =0 ; i <LNET_PEER_HASH_SIZE ; i++) {list_for_each_entry_safe (lp, tmp, &ptable->pt_hash[i], - lp_hashlist) { -if (ni && ni->ni_net != lp->lp_net) + lpni_hashlist) { +if (ni && ni->ni_net != lp->lpni_net)continue ; -list_del_init (&lp->lp_hashlist); +list_del_init (&lp->lpni_hashlist);/* Lose hash table's ref */ ptable->pt_zombies++;lnet_peer_decref_locked (lp);@@ -148,22 +148,22 @@ lnet_peer_table_del_rtrs_locked(struct lnet_ni *ni, {struct lnet_peer *lp;struct lnet_peer *tmp; -lnet_nid_t lp_nid; +lnet_nid_t lpni_nid;int i;for (i =0 ; i <LNET_PEER_HASH_SIZE ; i++) {list_for_each_entry_safe (lp, tmp, &ptable->pt_hash[i], - lp_hashlist) { -if (ni->ni_net != lp->lp_net) + lpni_hashlist) { +if (ni->ni_net != lp->lpni_net)continue ; -if (!lp->lp_rtr_refcount) +if (!lp->lpni_rtr_refcount)continue ; - lp_nid = lp->lp_nid; + lpni_nid = lp->lpni_nid;lnet_net_unlock (cpt_locked); -lnet_del_route (LNET_NIDNET (LNET_NID_ANY ), lp_nid); +lnet_del_route (LNET_NIDNET (LNET_NID_ANY ), lpni_nid);lnet_net_lock (cpt_locked); } }@@ -209,8 +209,8 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni) }while (!list_empty (&deathrow)) { - lp = list_entry(deathrow.next, struct lnet_peer, lp_hashlist); -list_del (&lp->lp_hashlist); + lp = list_entry(deathrow.next, struct lnet_peer, lpni_hashlist); +list_del (&lp->lpni_hashlist);kfree (lp); } }@@ -220,19 +220,19 @@ lnet_destroy_peer_locked(struct lnet_peer *lp) {struct lnet_peer_table *ptable; -LASSERT (!lp->lp_refcount); -LASSERT (!lp->lp_rtr_refcount); -LASSERT (list_empty (&lp->lp_txq)); -LASSERT (list_empty (&lp->lp_hashlist)); -LASSERT (!lp->lp_txqnob); +LASSERT (!lp->lpni_refcount); +LASSERT (!lp->lpni_rtr_refcount); +LASSERT (list_empty (&lp->lpni_txq)); +LASSERT (list_empty (&lp->lpni_hashlist)); +LASSERT (!lp->lpni_txqnob); - ptable = the_lnet.ln_peer_tables[lp->lp_cpt]; + ptable = the_lnet.ln_peer_tables[lp->lpni_cpt];LASSERT (ptable->pt_number >0 ); ptable->pt_number--; - lp->lp_net =NULL ; + lp->lpni_net =NULL ; -list_add (&lp->lp_hashlist, &ptable->pt_deathrow); +list_add (&lp->lpni_hashlist, &ptable->pt_deathrow);LASSERT (ptable->pt_zombies >0 ); ptable->pt_zombies--; }@@ -246,8 +246,8 @@ lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid)LASSERT (!the_lnet.ln_shutdown); peers = &ptable->pt_hash[lnet_nid2peerhash (nid)]; -list_for_each_entry (lp, peers, lp_hashlist) { -if (lp->lp_nid == nid) { +list_for_each_entry (lp, peers, lpni_hashlist) { +if (lp->lpni_nid == nid) {lnet_peer_addref_locked (lp);return lp; }@@ -281,8 +281,8 @@ lnet_nid2peer_locked(struct lnet_peer **lpp, lnet_nid_t nid, int cpt)if (!list_empty (&ptable->pt_deathrow)) { lp =list_entry (ptable->pt_deathrow.next, - struct lnet_peer, lp_hashlist); -list_del (&lp->lp_hashlist); + struct lnet_peer, lpni_hashlist); +list_del (&lp->lpni_hashlist); }/* @@ -303,24 +303,24 @@ lnet_nid2peer_locked(struct lnet_peer **lpp, lnet_nid_t nid, int cpt) goto out; } -INIT_LIST_HEAD (&lp->lp_txq); -INIT_LIST_HEAD (&lp->lp_rtrq); -INIT_LIST_HEAD (&lp->lp_routes); - - lp->lp_notify =0 ; - lp->lp_notifylnd =0 ; - lp->lp_notifying =0 ; - lp->lp_alive_count =0 ; - lp->lp_timestamp =0 ; - lp->lp_alive = !lnet_peers_start_down ();/* 1 bit!! */ - lp->lp_last_alive =ktime_get_seconds ();/* assumes alive */ - lp->lp_last_query =0 ;/* haven't asked NI yet */ - lp->lp_ping_timestamp =0 ; - lp->lp_ping_feats =LNET_PING_FEAT_INVAL ; - lp->lp_nid = nid; - lp->lp_cpt = cpt2; - lp->lp_refcount =2 ;/* 1 for caller; 1 for hash */ - lp->lp_rtr_refcount =0 ; +INIT_LIST_HEAD (&lp->lpni_txq); +INIT_LIST_HEAD (&lp->lpni_rtrq); +INIT_LIST_HEAD (&lp->lpni_routes); + + lp->lpni_notify =0 ; + lp->lpni_notifylnd =0 ; + lp->lpni_notifying =0 ; + lp->lpni_alive_count =0 ; + lp->lpni_timestamp =0 ; + lp->lpni_alive = !lnet_peers_start_down ();/* 1 bit!! */ + lp->lpni_last_alive =ktime_get_seconds ();/* assumes alive */ + lp->lpni_last_query =0 ;/* haven't asked NI yet */ + lp->lpni_ping_timestamp =0 ; + lp->lpni_ping_feats =LNET_PING_FEAT_INVAL ; + lp->lpni_nid = nid; + lp->lpni_cpt = cpt2; + lp->lpni_refcount =2 ;/* 1 for caller; 1 for hash */ + lp->lpni_rtr_refcount =0 ;lnet_net_lock (cpt);@@ -335,13 +335,14 @@ lnet_nid2peer_locked(struct lnet_peer **lpp, lnet_nid_t nid, int cpt) goto out; } - lp->lp_net =lnet_get_net_locked (LNET_NIDNET (lp->lp_nid)); - lp->lp_txcredits = - lp->lp_mintxcredits = lp->lp_net->net_tunables.lct_peer_tx_credits; - lp->lp_rtrcredits = - lp->lp_minrtrcredits =lnet_peer_buffer_credits (lp->lp_net); + lp->lpni_net =lnet_get_net_locked (LNET_NIDNET (lp->lpni_nid)); + lp->lpni_txcredits = + lp->lpni_mintxcredits = + lp->lpni_net->net_tunables.lct_peer_tx_credits; + lp->lpni_rtrcredits = + lp->lpni_minrtrcredits =lnet_peer_buffer_credits (lp->lpni_net); -list_add_tail (&lp->lp_hashlist, +list_add_tail (&lp->lpni_hashlist, &ptable->pt_hash[lnet_nid2peerhash (nid)]); ptable->pt_version++; *lpp = lp;@@ -349,7 +350,7 @@ lnet_nid2peer_locked(struct lnet_peer **lpp, lnet_nid_t nid, int cpt)return 0 ; out:if (lp) -list_add (&lp->lp_hashlist, &ptable->pt_deathrow); +list_add (&lp->lpni_hashlist, &ptable->pt_deathrow); ptable->pt_number--;return rc; }@@ -373,13 +374,13 @@ lnet_debug_peer(lnet_nid_t nid) }if (lnet_isrouter (lp) ||lnet_peer_aliveness_enabled (lp)) - aliveness = lp->lp_alive ?"up" :"down" ; + aliveness = lp->lpni_alive ?"up" :"down" ;CDEBUG (D_WARNING ,"%-24s %4d %5s %5d %5d %5d %5d %5d %ld\n" , -libcfs_nid2str (lp->lp_nid), lp->lp_refcount, - aliveness, lp->lp_net->net_tunables.lct_peer_tx_credits, - lp->lp_rtrcredits, lp->lp_minrtrcredits, - lp->lp_txcredits, lp->lp_mintxcredits, lp->lp_txqnob); +libcfs_nid2str (lp->lpni_nid), lp->lpni_refcount, + aliveness, lp->lpni_net->net_tunables.lct_peer_tx_credits, + lp->lpni_rtrcredits, lp->lpni_minrtrcredits, + lp->lpni_txcredits, lp->lpni_mintxcredits, lp->lpni_txqnob);lnet_peer_decref_locked (lp);@@ -420,7 +421,7 @@ lnet_get_peer_info(__u32 peer_index, __u64 *nid,for (j =0 ; j <LNET_PEER_HASH_SIZE && !found; j++) {struct list_head *peers = &peer_table->pt_hash[j]; -list_for_each_entry (lp, peers, lp_hashlist) { +list_for_each_entry (lp, peers, lpni_hashlist) {if (peer_index-- >0 )continue ;@@ -428,16 +429,16 @@ lnet_get_peer_info(__u32 peer_index, __u64 *nid,if (lnet_isrouter (lp) ||lnet_peer_aliveness_enabled (lp))snprintf (aliveness,LNET_MAX_STR_LEN , - lp->lp_alive ?"up" :"down" ); + lp->lpni_alive ?"up" :"down" ); - *nid = lp->lp_nid; - *refcount = lp->lp_refcount; + *nid = lp->lpni_nid; + *refcount = lp->lpni_refcount; *ni_peer_tx_credits = - lp->lp_net->net_tunables.lct_peer_tx_credits; - *peer_tx_credits = lp->lp_txcredits; - *peer_rtr_credits = lp->lp_rtrcredits; - *peer_min_rtr_credits = lp->lp_mintxcredits; - *peer_tx_qnob = lp->lp_txqnob; + lp->lpni_net->net_tunables.lct_peer_tx_credits; + *peer_tx_credits = lp->lpni_txcredits; + *peer_rtr_credits = lp->lpni_rtrcredits; + *peer_min_rtr_credits = lp->lpni_mintxcredits; + *peer_tx_qnob = lp->lpni_txqnob; found = true; }drivers/staging/lustre/lnet/lnet/router.c +110
-108@@ -103,30 +103,30 @@ void lnet_notify_locked(struct lnet_peer *lp, int notifylnd, int alive, time64_t when) { - if (lp->lp_timestamp > when) { /* out of date information */ + if (lp->lpni_timestamp > when) { /* out of date information */ CDEBUG(D_NET, "Out of date\n");return ; } - lp->lp_timestamp = when;/* update timestamp */ - lp->lp_ping_deadline =0 ;/* disable ping timeout */ + lp->lpni_timestamp = when;/* update timestamp */ + lp->lpni_ping_deadline =0 ;/* disable ping timeout */ -if (lp->lp_alive_count &&/* got old news */ - (!lp->lp_alive) == (!alive)) {/* new date for old news */ +if (lp->lpni_alive_count &&/* got old news */ + (!lp->lpni_alive) == (!alive)) {/* new date for old news */ CDEBUG (D_NET ,"Old news\n" );return ; }/* Flag that notification is outstanding */ - lp->lp_alive_count++; - lp->lp_alive = !(!alive);/* 1 bit! */ - lp->lp_notify =1 ; - lp->lp_notifylnd |= notifylnd; -if (lp->lp_alive) - lp->lp_ping_feats =LNET_PING_FEAT_INVAL ;/* reset */ + lp->lpni_alive_count++; + lp->lpni_alive = !(!alive);/* 1 bit! */ + lp->lpni_notify =1 ; + lp->lpni_notifylnd |= notifylnd; +if (lp->lpni_alive) + lp->lpni_ping_feats =LNET_PING_FEAT_INVAL ;/* reset */ -CDEBUG (D_NET ,"set %s %d\n" ,libcfs_nid2str (lp->lp_nid), alive); +CDEBUG (D_NET ,"set %s %d\n" ,libcfs_nid2str (lp->lpni_nid), alive); } static void@@ -140,55 +140,56 @@ lnet_ni_notify_locked(struct lnet_ni *ni, struct lnet_peer *lp)* NB individual events can be missed; the only guarantee is that you * always get the most recent news */ -if (lp->lp_notifying || !ni) +if (lp->lpni_notifying || !ni)return ; - lp->lp_notifying =1 ; + lp->lpni_notifying =1 ; -while (lp->lp_notify) { - alive = lp->lp_alive; - notifylnd = lp->lp_notifylnd; +while (lp->lpni_notify) { + alive = lp->lpni_alive; + notifylnd = lp->lpni_notifylnd; - lp->lp_notifylnd =0 ; - lp->lp_notify =0 ; + lp->lpni_notifylnd =0 ; + lp->lpni_notify =0 ;if (notifylnd && ni->ni_net->net_lnd->lnd_notify) { -lnet_net_unlock (lp->lp_cpt); +lnet_net_unlock (lp->lpni_cpt);/* * A new notification could happen now; I'll handle it * when control returns to me */ - ni->ni_net->net_lnd->lnd_notify (ni, lp->lp_nid, alive); + ni->ni_net->net_lnd->lnd_notify (ni, lp->lpni_nid, + alive); -lnet_net_lock (lp->lp_cpt); +lnet_net_lock (lp->lpni_cpt); } } - lp->lp_notifying =0 ; + lp->lpni_notifying =0 ; }static void lnet_rtr_addref_locked (struct lnet_peer *lp) { -LASSERT (lp->lp_refcount >0 ); -LASSERT (lp->lp_rtr_refcount >=0 ); +LASSERT (lp->lpni_refcount >0 ); +LASSERT (lp->lpni_rtr_refcount >=0 );/* lnet_net_lock must be exclusively locked */ - lp->lp_rtr_refcount++; -if (lp->lp_rtr_refcount ==1 ) { + lp->lpni_rtr_refcount++; +if (lp->lpni_rtr_refcount ==1 ) {struct list_head *pos;/* a simple insertion sort */ list_for_each_prev (pos, &the_lnet.ln_routers) {struct lnet_peer *rtr; - rtr = list_entry(pos, struct lnet_peer, lp_rtr_list); -if (rtr->lp_nid < lp->lp_nid) + rtr = list_entry(pos, struct lnet_peer, lpni_rtr_list); +if (rtr->lpni_nid < lp->lpni_nid)break ; } -list_add (&lp->lp_rtr_list, pos); +list_add (&lp->lpni_rtr_list, pos);/* addref for the_lnet.ln_routers */ lnet_peer_addref_locked (lp); the_lnet.ln_routers_version++;@@ -198,21 +199,21 @@ lnet_rtr_addref_locked(struct lnet_peer *lp)static void lnet_rtr_decref_locked (struct lnet_peer *lp) { -LASSERT (lp->lp_refcount >0 ); -LASSERT (lp->lp_rtr_refcount >0 ); +LASSERT (lp->lpni_refcount >0 ); +LASSERT (lp->lpni_rtr_refcount >0 );/* lnet_net_lock must be exclusively locked */ - lp->lp_rtr_refcount--; -if (!lp->lp_rtr_refcount) { -LASSERT (list_empty (&lp->lp_routes)); + lp->lpni_rtr_refcount--; +if (!lp->lpni_rtr_refcount) { +LASSERT (list_empty (&lp->lpni_routes)); -if (lp->lp_rcd) { -list_add (&lp->lp_rcd->rcd_list, +if (lp->lpni_rcd) { +list_add (&lp->lpni_rcd->rcd_list, &the_lnet.ln_rcd_deathrow); - lp->lp_rcd =NULL ; + lp->lpni_rcd =NULL ; } -list_del (&lp->lp_rtr_list); +list_del (&lp->lpni_rtr_list);/* decref for the_lnet.ln_routers */ lnet_peer_decref_locked (lp); the_lnet.ln_routers_version++;@@ -279,7 +280,7 @@ lnet_add_route_to_rnet(struct lnet_remotenet *rnet, struct lnet_route *route) offset--; }list_add (&route->lr_list, e); -list_add (&route->lr_gwlist, &route->lr_gateway->lp_routes); +list_add (&route->lr_gwlist, &route->lr_gateway->lpni_routes); the_lnet.ln_remote_nets_version++;lnet_rtr_addref_locked (route->lr_gateway);@@ -364,14 +365,14 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway, }/* our lookups must be true */ -LASSERT (route2->lr_gateway->lp_nid != gateway); +LASSERT (route2->lr_gateway->lpni_nid != gateway); }if (add_route) {lnet_peer_addref_locked (route->lr_gateway);/* +1 for notify */ lnet_add_route_to_rnet (rnet2, route); - ni =lnet_get_next_ni_locked (route->lr_gateway->lp_net,NULL ); + ni =lnet_get_next_ni_locked (route->lr_gateway->lpni_net,NULL );lnet_net_unlock (LNET_LOCK_EX );/* XXX Assume alive */ @@ -426,12 +427,12 @@ lnet_check_routes(void)continue ; } -if (route->lr_gateway->lp_net == - route2->lr_gateway->lp_net) +if (route->lr_gateway->lpni_net == + route2->lr_gateway->lpni_net)continue ; - nid1 = route->lr_gateway->lp_nid; - nid2 = route2->lr_gateway->lp_nid; + nid1 = route->lr_gateway->lpni_nid; + nid2 = route2->lr_gateway->lpni_nid; net = rnet->lrn_net;lnet_net_unlock (cpt);@@ -481,7 +482,7 @@ lnet_del_route(__u32 net, lnet_nid_t gw_nid)list_for_each_entry (route, &rnet->lrn_routes, lr_list) { gateway = route->lr_gateway;if (!(gw_nid ==LNET_NID_ANY || - gw_nid == gateway->lp_nid)) + gw_nid == gateway->lpni_nid))continue ;list_del (&route->lr_list);@@ -575,7 +576,7 @@ lnet_get_route(int idx, __u32 *net, __u32 *hops, *net = rnet->lrn_net; *hops = route->lr_hops; *priority = route->lr_priority; - *gateway = route->lr_gateway->lp_nid; + *gateway = route->lr_gateway->lpni_nid; *alive =lnet_is_route_alive (route);lnet_net_unlock (cpt);return 0 ;@@ -616,7 +617,7 @@ lnet_parse_rc_info(struct lnet_rc_data *rcd)struct lnet_peer *gw = rcd->rcd_gateway;struct lnet_route *rte; -if (!gw->lp_alive) +if (!gw->lpni_alive)return ;if (info->pi_magic ==__swab32 (LNET_PROTO_PING_MAGIC ))@@ -625,27 +626,27 @@ lnet_parse_rc_info(struct lnet_rc_data *rcd)/* NB always racing with network! */ if (info->pi_magic !=LNET_PROTO_PING_MAGIC ) {CDEBUG (D_NET ,"%s: Unexpected magic %08x\n" , -libcfs_nid2str (gw->lp_nid), info->pi_magic); - gw->lp_ping_feats =LNET_PING_FEAT_INVAL ; +libcfs_nid2str (gw->lpni_nid), info->pi_magic); + gw->lpni_ping_feats =LNET_PING_FEAT_INVAL ;return ; } - gw->lp_ping_feats = info->pi_features; -if (!(gw->lp_ping_feats &LNET_PING_FEAT_MASK )) { + gw->lpni_ping_feats = info->pi_features; +if (!(gw->lpni_ping_feats &LNET_PING_FEAT_MASK )) {CDEBUG (D_NET ,"%s: Unexpected features 0x%x\n" , -libcfs_nid2str (gw->lp_nid), gw->lp_ping_feats); +libcfs_nid2str (gw->lpni_nid), gw->lpni_ping_feats);return ;/* nothing I can understand */ } -if (!(gw->lp_ping_feats &LNET_PING_FEAT_NI_STATUS )) +if (!(gw->lpni_ping_feats &LNET_PING_FEAT_NI_STATUS ))return ;/* can't carry NI status info */ -list_for_each_entry (rte, &gw->lp_routes, lr_gwlist) { +list_for_each_entry (rte, &gw->lpni_routes, lr_gwlist) {int down =0 ;int up =0 ;int i; -if (gw->lp_ping_feats &LNET_PING_FEAT_RTE_DISABLED ) { +if (gw->lpni_ping_feats &LNET_PING_FEAT_RTE_DISABLED ) { rte->lr_downis =1 ;continue ; }@@ -656,8 +657,8 @@ lnet_parse_rc_info(struct lnet_rc_data *rcd)if (nid ==LNET_NID_ANY ) {CDEBUG (D_NET ,"%s: unexpected LNET_NID_ANY\n" , -libcfs_nid2str (gw->lp_nid)); - gw->lp_ping_feats =LNET_PING_FEAT_INVAL ; +libcfs_nid2str (gw->lpni_nid)); + gw->lpni_ping_feats =LNET_PING_FEAT_INVAL ;return ; }@@ -678,8 +679,8 @@ lnet_parse_rc_info(struct lnet_rc_data *rcd) }CDEBUG (D_NET ,"%s: Unexpected status 0x%x\n" , -libcfs_nid2str (gw->lp_nid), stat->ns_status); - gw->lp_ping_feats =LNET_PING_FEAT_INVAL ; +libcfs_nid2str (gw->lpni_nid), stat->ns_status); + gw->lpni_ping_feats =LNET_PING_FEAT_INVAL ;return ; }@@ -722,14 +723,14 @@ lnet_router_checker_event(struct lnet_event *event)* places need to hold both locks at the same time, please take * care of lock ordering */ -lnet_net_lock (lp->lp_cpt); -if (!lnet_isrouter (lp) || lp->lp_rcd != rcd) { +lnet_net_lock (lp->lpni_cpt); +if (!lnet_isrouter (lp) || lp->lpni_rcd != rcd) {/* ignore if no longer a router or rcd is replaced */ goto out; }if (event->type ==LNET_EVENT_SEND ) { - lp->lp_ping_notsent =0 ; + lp->lpni_ping_notsent =0 ;if (!event->status) goto out; }@@ -753,7 +754,7 @@ lnet_router_checker_event(struct lnet_event *event)lnet_parse_rc_info (rcd); out: -lnet_net_unlock (lp->lp_cpt); +lnet_net_unlock (lp->lpni_cpt); } static void@@ -768,8 +769,8 @@ lnet_wait_known_routerstate(void)int cpt =lnet_net_lock_current (); all_known =1 ; -list_for_each_entry (rtr, &the_lnet.ln_routers, lp_rtr_list) { -if (!rtr->lp_alive_count) { +list_for_each_entry (rtr, &the_lnet.ln_routers, lpni_rtr_list) { +if (!rtr->lpni_alive_count) { all_known =0 ;break ; }@@ -789,8 +790,8 @@ lnet_router_ni_update_locked(struct lnet_peer *gw, __u32 net) {struct lnet_route *rte; -if ((gw->lp_ping_feats &LNET_PING_FEAT_NI_STATUS )) { -list_for_each_entry (rte, &gw->lp_routes, lr_gwlist) { +if ((gw->lpni_ping_feats &LNET_PING_FEAT_NI_STATUS )) { +list_for_each_entry (rte, &gw->lpni_routes, lr_gwlist) {if (rte->lr_net == net) { rte->lr_downis =0 ;break ;@@ -849,7 +850,7 @@ lnet_destroy_rc_data(struct lnet_rc_data *rcd)LASSERT (LNetMDHandleIsInvalid (rcd->rcd_mdh));if (rcd->rcd_gateway) { -int cpt = rcd->rcd_gateway->lp_cpt; +int cpt = rcd->rcd_gateway->lpni_cpt;lnet_net_lock (cpt);lnet_peer_decref_locked (rcd->rcd_gateway);@@ -870,7 +871,7 @@ lnet_create_rc_data_locked(struct lnet_peer *gateway)int rc;int i; -lnet_net_unlock (gateway->lp_cpt); +lnet_net_unlock (gateway->lpni_cpt); rcd =kzalloc (sizeof (*rcd),GFP_NOFS );if (!rcd)@@ -904,17 +905,17 @@ lnet_create_rc_data_locked(struct lnet_peer *gateway) }LASSERT (!rc); -lnet_net_lock (gateway->lp_cpt); +lnet_net_lock (gateway->lpni_cpt);/* router table changed or someone has created rcd for this gateway */ -if (!lnet_isrouter (gateway) || gateway->lp_rcd) { -lnet_net_unlock (gateway->lp_cpt); +if (!lnet_isrouter (gateway) || gateway->lpni_rcd) { +lnet_net_unlock (gateway->lpni_cpt); goto out; }lnet_peer_addref_locked (gateway); rcd->rcd_gateway = gateway; - gateway->lp_rcd = rcd; - gateway->lp_ping_notsent =0 ; + gateway->lpni_rcd = rcd; + gateway->lpni_ping_notsent =0 ;return rcd;@@ -927,8 +928,8 @@ lnet_create_rc_data_locked(struct lnet_peer *gateway)lnet_destroy_rc_data (rcd); } -lnet_net_lock (gateway->lp_cpt); -return gateway->lp_rcd; +lnet_net_lock (gateway->lpni_cpt); +return gateway->lpni_rcd; } static int@@ -936,7 +937,7 @@ lnet_router_check_interval(struct lnet_peer *rtr) {int secs; - secs = rtr->lp_alive ? live_router_check_interval : + secs = rtr->lpni_alive ? live_router_check_interval : dead_router_check_interval;if (secs <0 ) secs =0 ;@@ -954,12 +955,12 @@ lnet_ping_router_locked(struct lnet_peer *rtr)lnet_peer_addref_locked (rtr); -if (rtr->lp_ping_deadline &&/* ping timed out? */ - now > rtr->lp_ping_deadline) +if (rtr->lpni_ping_deadline &&/* ping timed out? */ + now > rtr->lpni_ping_deadline)lnet_notify_locked (rtr,1 ,0 , now);/* Run any outstanding notifications */ - ni =lnet_get_next_ni_locked (rtr->lp_net,NULL ); + ni =lnet_get_next_ni_locked (rtr->lpni_net,NULL );lnet_ni_notify_locked (ni, rtr); if (!lnet_isrouter(rtr) ||@@ -969,8 +970,8 @@ lnet_ping_router_locked(struct lnet_peer *rtr)return ; } - rcd = rtr->lp_rcd ? - rtr->lp_rcd :lnet_create_rc_data_locked (rtr); + rcd = rtr->lpni_rcd ? + rtr->lpni_rcd :lnet_create_rc_data_locked (rtr);if (!rcd)return ;@@ -978,39 +979,40 @@ lnet_ping_router_locked(struct lnet_peer *rtr) secs =lnet_router_check_interval (rtr);CDEBUG (D_NET , -"rtr %s %lldd: deadline %lld ping_notsent %d alive %d alive_count %d lp_ping_timestamp %lld\n" , -libcfs_nid2str (rtr->lp_nid), secs, - rtr->lp_ping_deadline, rtr->lp_ping_notsent, - rtr->lp_alive, rtr->lp_alive_count, rtr->lp_ping_timestamp); - -if (secs && !rtr->lp_ping_notsent && - now > rtr->lp_ping_timestamp + secs) { +"rtr %s %lldd: deadline %lld ping_notsent %d alive %d alive_count %d lpni_ping_timestamp %lld\n" , +libcfs_nid2str (rtr->lpni_nid), secs, + rtr->lpni_ping_deadline, rtr->lpni_ping_notsent, + rtr->lpni_alive, rtr->lpni_alive_count, + rtr->lpni_ping_timestamp); + +if (secs && !rtr->lpni_ping_notsent && + now > rtr->lpni_ping_timestamp + secs) {int rc;struct lnet_process_id id;struct lnet_handle_md mdh; - id.nid = rtr->lp_nid; + id.nid = rtr->lpni_nid; id.pid =LNET_PID_LUSTRE ;CDEBUG (D_NET ,"Check: %s\n" ,libcfs_id2str (id)); - rtr->lp_ping_notsent =1 ; - rtr->lp_ping_timestamp = now; + rtr->lpni_ping_notsent =1 ; + rtr->lpni_ping_timestamp = now; mdh = rcd->rcd_mdh; -if (!rtr->lp_ping_deadline) { - rtr->lp_ping_deadline =ktime_get_seconds () + +if (!rtr->lpni_ping_deadline) { + rtr->lpni_ping_deadline =ktime_get_seconds () + router_ping_timeout; } -lnet_net_unlock (rtr->lp_cpt); +lnet_net_unlock (rtr->lpni_cpt); rc =LNetGet (LNET_NID_ANY , mdh, id,LNET_RESERVED_PORTAL ,LNET_PROTO_PING_MATCHBITS ,0 ); -lnet_net_lock (rtr->lp_cpt); +lnet_net_lock (rtr->lpni_cpt);if (rc) - rtr->lp_ping_notsent =0 ;/* no event pending */ + rtr->lpni_ping_notsent =0 ;/* no event pending */ }lnet_peer_decref_locked (rtr);@@ -1106,14 +1108,14 @@ lnet_prune_rc_data(int wait_unlink)if (the_lnet.ln_rc_state !=LNET_RC_STATE_RUNNING ) {/* router checker is stopping, prune all */ list_for_each_entry (lp, &the_lnet.ln_routers, - lp_rtr_list) { -if (!lp->lp_rcd) + lpni_rtr_list) { +if (!lp->lpni_rcd)continue ; -LASSERT (list_empty (&lp->lp_rcd->rcd_list)); -list_add (&lp->lp_rcd->rcd_list, +LASSERT (list_empty (&lp->lpni_rcd->rcd_list)); +list_add (&lp->lpni_rcd->rcd_list, &the_lnet.ln_rcd_deathrow); - lp->lp_rcd =NULL ; + lp->lpni_rcd =NULL ; } }@@ -1206,8 +1208,8 @@ lnet_router_checker(void *arg) rescan: version = the_lnet.ln_routers_version; -list_for_each_entry (rtr, &the_lnet.ln_routers, lp_rtr_list) { - cpt2 = rtr->lp_cpt; +list_for_each_entry (rtr, &the_lnet.ln_routers, lpni_rtr_list) { + cpt2 = rtr->lpni_cpt;if (cpt != cpt2) {lnet_net_unlock (cpt); cpt = cpt2;@@ -1745,8 +1747,8 @@ lnet_notify(struct lnet_ni *ni, lnet_nid_t nid, int alive, time64_t when)* call us with when == _time_when_the_node_was_booted_ if * no connections were successfully established */ -if (ni && !alive && when < lp->lp_last_alive) - when = lp->lp_last_alive; +if (ni && !alive && when < lp->lpni_last_alive) + when = lp->lpni_last_alive;lnet_notify_locked (lp, !ni, alive, when);drivers/staging/lustre/lnet/lnet/router_proc.c +26
-26@@ -214,7 +214,7 @@ static int proc_lnet_routes(struct ctl_table *table, int write,__u32 net = rnet->lrn_net;__u32 hops = route->lr_hops;unsigned int priority = route->lr_priority; -lnet_nid_t nid = route->lr_gateway->lp_nid; +lnet_nid_t nid = route->lr_gateway->lpni_nid;int alive =lnet_is_route_alive (route); s += snprintf(s, tmpstr + tmpsiz - s,@@ -306,7 +306,7 @@ static int proc_lnet_routers(struct ctl_table *table, int write,while (r != &the_lnet.ln_routers) {struct lnet_peer *lp; - lp = list_entry(r, struct lnet_peer, lp_rtr_list); + lp = list_entry(r, struct lnet_peer, lpni_rtr_list);if (!skip) { peer = lp;break ;@@ -317,21 +317,21 @@ static int proc_lnet_routers(struct ctl_table *table, int write, }if (peer) { -lnet_nid_t nid = peer->lp_nid; +lnet_nid_t nid = peer->lpni_nid;time64_t now =ktime_get_seconds (); -time64_t deadline = peer->lp_ping_deadline; -int nrefs = peer->lp_refcount; -int nrtrrefs = peer->lp_rtr_refcount; -int alive_cnt = peer->lp_alive_count; -int alive = peer->lp_alive; -int pingsent = !peer->lp_ping_notsent; -time64_t last_ping = now - peer->lp_ping_timestamp; +time64_t deadline = peer->lpni_ping_deadline; +int nrefs = peer->lpni_refcount; +int nrtrrefs = peer->lpni_rtr_refcount; +int alive_cnt = peer->lpni_alive_count; +int alive = peer->lpni_alive; +int pingsent = !peer->lpni_ping_notsent; +time64_t last_ping = now - peer->lpni_ping_timestamp;int down_ni =0 ;struct lnet_route *rtr; -if ((peer->lp_ping_feats & +if ((peer->lpni_ping_feats &LNET_PING_FEAT_NI_STATUS )) { -list_for_each_entry (rtr, &peer->lp_routes, +list_for_each_entry (rtr, &peer->lpni_routes, lr_gwlist) {/* * downis on any route should be the @@ -452,16 +452,16 @@ static int proc_lnet_peers(struct ctl_table *table, int write,struct lnet_peer *lp; lp = list_entry(p, struct lnet_peer, - lp_hashlist); + lpni_hashlist);if (!skip) { peer = lp;/* * minor optimization: start from idx+1 * on next iteration if we've just -* drained lp_hashlist +* drained lpni_hashlist */ -if (lp->lp_hashlist.next == +if (lp->lpni_hashlist.next == &ptable->pt_hash[hash]) { hoff =1 ; hash++;@@ -473,7 +473,7 @@ static int proc_lnet_peers(struct ctl_table *table, int write, } skip--; - p = lp->lp_hashlist.next; + p = lp->lpni_hashlist.next; }if (peer)@@ -485,25 +485,25 @@ static int proc_lnet_peers(struct ctl_table *table, int write, }if (peer) { -lnet_nid_t nid = peer->lp_nid; -int nrefs = peer->lp_refcount; +lnet_nid_t nid = peer->lpni_nid; +int nrefs = peer->lpni_refcount;time64_t lastalive =-1 ;char *aliveness ="NA" ; -int maxcr = peer->lp_net->net_tunables.lct_peer_tx_credits; -int txcr = peer->lp_txcredits; -int mintxcr = peer->lp_mintxcredits; -int rtrcr = peer->lp_rtrcredits; -int minrtrcr = peer->lp_minrtrcredits; -int txqnob = peer->lp_txqnob; +int maxcr = peer->lpni_net->net_tunables.lct_peer_tx_credits; +int txcr = peer->lpni_txcredits; +int mintxcr = peer->lpni_mintxcredits; +int rtrcr = peer->lpni_rtrcredits; +int minrtrcr = peer->lpni_minrtrcredits; +int txqnob = peer->lpni_txqnob;if (lnet_isrouter (peer) ||lnet_peer_aliveness_enabled (peer)) - aliveness = peer->lp_alive ?"up" :"down" ; + aliveness = peer->lpni_alive ?"up" :"down" ;if (lnet_peer_aliveness_enabled (peer)) {time64_t now =ktime_get_seconds (); - lastalive = now - peer->lp_last_alive; + lastalive = now - peer->lpni_last_alive;/* No need to mess up peers contents with * arbitrarily long integers - it suffices to
PATCH 2/34 lnet: change struct lnet_peer to struct lnet_peer_ni
In reply to NeilBrownAlso remove the typedef
sed -i -e 's/struct lnet_peer\b/struct lnet_peer_ni/g' -e 's/lnet_peer_t\b/struct lnet_peer_ni/g' git ls-files lnet
Then edit lib-types.h to remove the typedef, and clean up some long lines.
This is part of
Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")from upstream lustre, where it is marked:
WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Reviewed-on: http://review.whamcloud.com/18293
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 20 ++++++----- .../staging/lustre/include/linux/lnet/lib-types.h | 10 +++--- drivers/staging/lustre/lnet/lnet/lib-move.c | 26 +++++++-------- drivers/staging/lustre/lnet/lnet/peer.c | 31 +++++++++--------- drivers/staging/lustre/lnet/lnet/router.c | 35 ++++++++++---------- drivers/staging/lustre/lnet/lnet/router_proc.c | 12 +++---- 6 files changed, 68 insertions(+), 66 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +10 -10
@@ -311,16 +311,16 @@ lnet_handle2me(struct lnet_handle_me *handle) }static inline void -lnet_peer_addref_locked (struct lnet_peer *lp) +lnet_peer_addref_locked (struct lnet_peer_ni *lp) {LASSERT (lp->lpni_refcount >0 ); lp->lpni_refcount++; } -void lnet_destroy_peer_locked (struct lnet_peer *lp); +void lnet_destroy_peer_locked (struct lnet_peer_ni *lp);static inline void -lnet_peer_decref_locked (struct lnet_peer *lp) +lnet_peer_decref_locked (struct lnet_peer_ni *lp) {LASSERT (lp->lpni_refcount >0 ); lp->lpni_refcount--;
@@ -329,7 +329,7 @@ lnet_peer_decref_locked(struct lnet_peer *lp) }static inline int -lnet_isrouter (struct lnet_peer *lp) +lnet_isrouter (struct lnet_peer_ni *lp) {return lp->lpni_rtr_refcount ?1 :0 ; }
@@ -410,7 +410,7 @@ void lnet_lib_exit(void);int lnet_notify (struct lnet_ni *ni,lnet_nid_t peer,int alive,time64_t when); -void lnet_notify_locked (struct lnet_peer *lp,int notifylnd,int alive, +void lnet_notify_locked (struct lnet_peer_ni *lp,int notifylnd,int alive,time64_t when);int lnet_add_route (__u32 net,__u32 hops,lnet_nid_t gateway_nid,unsigned int priority);
@@ -624,7 +624,7 @@ int lnet_peer_buffer_credits(struct lnet_net *net);int lnet_router_checker_start (void );void lnet_router_checker_stop (void ); -void lnet_router_ni_update_locked (struct lnet_peer *gw,__u32 net); +void lnet_router_ni_update_locked (struct lnet_peer_ni *gw,__u32 net);void lnet_swap_pinginfo (struct lnet_ping_info *info);int lnet_parse_ip2nets (char **networksp,char *ip2nets);
@@ -635,9 +635,9 @@ bool lnet_net_unique(__u32 net_id, struct list_head *nilist, struct lnet_net **net);bool lnet_ni_unique_net (struct list_head *nilist,char *iface); -int lnet_nid2peer_locked (struct lnet_peer **lpp,lnet_nid_t nid,int cpt); -struct lnet_peer *lnet_find_peer_locked (struct lnet_peer_table *ptable, -lnet_nid_t nid); +int lnet_nid2peer_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt); +struct lnet_peer_ni *lnet_find_peer_locked (struct lnet_peer_table *ptable, +lnet_nid_t nid);void lnet_peer_tables_cleanup (struct lnet_ni *ni);void lnet_peer_tables_destroy (void );int lnet_peer_tables_create (void );
@@ -650,7 +650,7 @@ int lnet_get_peer_info(__u32 peer_index, __u64 *nid, __u32 *peer_tx_qnob);static inline void -lnet_peer_set_alive (struct lnet_peer *lp) +lnet_peer_set_alive (struct lnet_peer_ni *lp) { lp->lpni_last_query =ktime_get_seconds (); lp->lpni_last_alive = lp->lpni_last_query;
drivers/staging/lustre/include/linux/lnet/lib-types.h +5 -5
@@ -93,8 +93,8 @@ struct lnet_msg { unsigned int msg_onactivelist:1; /* on the activelist */ unsigned int msg_rdma_get:1; -struct lnet_peer *msg_txpeer;/* peer I'm sending to */ -struct lnet_peer *msg_rxpeer;/* peer I received from */ +struct lnet_peer_ni *msg_txpeer;/* peer I'm sending to */ +struct lnet_peer_ni *msg_rxpeer;/* peer I received from */ void *msg_private;struct lnet_libmd *msg_md;
@@ -378,12 +378,12 @@ struct lnet_rc_data {/* ping buffer MD */ struct lnet_handle_md rcd_mdh;/* reference to gateway */ -struct lnet_peer *rcd_gateway; +struct lnet_peer_ni *rcd_gateway;/* ping buffer */ struct lnet_ping_info *rcd_pinginfo; }; -struct lnet_peer { +struct lnet_peer_ni {/* chain on peer hash */ struct list_head lpni_hashlist;/* messages blocking for tx credits */
@@ -474,7 +474,7 @@ struct lnet_route {/* chain on gateway */ struct list_head lr_gwlist;/* router node */ -struct lnet_peer *lr_gateway; +struct lnet_peer_ni *lr_gateway;/* remote network number */ __u32 lr_net;/* sequence for round-robin */
drivers/staging/lustre/lnet/lnet/lib-move.c +13 -13
@@ -491,7 +491,7 @@ lnet_ni_eager_recv(struct lnet_ni *ni, struct lnet_msg *msg)/* NB: caller shall hold a ref on 'lp' as I'd drop lnet_net_lock */ static void -lnet_ni_query_locked (struct lnet_ni *ni,struct lnet_peer *lp) +lnet_ni_query_locked (struct lnet_ni *ni,struct lnet_peer_ni *lp) {time64_t last_alive =0 ;
@@ -510,7 +510,7 @@ lnet_ni_query_locked(struct lnet_ni *ni, struct lnet_peer *lp)/* NB: always called with lnet_net_lock held */ static inline int -lnet_peer_is_alive (struct lnet_peer *lp,unsigned long now) +lnet_peer_is_alive (struct lnet_peer_ni *lp,unsigned long now) {int alive;time64_t deadline;
@@ -544,7 +544,7 @@ lnet_peer_is_alive(struct lnet_peer *lp, unsigned long now)* may drop the lnet_net_lock */ static int -lnet_peer_alive_locked (struct lnet_ni *ni,struct lnet_peer *lp) +lnet_peer_alive_locked (struct lnet_ni *ni,struct lnet_peer_ni *lp) {time64_t now =ktime_get_seconds ();
@@ -599,7 +599,7 @@ lnet_peer_alive_locked(struct lnet_ni *ni, struct lnet_peer *lp)static int lnet_post_send_locked (struct lnet_msg *msg,int do_send) { -struct lnet_peer *lp = msg->msg_txpeer; +struct lnet_peer_ni *lp = msg->msg_txpeer;struct lnet_ni *ni = msg->msg_txni;int cpt = msg->msg_tx_cpt;struct lnet_tx_queue *tq = ni->ni_tx_queues[cpt];
@@ -710,7 +710,7 @@ lnet_post_routed_recv_locked(struct lnet_msg *msg, int do_recv)* I return LNET_CREDIT_WAIT if msg blocked and LNET_CREDIT_OK if * received or OK to receive */ -struct lnet_peer *lp = msg->msg_rxpeer; +struct lnet_peer_ni *lp = msg->msg_rxpeer;struct lnet_rtrbufpool *rbp;struct lnet_rtrbuf *rb;
@@ -780,7 +780,7 @@ lnet_post_routed_recv_locked(struct lnet_msg *msg, int do_recv)void lnet_return_tx_credits_locked (struct lnet_msg *msg) { -struct lnet_peer *txpeer = msg->msg_txpeer; +struct lnet_peer_ni *txpeer = msg->msg_txpeer;struct lnet_msg *msg2;struct lnet_ni *txni = msg->msg_txni;
@@ -881,7 +881,7 @@ lnet_drop_routed_msgs_locked(struct list_head *list, int cpt)void lnet_return_rx_credits_locked (struct lnet_msg *msg) { -struct lnet_peer *rxpeer = msg->msg_rxpeer; +struct lnet_peer_ni *rxpeer = msg->msg_rxpeer;struct lnet_ni *rxni = msg->msg_rxni;struct lnet_msg *msg2;
@@ -971,8 +971,8 @@ lnet_return_rx_credits_locked(struct lnet_msg *msg)static int lnet_compare_routes (struct lnet_route *r1,struct lnet_route *r2) { -struct lnet_peer *p1 = r1->lr_gateway; -struct lnet_peer *p2 = r2->lr_gateway; +struct lnet_peer_ni *p1 = r1->lr_gateway; +struct lnet_peer_ni *p2 = r2->lr_gateway;int r1_hops = (r1->lr_hops ==LNET_UNDEFINED_HOPS ) ?1 : r1->lr_hops;int r2_hops = (r2->lr_hops ==LNET_UNDEFINED_HOPS ) ?1 : r2->lr_hops;
@@ -1006,7 +1006,7 @@ lnet_compare_routes(struct lnet_route *r1, struct lnet_route *r2)return -ERANGE ; } -static struct lnet_peer * +static struct lnet_peer_ni *lnet_find_route_locked (struct lnet_net *net,lnet_nid_t target,lnet_nid_t rtr_nid) {
@@ -1014,8 +1014,8 @@ lnet_find_route_locked(struct lnet_net *net, lnet_nid_t target,struct lnet_route *route;struct lnet_route *best_route;struct lnet_route *last_route; -struct lnet_peer *lpni_best; -struct lnet_peer *lp; +struct lnet_peer_ni *lpni_best; +struct lnet_peer_ni *lp;int rc;/*
@@ -1076,7 +1076,7 @@ lnet_send(lnet_nid_t src_nid, struct lnet_msg *msg, lnet_nid_t rtr_nid)lnet_nid_t dst_nid = msg->msg_target.nid;struct lnet_ni *src_ni;struct lnet_ni *local_ni; -struct lnet_peer *lp; +struct lnet_peer_ni *lp;int cpt;int cpt2;int rc;
drivers/staging/lustre/lnet/lnet/peer.c +16 -15
@@ -106,8 +106,8 @@ lnet_peer_table_cleanup_locked(struct lnet_ni *ni, struct lnet_peer_table *ptable) {int i; -struct lnet_peer *lp; -struct lnet_peer *tmp; +struct lnet_peer_ni *lp; +struct lnet_peer_ni *tmp;for (i =0 ; i <LNET_PEER_HASH_SIZE ; i++) { list_for_each_entry_safe(lp, tmp, &ptable->pt_hash[i],
@@ -146,8 +146,8 @@ lnet_peer_table_del_rtrs_locked(struct lnet_ni *ni, struct lnet_peer_table *ptable, int cpt_locked) { -struct lnet_peer *lp; -struct lnet_peer *tmp; +struct lnet_peer_ni *lp; +struct lnet_peer_ni *tmp;lnet_nid_t lpni_nid;int i;
@@ -174,7 +174,7 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni) {struct lnet_peer_table *ptable;struct list_head deathrow; -struct lnet_peer *lp; +struct lnet_peer_ni *lp;int i;INIT_LIST_HEAD (&deathrow);
@@ -209,14 +209,15 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni) }while (!list_empty (&deathrow)) { - lp = list_entry(deathrow.next, struct lnet_peer, lpni_hashlist); + lp = list_entry(deathrow.next, struct lnet_peer_ni, + lpni_hashlist);list_del (&lp->lpni_hashlist);kfree (lp); } }void -lnet_destroy_peer_locked (struct lnet_peer *lp) +lnet_destroy_peer_locked (struct lnet_peer_ni *lp) {struct lnet_peer_table *ptable;
@@ -237,11 +238,11 @@ lnet_destroy_peer_locked(struct lnet_peer *lp) ptable->pt_zombies--; } -struct lnet_peer * +struct lnet_peer_ni *lnet_find_peer_locked (struct lnet_peer_table *ptable,lnet_nid_t nid) {struct list_head *peers; -struct lnet_peer *lp; +struct lnet_peer_ni *lp;LASSERT (!the_lnet.ln_shutdown);
@@ -257,11 +258,11 @@ lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid) }int -lnet_nid2peer_locked (struct lnet_peer **lpp,lnet_nid_t nid,int cpt) +lnet_nid2peer_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt) {struct lnet_peer_table *ptable; -struct lnet_peer *lp =NULL ; -struct lnet_peer *lp2; +struct lnet_peer_ni *lp =NULL ; +struct lnet_peer_ni *lp2;int cpt2;int rc =0 ;
@@ -281,7 +282,7 @@ lnet_nid2peer_locked(struct lnet_peer **lpp, lnet_nid_t nid, int cpt)if (!list_empty (&ptable->pt_deathrow)) { lp =list_entry (ptable->pt_deathrow.next, - struct lnet_peer, lpni_hashlist); + struct lnet_peer_ni, lpni_hashlist);list_del (&lp->lpni_hashlist); }
@@ -359,7 +360,7 @@ void lnet_debug_peer(lnet_nid_t nid) {char *aliveness ="NA" ; -struct lnet_peer *lp; +struct lnet_peer_ni *lp;int rc;int cpt;
@@ -396,7 +397,7 @@ lnet_get_peer_info(__u32 peer_index, __u64 *nid, __u32 *peer_tx_qnob) {struct lnet_peer_table *peer_table; -struct lnet_peer *lp; +struct lnet_peer_ni *lp;bool found = false;int lncpt, j;
drivers/staging/lustre/lnet/lnet/router.c +18 -17
@@ -100,7 +100,7 @@ lnet_peers_start_down(void) }void -lnet_notify_locked (struct lnet_peer *lp,int notifylnd,int alive, +lnet_notify_locked (struct lnet_peer_ni *lp,int notifylnd,int alive,time64_t when) {if (lp->lpni_timestamp > when) {/* out of date information */
@@ -130,7 +130,7 @@ lnet_notify_locked(struct lnet_peer *lp, int notifylnd, int alive, }static void -lnet_ni_notify_locked (struct lnet_ni *ni,struct lnet_peer *lp) +lnet_ni_notify_locked (struct lnet_ni *ni,struct lnet_peer_ni *lp) {int alive;int notifylnd;
@@ -170,7 +170,7 @@ lnet_ni_notify_locked(struct lnet_ni *ni, struct lnet_peer *lp) }static void -lnet_rtr_addref_locked (struct lnet_peer *lp) +lnet_rtr_addref_locked (struct lnet_peer_ni *lp) {LASSERT (lp->lpni_refcount >0 );LASSERT (lp->lpni_rtr_refcount >=0 );
@@ -182,9 +182,10 @@ lnet_rtr_addref_locked(struct lnet_peer *lp)/* a simple insertion sort */ list_for_each_prev (pos, &the_lnet.ln_routers) { -struct lnet_peer *rtr; +struct lnet_peer_ni *rtr; - rtr = list_entry(pos, struct lnet_peer, lpni_rtr_list); + rtr = list_entry(pos, struct lnet_peer_ni, + lpni_rtr_list);if (rtr->lpni_nid < lp->lpni_nid)break ; }
@@ -197,7 +198,7 @@ lnet_rtr_addref_locked(struct lnet_peer *lp) }static void -lnet_rtr_decref_locked (struct lnet_peer *lp) +lnet_rtr_decref_locked (struct lnet_peer_ni *lp) {LASSERT (lp->lpni_refcount >0 );LASSERT (lp->lpni_rtr_refcount >0 );
@@ -453,7 +454,7 @@ lnet_check_routes(void)int lnet_del_route (__u32 net,lnet_nid_t gw_nid) { -struct lnet_peer *gateway; +struct lnet_peer_ni *gateway;struct lnet_remotenet *rnet;struct lnet_route *route;int rc = -ENOENT ;
@@ -614,7 +615,7 @@ static void lnet_parse_rc_info(struct lnet_rc_data *rcd) {struct lnet_ping_info *info = rcd->rcd_pinginfo; -struct lnet_peer *gw = rcd->rcd_gateway; +struct lnet_peer_ni *gw = rcd->rcd_gateway;struct lnet_route *rte;if (!gw->lpni_alive)
@@ -703,7 +704,7 @@ static void lnet_router_checker_event(struct lnet_event *event) {struct lnet_rc_data *rcd = event->md.user_ptr; -struct lnet_peer *lp; +struct lnet_peer_ni *lp;LASSERT (rcd);
@@ -760,7 +761,7 @@ lnet_router_checker_event(struct lnet_event *event)static void lnet_wait_known_routerstate (void ) { -struct lnet_peer *rtr; +struct lnet_peer_ni *rtr;int all_known;LASSERT (the_lnet.ln_rc_state ==LNET_RC_STATE_RUNNING );
@@ -786,7 +787,7 @@ lnet_wait_known_routerstate(void) }void -lnet_router_ni_update_locked (struct lnet_peer *gw,__u32 net) +lnet_router_ni_update_locked (struct lnet_peer_ni *gw,__u32 net) {struct lnet_route *rte;
@@ -863,7 +864,7 @@ lnet_destroy_rc_data(struct lnet_rc_data *rcd) }static struct lnet_rc_data * -lnet_create_rc_data_locked (struct lnet_peer *gateway) +lnet_create_rc_data_locked (struct lnet_peer_ni *gateway) {struct lnet_rc_data *rcd =NULL ;struct lnet_ping_info *pi;
@@ -933,7 +934,7 @@ lnet_create_rc_data_locked(struct lnet_peer *gateway) }static int -lnet_router_check_interval (struct lnet_peer *rtr) +lnet_router_check_interval (struct lnet_peer_ni *rtr) {int secs;
@@ -946,7 +947,7 @@ lnet_router_check_interval(struct lnet_peer *rtr) }static void -lnet_ping_router_locked (struct lnet_peer *rtr) +lnet_ping_router_locked (struct lnet_peer_ni *rtr) {struct lnet_rc_data *rcd =NULL ;time64_t now =ktime_get_seconds ();
@@ -1092,7 +1093,7 @@ lnet_prune_rc_data(int wait_unlink) {struct lnet_rc_data *rcd;struct lnet_rc_data *tmp; -struct lnet_peer *lp; +struct lnet_peer_ni *lp;struct list_head head;int i =2 ;
@@ -1197,7 +1198,7 @@ lnet_router_checker_active(void)static int lnet_router_checker (void *arg) { -struct lnet_peer *rtr; +struct lnet_peer_ni *rtr;while (the_lnet.ln_rc_state ==LNET_RC_STATE_RUNNING ) {__u64 version;
@@ -1693,7 +1694,7 @@ lnet_rtrpools_disable(void)int lnet_notify (struct lnet_ni *ni,lnet_nid_t nid,int alive,time64_t when) { -struct lnet_peer *lp =NULL ; +struct lnet_peer_ni *lp =NULL ;time64_t now =ktime_get_seconds ();int cpt =lnet_cpt_of_nid (nid, ni);
drivers/staging/lustre/lnet/lnet/router_proc.c +6 -6
@@ -289,7 +289,7 @@ static int proc_lnet_routers(struct ctl_table *table, int write, *ppos =LNET_PROC_POS_MAKE (0 , ver,0 , off); }else {struct list_head *r; -struct lnet_peer *peer =NULL ; +struct lnet_peer_ni *peer =NULL ;int skip = off -1 ;lnet_net_lock (0 );
@@ -304,9 +304,9 @@ static int proc_lnet_routers(struct ctl_table *table, int write, r = the_lnet.ln_routers.next;while (r != &the_lnet.ln_routers) { -struct lnet_peer *lp; +struct lnet_peer_ni *lp; - lp = list_entry(r, struct lnet_peer, lpni_rtr_list); + lp = list_entry(r, struct lnet_peer_ni, lpni_rtr_list);if (!skip) { peer = lp;break ;
@@ -425,7 +425,7 @@ static int proc_lnet_peers(struct ctl_table *table, int write, hoff++; }else { -struct lnet_peer *peer; +struct lnet_peer_ni *peer;struct list_head *p;int skip; again:
@@ -449,9 +449,9 @@ static int proc_lnet_peers(struct ctl_table *table, int write, p = ptable->pt_hash[hash].next;while (p != &ptable->pt_hash[hash]) { -struct lnet_peer *lp; +struct lnet_peer_ni *lp; - lp = list_entry(p, struct lnet_peer, + lp = list_entry(p, struct lnet_peer_ni, lpni_hashlist);if (!skip) { peer = lp;
PATCH 2/34 lnet: change struct lnet_peer to struct lnet_peer_ni
Quoted 7 lines
Also remove the typedef
sed -i -e 's/struct lnet_peer\b/struct lnet_peer_ni/g' -e 's/lnet_peer_t\b/struct lnet_peer_ni/g'
git ls-files lnetThen edit
lib-types.hto remove the typedef, and clean up some long lines.
Quoted 8 lines
This is part of
Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")from upstream lustre, where it is marked:
Signed-off-by Amir Shehata <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Reviewed-on: http://review.whamcloud.com/18293Reviewed-by Olaf Weber <[email protected]>Reviewed-by Doug Oucharek <[email protected]>
Sigh, I missed some typedef. Thanks for finding them.
Quoted 539 lines
Signed-off-by NeilBrown <[email protected]>--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 20 ++++++----- .../staging/lustre/include/linux/lnet/lib-types.h | 10 +++--- drivers/staging/lustre/lnet/lnet/lib-move.c | 26 +++++++-------- drivers/staging/lustre/lnet/lnet/peer.c | 31 +++++++++--------- drivers/staging/lustre/lnet/lnet/router.c | 35 ++++++++++---------- drivers/staging/lustre/lnet/lnet/router_proc.c | 12 +++---- 6 files changed, 68 insertions(+), 66 deletions(-)drivers/staging/lustre/include/linux/lnet/lib-lnet.h +10
-10@@ -311,16 +311,16 @@ lnet_handle2me(struct lnet_handle_me *handle) }static inline void -lnet_peer_addref_locked (struct lnet_peer *lp) +lnet_peer_addref_locked (struct lnet_peer_ni *lp) {LASSERT (lp->lpni_refcount >0 ); lp->lpni_refcount++; } -void lnet_destroy_peer_locked (struct lnet_peer *lp); +void lnet_destroy_peer_locked (struct lnet_peer_ni *lp);static inline void -lnet_peer_decref_locked (struct lnet_peer *lp) +lnet_peer_decref_locked (struct lnet_peer_ni *lp) {LASSERT (lp->lpni_refcount >0 ); lp->lpni_refcount--;@@ -329,7 +329,7 @@ lnet_peer_decref_locked(struct lnet_peer *lp) }static inline int -lnet_isrouter (struct lnet_peer *lp) +lnet_isrouter (struct lnet_peer_ni *lp) {return lp->lpni_rtr_refcount ?1 :0 ; }@@ -410,7 +410,7 @@ void lnet_lib_exit(void);int lnet_notify (struct lnet_ni *ni,lnet_nid_t peer,int alive,time64_t when); -void lnet_notify_locked (struct lnet_peer *lp,int notifylnd,int alive, +void lnet_notify_locked (struct lnet_peer_ni *lp,int notifylnd,int alive,time64_t when);int lnet_add_route (__u32 net,__u32 hops,lnet_nid_t gateway_nid,unsigned int priority);@@ -624,7 +624,7 @@ int lnet_peer_buffer_credits(struct lnet_net *net);int lnet_router_checker_start (void );void lnet_router_checker_stop (void ); -void lnet_router_ni_update_locked (struct lnet_peer *gw,__u32 net); +void lnet_router_ni_update_locked (struct lnet_peer_ni *gw,__u32 net);void lnet_swap_pinginfo (struct lnet_ping_info *info);int lnet_parse_ip2nets (char **networksp,char *ip2nets);@@ -635,9 +635,9 @@ bool lnet_net_unique(__u32 net_id, struct list_head *nilist, struct lnet_net **net);bool lnet_ni_unique_net (struct list_head *nilist,char *iface); -int lnet_nid2peer_locked (struct lnet_peer **lpp,lnet_nid_t nid,int cpt); -struct lnet_peer *lnet_find_peer_locked (struct lnet_peer_table *ptable, -lnet_nid_t nid); +int lnet_nid2peer_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt); +struct lnet_peer_ni *lnet_find_peer_locked (struct lnet_peer_table *ptable, +lnet_nid_t nid);void lnet_peer_tables_cleanup (struct lnet_ni *ni);void lnet_peer_tables_destroy (void );int lnet_peer_tables_create (void );@@ -650,7 +650,7 @@ int lnet_get_peer_info(__u32 peer_index, __u64 *nid, __u32 *peer_tx_qnob);static inline void -lnet_peer_set_alive (struct lnet_peer *lp) +lnet_peer_set_alive (struct lnet_peer_ni *lp) { lp->lpni_last_query =ktime_get_seconds (); lp->lpni_last_alive = lp->lpni_last_query;drivers/staging/lustre/include/linux/lnet/lib-types.h +5
-5@@ -93,8 +93,8 @@ struct lnet_msg { unsigned int msg_onactivelist:1; /* on the activelist */ unsigned int msg_rdma_get:1; -struct lnet_peer *msg_txpeer;/* peer I'm sending to */ -struct lnet_peer *msg_rxpeer;/* peer I received from */ +struct lnet_peer_ni *msg_txpeer;/* peer I'm sending to */ +struct lnet_peer_ni *msg_rxpeer;/* peer I received from */ void *msg_private;struct lnet_libmd *msg_md;@@ -378,12 +378,12 @@ struct lnet_rc_data {/* ping buffer MD */ struct lnet_handle_md rcd_mdh;/* reference to gateway */ -struct lnet_peer *rcd_gateway; +struct lnet_peer_ni *rcd_gateway;/* ping buffer */ struct lnet_ping_info *rcd_pinginfo; }; -struct lnet_peer { +struct lnet_peer_ni {/* chain on peer hash */ struct list_head lpni_hashlist;/* messages blocking for tx credits */ @@ -474,7 +474,7 @@ struct lnet_route {/* chain on gateway */ struct list_head lr_gwlist;/* router node */ -struct lnet_peer *lr_gateway; +struct lnet_peer_ni *lr_gateway;/* remote network number */ __u32 lr_net;/* sequence for round-robin */ drivers/staging/lustre/lnet/lnet/lib-move.c +13
-13@@ -491,7 +491,7 @@ lnet_ni_eager_recv(struct lnet_ni *ni, struct lnet_msg *msg)/* NB: caller shall hold a ref on 'lp' as I'd drop lnet_net_lock */ static void -lnet_ni_query_locked (struct lnet_ni *ni,struct lnet_peer *lp) +lnet_ni_query_locked (struct lnet_ni *ni,struct lnet_peer_ni *lp) {time64_t last_alive =0 ;@@ -510,7 +510,7 @@ lnet_ni_query_locked(struct lnet_ni *ni, struct lnet_peer *lp)/* NB: always called with lnet_net_lock held */ static inline int -lnet_peer_is_alive (struct lnet_peer *lp,unsigned long now) +lnet_peer_is_alive (struct lnet_peer_ni *lp,unsigned long now) {int alive;time64_t deadline;@@ -544,7 +544,7 @@ lnet_peer_is_alive(struct lnet_peer *lp, unsigned long now)* may drop the lnet_net_lock */ static int -lnet_peer_alive_locked (struct lnet_ni *ni,struct lnet_peer *lp) +lnet_peer_alive_locked (struct lnet_ni *ni,struct lnet_peer_ni *lp) {time64_t now =ktime_get_seconds ();@@ -599,7 +599,7 @@ lnet_peer_alive_locked(struct lnet_ni *ni, struct lnet_peer *lp)static int lnet_post_send_locked (struct lnet_msg *msg,int do_send) { -struct lnet_peer *lp = msg->msg_txpeer; +struct lnet_peer_ni *lp = msg->msg_txpeer;struct lnet_ni *ni = msg->msg_txni;int cpt = msg->msg_tx_cpt;struct lnet_tx_queue *tq = ni->ni_tx_queues[cpt];@@ -710,7 +710,7 @@ lnet_post_routed_recv_locked(struct lnet_msg *msg, int do_recv)* I return LNET_CREDIT_WAIT if msg blocked and LNET_CREDIT_OK if * received or OK to receive */ -struct lnet_peer *lp = msg->msg_rxpeer; +struct lnet_peer_ni *lp = msg->msg_rxpeer;struct lnet_rtrbufpool *rbp;struct lnet_rtrbuf *rb;@@ -780,7 +780,7 @@ lnet_post_routed_recv_locked(struct lnet_msg *msg, int do_recv)void lnet_return_tx_credits_locked (struct lnet_msg *msg) { -struct lnet_peer *txpeer = msg->msg_txpeer; +struct lnet_peer_ni *txpeer = msg->msg_txpeer;struct lnet_msg *msg2;struct lnet_ni *txni = msg->msg_txni;@@ -881,7 +881,7 @@ lnet_drop_routed_msgs_locked(struct list_head *list, int cpt)void lnet_return_rx_credits_locked (struct lnet_msg *msg) { -struct lnet_peer *rxpeer = msg->msg_rxpeer; +struct lnet_peer_ni *rxpeer = msg->msg_rxpeer;struct lnet_ni *rxni = msg->msg_rxni;struct lnet_msg *msg2;@@ -971,8 +971,8 @@ lnet_return_rx_credits_locked(struct lnet_msg *msg)static int lnet_compare_routes (struct lnet_route *r1,struct lnet_route *r2) { -struct lnet_peer *p1 = r1->lr_gateway; -struct lnet_peer *p2 = r2->lr_gateway; +struct lnet_peer_ni *p1 = r1->lr_gateway; +struct lnet_peer_ni *p2 = r2->lr_gateway;int r1_hops = (r1->lr_hops ==LNET_UNDEFINED_HOPS ) ?1 : r1->lr_hops;int r2_hops = (r2->lr_hops ==LNET_UNDEFINED_HOPS ) ?1 : r2->lr_hops;@@ -1006,7 +1006,7 @@ lnet_compare_routes(struct lnet_route *r1, struct lnet_route *r2)return -ERANGE ; } -static struct lnet_peer * +static struct lnet_peer_ni *lnet_find_route_locked (struct lnet_net *net,lnet_nid_t target,lnet_nid_t rtr_nid) {@@ -1014,8 +1014,8 @@ lnet_find_route_locked(struct lnet_net *net, lnet_nid_t target,struct lnet_route *route;struct lnet_route *best_route;struct lnet_route *last_route; -struct lnet_peer *lpni_best; -struct lnet_peer *lp; +struct lnet_peer_ni *lpni_best; +struct lnet_peer_ni *lp;int rc;/* @@ -1076,7 +1076,7 @@ lnet_send(lnet_nid_t src_nid, struct lnet_msg *msg, lnet_nid_t rtr_nid)lnet_nid_t dst_nid = msg->msg_target.nid;struct lnet_ni *src_ni;struct lnet_ni *local_ni; -struct lnet_peer *lp; +struct lnet_peer_ni *lp;int cpt;int cpt2;int rc;drivers/staging/lustre/lnet/lnet/peer.c +16
-15@@ -106,8 +106,8 @@ lnet_peer_table_cleanup_locked(struct lnet_ni *ni, struct lnet_peer_table *ptable) {int i; -struct lnet_peer *lp; -struct lnet_peer *tmp; +struct lnet_peer_ni *lp; +struct lnet_peer_ni *tmp;for (i =0 ; i <LNET_PEER_HASH_SIZE ; i++) { list_for_each_entry_safe(lp, tmp, &ptable->pt_hash[i],@@ -146,8 +146,8 @@ lnet_peer_table_del_rtrs_locked(struct lnet_ni *ni, struct lnet_peer_table *ptable, int cpt_locked) { -struct lnet_peer *lp; -struct lnet_peer *tmp; +struct lnet_peer_ni *lp; +struct lnet_peer_ni *tmp;lnet_nid_t lpni_nid;int i;@@ -174,7 +174,7 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni) {struct lnet_peer_table *ptable;struct list_head deathrow; -struct lnet_peer *lp; +struct lnet_peer_ni *lp;int i;INIT_LIST_HEAD (&deathrow);@@ -209,14 +209,15 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni) }while (!list_empty (&deathrow)) { - lp = list_entry(deathrow.next, struct lnet_peer, lpni_hashlist); + lp = list_entry(deathrow.next, struct lnet_peer_ni, + lpni_hashlist);list_del (&lp->lpni_hashlist);kfree (lp); } }void -lnet_destroy_peer_locked (struct lnet_peer *lp) +lnet_destroy_peer_locked (struct lnet_peer_ni *lp) {struct lnet_peer_table *ptable;@@ -237,11 +238,11 @@ lnet_destroy_peer_locked(struct lnet_peer *lp) ptable->pt_zombies--; } -struct lnet_peer * +struct lnet_peer_ni *lnet_find_peer_locked (struct lnet_peer_table *ptable,lnet_nid_t nid) {struct list_head *peers; -struct lnet_peer *lp; +struct lnet_peer_ni *lp;LASSERT (!the_lnet.ln_shutdown);@@ -257,11 +258,11 @@ lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid) }int -lnet_nid2peer_locked (struct lnet_peer **lpp,lnet_nid_t nid,int cpt) +lnet_nid2peer_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt) {struct lnet_peer_table *ptable; -struct lnet_peer *lp =NULL ; -struct lnet_peer *lp2; +struct lnet_peer_ni *lp =NULL ; +struct lnet_peer_ni *lp2;int cpt2;int rc =0 ;@@ -281,7 +282,7 @@ lnet_nid2peer_locked(struct lnet_peer **lpp, lnet_nid_t nid, int cpt)if (!list_empty (&ptable->pt_deathrow)) { lp =list_entry (ptable->pt_deathrow.next, - struct lnet_peer, lpni_hashlist); + struct lnet_peer_ni, lpni_hashlist);list_del (&lp->lpni_hashlist); }@@ -359,7 +360,7 @@ void lnet_debug_peer(lnet_nid_t nid) {char *aliveness ="NA" ; -struct lnet_peer *lp; +struct lnet_peer_ni *lp;int rc;int cpt;@@ -396,7 +397,7 @@ lnet_get_peer_info(__u32 peer_index, __u64 *nid, __u32 *peer_tx_qnob) {struct lnet_peer_table *peer_table; -struct lnet_peer *lp; +struct lnet_peer_ni *lp;bool found = false;int lncpt, j;drivers/staging/lustre/lnet/lnet/router.c +18
-17@@ -100,7 +100,7 @@ lnet_peers_start_down(void) }void -lnet_notify_locked (struct lnet_peer *lp,int notifylnd,int alive, +lnet_notify_locked (struct lnet_peer_ni *lp,int notifylnd,int alive,time64_t when) {if (lp->lpni_timestamp > when) {/* out of date information */ @@ -130,7 +130,7 @@ lnet_notify_locked(struct lnet_peer *lp, int notifylnd, int alive, }static void -lnet_ni_notify_locked (struct lnet_ni *ni,struct lnet_peer *lp) +lnet_ni_notify_locked (struct lnet_ni *ni,struct lnet_peer_ni *lp) {int alive;int notifylnd;@@ -170,7 +170,7 @@ lnet_ni_notify_locked(struct lnet_ni *ni, struct lnet_peer *lp) }static void -lnet_rtr_addref_locked (struct lnet_peer *lp) +lnet_rtr_addref_locked (struct lnet_peer_ni *lp) {LASSERT (lp->lpni_refcount >0 );LASSERT (lp->lpni_rtr_refcount >=0 );@@ -182,9 +182,10 @@ lnet_rtr_addref_locked(struct lnet_peer *lp)/* a simple insertion sort */ list_for_each_prev (pos, &the_lnet.ln_routers) { -struct lnet_peer *rtr; +struct lnet_peer_ni *rtr; - rtr = list_entry(pos, struct lnet_peer, lpni_rtr_list); + rtr = list_entry(pos, struct lnet_peer_ni, + lpni_rtr_list);if (rtr->lpni_nid < lp->lpni_nid)break ; }@@ -197,7 +198,7 @@ lnet_rtr_addref_locked(struct lnet_peer *lp) }static void -lnet_rtr_decref_locked (struct lnet_peer *lp) +lnet_rtr_decref_locked (struct lnet_peer_ni *lp) {LASSERT (lp->lpni_refcount >0 );LASSERT (lp->lpni_rtr_refcount >0 );@@ -453,7 +454,7 @@ lnet_check_routes(void)int lnet_del_route (__u32 net,lnet_nid_t gw_nid) { -struct lnet_peer *gateway; +struct lnet_peer_ni *gateway;struct lnet_remotenet *rnet;struct lnet_route *route;int rc = -ENOENT ;@@ -614,7 +615,7 @@ static void lnet_parse_rc_info(struct lnet_rc_data *rcd) {struct lnet_ping_info *info = rcd->rcd_pinginfo; -struct lnet_peer *gw = rcd->rcd_gateway; +struct lnet_peer_ni *gw = rcd->rcd_gateway;struct lnet_route *rte;if (!gw->lpni_alive)@@ -703,7 +704,7 @@ static void lnet_router_checker_event(struct lnet_event *event) {struct lnet_rc_data *rcd = event->md.user_ptr; -struct lnet_peer *lp; +struct lnet_peer_ni *lp;LASSERT (rcd);@@ -760,7 +761,7 @@ lnet_router_checker_event(struct lnet_event *event)static void lnet_wait_known_routerstate (void ) { -struct lnet_peer *rtr; +struct lnet_peer_ni *rtr;int all_known;LASSERT (the_lnet.ln_rc_state ==LNET_RC_STATE_RUNNING );@@ -786,7 +787,7 @@ lnet_wait_known_routerstate(void) }void -lnet_router_ni_update_locked (struct lnet_peer *gw,__u32 net) +lnet_router_ni_update_locked (struct lnet_peer_ni *gw,__u32 net) {struct lnet_route *rte;@@ -863,7 +864,7 @@ lnet_destroy_rc_data(struct lnet_rc_data *rcd) }static struct lnet_rc_data * -lnet_create_rc_data_locked (struct lnet_peer *gateway) +lnet_create_rc_data_locked (struct lnet_peer_ni *gateway) {struct lnet_rc_data *rcd =NULL ;struct lnet_ping_info *pi;@@ -933,7 +934,7 @@ lnet_create_rc_data_locked(struct lnet_peer *gateway) }static int -lnet_router_check_interval (struct lnet_peer *rtr) +lnet_router_check_interval (struct lnet_peer_ni *rtr) {int secs;@@ -946,7 +947,7 @@ lnet_router_check_interval(struct lnet_peer *rtr) }static void -lnet_ping_router_locked (struct lnet_peer *rtr) +lnet_ping_router_locked (struct lnet_peer_ni *rtr) {struct lnet_rc_data *rcd =NULL ;time64_t now =ktime_get_seconds ();@@ -1092,7 +1093,7 @@ lnet_prune_rc_data(int wait_unlink) {struct lnet_rc_data *rcd;struct lnet_rc_data *tmp; -struct lnet_peer *lp; +struct lnet_peer_ni *lp;struct list_head head;int i =2 ;@@ -1197,7 +1198,7 @@ lnet_router_checker_active(void)static int lnet_router_checker (void *arg) { -struct lnet_peer *rtr; +struct lnet_peer_ni *rtr;while (the_lnet.ln_rc_state ==LNET_RC_STATE_RUNNING ) {__u64 version;@@ -1693,7 +1694,7 @@ lnet_rtrpools_disable(void)int lnet_notify (struct lnet_ni *ni,lnet_nid_t nid,int alive,time64_t when) { -struct lnet_peer *lp =NULL ; +struct lnet_peer_ni *lp =NULL ;time64_t now =ktime_get_seconds ();int cpt =lnet_cpt_of_nid (nid, ni);drivers/staging/lustre/lnet/lnet/router_proc.c +6
-6@@ -289,7 +289,7 @@ static int proc_lnet_routers(struct ctl_table *table, int write, *ppos =LNET_PROC_POS_MAKE (0 , ver,0 , off); }else {struct list_head *r; -struct lnet_peer *peer =NULL ; +struct lnet_peer_ni *peer =NULL ;int skip = off -1 ;lnet_net_lock (0 );@@ -304,9 +304,9 @@ static int proc_lnet_routers(struct ctl_table *table, int write, r = the_lnet.ln_routers.next;while (r != &the_lnet.ln_routers) { -struct lnet_peer *lp; +struct lnet_peer_ni *lp; - lp = list_entry(r, struct lnet_peer, lpni_rtr_list); + lp = list_entry(r, struct lnet_peer_ni, lpni_rtr_list);if (!skip) { peer = lp;break ;@@ -425,7 +425,7 @@ static int proc_lnet_peers(struct ctl_table *table, int write, hoff++; }else { -struct lnet_peer *peer; +struct lnet_peer_ni *peer;struct list_head *p;int skip; again:@@ -449,9 +449,9 @@ static int proc_lnet_peers(struct ctl_table *table, int write, p = ptable->pt_hash[hash].next;while (p != &ptable->pt_hash[hash]) { -struct lnet_peer *lp; +struct lnet_peer_ni *lp; - lp = list_entry(p, struct lnet_peer, + lp = list_entry(p, struct lnet_peer_ni, lpni_hashlist);if (!skip) { peer = lp;
PATCH 3/34 lnet: Change lpni_refcount to atomic_t
In reply to NeilBrownThis is part of
Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")from upstream lustre, where it is marked:
WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Reviewed-on: http://review.whamcloud.com/18293
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 10 +++++----- .../staging/lustre/include/linux/lnet/lib-types.h | 2 +- drivers/staging/lustre/lnet/lnet/peer.c | 8 ++++---- drivers/staging/lustre/lnet/lnet/router.c | 4 ++-- drivers/staging/lustre/lnet/lnet/router_proc.c | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +5 -5
@@ -313,8 +313,8 @@ lnet_handle2me(struct lnet_handle_me *handle)static inline void lnet_peer_addref_locked (struct lnet_peer_ni *lp) { -LASSERT (lp->lpni_refcount >0 ); - lp->lpni_refcount++; +LASSERT (atomic_read (&lp->lpni_refcount) >0 ); +atomic_inc (&lp->lpni_refcount); }void lnet_destroy_peer_locked (struct lnet_peer_ni *lp);
@@ -322,9 +322,9 @@ void lnet_destroy_peer_locked(struct lnet_peer_ni *lp);static inline void lnet_peer_decref_locked (struct lnet_peer_ni *lp) { -LASSERT (lp->lpni_refcount >0 ); - lp->lpni_refcount--; -if (!lp->lpni_refcount) +LASSERT (atomic_read (&lp->lpni_refcount) >0 ); +atomic_dec (&lp->lpni_refcount); +if (atomic_read (&lp->lpni_refcount) ==0 )lnet_destroy_peer_locked (lp); }
drivers/staging/lustre/include/linux/lnet/lib-types.h +1 -1
@@ -429,7 +429,7 @@ struct lnet_peer_ni {/* peer's NID */ lnet_nid_t lpni_nid;/* # refs */ -int lpni_refcount; +atomic_t lpni_refcount;/* CPT this peer attached on */ int lpni_cpt;/* # refs from lnet_route::lr_gateway */
drivers/staging/lustre/lnet/lnet/peer.c +4 -4
@@ -221,7 +221,7 @@ lnet_destroy_peer_locked(struct lnet_peer_ni *lp) {struct lnet_peer_table *ptable; -LASSERT (!lp->lpni_refcount); +LASSERT (atomic_read (&lp->lpni_refcount) ==0 );LASSERT (!lp->lpni_rtr_refcount);LASSERT (list_empty (&lp->lpni_txq));LASSERT (list_empty (&lp->lpni_hashlist));
@@ -320,7 +320,7 @@ lnet_nid2peer_locked(struct lnet_peer_ni **lpp, lnet_nid_t nid, int cpt) lp->lpni_ping_feats =LNET_PING_FEAT_INVAL ; lp->lpni_nid = nid; lp->lpni_cpt = cpt2; - lp->lpni_refcount =2 ;/* 1 for caller; 1 for hash */ +atomic_set (&lp->lpni_refcount,2 );/* 1 for caller; 1 for hash */ lp->lpni_rtr_refcount =0 ;lnet_net_lock (cpt);
@@ -378,7 +378,7 @@ lnet_debug_peer(lnet_nid_t nid) aliveness = lp->lpni_alive ?"up" :"down" ;CDEBUG (D_WARNING ,"%-24s %4d %5s %5d %5d %5d %5d %5d %ld\n" , -libcfs_nid2str (lp->lpni_nid), lp->lpni_refcount, +libcfs_nid2str (lp->lpni_nid),atomic_read (&lp->lpni_refcount), aliveness, lp->lpni_net->net_tunables.lct_peer_tx_credits, lp->lpni_rtrcredits, lp->lpni_minrtrcredits, lp->lpni_txcredits, lp->lpni_mintxcredits, lp->lpni_txqnob);
@@ -433,7 +433,7 @@ lnet_get_peer_info(__u32 peer_index, __u64 *nid, lp->lpni_alive ? "up" : "down"); *nid = lp->lpni_nid; - *refcount = lp->lpni_refcount; + *refcount =atomic_read (&lp->lpni_refcount); *ni_peer_tx_credits = lp->lpni_net->net_tunables.lct_peer_tx_credits; *peer_tx_credits = lp->lpni_txcredits;
drivers/staging/lustre/lnet/lnet/router.c +2 -2
@@ -172,7 +172,7 @@ lnet_ni_notify_locked(struct lnet_ni *ni, struct lnet_peer_ni *lp)static void lnet_rtr_addref_locked (struct lnet_peer_ni *lp) { -LASSERT (lp->lpni_refcount >0 ); +LASSERT (atomic_read (&lp->lpni_refcount) >0 );LASSERT (lp->lpni_rtr_refcount >=0 );/* lnet_net_lock must be exclusively locked */
@@ -200,7 +200,7 @@ lnet_rtr_addref_locked(struct lnet_peer_ni *lp)static void lnet_rtr_decref_locked (struct lnet_peer_ni *lp) { -LASSERT (lp->lpni_refcount >0 ); +LASSERT (atomic_read (&lp->lpni_refcount) >0 );LASSERT (lp->lpni_rtr_refcount >0 );/* lnet_net_lock must be exclusively locked */
drivers/staging/lustre/lnet/lnet/router_proc.c +2 -2
@@ -320,7 +320,7 @@ static int proc_lnet_routers(struct ctl_table *table, int write,lnet_nid_t nid = peer->lpni_nid;time64_t now =ktime_get_seconds ();time64_t deadline = peer->lpni_ping_deadline; -int nrefs = peer->lpni_refcount; +int nrefs =atomic_read (&peer->lpni_refcount);int nrtrrefs = peer->lpni_rtr_refcount;int alive_cnt = peer->lpni_alive_count;int alive = peer->lpni_alive;
@@ -486,7 +486,7 @@ static int proc_lnet_peers(struct ctl_table *table, int write,if (peer) {lnet_nid_t nid = peer->lpni_nid; -int nrefs = peer->lpni_refcount; +int nrefs =atomic_read (&peer->lpni_refcount);time64_t lastalive =-1 ;char *aliveness ="NA" ;int maxcr = peer->lpni_net->net_tunables.lct_peer_tx_credits;
PATCH 3/34 lnet: Change lpni_refcount to atomic_t
Quoted 9 lines
This is part of
Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")from upstream lustre, where it is marked:
Signed-off-by Amir Shehata <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Reviewed-on: http://review.whamcloud.com/18293Reviewed-by Olaf Weber <[email protected]>Reviewed-by Doug Oucharek <[email protected]>
Quoted 137 lines
Signed-off-by NeilBrown <[email protected]>--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 10 +++++----- .../staging/lustre/include/linux/lnet/lib-types.h | 2 +- drivers/staging/lustre/lnet/lnet/peer.c | 8 ++++---- drivers/staging/lustre/lnet/lnet/router.c | 4 ++-- drivers/staging/lustre/lnet/lnet/router_proc.c | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-)drivers/staging/lustre/include/linux/lnet/lib-lnet.h +5
-5@@ -313,8 +313,8 @@ lnet_handle2me(struct lnet_handle_me *handle)static inline void lnet_peer_addref_locked (struct lnet_peer_ni *lp) { -LASSERT (lp->lpni_refcount >0 ); - lp->lpni_refcount++; +LASSERT (atomic_read (&lp->lpni_refcount) >0 ); +atomic_inc (&lp->lpni_refcount); }void lnet_destroy_peer_locked (struct lnet_peer_ni *lp);@@ -322,9 +322,9 @@ void lnet_destroy_peer_locked(struct lnet_peer_ni *lp);static inline void lnet_peer_decref_locked (struct lnet_peer_ni *lp) { -LASSERT (lp->lpni_refcount >0 ); - lp->lpni_refcount--; -if (!lp->lpni_refcount) +LASSERT (atomic_read (&lp->lpni_refcount) >0 ); +atomic_dec (&lp->lpni_refcount); +if (atomic_read (&lp->lpni_refcount) ==0 )lnet_destroy_peer_locked (lp); }drivers/staging/lustre/include/linux/lnet/lib-types.h +1
-1@@ -429,7 +429,7 @@ struct lnet_peer_ni {/* peer's NID */ lnet_nid_t lpni_nid;/* # refs */ -int lpni_refcount; +atomic_t lpni_refcount;/* CPT this peer attached on */ int lpni_cpt;/* # refs from lnet_route::lr_gateway */ drivers/staging/lustre/lnet/lnet/peer.c +4
-4@@ -221,7 +221,7 @@ lnet_destroy_peer_locked(struct lnet_peer_ni *lp) {struct lnet_peer_table *ptable; -LASSERT (!lp->lpni_refcount); +LASSERT (atomic_read (&lp->lpni_refcount) ==0 );LASSERT (!lp->lpni_rtr_refcount);LASSERT (list_empty (&lp->lpni_txq));LASSERT (list_empty (&lp->lpni_hashlist));@@ -320,7 +320,7 @@ lnet_nid2peer_locked(struct lnet_peer_ni **lpp, lnet_nid_t nid, int cpt) lp->lpni_ping_feats =LNET_PING_FEAT_INVAL ; lp->lpni_nid = nid; lp->lpni_cpt = cpt2; - lp->lpni_refcount =2 ;/* 1 for caller; 1 for hash */ +atomic_set (&lp->lpni_refcount,2 );/* 1 for caller; 1 for hash */ lp->lpni_rtr_refcount =0 ;lnet_net_lock (cpt);@@ -378,7 +378,7 @@ lnet_debug_peer(lnet_nid_t nid) aliveness = lp->lpni_alive ?"up" :"down" ;CDEBUG (D_WARNING ,"%-24s %4d %5s %5d %5d %5d %5d %5d %ld\n" , -libcfs_nid2str (lp->lpni_nid), lp->lpni_refcount, +libcfs_nid2str (lp->lpni_nid),atomic_read (&lp->lpni_refcount), aliveness, lp->lpni_net->net_tunables.lct_peer_tx_credits, lp->lpni_rtrcredits, lp->lpni_minrtrcredits, lp->lpni_txcredits, lp->lpni_mintxcredits, lp->lpni_txqnob);@@ -433,7 +433,7 @@ lnet_get_peer_info(__u32 peer_index, __u64 *nid, lp->lpni_alive ? "up" : "down"); *nid = lp->lpni_nid; - *refcount = lp->lpni_refcount; + *refcount =atomic_read (&lp->lpni_refcount); *ni_peer_tx_credits = lp->lpni_net->net_tunables.lct_peer_tx_credits; *peer_tx_credits = lp->lpni_txcredits;drivers/staging/lustre/lnet/lnet/router.c +2
-2@@ -172,7 +172,7 @@ lnet_ni_notify_locked(struct lnet_ni *ni, struct lnet_peer_ni *lp)static void lnet_rtr_addref_locked (struct lnet_peer_ni *lp) { -LASSERT (lp->lpni_refcount >0 ); +LASSERT (atomic_read (&lp->lpni_refcount) >0 );LASSERT (lp->lpni_rtr_refcount >=0 );/* lnet_net_lock must be exclusively locked */ @@ -200,7 +200,7 @@ lnet_rtr_addref_locked(struct lnet_peer_ni *lp)static void lnet_rtr_decref_locked (struct lnet_peer_ni *lp) { -LASSERT (lp->lpni_refcount >0 ); +LASSERT (atomic_read (&lp->lpni_refcount) >0 );LASSERT (lp->lpni_rtr_refcount >0 );/* lnet_net_lock must be exclusively locked */ drivers/staging/lustre/lnet/lnet/router_proc.c +2
-2@@ -320,7 +320,7 @@ static int proc_lnet_routers(struct ctl_table *table, int write,lnet_nid_t nid = peer->lpni_nid;time64_t now =ktime_get_seconds ();time64_t deadline = peer->lpni_ping_deadline; -int nrefs = peer->lpni_refcount; +int nrefs =atomic_read (&peer->lpni_refcount);int nrtrrefs = peer->lpni_rtr_refcount;int alive_cnt = peer->lpni_alive_count;int alive = peer->lpni_alive;@@ -486,7 +486,7 @@ static int proc_lnet_peers(struct ctl_table *table, int write,if (peer) {lnet_nid_t nid = peer->lpni_nid; -int nrefs = peer->lpni_refcount; +int nrefs =atomic_read (&peer->lpni_refcount);time64_t lastalive =-1 ;char *aliveness ="NA" ;int maxcr = peer->lpni_net->net_tunables.lct_peer_tx_credits;
PATCH 4/34 lnet: change some function names - add 'ni'.
In reply to NeilBrownsed -i 's/lnet_peer_addref_locked/lnet_peer_ni_addref_locked/g' git grep -l lnet_peer_addref_locked lnet/ sed -i 's/lnet_destroy_peer_locked/lnet_destroy_peer_ni_locked/g' git grep -l lnet_destroy_peer_locked lnet/ sed -i 's/lnet_peer_decref_locked/lnet_peer_ni_decref_locked/g' git grep -l lnet_peer_decref_locked lnet/ sed -i 's/lnet_nid2peer_locked/lnet_nid2peerni_locked/g' git grep -l lnet_nid2peer_locked lnet/
This is part of
Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")from upstream lustre, where it is marked:
WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Reviewed-on: http://review.whamcloud.com/18293
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 10 ++++---- drivers/staging/lustre/lnet/lnet/lib-move.c | 10 ++++---- drivers/staging/lustre/lnet/lnet/peer.c | 12 +++++----- drivers/staging/lustre/lnet/lnet/router.c | 24 ++++++++++---------- 4 files changed, 28 insertions(+), 28 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +5 -5
@@ -311,21 +311,21 @@ lnet_handle2me(struct lnet_handle_me *handle) }static inline void -lnet_peer_addref_locked (struct lnet_peer_ni *lp) +lnet_peer_ni_addref_locked (struct lnet_peer_ni *lp) {LASSERT (atomic_read (&lp->lpni_refcount) >0 );atomic_inc (&lp->lpni_refcount); } -void lnet_destroy_peer_locked (struct lnet_peer_ni *lp); +void lnet_destroy_peer_ni_locked (struct lnet_peer_ni *lp);static inline void -lnet_peer_decref_locked (struct lnet_peer_ni *lp) +lnet_peer_ni_decref_locked (struct lnet_peer_ni *lp) {LASSERT (atomic_read (&lp->lpni_refcount) >0 );atomic_dec (&lp->lpni_refcount);if (atomic_read (&lp->lpni_refcount) ==0 ) -lnet_destroy_peer_locked (lp); +lnet_destroy_peer_ni_locked (lp); } static inline int
@@ -635,7 +635,7 @@ bool lnet_net_unique(__u32 net_id, struct list_head *nilist, struct lnet_net **net);bool lnet_ni_unique_net (struct list_head *nilist,char *iface); -int lnet_nid2peer_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt); +int lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt);struct lnet_peer_ni *lnet_find_peer_locked (struct lnet_peer_table *ptable,lnet_nid_t nid);void lnet_peer_tables_cleanup (struct lnet_ni *ni);
drivers/staging/lustre/lnet/lnet/lib-move.c +5 -5
@@ -837,7 +837,7 @@ lnet_return_tx_credits_locked(struct lnet_msg *msg)if (txpeer) { msg->msg_txpeer =NULL ; -lnet_peer_decref_locked (txpeer); +lnet_peer_ni_decref_locked (txpeer); } }
@@ -964,7 +964,7 @@ lnet_return_rx_credits_locked(struct lnet_msg *msg) }if (rxpeer) { msg->msg_rxpeer =NULL ; -lnet_peer_decref_locked (rxpeer); +lnet_peer_ni_decref_locked (rxpeer); } }
@@ -1148,7 +1148,7 @@ lnet_send(lnet_nid_t src_nid, struct lnet_msg *msg, lnet_nid_t rtr_nid)return 0 ; } - rc =lnet_nid2peer_locked (&lp, dst_nid, cpt); + rc =lnet_nid2peerni_locked (&lp, dst_nid, cpt);if (rc) {lnet_net_unlock (cpt); LCONSOLE_WARN("Error %d finding peer %s\n", rc,
@@ -1199,7 +1199,7 @@ lnet_send(lnet_nid_t src_nid, struct lnet_msg *msg, lnet_nid_t rtr_nid)LASSERT (src_ni->ni_net == lp->lpni_net); } -lnet_peer_addref_locked (lp); +lnet_peer_ni_addref_locked (lp);LASSERT (src_nid !=LNET_NID_ANY );lnet_msg_commit (msg, cpt);
@@ -1810,7 +1810,7 @@ lnet_parse(struct lnet_ni *ni, struct lnet_hdr *hdr, lnet_nid_t from_nid, }lnet_net_lock (cpt); - rc =lnet_nid2peer_locked (&msg->msg_rxpeer, from_nid, cpt); + rc =lnet_nid2peerni_locked (&msg->msg_rxpeer, from_nid, cpt);if (rc) {lnet_net_unlock (cpt); CERROR("%s, src %s: Dropping %s (error %d looking up sender)\n",
drivers/staging/lustre/lnet/lnet/peer.c +6 -6
@@ -117,7 +117,7 @@ lnet_peer_table_cleanup_locked(struct lnet_ni *ni,list_del_init (&lp->lpni_hashlist);/* Lose hash table's ref */ ptable->pt_zombies++; -lnet_peer_decref_locked (lp); +lnet_peer_ni_decref_locked (lp); } } }
@@ -217,7 +217,7 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni) }void -lnet_destroy_peer_locked (struct lnet_peer_ni *lp) +lnet_destroy_peer_ni_locked (struct lnet_peer_ni *lp) {struct lnet_peer_table *ptable;
@@ -249,7 +249,7 @@ lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid) peers = &ptable->pt_hash[lnet_nid2peerhash (nid)];list_for_each_entry (lp, peers, lpni_hashlist) {if (lp->lpni_nid == nid) { -lnet_peer_addref_locked (lp); +lnet_peer_ni_addref_locked (lp);return lp; } }
@@ -258,7 +258,7 @@ lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid) }int -lnet_nid2peer_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt) +lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt) {struct lnet_peer_table *ptable;struct lnet_peer_ni *lp =NULL ;
@@ -367,7 +367,7 @@ lnet_debug_peer(lnet_nid_t nid) cpt =lnet_cpt_of_nid (nid,NULL );lnet_net_lock (cpt); - rc =lnet_nid2peer_locked (&lp, nid, cpt); + rc =lnet_nid2peerni_locked (&lp, nid, cpt);if (rc) {lnet_net_unlock (cpt);CDEBUG (D_WARNING ,"No peer %s\n" ,libcfs_nid2str (nid));
@@ -383,7 +383,7 @@ lnet_debug_peer(lnet_nid_t nid) lp->lpni_rtrcredits, lp->lpni_minrtrcredits, lp->lpni_txcredits, lp->lpni_mintxcredits, lp->lpni_txqnob); -lnet_peer_decref_locked (lp); +lnet_peer_ni_decref_locked (lp);lnet_net_unlock (cpt); }
drivers/staging/lustre/lnet/lnet/router.c +12 -12
@@ -192,7 +192,7 @@ lnet_rtr_addref_locked(struct lnet_peer_ni *lp)list_add (&lp->lpni_rtr_list, pos);/* addref for the_lnet.ln_routers */ -lnet_peer_addref_locked (lp); +lnet_peer_ni_addref_locked (lp); the_lnet.ln_routers_version++; } }
@@ -216,7 +216,7 @@ lnet_rtr_decref_locked(struct lnet_peer_ni *lp)list_del (&lp->lpni_rtr_list);/* decref for the_lnet.ln_routers */ -lnet_peer_decref_locked (lp); +lnet_peer_ni_decref_locked (lp); the_lnet.ln_routers_version++; } }
@@ -332,7 +332,7 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway,lnet_net_lock (LNET_LOCK_EX ); - rc =lnet_nid2peer_locked (&route->lr_gateway, gateway,LNET_LOCK_EX ); + rc =lnet_nid2peerni_locked (&route->lr_gateway, gateway,LNET_LOCK_EX );if (rc) {lnet_net_unlock (LNET_LOCK_EX );
@@ -370,7 +370,7 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway, }if (add_route) { -lnet_peer_addref_locked (route->lr_gateway);/* +1 for notify */ +lnet_peer_ni_addref_locked (route->lr_gateway);/* +1 for notify */ lnet_add_route_to_rnet (rnet2, route); ni =lnet_get_next_ni_locked (route->lr_gateway->lpni_net,NULL );
@@ -384,7 +384,7 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway, }/* -1 for notify or !add_route */ -lnet_peer_decref_locked (route->lr_gateway); +lnet_peer_ni_decref_locked (route->lr_gateway);lnet_net_unlock (LNET_LOCK_EX ); rc =0 ;
@@ -496,7 +496,7 @@ lnet_del_route(__u32 net, lnet_nid_t gw_nid) rnet =NULL ;lnet_rtr_decref_locked (gateway); -lnet_peer_decref_locked (gateway); +lnet_peer_ni_decref_locked (gateway);lnet_net_unlock (LNET_LOCK_EX );
@@ -854,7 +854,7 @@ lnet_destroy_rc_data(struct lnet_rc_data *rcd)int cpt = rcd->rcd_gateway->lpni_cpt;lnet_net_lock (cpt); -lnet_peer_decref_locked (rcd->rcd_gateway); +lnet_peer_ni_decref_locked (rcd->rcd_gateway);lnet_net_unlock (cpt); }
@@ -913,7 +913,7 @@ lnet_create_rc_data_locked(struct lnet_peer_ni *gateway) goto out; } -lnet_peer_addref_locked (gateway); +lnet_peer_ni_addref_locked (gateway); rcd->rcd_gateway = gateway; gateway->lpni_rcd = rcd; gateway->lpni_ping_notsent =0 ;
@@ -954,7 +954,7 @@ lnet_ping_router_locked(struct lnet_peer_ni *rtr)time64_t secs;struct lnet_ni *ni; -lnet_peer_addref_locked (rtr); +lnet_peer_ni_addref_locked (rtr);if (rtr->lpni_ping_deadline &&/* ping timed out? */ now > rtr->lpni_ping_deadline)
@@ -967,7 +967,7 @@ lnet_ping_router_locked(struct lnet_peer_ni *rtr)if (!lnet_isrouter (rtr) || the_lnet.ln_rc_state !=LNET_RC_STATE_RUNNING ) {/* router table changed or router checker is shutting down */ -lnet_peer_decref_locked (rtr); +lnet_peer_ni_decref_locked (rtr);return ; }
@@ -1016,7 +1016,7 @@ lnet_ping_router_locked(struct lnet_peer_ni *rtr) rtr->lpni_ping_notsent =0 ;/* no event pending */ } -lnet_peer_decref_locked (rtr); +lnet_peer_ni_decref_locked (rtr); }int
@@ -1756,7 +1756,7 @@ lnet_notify(struct lnet_ni *ni, lnet_nid_t nid, int alive, time64_t when)if (ni)lnet_ni_notify_locked (ni, lp); -lnet_peer_decref_locked (lp); +lnet_peer_ni_decref_locked (lp);lnet_net_unlock (cpt);return 0 ;
PATCH 4/34 lnet: change some function names - add 'ni'.
Quoted 6 lines
sed -i 's/lnet_peer_addref_locked/lnet_peer_ni_addref_locked/g'
git grep -l lnet_peer_addref_locked lnet/sed -i 's/lnet_destroy_peer_locked/lnet_destroy_peer_ni_locked/g'git grep -l lnet_destroy_peer_locked lnet/sed -i 's/lnet_peer_decref_locked/lnet_peer_ni_decref_locked/g'git grep -l lnet_peer_decref_locked lnet/sed -i 's/lnet_nid2peer_locked/lnet_nid2peerni_locked/g'git grep -l lnet_nid2peer_locked lnet/
Quoted 8 lines
This is part of
Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")from upstream lustre, where it is marked:
Signed-off-by Amir Shehata <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Reviewed-on: http://review.whamcloud.com/18293Reviewed-by Olaf Weber <[email protected]>Reviewed-by Doug Oucharek <[email protected]>
Quoted 269 lines
Signed-off-by NeilBrown <[email protected]>--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 10 ++++---- drivers/staging/lustre/lnet/lnet/lib-move.c | 10 ++++---- drivers/staging/lustre/lnet/lnet/peer.c | 12 +++++----- drivers/staging/lustre/lnet/lnet/router.c | 24 ++++++++++---------- 4 files changed, 28 insertions(+), 28 deletions(-)drivers/staging/lustre/include/linux/lnet/lib-lnet.h +5
-5@@ -311,21 +311,21 @@ lnet_handle2me(struct lnet_handle_me *handle) }static inline void -lnet_peer_addref_locked (struct lnet_peer_ni *lp) +lnet_peer_ni_addref_locked (struct lnet_peer_ni *lp) {LASSERT (atomic_read (&lp->lpni_refcount) >0 );atomic_inc (&lp->lpni_refcount); } -void lnet_destroy_peer_locked (struct lnet_peer_ni *lp); +void lnet_destroy_peer_ni_locked (struct lnet_peer_ni *lp);static inline void -lnet_peer_decref_locked (struct lnet_peer_ni *lp) +lnet_peer_ni_decref_locked (struct lnet_peer_ni *lp) {LASSERT (atomic_read (&lp->lpni_refcount) >0 );atomic_dec (&lp->lpni_refcount);if (atomic_read (&lp->lpni_refcount) ==0 ) -lnet_destroy_peer_locked (lp); +lnet_destroy_peer_ni_locked (lp); } static inline int@@ -635,7 +635,7 @@ bool lnet_net_unique(__u32 net_id, struct list_head *nilist, struct lnet_net **net);bool lnet_ni_unique_net (struct list_head *nilist,char *iface); -int lnet_nid2peer_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt); +int lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt);struct lnet_peer_ni *lnet_find_peer_locked (struct lnet_peer_table *ptable,lnet_nid_t nid);void lnet_peer_tables_cleanup (struct lnet_ni *ni);drivers/staging/lustre/lnet/lnet/lib-move.c +5
-5@@ -837,7 +837,7 @@ lnet_return_tx_credits_locked(struct lnet_msg *msg)if (txpeer) { msg->msg_txpeer =NULL ; -lnet_peer_decref_locked (txpeer); +lnet_peer_ni_decref_locked (txpeer); } }@@ -964,7 +964,7 @@ lnet_return_rx_credits_locked(struct lnet_msg *msg) }if (rxpeer) { msg->msg_rxpeer =NULL ; -lnet_peer_decref_locked (rxpeer); +lnet_peer_ni_decref_locked (rxpeer); } }@@ -1148,7 +1148,7 @@ lnet_send(lnet_nid_t src_nid, struct lnet_msg *msg, lnet_nid_t rtr_nid)return 0 ; } - rc =lnet_nid2peer_locked (&lp, dst_nid, cpt); + rc =lnet_nid2peerni_locked (&lp, dst_nid, cpt);if (rc) {lnet_net_unlock (cpt); LCONSOLE_WARN("Error %d finding peer %s\n", rc,@@ -1199,7 +1199,7 @@ lnet_send(lnet_nid_t src_nid, struct lnet_msg *msg, lnet_nid_t rtr_nid)LASSERT (src_ni->ni_net == lp->lpni_net); } -lnet_peer_addref_locked (lp); +lnet_peer_ni_addref_locked (lp);LASSERT (src_nid !=LNET_NID_ANY );lnet_msg_commit (msg, cpt);@@ -1810,7 +1810,7 @@ lnet_parse(struct lnet_ni *ni, struct lnet_hdr *hdr, lnet_nid_t from_nid, }lnet_net_lock (cpt); - rc =lnet_nid2peer_locked (&msg->msg_rxpeer, from_nid, cpt); + rc =lnet_nid2peerni_locked (&msg->msg_rxpeer, from_nid, cpt);if (rc) {lnet_net_unlock (cpt); CERROR("%s, src %s: Dropping %s (error %d looking up sender)\n",drivers/staging/lustre/lnet/lnet/peer.c +6
-6@@ -117,7 +117,7 @@ lnet_peer_table_cleanup_locked(struct lnet_ni *ni,list_del_init (&lp->lpni_hashlist);/* Lose hash table's ref */ ptable->pt_zombies++; -lnet_peer_decref_locked (lp); +lnet_peer_ni_decref_locked (lp); } } }@@ -217,7 +217,7 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni) }void -lnet_destroy_peer_locked (struct lnet_peer_ni *lp) +lnet_destroy_peer_ni_locked (struct lnet_peer_ni *lp) {struct lnet_peer_table *ptable;@@ -249,7 +249,7 @@ lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid) peers = &ptable->pt_hash[lnet_nid2peerhash (nid)];list_for_each_entry (lp, peers, lpni_hashlist) {if (lp->lpni_nid == nid) { -lnet_peer_addref_locked (lp); +lnet_peer_ni_addref_locked (lp);return lp; } }@@ -258,7 +258,7 @@ lnet_find_peer_locked(struct lnet_peer_table *ptable, lnet_nid_t nid) }int -lnet_nid2peer_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt) +lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt) {struct lnet_peer_table *ptable;struct lnet_peer_ni *lp =NULL ;@@ -367,7 +367,7 @@ lnet_debug_peer(lnet_nid_t nid) cpt =lnet_cpt_of_nid (nid,NULL );lnet_net_lock (cpt); - rc =lnet_nid2peer_locked (&lp, nid, cpt); + rc =lnet_nid2peerni_locked (&lp, nid, cpt);if (rc) {lnet_net_unlock (cpt);CDEBUG (D_WARNING ,"No peer %s\n" ,libcfs_nid2str (nid));@@ -383,7 +383,7 @@ lnet_debug_peer(lnet_nid_t nid) lp->lpni_rtrcredits, lp->lpni_minrtrcredits, lp->lpni_txcredits, lp->lpni_mintxcredits, lp->lpni_txqnob); -lnet_peer_decref_locked (lp); +lnet_peer_ni_decref_locked (lp);lnet_net_unlock (cpt); }drivers/staging/lustre/lnet/lnet/router.c +12
-12@@ -192,7 +192,7 @@ lnet_rtr_addref_locked(struct lnet_peer_ni *lp)list_add (&lp->lpni_rtr_list, pos);/* addref for the_lnet.ln_routers */ -lnet_peer_addref_locked (lp); +lnet_peer_ni_addref_locked (lp); the_lnet.ln_routers_version++; } }@@ -216,7 +216,7 @@ lnet_rtr_decref_locked(struct lnet_peer_ni *lp)list_del (&lp->lpni_rtr_list);/* decref for the_lnet.ln_routers */ -lnet_peer_decref_locked (lp); +lnet_peer_ni_decref_locked (lp); the_lnet.ln_routers_version++; } }@@ -332,7 +332,7 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway,lnet_net_lock (LNET_LOCK_EX ); - rc =lnet_nid2peer_locked (&route->lr_gateway, gateway,LNET_LOCK_EX ); + rc =lnet_nid2peerni_locked (&route->lr_gateway, gateway,LNET_LOCK_EX );if (rc) {lnet_net_unlock (LNET_LOCK_EX );@@ -370,7 +370,7 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway, }if (add_route) { -lnet_peer_addref_locked (route->lr_gateway);/* +1 for notify */ +lnet_peer_ni_addref_locked (route->lr_gateway);/* +1 for notify */ lnet_add_route_to_rnet (rnet2, route); ni =lnet_get_next_ni_locked (route->lr_gateway->lpni_net,NULL );@@ -384,7 +384,7 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway, }/* -1 for notify or !add_route */ -lnet_peer_decref_locked (route->lr_gateway); +lnet_peer_ni_decref_locked (route->lr_gateway);lnet_net_unlock (LNET_LOCK_EX ); rc =0 ;@@ -496,7 +496,7 @@ lnet_del_route(__u32 net, lnet_nid_t gw_nid) rnet =NULL ;lnet_rtr_decref_locked (gateway); -lnet_peer_decref_locked (gateway); +lnet_peer_ni_decref_locked (gateway);lnet_net_unlock (LNET_LOCK_EX );@@ -854,7 +854,7 @@ lnet_destroy_rc_data(struct lnet_rc_data *rcd)int cpt = rcd->rcd_gateway->lpni_cpt;lnet_net_lock (cpt); -lnet_peer_decref_locked (rcd->rcd_gateway); +lnet_peer_ni_decref_locked (rcd->rcd_gateway);lnet_net_unlock (cpt); }@@ -913,7 +913,7 @@ lnet_create_rc_data_locked(struct lnet_peer_ni *gateway) goto out; } -lnet_peer_addref_locked (gateway); +lnet_peer_ni_addref_locked (gateway); rcd->rcd_gateway = gateway; gateway->lpni_rcd = rcd; gateway->lpni_ping_notsent =0 ;@@ -954,7 +954,7 @@ lnet_ping_router_locked(struct lnet_peer_ni *rtr)time64_t secs;struct lnet_ni *ni; -lnet_peer_addref_locked (rtr); +lnet_peer_ni_addref_locked (rtr);if (rtr->lpni_ping_deadline &&/* ping timed out? */ now > rtr->lpni_ping_deadline)@@ -967,7 +967,7 @@ lnet_ping_router_locked(struct lnet_peer_ni *rtr)if (!lnet_isrouter (rtr) || the_lnet.ln_rc_state !=LNET_RC_STATE_RUNNING ) {/* router table changed or router checker is shutting down */ -lnet_peer_decref_locked (rtr); +lnet_peer_ni_decref_locked (rtr);return ; }@@ -1016,7 +1016,7 @@ lnet_ping_router_locked(struct lnet_peer_ni *rtr) rtr->lpni_ping_notsent =0 ;/* no event pending */ } -lnet_peer_decref_locked (rtr); +lnet_peer_ni_decref_locked (rtr); }int @@ -1756,7 +1756,7 @@ lnet_notify(struct lnet_ni *ni, lnet_nid_t nid, int alive, time64_t when)if (ni)lnet_ni_notify_locked (ni, lp); -lnet_peer_decref_locked (lp); +lnet_peer_ni_decref_locked (lp);lnet_net_unlock (cpt);return 0 ;
PATCH 5/34 lnet: make lnet_nid_cpt_hash non-static.
In reply to NeilBrownFuture patch will need this.
This is part of
Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")from upstream lustre, where it is marked:
WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Reviewed-on: http://review.whamcloud.com/18293
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 1 + drivers/staging/lustre/lnet/lnet/api-ni.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +1 -0
@@ -395,6 +395,7 @@ lnet_net2rnethash(__u32 net)extern struct lnet_lnd the_lolnd;extern int avoid_asym_router_failure; +unsigned int lnet_nid_cpt_hash (lnet_nid_t nid,unsigned int number);int lnet_cpt_of_nid_locked (lnet_nid_t nid,struct lnet_ni *ni);int lnet_cpt_of_nid (lnet_nid_t nid,struct lnet_ni *ni);struct lnet_ni *lnet_nid2ni_locked (lnet_nid_t nid,int cpt);
drivers/staging/lustre/lnet/lnet/api-ni.c +1 -1
@@ -693,7 +693,7 @@ lnet_get_net_locked(__u32 net_id)return NULL ; } -static unsigned int +unsigned int lnet_nid_cpt_hash (lnet_nid_t nid,unsigned int number) {__u64 key = nid;
PATCH 5/34 lnet: make lnet_nid_cpt_hash non-static.
Quoted 11 lines
Future patch will need this.
This is part of
Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")from upstream lustre, where it is marked:
Signed-off-by Amir Shehata <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Reviewed-on: http://review.whamcloud.com/18293Reviewed-by Olaf Weber <[email protected]>Reviewed-by Doug Oucharek <[email protected]>
Quoted 34 lines
Signed-off-by NeilBrown <[email protected]>--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 1 + drivers/staging/lustre/lnet/lnet/api-ni.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)drivers/staging/lustre/include/linux/lnet/lib-lnet.h +1
-0@@ -395,6 +395,7 @@ lnet_net2rnethash(__u32 net)extern struct lnet_lnd the_lolnd;extern int avoid_asym_router_failure; +unsigned int lnet_nid_cpt_hash (lnet_nid_t nid,unsigned int number);int lnet_cpt_of_nid_locked (lnet_nid_t nid,struct lnet_ni *ni);int lnet_cpt_of_nid (lnet_nid_t nid,struct lnet_ni *ni);struct lnet_ni *lnet_nid2ni_locked (lnet_nid_t nid,int cpt);drivers/staging/lustre/lnet/lnet/api-ni.c +1
-1@@ -693,7 +693,7 @@ lnet_get_net_locked(__u32 net_id)return NULL ; } -static unsigned int +unsigned int lnet_nid_cpt_hash (lnet_nid_t nid,unsigned int number) {__u64 key = nid;
PATCH 6/34 lnet: introduce lnet_find_peer_ni_locked()
In reply to NeilBrownUse in place of lnet_find_peer_locked()
This is part of
Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")from upstream lustre, where it is marked:
WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Reviewed-on: http://review.whamcloud.com/18293
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 1 + drivers/staging/lustre/lnet/lnet/peer.c | 31 ++++++++++++++++++++ drivers/staging/lustre/lnet/lnet/router.c | 2 + 3 files changed, 33 insertions(+), 1 deletion(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +1 -0
@@ -639,6 +639,7 @@ bool lnet_ni_unique_net(struct list_head *nilist, char *iface);int lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt);struct lnet_peer_ni *lnet_find_peer_locked (struct lnet_peer_table *ptable,lnet_nid_t nid); +struct lnet_peer_ni *lnet_find_peer_ni_locked (lnet_nid_t nid,int cpt);void lnet_peer_tables_cleanup (struct lnet_ni *ni);void lnet_peer_tables_destroy (void );int lnet_peer_tables_create (void );
drivers/staging/lustre/lnet/lnet/peer.c +31 -0
@@ -216,6 +216,37 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni) } } +static struct lnet_peer_ni * +lnet_get_peer_ni_locked (struct lnet_peer_table *ptable,lnet_nid_t nid) +{ +struct list_head *peers; +struct lnet_peer_ni *lp; + +LASSERT (!the_lnet.ln_shutdown); + + peers = &ptable->pt_hash[lnet_nid2peerhash (nid)]; +list_for_each_entry (lp, peers, lpni_hashlist) { +if (lp->lpni_nid == nid) { +lnet_peer_ni_addref_locked (lp); +return lp; + } + } + +return NULL ; +} + +struct lnet_peer_ni * +lnet_find_peer_ni_locked (lnet_nid_t nid,int cpt) +{ +struct lnet_peer_ni *lpni; +struct lnet_peer_table *ptable; + + ptable = the_lnet.ln_peer_tables[cpt]; + lpni =lnet_get_peer_ni_locked (ptable, nid); + +return lpni; +} +void lnet_destroy_peer_ni_locked (struct lnet_peer_ni *lp) {
drivers/staging/lustre/lnet/lnet/router.c +1 -1
@@ -1734,7 +1734,7 @@ lnet_notify(struct lnet_ni *ni, lnet_nid_t nid, int alive, time64_t when)return -ESHUTDOWN ; } - lp =lnet_find_peer_locked (the_lnet.ln_peer_tables[cpt], nid); + lp =lnet_find_peer_ni_locked (nid, cpt);if (!lp) {/* nid not found */ lnet_net_unlock (cpt);
PATCH 6/34 lnet: introduce lnet_find_peer_ni_locked()
Quoted 11 lines
Use in place of
lnet_find_peer_locked()This is part of
Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")from upstream lustre, where it is marked:
Signed-off-by Amir Shehata <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Reviewed-on: http://review.whamcloud.com/18293Reviewed-by Olaf Weber <[email protected]>Reviewed-by Doug Oucharek <[email protected]>
Quoted 77 lines
Signed-off-by NeilBrown <[email protected]>--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 1 + drivers/staging/lustre/lnet/lnet/peer.c | 31 ++++++++++++++++++++ drivers/staging/lustre/lnet/lnet/router.c | 2 + 3 files changed, 33 insertions(+), 1 deletion(-)drivers/staging/lustre/include/linux/lnet/lib-lnet.h +1
-0@@ -639,6 +639,7 @@ bool lnet_ni_unique_net(struct list_head *nilist, char *iface);int lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt);struct lnet_peer_ni *lnet_find_peer_locked (struct lnet_peer_table *ptable,lnet_nid_t nid); +struct lnet_peer_ni *lnet_find_peer_ni_locked (lnet_nid_t nid,int cpt);void lnet_peer_tables_cleanup (struct lnet_ni *ni);void lnet_peer_tables_destroy (void );int lnet_peer_tables_create (void );drivers/staging/lustre/lnet/lnet/peer.c +31
-0@@ -216,6 +216,37 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni) } } +static struct lnet_peer_ni * +lnet_get_peer_ni_locked (struct lnet_peer_table *ptable,lnet_nid_t nid) +{ +struct list_head *peers; +struct lnet_peer_ni *lp; + +LASSERT (!the_lnet.ln_shutdown); + + peers = &ptable->pt_hash[lnet_nid2peerhash (nid)]; +list_for_each_entry (lp, peers, lpni_hashlist) { +if (lp->lpni_nid == nid) { +lnet_peer_ni_addref_locked (lp); +return lp; + } + } + +return NULL ; +} + +struct lnet_peer_ni * +lnet_find_peer_ni_locked (lnet_nid_t nid,int cpt) +{ +struct lnet_peer_ni *lpni; +struct lnet_peer_table *ptable; + + ptable = the_lnet.ln_peer_tables[cpt]; + lpni =lnet_get_peer_ni_locked (ptable, nid); + +return lpni; +} +void lnet_destroy_peer_ni_locked (struct lnet_peer_ni *lp) {drivers/staging/lustre/lnet/lnet/router.c +1
-1@@ -1734,7 +1734,7 @@ lnet_notify(struct lnet_ni *ni, lnet_nid_t nid, int alive, time64_t when)return -ESHUTDOWN ; } - lp =lnet_find_peer_locked (the_lnet.ln_peer_tables[cpt], nid); + lp =lnet_find_peer_ni_locked (nid, cpt);if (!lp) {/* nid not found */ lnet_net_unlock (cpt);
PATCH 7/34 lnet: lnet_peer_tables_cleanup: use an exclusive lock.
In reply to NeilBrownWhy?? surely this will deadlock.
This is part of
Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")from upstream lustre, where it is marked:
WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Reviewed-on: http://review.whamcloud.com/18293
--- drivers/staging/lustre/lnet/lnet/peer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/lustre/lnet/lnet/peer.c +6 -6
@@ -185,9 +185,9 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)* peers are gateways for. */ cfs_percpt_for_each (ptable, i, the_lnet.ln_peer_tables) { -lnet_net_lock (i); +lnet_net_lock (LNET_LOCK_EX );lnet_peer_table_del_rtrs_locked (ni, ptable, i); -lnet_net_unlock (i); +lnet_net_unlock (LNET_LOCK_EX ); }/*
@@ -195,17 +195,17 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)* deathrow. */ cfs_percpt_for_each (ptable, i, the_lnet.ln_peer_tables) { -lnet_net_lock (i); +lnet_net_lock (LNET_LOCK_EX );lnet_peer_table_cleanup_locked (ni, ptable); -lnet_net_unlock (i); +lnet_net_unlock (LNET_LOCK_EX ); }/* Cleanup all entries on deathrow. */ cfs_percpt_for_each (ptable, i, the_lnet.ln_peer_tables) { -lnet_net_lock (i); +lnet_net_lock (LNET_LOCK_EX );lnet_peer_table_deathrow_wait_locked (ptable, i);list_splice_init (&ptable->pt_deathrow, &deathrow); -lnet_net_unlock (i); +lnet_net_unlock (LNET_LOCK_EX ); }while (!list_empty (&deathrow)) {
PATCH 7/34 lnet: lnet_peer_tables_cleanup: use an exclusive lock.
Quoted 11 lines
Why?? surely this will deadlock.
This is part of
Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")from upstream lustre, where it is marked:
Signed-off-by Amir Shehata <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Reviewed-on: http://review.whamcloud.com/18293Reviewed-by Olaf Weber <[email protected]>Reviewed-by Doug Oucharek <[email protected]>
The code is right but the commit message needs a update. Olaf, Doug, or Amir can you fill in the gaps.
P.S
Its strange that git is not sending message to the people in the
Reviewed-by:. Maybe git can't handle the indent?
Quoted 46 lines
Signed-off-by NeilBrown <[email protected]>--- drivers/staging/lustre/lnet/lnet/peer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/staging/lustre/lnet/lnet/peer.c +6
-6@@ -185,9 +185,9 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)* peers are gateways for. */ cfs_percpt_for_each (ptable, i, the_lnet.ln_peer_tables) { -lnet_net_lock (i); +lnet_net_lock (LNET_LOCK_EX );lnet_peer_table_del_rtrs_locked (ni, ptable, i); -lnet_net_unlock (i); +lnet_net_unlock (LNET_LOCK_EX ); }/* @@ -195,17 +195,17 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)* deathrow. */ cfs_percpt_for_each (ptable, i, the_lnet.ln_peer_tables) { -lnet_net_lock (i); +lnet_net_lock (LNET_LOCK_EX );lnet_peer_table_cleanup_locked (ni, ptable); -lnet_net_unlock (i); +lnet_net_unlock (LNET_LOCK_EX ); }/* Cleanup all entries on deathrow. */ cfs_percpt_for_each (ptable, i, the_lnet.ln_peer_tables) { -lnet_net_lock (i); +lnet_net_lock (LNET_LOCK_EX );lnet_peer_table_deathrow_wait_locked (ptable, i);list_splice_init (&ptable->pt_deathrow, &deathrow); -lnet_net_unlock (i); +lnet_net_unlock (LNET_LOCK_EX ); }while (!list_empty (&deathrow)) {
PATCH 7/34 lnet: lnet_peer_tables_cleanup: use an exclusive lock.
Quoted 11 lines · James Simmons
Quoted 10 lines
Why?? surely this will deadlock.
This is part of
Commit: 58091af960fe ("LU-7734 lnet: Multi-Rail peer split")from upstream lustre, where it is marked:
Signed-off-by Amir Shehata <[email protected]>WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Reviewed-on: http://review.whamcloud.com/18293Reviewed-by Olaf Weber <[email protected]>Reviewed-by Doug Oucharek <[email protected]>
Quoted 4 lines
The code is right but the commit message needs a update. Olaf, Doug, or Amir can you fill in the gaps.
Reviewed-by James Simmons <[email protected]>
thanks
Quoted 4 lines
P.S
Its strange that git is not sending message to the people in the
Reviewed-by:. Maybe git can't handle the indent?
I wasn't asking it to - I was just sending it the list and Oleg, Andreas, Doug, and you. Maybe I should ...
Thanks,
NeilBrown
Quoted 43 lines
Quoted 43 lines
Signed-off-by NeilBrown <[email protected]>--- drivers/staging/lustre/lnet/lnet/peer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/staging/lustre/lnet/lnet/peer.c +6
-6@@ -185,9 +185,9 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)* peers are gateways for. */ cfs_percpt_for_each (ptable, i, the_lnet.ln_peer_tables) { -lnet_net_lock (i); +lnet_net_lock (LNET_LOCK_EX );lnet_peer_table_del_rtrs_locked (ni, ptable, i); -lnet_net_unlock (i); +lnet_net_unlock (LNET_LOCK_EX ); }/* @@ -195,17 +195,17 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)* deathrow. */ cfs_percpt_for_each (ptable, i, the_lnet.ln_peer_tables) { -lnet_net_lock (i); +lnet_net_lock (LNET_LOCK_EX );lnet_peer_table_cleanup_locked (ni, ptable); -lnet_net_unlock (i); +lnet_net_unlock (LNET_LOCK_EX ); }/* Cleanup all entries on deathrow. */ cfs_percpt_for_each (ptable, i, the_lnet.ln_peer_tables) { -lnet_net_lock (i); +lnet_net_lock (LNET_LOCK_EX );lnet_peer_table_deathrow_wait_locked (ptable, i);list_splice_init (&ptable->pt_deathrow, &deathrow); -lnet_net_unlock (i); +lnet_net_unlock (LNET_LOCK_EX ); }
Quoted 4 lines
drivers/staging/lustre/lnet/lnet/peer.c lnet_peer_tables_cleanup(struct lnet_ni *ni) · line 211
Quoted 4 lines
drivers/staging/lustre/lnet/lnet/peer.c +0
-0while (!list_empty (&deathrow)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20181002/5b2f42ab/attachment.sig>
PATCH 8/34 LU-7734 lnet: Multi-Rail peer split
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
[[Note, the preceding few patches are part of this
in the upstream lustre code - they were split for easier merging into linux.
]]
Split the peer structure into peer/peer_net/peer_ni, as described in the Multi-Rail HLD.
Removed deathrow list in peers, instead peers are immediately deleted. deathrow complicates memory management for peers to little gain.
Moved to LNET_LOCK_EX for any operations which will modify the peer tables. And CPT locks for any operatios which read the peer tables. Therefore there is no need to use lnet_cpt_of_nid() to calculate the CPT of the peer NID, instead we use lnet_nid_cpt_hash() to distribute peers across multiple CPTs.
It is no longe true that peers and NIs would exist on the same CPT. In the new design peers and NIs don't have a 1-1 relationship. You can send to the same peer from several NIs, which can exist on separate CPTs
Reviewed-on: http://review.whamcloud.com/18293
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 2 .../staging/lustre/include/linux/lnet/lib-types.h | 29 ++ drivers/staging/lustre/lnet/lnet/api-ni.c | 1 drivers/staging/lustre/lnet/lnet/peer.c | 260 ++++++++++++-------- drivers/staging/lustre/lnet/lnet/router_proc.c | 3 5 files changed, 191 insertions(+), 104 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +0 -2
@@ -637,8 +637,6 @@ bool lnet_net_unique(__u32 net_id, struct list_head *nilist,bool lnet_ni_unique_net (struct list_head *nilist,char *iface);int lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt); -struct lnet_peer_ni *lnet_find_peer_locked (struct lnet_peer_table *ptable, -lnet_nid_t nid);struct lnet_peer_ni *lnet_find_peer_ni_locked (lnet_nid_t nid,int cpt);void lnet_peer_tables_cleanup (struct lnet_ni *ni);void lnet_peer_tables_destroy (void );
drivers/staging/lustre/include/linux/lnet/lib-types.h +29 -0
@@ -384,6 +384,7 @@ struct lnet_rc_data { };struct lnet_peer_ni { +struct list_head lpni_on_peer_net_list;/* chain on peer hash */ struct list_head lpni_hashlist;/* messages blocking for tx credits */
@@ -394,6 +395,7 @@ struct lnet_peer_ni {struct list_head lpni_rtr_list;/* # tx credits available */ int lpni_txcredits; +struct lnet_peer_net *lpni_peer_net;/* low water mark */ int lpni_mintxcredits;/* # router credits */
@@ -442,6 +444,31 @@ struct lnet_peer_ni {struct lnet_rc_data *lpni_rcd; }; +struct lnet_peer { +/* chain on global peer list */ +struct list_head lp_on_lnet_peer_list; + +/* list of peer nets */ +struct list_head lp_peer_nets; + +/* primary NID of the peer */ +lnet_nid_t lp_primary_nid; +}; + +struct lnet_peer_net { +/* chain on peer block */ +struct list_head lpn_on_peer_list; + +/* list of peer_nis on this network */ +struct list_head lpn_peer_nis; + +/* pointer to the peer I'm part of */ +struct lnet_peer *lpn_peer; + +/* Net ID */ +__u32 lpn_net_id; +}; +/* peer hash size */ #define LNET_PEER_HASH_BITS 9#define LNET_PEER_HASH_SIZE (1 << LNET_PEER_HASH_BITS)
@@ -686,6 +713,8 @@ struct lnet {struct lnet_msg_container **ln_msg_containers;struct lnet_counters **ln_counters;struct lnet_peer_table **ln_peer_tables; +/* list of configured or discovered peers */ +struct list_head ln_peers;/* failure simulation */ struct list_head ln_test_peers;struct list_head ln_drop_rules;
drivers/staging/lustre/lnet/lnet/api-ni.c +1 -0
@@ -542,6 +542,7 @@ lnet_prepare(lnet_pid_t requested_pid) the_lnet.ln_pid = requested_pid;INIT_LIST_HEAD (&the_lnet.ln_test_peers); +INIT_LIST_HEAD (&the_lnet.ln_peers);INIT_LIST_HEAD (&the_lnet.ln_nets);INIT_LIST_HEAD (&the_lnet.ln_routers);INIT_LIST_HEAD (&the_lnet.ln_drop_rules);
drivers/staging/lustre/lnet/lnet/peer.c +158 -102
363 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/router_proc.c +3 -0
@@ -385,6 +385,9 @@ static int proc_lnet_routers(struct ctl_table *table, int write,return rc; } +/* TODO: there should be no direct access to ptable. We should add a set +* of APIs that give access to the ptable and its members +*/ static int proc_lnet_peers (struct ctl_table *table,int write,void __user *buffer,size_t *lenp,loff_t *ppos) {
PATCH 8/34 LU-7734 lnet: Multi-Rail peer split
Quoted 25 lines · NeilBrown
From: Amir Shehata <[email protected]>
[[Note, the preceding few patches are part of this
in the upstream lustre code - they were split for easier merging into linux.
]]Split the peer structure into peer/peer_net/peer_ni, as described in the Multi-Rail HLD.
Removed deathrow list in peers, instead peers are immediately deleted. deathrow complicates memory management for peers to little gain.
Moved to
LNET_LOCK_EXfor any operations which will modify the peer tables. And CPT locks for any operatios which read the peer tables. Therefore there is no need to uselnet_cpt_of_nid()to calculate the CPT of the peer NID, instead we uselnet_nid_cpt_hash()to distribute peers across multiple CPTs.It is no longe true that peers and NIs would exist on the same CPT. In the new design peers and NIs don't have a 1-1 relationship. You can send to the same peer from several NIs, which can exist on separate CPTs
Quoted 6 lines
Signed-off-by Amir Shehata <[email protected]>Change-Id Ida41d830d38d0ab2bb551476e4a8866d52a25fe2Reviewed-on: http://review.whamcloud.com/18293
Reviewed-by Olaf Weber <[email protected]>Reviewed-by Doug Oucharek <[email protected]>Signed-off-by NeilBrown <[email protected]>
The patch is fine but the commit message needs to be properly formatted. While patches to OpenSFS tree are titled with "LU-7743 lnet:" for the linux client we changed that to be more inline with what the kernel does.
LU-7734 lnet: Multi-Rail peer split --->>> lustre: lnet: Multi-Rail peer split
To the outsider reviewer LU-7734 doesn't mean much. Also please replace
Change-Id: to the URL link for the work which in turn explains LU-7734.
WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Same for the other patches this series. Seem reasonable?
Quoted 486 lines
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 2 .../staging/lustre/include/linux/lnet/lib-types.h | 29 ++ drivers/staging/lustre/lnet/lnet/api-ni.c | 1 drivers/staging/lustre/lnet/lnet/peer.c | 260 ++++++++++++-------- drivers/staging/lustre/lnet/lnet/router_proc.c | 3 5 files changed, 191 insertions(+), 104 deletions(-)drivers/staging/lustre/include/linux/lnet/lib-lnet.h +0
-2@@ -637,8 +637,6 @@ bool lnet_net_unique(__u32 net_id, struct list_head *nilist,bool lnet_ni_unique_net (struct list_head *nilist,char *iface);int lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt); -struct lnet_peer_ni *lnet_find_peer_locked (struct lnet_peer_table *ptable, -lnet_nid_t nid);struct lnet_peer_ni *lnet_find_peer_ni_locked (lnet_nid_t nid,int cpt);void lnet_peer_tables_cleanup (struct lnet_ni *ni);void lnet_peer_tables_destroy (void );drivers/staging/lustre/include/linux/lnet/lib-types.h +29
-0@@ -384,6 +384,7 @@ struct lnet_rc_data { };struct lnet_peer_ni { +struct list_head lpni_on_peer_net_list;/* chain on peer hash */ struct list_head lpni_hashlist;/* messages blocking for tx credits */ @@ -394,6 +395,7 @@ struct lnet_peer_ni {struct list_head lpni_rtr_list;/* # tx credits available */ int lpni_txcredits; +struct lnet_peer_net *lpni_peer_net;/* low water mark */ int lpni_mintxcredits;/* # router credits */ @@ -442,6 +444,31 @@ struct lnet_peer_ni {struct lnet_rc_data *lpni_rcd; }; +struct lnet_peer { +/* chain on global peer list */ +struct list_head lp_on_lnet_peer_list; + +/* list of peer nets */ +struct list_head lp_peer_nets; + +/* primary NID of the peer */ +lnet_nid_t lp_primary_nid; +}; + +struct lnet_peer_net { +/* chain on peer block */ +struct list_head lpn_on_peer_list; + +/* list of peer_nis on this network */ +struct list_head lpn_peer_nis; + +/* pointer to the peer I'm part of */ +struct lnet_peer *lpn_peer; + +/* Net ID */ +__u32 lpn_net_id; +}; +/* peer hash size */ #define LNET_PEER_HASH_BITS 9#define LNET_PEER_HASH_SIZE (1 << LNET_PEER_HASH_BITS)@@ -686,6 +713,8 @@ struct lnet {struct lnet_msg_container **ln_msg_containers;struct lnet_counters **ln_counters;struct lnet_peer_table **ln_peer_tables; +/* list of configured or discovered peers */ +struct list_head ln_peers;/* failure simulation */ struct list_head ln_test_peers;struct list_head ln_drop_rules;drivers/staging/lustre/lnet/lnet/api-ni.c +1
-0@@ -542,6 +542,7 @@ lnet_prepare(lnet_pid_t requested_pid) the_lnet.ln_pid = requested_pid;INIT_LIST_HEAD (&the_lnet.ln_test_peers); +INIT_LIST_HEAD (&the_lnet.ln_peers);INIT_LIST_HEAD (&the_lnet.ln_nets);INIT_LIST_HEAD (&the_lnet.ln_routers);INIT_LIST_HEAD (&the_lnet.ln_drop_rules);drivers/staging/lustre/lnet/lnet/peer.c +158
-102@@ -54,8 +54,6 @@ lnet_peer_tables_create(void) }cfs_percpt_for_each (ptable, i, the_lnet.ln_peer_tables) { -INIT_LIST_HEAD (&ptable->pt_deathrow); - hash =kvmalloc_cpt (LNET_PEER_HASH_SIZE *sizeof (*hash),GFP_KERNEL , i);if (!hash) {@@ -88,8 +86,6 @@ lnet_peer_tables_destroy(void)if (!hash)/* not initialized */ break ; -LASSERT (list_empty (&ptable->pt_deathrow)); - ptable->pt_hash =NULL ;for (j =0 ; j <LNET_PEER_HASH_SIZE ; j++)LASSERT (list_empty (&hash[j]));@@ -123,7 +119,7 @@ lnet_peer_table_cleanup_locked(struct lnet_ni *ni, }static void -lnet_peer_table_deathrow_wait_locked (struct lnet_peer_table *ptable, +lnet_peer_table_finalize_wait_locked (struct lnet_peer_table *ptable,int cpt_locked) {int i;@@ -173,12 +169,8 @@ void lnet_peer_tables_cleanup(struct lnet_ni *ni) {struct lnet_peer_table *ptable; -struct list_head deathrow; -struct lnet_peer_ni *lp;int i; -INIT_LIST_HEAD (&deathrow); -LASSERT (the_lnet.ln_shutdown || ni);/* * If just deleting the peers for a NI, get rid of any routes these @@ -191,8 +183,7 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni) }/* -* Start the process of moving the applicable peers to -* deathrow. +* Start the cleanup process */ cfs_percpt_for_each (ptable, i, the_lnet.ln_peer_tables) {lnet_net_lock (LNET_LOCK_EX );@@ -200,20 +191,12 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)lnet_net_unlock (LNET_LOCK_EX ); } -/* Cleanup all entries on deathrow. */ +/* Wait until all peers have been destroyed. */ cfs_percpt_for_each (ptable, i, the_lnet.ln_peer_tables) {lnet_net_lock (LNET_LOCK_EX ); -lnet_peer_table_deathrow_wait_locked (ptable, i); -list_splice_init (&ptable->pt_deathrow, &deathrow); +lnet_peer_table_finalize_wait_locked (ptable, i);lnet_net_unlock (LNET_LOCK_EX ); } - -while (!list_empty (&deathrow)) { - lp = list_entry(deathrow.next, struct lnet_peer_ni, - lpni_hashlist); -list_del (&lp->lpni_hashlist); -kfree (lp); - } } static struct lnet_peer_ni *@@ -247,74 +230,143 @@ lnet_find_peer_ni_locked(lnet_nid_t nid, int cpt)return lpni; } -void -lnet_destroy_peer_ni_locked (struct lnet_peer_ni *lp) +static void +lnet_try_destroy_peer_hierarchy_locked (struct lnet_peer_ni *lpni) { -struct lnet_peer_table *ptable; +struct lnet_peer_net *peer_net; +struct lnet_peer *peer; -LASSERT (atomic_read (&lp->lpni_refcount) ==0 ); -LASSERT (!lp->lpni_rtr_refcount); -LASSERT (list_empty (&lp->lpni_txq)); -LASSERT (list_empty (&lp->lpni_hashlist)); -LASSERT (!lp->lpni_txqnob); +/* TODO: could the below situation happen? accessing an already +* destroyed peer? +*/ +if (!lpni->lpni_peer_net || + !lpni->lpni_peer_net->lpn_peer) +return ; - ptable = the_lnet.ln_peer_tables[lp->lpni_cpt]; -LASSERT (ptable->pt_number >0 ); - ptable->pt_number--; + peer_net = lpni->lpni_peer_net; + peer = lpni->lpni_peer_net->lpn_peer; - lp->lpni_net =NULL ; +list_del_init (&lpni->lpni_on_peer_net_list); + lpni->lpni_peer_net =NULL ; -list_add (&lp->lpni_hashlist, &ptable->pt_deathrow); -LASSERT (ptable->pt_zombies >0 ); - ptable->pt_zombies--; +/* if peer_net is empty, then remove it from the peer */ +if (list_empty (&peer_net->lpn_peer_nis)) { +list_del_init (&peer_net->lpn_on_peer_list); + peer_net->lpn_peer =NULL ; +kfree (peer_net); + +/* If the peer is empty then remove it from the +* the_lnet.ln_peers +*/ +if (list_empty (&peer->lp_peer_nets)) { +list_del_init (&peer->lp_on_lnet_peer_list); +kfree (peer); + } + } } -struct lnet_peer_ni * -lnet_find_peer_locked (struct lnet_peer_table *ptable,lnet_nid_t nid) +static int +lnet_build_peer_hierarchy (struct lnet_peer_ni *lpni) { -struct list_head *peers; -struct lnet_peer_ni *lp; +struct lnet_peer *peer; +struct lnet_peer_net *peer_net; +__u32 lpni_net =LNET_NIDNET (lpni->lpni_nid); -LASSERT (!the_lnet.ln_shutdown); + peer =NULL ; + peer_net =NULL ; - peers = &ptable->pt_hash[lnet_nid2peerhash (nid)]; -list_for_each_entry (lp, peers, lpni_hashlist) { -if (lp->lpni_nid == nid) { -lnet_peer_ni_addref_locked (lp); -return lp; - } + peer =kzalloc (sizeof (*peer),GFP_KERNEL ); +if (!peer) +return -ENOMEM ; + + peer_net =kzalloc (sizeof (*peer_net),GFP_KERNEL ); +if (!peer_net) { +kfree (peer); +return -ENOMEM ; } -return NULL ; +INIT_LIST_HEAD (&peer->lp_on_lnet_peer_list); +INIT_LIST_HEAD (&peer->lp_peer_nets); +INIT_LIST_HEAD (&peer_net->lpn_on_peer_list); +INIT_LIST_HEAD (&peer_net->lpn_peer_nis); + +/* build the hierarchy */ + peer_net->lpn_net_id = lpni_net; + peer_net->lpn_peer = peer; + lpni->lpni_peer_net = peer_net; + peer->lp_primary_nid = lpni->lpni_nid; +list_add_tail (&peer_net->lpn_on_peer_list, &peer->lp_peer_nets); +list_add_tail (&lpni->lpni_on_peer_net_list, &peer_net->lpn_peer_nis); +list_add_tail (&peer->lp_on_lnet_peer_list, &the_lnet.ln_peers); + +return 0 ; +} + +void +lnet_destroy_peer_ni_locked (struct lnet_peer_ni *lpni) +{ +struct lnet_peer_table *ptable; + +LASSERT (atomic_read (&lpni->lpni_refcount) ==0 ); +LASSERT (lpni->lpni_rtr_refcount ==0 ); +LASSERT (list_empty (&lpni->lpni_txq)); +LASSERT (list_empty (&lpni->lpni_hashlist)); +LASSERT (lpni->lpni_txqnob ==0 ); +LASSERT (lpni->lpni_peer_net); +LASSERT (lpni->lpni_peer_net->lpn_peer); + + ptable = the_lnet.ln_peer_tables[lpni->lpni_cpt]; +LASSERT (ptable->pt_number >0 ); + ptable->pt_number--; + + lpni->lpni_net =NULL ; + +lnet_try_destroy_peer_hierarchy_locked (lpni); + +kfree (lpni); + +LASSERT (ptable->pt_zombies >0 ); + ptable->pt_zombies--; }int -lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt) +lnet_nid2peerni_locked (struct lnet_peer_ni **lpnip,lnet_nid_t nid,int cpt) {struct lnet_peer_table *ptable; -struct lnet_peer_ni *lp =NULL ; -struct lnet_peer_ni *lp2; +struct lnet_peer_ni *lpni =NULL ; +struct lnet_peer_ni *lpni2;int cpt2;int rc =0 ; - *lpp =NULL ; + *lpnip =NULL ;if (the_lnet.ln_shutdown)/* it's shutting down */ return -ESHUTDOWN ; -/* cpt can be LNET_LOCK_EX if it's called from router functions */ - cpt2 = cpt !=LNET_LOCK_EX ? cpt :lnet_cpt_of_nid_locked (nid,NULL ); +/* +* calculate cpt2 with the standard hash function +* This cpt2 becomes the slot where we'll find or create the peer. +*/ + cpt2 =lnet_nid_cpt_hash (nid,LNET_CPT_NUMBER ); - ptable = the_lnet.ln_peer_tables[cpt2]; - lp =lnet_find_peer_locked (ptable, nid); -if (lp) { - *lpp = lp; -return 0 ; +/* +* Any changes to the peer tables happen under exclusive write +* lock. Any reads to the peer tables can be done via a standard +* CPT read lock. +*/ +if (cpt !=LNET_LOCK_EX ) { +lnet_net_unlock (cpt); +lnet_net_lock (LNET_LOCK_EX ); } -if (!list_empty (&ptable->pt_deathrow)) { - lp =list_entry (ptable->pt_deathrow.next, - struct lnet_peer_ni, lpni_hashlist); -list_del (&lp->lpni_hashlist); + ptable = the_lnet.ln_peer_tables[cpt2]; + lpni =lnet_get_peer_ni_locked (ptable, nid); +if (lpni) { + *lpnip = lpni; +if (cpt !=LNET_LOCK_EX ) { +lnet_net_unlock (LNET_LOCK_EX ); +lnet_net_lock (cpt); + } +return 0 ; }/* @@ -322,68 +374,72 @@ lnet_nid2peerni_locked(struct lnet_peer_ni **lpp, lnet_nid_t nid, int cpt)* and destroyed locks and peer-table before I finish the allocation */ ptable->pt_number++; -lnet_net_unlock (cpt); +lnet_net_unlock (LNET_LOCK_EX ); -if (lp) -memset (lp,0 ,sizeof (*lp)); -else - lp =kzalloc_cpt (sizeof (*lp),GFP_NOFS , cpt2); - -if (!lp) { + lpni =kzalloc_cpt (sizeof (*lpni),GFP_KERNEL , cpt2); +if (!lpni) { rc = -ENOMEM ;lnet_net_lock (cpt); goto out; } -INIT_LIST_HEAD (&lp->lpni_txq); -INIT_LIST_HEAD (&lp->lpni_rtrq); -INIT_LIST_HEAD (&lp->lpni_routes); - - lp->lpni_notify =0 ; - lp->lpni_notifylnd =0 ; - lp->lpni_notifying =0 ; - lp->lpni_alive_count =0 ; - lp->lpni_timestamp =0 ; - lp->lpni_alive = !lnet_peers_start_down ();/* 1 bit!! */ - lp->lpni_last_alive =ktime_get_seconds ();/* assumes alive */ - lp->lpni_last_query =0 ;/* haven't asked NI yet */ - lp->lpni_ping_timestamp =0 ; - lp->lpni_ping_feats =LNET_PING_FEAT_INVAL ; - lp->lpni_nid = nid; - lp->lpni_cpt = cpt2; -atomic_set (&lp->lpni_refcount,2 );/* 1 for caller; 1 for hash */ - lp->lpni_rtr_refcount =0 ; +INIT_LIST_HEAD (&lpni->lpni_txq); +INIT_LIST_HEAD (&lpni->lpni_rtrq); +INIT_LIST_HEAD (&lpni->lpni_routes); -lnet_net_lock (cpt); + lpni->lpni_alive = !lnet_peers_start_down ();/* 1 bit!! */ + lpni->lpni_last_alive =ktime_get_seconds ();/* assumes alive */ + lpni->lpni_ping_feats =LNET_PING_FEAT_INVAL ; + lpni->lpni_nid = nid; + lpni->lpni_cpt = cpt2; +atomic_set (&lpni->lpni_refcount,2 );/* 1 for caller; 1 for hash */ + + rc =lnet_build_peer_hierarchy (lpni); +if (rc !=0 ) + goto out; + +lnet_net_lock (LNET_LOCK_EX );if (the_lnet.ln_shutdown) { rc = -ESHUTDOWN ; goto out; } - lp2 =lnet_find_peer_locked (ptable, nid); -if (lp2) { - *lpp = lp2; + lpni2 =lnet_get_peer_ni_locked (ptable, nid); +if (lpni2) { + *lpnip = lpni2; goto out; } - lp->lpni_net =lnet_get_net_locked (LNET_NIDNET (lp->lpni_nid)); - lp->lpni_txcredits = - lp->lpni_mintxcredits = - lp->lpni_net->net_tunables.lct_peer_tx_credits; - lp->lpni_rtrcredits = - lp->lpni_minrtrcredits =lnet_peer_buffer_credits (lp->lpni_net); + lpni->lpni_net =lnet_get_net_locked (LNET_NIDNET (lpni->lpni_nid)); + lpni->lpni_txcredits = + lpni->lpni_mintxcredits = + lpni->lpni_net->net_tunables.lct_peer_tx_credits; + lpni->lpni_rtrcredits = + lpni->lpni_minrtrcredits = +lnet_peer_buffer_credits (lpni->lpni_net); -list_add_tail (&lp->lpni_hashlist, +list_add_tail (&lpni->lpni_hashlist, &ptable->pt_hash[lnet_nid2peerhash (nid)]); ptable->pt_version++; - *lpp = lp; + *lpnip = lpni; + +if (cpt !=LNET_LOCK_EX ) { +lnet_net_unlock (LNET_LOCK_EX ); +lnet_net_lock (cpt); + }return 0 ; out: -if (lp) -list_add (&lp->lpni_hashlist, &ptable->pt_deathrow); +if (lpni) { +lnet_try_destroy_peer_hierarchy_locked (lpni); +kfree (lpni); + } ptable->pt_number--; +if (cpt !=LNET_LOCK_EX ) { +lnet_net_unlock (LNET_LOCK_EX ); +lnet_net_lock (cpt); + }return rc; }drivers/staging/lustre/lnet/lnet/router_proc.c +3
-0@@ -385,6 +385,9 @@ static int proc_lnet_routers(struct ctl_table *table, int write,return rc; } +/* TODO: there should be no direct access to ptable. We should add a set +* of APIs that give access to the ptable and its members +*/ static int proc_lnet_peers (struct ctl_table *table,int write,void __user *buffer,size_t *lenp,loff_t *ppos) {
PATCH 8/34 LU-7734 lnet: Multi-Rail peer split
Quoted 38 lines · James Simmons
Quoted 25 lines · NeilBrown
From: Amir Shehata <[email protected]>
[[Note, the preceding few patches are part of this
in the upstream lustre code - they were split for easier merging into linux.
]]Split the peer structure into peer/peer_net/peer_ni, as described in the Multi-Rail HLD.
Removed deathrow list in peers, instead peers are immediately deleted. deathrow complicates memory management for peers to little gain.
Moved to
LNET_LOCK_EXfor any operations which will modify the peer tables. And CPT locks for any operatios which read the peer tables. Therefore there is no need to uselnet_cpt_of_nid()to calculate the CPT of the peer NID, instead we uselnet_nid_cpt_hash()to distribute peers across multiple CPTs.It is no longe true that peers and NIs would exist on the same CPT. In the new design peers and NIs don't have a 1-1 relationship. You can send to the same peer from several NIs, which can exist on separate CPTs
Quoted 6 lines
Signed-off-by Amir Shehata <[email protected]>Change-Id Ida41d830d38d0ab2bb551476e4a8866d52a25fe2Reviewed-on: http://review.whamcloud.com/18293
Reviewed-by Olaf Weber <[email protected]>Reviewed-by Doug Oucharek <[email protected]>Signed-off-by NeilBrown <[email protected]>The patch is fine but the commit message needs to be properly formatted. While patches to OpenSFS tree are titled with "LU-7743 lnet:" for the linux client we changed that to be more inline with what the kernel does.
Quoted 8 lines
LU-7734 lnet: Multi-Rail peer split --->>> lustre: lnet: Multi-Rail peer split
To the outsider reviewer LU-7734 doesn't mean much. Also please replace
Change-Id: to the URL link for the work which in turn explains LU-7734.WC-bug-id: https://jira.whamcloud.com/browse/LU-7734
Same for the other patches this series. Seem reasonable?
If I can automate it, it is probably reasonable.
However, when Greg kicked us out of mainline, one of the things he said was it would mean we don't have to stick to kernel rules anymore, and that this might be good thing.
A lot of the kernel rules (one patch = one change, good comment messages, ...) benefit us whether we are in the kernel or not so it makes sense to keep them.
However I don't think that being picky about exactly where the LU number appears in the commit message actually helps us. Do you think it does?
Thanks,
NeilBrown
Quoted 478 lines
Quoted 478 lines
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 2 .../staging/lustre/include/linux/lnet/lib-types.h | 29 ++ drivers/staging/lustre/lnet/lnet/api-ni.c | 1 drivers/staging/lustre/lnet/lnet/peer.c | 260 ++++++++++++-------- drivers/staging/lustre/lnet/lnet/router_proc.c | 3 5 files changed, 191 insertions(+), 104 deletions(-)drivers/staging/lustre/include/linux/lnet/lib-lnet.h +0
-2@@ -637,8 +637,6 @@ bool lnet_net_unique(__u32 net_id, struct list_head *nilist,bool lnet_ni_unique_net (struct list_head *nilist,char *iface);int lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt); -struct lnet_peer_ni *lnet_find_peer_locked (struct lnet_peer_table *ptable, -lnet_nid_t nid);struct lnet_peer_ni *lnet_find_peer_ni_locked (lnet_nid_t nid,int cpt);void lnet_peer_tables_cleanup (struct lnet_ni *ni);void lnet_peer_tables_destroy (void );drivers/staging/lustre/include/linux/lnet/lib-types.h +29
-0@@ -384,6 +384,7 @@ struct lnet_rc_data { };struct lnet_peer_ni { +struct list_head lpni_on_peer_net_list;/* chain on peer hash */ struct list_head lpni_hashlist;/* messages blocking for tx credits */ @@ -394,6 +395,7 @@ struct lnet_peer_ni {struct list_head lpni_rtr_list;/* # tx credits available */ int lpni_txcredits; +struct lnet_peer_net *lpni_peer_net;/* low water mark */ int lpni_mintxcredits;/* # router credits */ @@ -442,6 +444,31 @@ struct lnet_peer_ni {struct lnet_rc_data *lpni_rcd; }; +struct lnet_peer { +/* chain on global peer list */ +struct list_head lp_on_lnet_peer_list; + +/* list of peer nets */ +struct list_head lp_peer_nets; + +/* primary NID of the peer */ +lnet_nid_t lp_primary_nid; +}; + +struct lnet_peer_net { +/* chain on peer block */ +struct list_head lpn_on_peer_list; + +/* list of peer_nis on this network */ +struct list_head lpn_peer_nis; + +/* pointer to the peer I'm part of */ +struct lnet_peer *lpn_peer; + +/* Net ID */ +__u32 lpn_net_id; +}; +/* peer hash size */ #define LNET_PEER_HASH_BITS 9#define LNET_PEER_HASH_SIZE (1 << LNET_PEER_HASH_BITS)@@ -686,6 +713,8 @@ struct lnet {struct lnet_msg_container **ln_msg_containers;struct lnet_counters **ln_counters;struct lnet_peer_table **ln_peer_tables; +/* list of configured or discovered peers */ +struct list_head ln_peers;/* failure simulation */ struct list_head ln_test_peers;struct list_head ln_drop_rules;drivers/staging/lustre/lnet/lnet/api-ni.c +1
-0@@ -542,6 +542,7 @@ lnet_prepare(lnet_pid_t requested_pid) the_lnet.ln_pid = requested_pid;INIT_LIST_HEAD (&the_lnet.ln_test_peers); +INIT_LIST_HEAD (&the_lnet.ln_peers);INIT_LIST_HEAD (&the_lnet.ln_nets);INIT_LIST_HEAD (&the_lnet.ln_routers);INIT_LIST_HEAD (&the_lnet.ln_drop_rules);drivers/staging/lustre/lnet/lnet/peer.c +158
-102@@ -54,8 +54,6 @@ lnet_peer_tables_create(void) }cfs_percpt_for_each (ptable, i, the_lnet.ln_peer_tables) { -INIT_LIST_HEAD (&ptable->pt_deathrow); - hash =kvmalloc_cpt (LNET_PEER_HASH_SIZE *sizeof (*hash),GFP_KERNEL , i);if (!hash) {@@ -88,8 +86,6 @@ lnet_peer_tables_destroy(void)if (!hash)/* not initialized */ break ; -LASSERT (list_empty (&ptable->pt_deathrow)); - ptable->pt_hash =NULL ;for (j =0 ; j <LNET_PEER_HASH_SIZE ; j++)LASSERT (list_empty (&hash[j]));@@ -123,7 +119,7 @@ lnet_peer_table_cleanup_locked(struct lnet_ni *ni, }static void -lnet_peer_table_deathrow_wait_locked (struct lnet_peer_table *ptable, +lnet_peer_table_finalize_wait_locked (struct lnet_peer_table *ptable,int cpt_locked) {int i;@@ -173,12 +169,8 @@ void lnet_peer_tables_cleanup(struct lnet_ni *ni) {struct lnet_peer_table *ptable; -struct list_head deathrow; -struct lnet_peer_ni *lp;int i; -INIT_LIST_HEAD (&deathrow); -LASSERT (the_lnet.ln_shutdown || ni);/* * If just deleting the peers for a NI, get rid of any routes these @@ -191,8 +183,7 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni) }/* -* Start the process of moving the applicable peers to -* deathrow. +* Start the cleanup process */ cfs_percpt_for_each (ptable, i, the_lnet.ln_peer_tables) {lnet_net_lock (LNET_LOCK_EX );@@ -200,20 +191,12 @@ lnet_peer_tables_cleanup(struct lnet_ni *ni)lnet_net_unlock (LNET_LOCK_EX ); } -/* Cleanup all entries on deathrow. */ +/* Wait until all peers have been destroyed. */ cfs_percpt_for_each (ptable, i, the_lnet.ln_peer_tables) {lnet_net_lock (LNET_LOCK_EX ); -lnet_peer_table_deathrow_wait_locked (ptable, i); -list_splice_init (&ptable->pt_deathrow, &deathrow); +lnet_peer_table_finalize_wait_locked (ptable, i);lnet_net_unlock (LNET_LOCK_EX ); } - -while (!list_empty (&deathrow)) { - lp = list_entry(deathrow.next, struct lnet_peer_ni, - lpni_hashlist); -list_del (&lp->lpni_hashlist); -kfree (lp); - } } static struct lnet_peer_ni *@@ -247,74 +230,143 @@ lnet_find_peer_ni_locked(lnet_nid_t nid, int cpt)return lpni; } -void -lnet_destroy_peer_ni_locked (struct lnet_peer_ni *lp) +static void +lnet_try_destroy_peer_hierarchy_locked (struct lnet_peer_ni *lpni) { -struct lnet_peer_table *ptable; +struct lnet_peer_net *peer_net; +struct lnet_peer *peer; -LASSERT (atomic_read (&lp->lpni_refcount) ==0 ); -LASSERT (!lp->lpni_rtr_refcount); -LASSERT (list_empty (&lp->lpni_txq)); -LASSERT (list_empty (&lp->lpni_hashlist)); -LASSERT (!lp->lpni_txqnob); +/* TODO: could the below situation happen? accessing an already +* destroyed peer? +*/ +if (!lpni->lpni_peer_net || + !lpni->lpni_peer_net->lpn_peer) +return ; - ptable = the_lnet.ln_peer_tables[lp->lpni_cpt]; -LASSERT (ptable->pt_number >0 ); - ptable->pt_number--; + peer_net = lpni->lpni_peer_net; + peer = lpni->lpni_peer_net->lpn_peer; - lp->lpni_net =NULL ; +list_del_init (&lpni->lpni_on_peer_net_list); + lpni->lpni_peer_net =NULL ; -list_add (&lp->lpni_hashlist, &ptable->pt_deathrow); -LASSERT (ptable->pt_zombies >0 ); - ptable->pt_zombies--; +/* if peer_net is empty, then remove it from the peer */ +if (list_empty (&peer_net->lpn_peer_nis)) { +list_del_init (&peer_net->lpn_on_peer_list); + peer_net->lpn_peer =NULL ; +kfree (peer_net); + +/* If the peer is empty then remove it from the +* the_lnet.ln_peers +*/ +if (list_empty (&peer->lp_peer_nets)) { +list_del_init (&peer->lp_on_lnet_peer_list); +kfree (peer); + } + } } -struct lnet_peer_ni * -lnet_find_peer_locked (struct lnet_peer_table *ptable,lnet_nid_t nid) +static int +lnet_build_peer_hierarchy (struct lnet_peer_ni *lpni) { -struct list_head *peers; -struct lnet_peer_ni *lp; +struct lnet_peer *peer; +struct lnet_peer_net *peer_net; +__u32 lpni_net =LNET_NIDNET (lpni->lpni_nid); -LASSERT (!the_lnet.ln_shutdown); + peer =NULL ; + peer_net =NULL ; - peers = &ptable->pt_hash[lnet_nid2peerhash (nid)]; -list_for_each_entry (lp, peers, lpni_hashlist) { -if (lp->lpni_nid == nid) { -lnet_peer_ni_addref_locked (lp); -return lp; - } + peer =kzalloc (sizeof (*peer),GFP_KERNEL ); +if (!peer) +return -ENOMEM ; + + peer_net =kzalloc (sizeof (*peer_net),GFP_KERNEL ); +if (!peer_net) { +kfree (peer); +return -ENOMEM ; } -return NULL ; +INIT_LIST_HEAD (&peer->lp_on_lnet_peer_list); +INIT_LIST_HEAD (&peer->lp_peer_nets); +INIT_LIST_HEAD (&peer_net->lpn_on_peer_list); +INIT_LIST_HEAD (&peer_net->lpn_peer_nis); + +/* build the hierarchy */ + peer_net->lpn_net_id = lpni_net; + peer_net->lpn_peer = peer; + lpni->lpni_peer_net = peer_net; + peer->lp_primary_nid = lpni->lpni_nid; +list_add_tail (&peer_net->lpn_on_peer_list, &peer->lp_peer_nets); +list_add_tail (&lpni->lpni_on_peer_net_list, &peer_net->lpn_peer_nis); +list_add_tail (&peer->lp_on_lnet_peer_list, &the_lnet.ln_peers); + +return 0 ; +} + +void +lnet_destroy_peer_ni_locked (struct lnet_peer_ni *lpni) +{ +struct lnet_peer_table *ptable; + +LASSERT (atomic_read (&lpni->lpni_refcount) ==0 ); +LASSERT (lpni->lpni_rtr_refcount ==0 ); +LASSERT (list_empty (&lpni->lpni_txq)); +LASSERT (list_empty (&lpni->lpni_hashlist)); +LASSERT (lpni->lpni_txqnob ==0 ); +LASSERT (lpni->lpni_peer_net); +LASSERT (lpni->lpni_peer_net->lpn_peer); + + ptable = the_lnet.ln_peer_tables[lpni->lpni_cpt]; +LASSERT (ptable->pt_number >0 ); + ptable->pt_number--; + + lpni->lpni_net =NULL ; + +lnet_try_destroy_peer_hierarchy_locked (lpni); + +kfree (lpni); + +LASSERT (ptable->pt_zombies >0 ); + ptable->pt_zombies--; }int -lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt) +lnet_nid2peerni_locked (struct lnet_peer_ni **lpnip,lnet_nid_t nid,int cpt) {struct lnet_peer_table *ptable; -struct lnet_peer_ni *lp =NULL ; -struct lnet_peer_ni *lp2; +struct lnet_peer_ni *lpni =NULL ; +struct lnet_peer_ni *lpni2;int cpt2;int rc =0 ; - *lpp =NULL ; + *lpnip =NULL ;if (the_lnet.ln_shutdown)/* it's shutting down */ return -ESHUTDOWN ; -/* cpt can be LNET_LOCK_EX if it's called from router functions */ - cpt2 = cpt !=LNET_LOCK_EX ? cpt :lnet_cpt_of_nid_locked (nid,NULL ); +/* +* calculate cpt2 with the standard hash function +* This cpt2 becomes the slot where we'll find or create the peer. +*/ + cpt2 =lnet_nid_cpt_hash (nid,LNET_CPT_NUMBER ); - ptable = the_lnet.ln_peer_tables[cpt2]; - lp =lnet_find_peer_locked (ptable, nid); -if (lp) { - *lpp = lp; -return 0 ; +/* +* Any changes to the peer tables happen under exclusive write +* lock. Any reads to the peer tables can be done via a standard +* CPT read lock. +*/ +if (cpt !=LNET_LOCK_EX ) { +lnet_net_unlock (cpt); +lnet_net_lock (LNET_LOCK_EX ); } -if (!list_empty (&ptable->pt_deathrow)) { - lp =list_entry (ptable->pt_deathrow.next, - struct lnet_peer_ni, lpni_hashlist); -list_del (&lp->lpni_hashlist); + ptable = the_lnet.ln_peer_tables[cpt2]; + lpni =lnet_get_peer_ni_locked (ptable, nid); +if (lpni) { + *lpnip = lpni; +if (cpt !=LNET_LOCK_EX ) { +lnet_net_unlock (LNET_LOCK_EX ); +lnet_net_lock (cpt); + } +return 0 ; }/* @@ -322,68 +374,72 @@ lnet_nid2peerni_locked(struct lnet_peer_ni **lpp, lnet_nid_t nid, int cpt)* and destroyed locks and peer-table before I finish the allocation */ ptable->pt_number++; -lnet_net_unlock (cpt); +lnet_net_unlock (LNET_LOCK_EX ); -if (lp) -memset (lp,0 ,sizeof (*lp)); -else - lp =kzalloc_cpt (sizeof (*lp),GFP_NOFS , cpt2); - -if (!lp) { + lpni =kzalloc_cpt (sizeof (*lpni),GFP_KERNEL , cpt2); +if (!lpni) { rc = -ENOMEM ;lnet_net_lock (cpt); goto out; } -INIT_LIST_HEAD (&lp->lpni_txq); -INIT_LIST_HEAD (&lp->lpni_rtrq); -INIT_LIST_HEAD (&lp->lpni_routes); - - lp->lpni_notify =0 ; - lp->lpni_notifylnd =0 ; - lp->lpni_notifying =0 ; - lp->lpni_alive_count =0 ; - lp->lpni_timestamp =0 ; - lp->lpni_alive = !lnet_peers_start_down ();/* 1 bit!! */ - lp->lpni_last_alive =ktime_get_seconds ();/* assumes alive */ - lp->lpni_last_query =0 ;/* haven't asked NI yet */ - lp->lpni_ping_timestamp =0 ; - lp->lpni_ping_feats =LNET_PING_FEAT_INVAL ; - lp->lpni_nid = nid; - lp->lpni_cpt = cpt2; -atomic_set (&lp->lpni_refcount,2 );/* 1 for caller; 1 for hash */ - lp->lpni_rtr_refcount =0 ; +INIT_LIST_HEAD (&lpni->lpni_txq); +INIT_LIST_HEAD (&lpni->lpni_rtrq); +INIT_LIST_HEAD (&lpni->lpni_routes); -lnet_net_lock (cpt); + lpni->lpni_alive = !lnet_peers_start_down ();/* 1 bit!! */ + lpni->lpni_last_alive =ktime_get_seconds ();/* assumes alive */ + lpni->lpni_ping_feats =LNET_PING_FEAT_INVAL ; + lpni->lpni_nid = nid; + lpni->lpni_cpt = cpt2; +atomic_set (&lpni->lpni_refcount,2 );/* 1 for caller; 1 for hash */ + + rc =lnet_build_peer_hierarchy (lpni); +if (rc !=0 ) + goto out; + +lnet_net_lock (LNET_LOCK_EX );if (the_lnet.ln_shutdown) { rc = -ESHUTDOWN ; goto out; } - lp2 =lnet_find_peer_locked (ptable, nid); -if (lp2) { - *lpp = lp2; + lpni2 =lnet_get_peer_ni_locked (ptable, nid); +if (lpni2) { + *lpnip = lpni2; goto out; } - lp->lpni_net =lnet_get_net_locked (LNET_NIDNET (lp->lpni_nid)); - lp->lpni_txcredits = - lp->lpni_mintxcredits = - lp->lpni_net->net_tunables.lct_peer_tx_credits; - lp->lpni_rtrcredits = - lp->lpni_minrtrcredits =lnet_peer_buffer_credits (lp->lpni_net); + lpni->lpni_net =lnet_get_net_locked (LNET_NIDNET (lpni->lpni_nid)); + lpni->lpni_txcredits = + lpni->lpni_mintxcredits = + lpni->lpni_net->net_tunables.lct_peer_tx_credits; + lpni->lpni_rtrcredits = + lpni->lpni_minrtrcredits = +lnet_peer_buffer_credits (lpni->lpni_net); -list_add_tail (&lp->lpni_hashlist, +list_add_tail (&lpni->lpni_hashlist, &ptable->pt_hash[lnet_nid2peerhash (nid)]); ptable->pt_version++; - *lpp = lp; + *lpnip = lpni; + +if (cpt !=LNET_LOCK_EX ) { +lnet_net_unlock (LNET_LOCK_EX ); +lnet_net_lock (cpt); + }return 0 ; out: -if (lp) -list_add (&lp->lpni_hashlist, &ptable->pt_deathrow); +if (lpni) { +lnet_try_destroy_peer_hierarchy_locked (lpni); +kfree (lpni); + } ptable->pt_number--; +if (cpt !=LNET_LOCK_EX ) { +lnet_net_unlock (LNET_LOCK_EX ); +lnet_net_lock (cpt); + }return rc; }drivers/staging/lustre/lnet/lnet/router_proc.c +0
-0@@ -385,6 +385,9 @@ static int proc_lnet_routers(struct ctl_table *table, int write,return rc; }
Quoted 9 lines
drivers/staging/lustre/lnet/lnet/router_proc.c static int proc_lnet_routers(struct ctl_table *table, int write, · line 393
Quoted 9 lines
drivers/staging/lustre/lnet/lnet/router_proc.c +3
-0+/* TODO: there should be no direct access to ptable. We should add a set +* of APIs that give access to the ptable and its members +*/ static int proc_lnet_peers (struct ctl_table *table,int write,void __user *buffer,size_t *lenp,loff_t *ppos) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20181002/c285845b/attachment.sig>
PATCH 9/34 LU-7734 lnet: Multi-Rail local_ni/peer_ni selection
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
This patch implements the local_ni/peer_ni selection algorithm. It adds APIs to the peer module to encapsulate iterating through the peer_nis in a peer and creating a peer.
Reviewed-on: http://review.whamcloud.com/18383
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 53 ++ .../staging/lustre/include/linux/lnet/lib-types.h | 17 + drivers/staging/lustre/lnet/lnet/api-ni.c | 20 + drivers/staging/lustre/lnet/lnet/lib-move.c | 522 +++++++++++++++----- drivers/staging/lustre/lnet/lnet/peer.c | 120 ++++- 5 files changed, 603 insertions(+), 129 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +52 -1
@@ -403,6 +403,7 @@ struct lnet_ni *lnet_nid2ni_addref(lnet_nid_t nid);struct lnet_ni *lnet_net2ni_locked (__u32 net,int cpt);struct lnet_ni *lnet_net2ni (__u32 net);bool lnet_is_ni_healthy_locked (struct lnet_ni *ni); +struct lnet_net *lnet_get_net_locked (u32 net_id);extern int portal_rotor;
@@ -635,13 +636,24 @@ int lnet_parse_networks(struct list_head *nilist, char *networks,bool lnet_net_unique (__u32 net_id,struct list_head *nilist,struct lnet_net **net);bool lnet_ni_unique_net (struct list_head *nilist,char *iface); - +void lnet_incr_dlc_seq (void ); +u32 lnet_get_dlc_seq_locked (void ); + +struct lnet_peer_ni *lnet_get_next_peer_ni_locked (struct lnet_peer *peer, +struct lnet_peer_net *peer_net, +struct lnet_peer_ni *prev); +int lnet_find_or_create_peer_locked (lnet_nid_t dst_nid,int cpt, +struct lnet_peer **peer);int lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt);struct lnet_peer_ni *lnet_find_peer_ni_locked (lnet_nid_t nid,int cpt);void lnet_peer_tables_cleanup (struct lnet_ni *ni);void lnet_peer_tables_destroy (void );int lnet_peer_tables_create (void );void lnet_debug_peer (lnet_nid_t nid); +struct lnet_peer_net *lnet_peer_get_net_locked (struct lnet_peer *peer, +u32 net_id); +bool lnet_peer_is_ni_pref_locked (struct lnet_peer_ni *lpni, +struct lnet_ni *ni); int lnet_get_peer_info(__u32 peer_index, __u64 *nid, char alivness[LNET_MAX_STR_LEN], __u32 *cpt_iter, __u32 *refcount,
@@ -649,6 +661,45 @@ int lnet_get_peer_info(__u32 peer_index, __u64 *nid, __u32 *peer_rtr_credits, __u32 *peer_min_rtr_credtis, __u32 *peer_tx_qnob); +static inline bool +lnet_is_peer_ni_healthy_locked (struct lnet_peer_ni *lpni) +{ +return lpni->lpni_healthy; +} + +static inline void +lnet_set_peer_ni_health_locked (struct lnet_peer_ni *lpni,bool health) +{ + lpni->lpni_healthy = health; +} + +static inline bool +lnet_is_peer_net_healthy_locked (struct lnet_peer_net *peer_net) +{ +struct lnet_peer_ni *lpni; + +list_for_each_entry (lpni, &peer_net->lpn_peer_nis, + lpni_on_peer_net_list) { +if (lnet_is_peer_ni_healthy_locked (lpni)) +return true; + } + +return false; +} + +static inline bool +lnet_is_peer_healthy_locked (struct lnet_peer *peer) +{ +struct lnet_peer_net *peer_net; + +list_for_each_entry (peer_net, &peer->lp_peer_nets, lpn_on_peer_list) { +if (lnet_is_peer_net_healthy_locked (peer_net)) +return true; + } + +return false; +} +static inline void lnet_peer_set_alive (struct lnet_peer_ni *lp) {
drivers/staging/lustre/include/linux/lnet/lib-types.h +17 -0
@@ -346,6 +346,9 @@ struct lnet_ni {/* lnd tunables set explicitly */ bool ni_lnd_tunables_set; +/* sequence number used to round robin over nis within a net */ +u32 ni_seq; +/* * equivalent interfaces to use * This is an array because socklnd bonding can still be configured
@@ -436,10 +439,18 @@ struct lnet_peer_ni {int lpni_cpt;/* # refs from lnet_route::lr_gateway */ int lpni_rtr_refcount; +/* sequence number used to round robin over peer nis within a net */ +u32 lpni_seq; +/* health flag */ +bool lpni_healthy;/* returned RC ping features */ unsigned int lpni_ping_feats;/* routers on this peer */ struct list_head lpni_routes; +/* array of preferred local nids */ +lnet_nid_t *lpni_pref_nids; +/* number of preferred NIDs in lnpi_pref_nids */ +u32 lpni_pref_nnids;/* router checker state */ struct lnet_rc_data *lpni_rcd; };
@@ -453,6 +464,9 @@ struct lnet_peer {/* primary NID of the peer */ lnet_nid_t lp_primary_nid; + +/* peer is Multi-Rail enabled peer */ +bool lp_multi_rail; };struct lnet_peer_net {
@@ -467,6 +481,9 @@ struct lnet_peer_net {/* Net ID */ __u32 lpn_net_id; + +/* health flag */ +bool lpn_healthy; };/* peer hash size */
drivers/staging/lustre/lnet/lnet/api-ni.c +20 -0
@@ -64,6 +64,15 @@ module_param(use_tcp_bonding, int, 0444);MODULE_PARM_DESC (use_tcp_bonding,"Set to 1 to use socklnd bonding. 0 to use Multi-Rail" ); +/* +* This sequence number keeps track of how many times DLC was used to +* update the configuration. It is incremented on any DLC update and +* checked when sending a message to determine if there is a need to +* re-run the selection algorithm to handle configuration change. +* Look at lnet_select_pathway() for more details on its usage. +*/ +static atomic_t lnet_dlc_seq_no =ATOMIC_INIT (0 ); +static int lnet_ping (struct lnet_process_id id,signed long timeout,struct lnet_process_id __user *ids,int n_ids);
@@ -1490,6 +1499,7 @@ lnet_startup_lndnet(struct lnet_net *net, struct lnet_lnd_tunables *tun)lnet_net_lock (LNET_LOCK_EX );list_splice_tail (&local_ni_list, &net_l->net_ni_list); +lnet_incr_dlc_seq ();lnet_net_unlock (LNET_LOCK_EX );/* if the network is not unique then we don't want to keep
@@ -2165,6 +2175,16 @@ lnet_dyn_del_ni(__u32 net_id)return rc; } +void lnet_incr_dlc_seq (void ) +{ +atomic_inc (&lnet_dlc_seq_no); +} + +u32 lnet_get_dlc_seq_locked (void ) +{ +return atomic_read (&lnet_dlc_seq_no); +} +/** * LNet ioctl handler. *
drivers/staging/lustre/lnet/lnet/lib-move.c +400 -122
625 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/peer.c +114 -6
138 lines not on this page · raw message
PATCH 10/34 LU-7734 lnet: configure peers from DLC
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
This patch adds the ability to configure peers from the DLC interface.
When a peer is added a primary NID should be provided. If none is provided then the first NID in the list of NIDs will be used as the primary NID.
Basic error checking is done at the DLC level to ensure properly formatted NIDs. However, if a NID is a duplicate, this will be detected when adding it in the kernel. Operation is halted, which means some peer NIDs might have already been added, but not the entire set. It's the role of the caller to backtrack and remove that peer that failed to add.
When deleting a peer a primary NID or a normal NID can be provided. If a standard NID is provided, then the peer is found, and the primary NID is compared to the peer ni. If they are the same the entire peer is deleted. Otherwise, only the identified peer ni is deleted. If a set of NIDs are provided each one will be removed from the peer identified by the peer NID in turn.
The existing show peer credits API can be used to show peer information.
Reviewed-on: http://review.whamcloud.com/18476
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 20 + .../staging/lustre/include/linux/lnet/lib-types.h | 4 .../lustre/include/uapi/linux/lnet/libcfs_ioctl.h | 5 .../lustre/include/uapi/linux/lnet/lnet-dlc.h | 32 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 39 ++ drivers/staging/lustre/lnet/lnet/lib-move.c | 4 drivers/staging/lustre/lnet/lnet/peer.c | 387 ++++++++++++++++++-- drivers/staging/lustre/lnet/lnet/router.c | 2 8 files changed, 433 insertions(+), 60 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +12 -8
@@ -645,21 +645,25 @@ struct lnet_peer_ni *lnet_get_next_peer_ni_locked(struct lnet_peer *peer,int lnet_find_or_create_peer_locked (lnet_nid_t dst_nid,int cpt,struct lnet_peer **peer);int lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt); -struct lnet_peer_ni *lnet_find_peer_ni_locked (lnet_nid_t nid,int cpt); +struct lnet_peer_ni *lnet_find_peer_ni_locked (lnet_nid_t nid);void lnet_peer_tables_cleanup (struct lnet_ni *ni); -void lnet_peer_tables_destroy (void ); +void lnet_peer_uninit (void );int lnet_peer_tables_create (void );void lnet_debug_peer (lnet_nid_t nid);struct lnet_peer_net *lnet_peer_get_net_locked (struct lnet_peer *peer,u32 net_id);bool lnet_peer_is_ni_pref_locked (struct lnet_peer_ni *lpni,struct lnet_ni *ni); -int lnet_get_peer_info (__u32 peer_index,__u64 *nid, -char alivness[LNET_MAX_STR_LEN ], -__u32 *cpt_iter,__u32 *refcount, -__u32 *ni_peer_tx_credits,__u32 *peer_tx_credits, -__u32 *peer_rtr_credits,__u32 *peer_min_rtr_credtis, -__u32 *peer_tx_qnob); +int lnet_add_peer_ni_to_peer (lnet_nid_t key_nid,lnet_nid_t nid); +int lnet_del_peer_ni_from_peer (lnet_nid_t key_nid,lnet_nid_t nid); +int lnet_get_peer_info (__u32 idx,lnet_nid_t *primary_nid,lnet_nid_t *nid, +struct lnet_peer_ni_credit_info *peer_ni_info); +int lnet_get_peer_ni_info (__u32 peer_index,__u64 *nid, +char alivness[LNET_MAX_STR_LEN ], +__u32 *cpt_iter,__u32 *refcount, +__u32 *ni_peer_tx_credits,__u32 *peer_tx_credits, +__u32 *peer_rtr_credits,__u32 *peer_min_rtr_credtis, +__u32 *peer_tx_qnob);static inline bool lnet_is_peer_ni_healthy_locked (struct lnet_peer_ni *lpni)
drivers/staging/lustre/include/linux/lnet/lib-types.h +4 -0
@@ -388,6 +388,8 @@ struct lnet_rc_data {struct lnet_peer_ni {struct list_head lpni_on_peer_net_list; +/* chain on remote peer list */ +struct list_head lpni_on_remote_peer_ni_list;/* chain on peer hash */ struct list_head lpni_hashlist;/* messages blocking for tx credits */
@@ -732,6 +734,8 @@ struct lnet {struct lnet_peer_table **ln_peer_tables;/* list of configured or discovered peers */ struct list_head ln_peers; +/* list of peer nis not on a local network */ +struct list_head ln_remote_peer_ni_list;/* failure simulation */ struct list_head ln_test_peers;struct list_head ln_drop_rules;
drivers/staging/lustre/include/uapi/linux/lnet/libcfs_ioctl.h +4 -1
@@ -136,6 +136,9 @@ struct libcfs_debug_ioctl_data {#define IOC_LIBCFS_GET_BUF _IOWR(IOC_LIBCFS_TYPE, 89, IOCTL_CONFIG_SIZE)#define IOC_LIBCFS_GET_PEER_INFO _IOWR(IOC_LIBCFS_TYPE, 90, IOCTL_CONFIG_SIZE)#define IOC_LIBCFS_GET_LNET_STATS _IOWR(IOC_LIBCFS_TYPE, 91, IOCTL_CONFIG_SIZE) -#define IOC_LIBCFS_MAX_NR 91 +#define IOC_LIBCFS_ADD_PEER_NI _IOWR(IOC_LIBCFS_TYPE, 92, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_DEL_PEER_NI _IOWR(IOC_LIBCFS_TYPE, 93, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_GET_PEER_NI _IOWR(IOC_LIBCFS_TYPE, 94, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_MAX_NR 94#endif /* __LIBCFS_IOCTL_H__ */
drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h +21 -11
@@ -126,26 +126,36 @@ struct lnet_ioctl_config_data {char cfg_bulk[0 ]; }; +struct lnet_peer_ni_credit_info { +char cr_aliveness[LNET_MAX_STR_LEN ]; +__u32 cr_refcount; +__s32 cr_ni_peer_tx_credits; +__s32 cr_peer_tx_credits; +__s32 cr_peer_rtr_credits; +__s32 cr_peer_min_rtr_credits; +__u32 cr_peer_tx_qnob; +__u32 cr_ncpt; +}; +struct lnet_ioctl_peer {struct libcfs_ioctl_hdr pr_hdr;__u32 pr_count;__u32 pr_pad; -__u64 pr_nid; +lnet_nid_t pr_nid;union { -struct { -char cr_aliveness[LNET_MAX_STR_LEN ]; -__u32 cr_refcount; -__u32 cr_ni_peer_tx_credits; -__u32 cr_peer_tx_credits; -__u32 cr_peer_rtr_credits; -__u32 cr_peer_min_rtr_credits; -__u32 cr_peer_tx_qnob; -__u32 cr_ncpt; - } pr_peer_credits; +struct lnet_peer_ni_credit_info pr_peer_credits; } pr_lnd_u; }; +struct lnet_ioctl_peer_cfg { +struct libcfs_ioctl_hdr prcfg_hdr; +lnet_nid_t prcfg_key_nid; +lnet_nid_t prcfg_cfg_nid; +__u32 prcfg_idx; +char prcfg_bulk[0 ]; +}; +struct lnet_ioctl_lnet_stats {struct libcfs_ioctl_hdr st_hdr;struct lnet_counters st_cntrs;
drivers/staging/lustre/lnet/lnet/api-ni.c +37 -2
@@ -552,6 +552,7 @@ lnet_prepare(lnet_pid_t requested_pid)INIT_LIST_HEAD (&the_lnet.ln_test_peers);INIT_LIST_HEAD (&the_lnet.ln_peers); +INIT_LIST_HEAD (&the_lnet.ln_remote_peer_ni_list);INIT_LIST_HEAD (&the_lnet.ln_nets);INIT_LIST_HEAD (&the_lnet.ln_routers);INIT_LIST_HEAD (&the_lnet.ln_drop_rules);
@@ -646,7 +647,7 @@ lnet_unprepare(void)lnet_res_container_cleanup (&the_lnet.ln_eq_container);lnet_msg_containers_destroy (); -lnet_peer_tables_destroy (); +lnet_peer_uninit ();lnet_rtrpools_free (0 );if (the_lnet.ln_counters) {
@@ -2318,13 +2319,33 @@ LNetCtl(unsigned int cmd, void *arg)return lnet_get_rtr_pool_cfg (config->cfg_count, pool_cfg); } +case IOC_LIBCFS_ADD_PEER_NI : { +struct lnet_ioctl_peer_cfg *cfg = arg; + +if (cfg->prcfg_hdr.ioc_len <sizeof (*cfg)) +return -EINVAL ; + +return lnet_add_peer_ni_to_peer (cfg->prcfg_key_nid, + cfg->prcfg_cfg_nid); + } + +case IOC_LIBCFS_DEL_PEER_NI : { +struct lnet_ioctl_peer_cfg *cfg = arg; + +if (cfg->prcfg_hdr.ioc_len <sizeof (*cfg)) +return -EINVAL ; + +return lnet_del_peer_ni_from_peer (cfg->prcfg_key_nid, + cfg->prcfg_cfg_nid); + } +case IOC_LIBCFS_GET_PEER_INFO : {struct lnet_ioctl_peer *peer_info = arg;if (peer_info->pr_hdr.ioc_len <sizeof (*peer_info))return -EINVAL ; - return lnet_get_peer_info(peer_info->pr_count, + return lnet_get_peer_ni_info(peer_info->pr_count, &peer_info->pr_nid, peer_info->pr_lnd_u.pr_peer_credits.cr_aliveness, &peer_info->pr_lnd_u.pr_peer_credits.cr_ncpt,
@@ -2336,6 +2357,20 @@ LNetCtl(unsigned int cmd, void *arg) &peer_info->pr_lnd_u.pr_peer_credits.cr_peer_tx_qnob); } +case IOC_LIBCFS_GET_PEER_NI : { +struct lnet_ioctl_peer_cfg *cfg = arg; +struct lnet_peer_ni_credit_info *lpni_cri; +size_t total =sizeof (*cfg) +sizeof (*lpni_cri); + +if (cfg->prcfg_hdr.ioc_len < total) +return -EINVAL ; + + lpni_cri = (struct lnet_peer_ni_credit_info *)cfg->prcfg_bulk; + +return lnet_get_peer_info (cfg->prcfg_idx, &cfg->prcfg_key_nid, + &cfg->prcfg_cfg_nid, lpni_cri); + } +case IOC_LIBCFS_NOTIFY_ROUTER : {time64_t deadline =ktime_get_real_seconds () - data->ioc_u64[0 ];
drivers/staging/lustre/lnet/lnet/lib-move.c +2 -2
@@ -1307,7 +1307,7 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,* received the message on if possible. If not, then pick * a peer_ni to send to */ - best_lpni =lnet_find_peer_ni_locked (dst_nid, cpt); + best_lpni =lnet_find_peer_ni_locked (dst_nid);if (best_lpni) {lnet_peer_ni_decref_locked (best_lpni); goto send;
@@ -1348,7 +1348,7 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,libcfs_nid2str (best_gw->lpni_nid), lnet_msgtyp2str(msg->msg_type), msg->msg_len); - best_lpni =lnet_find_peer_ni_locked (dst_nid, cpt); + best_lpni =lnet_find_peer_ni_locked (dst_nid);LASSERT (best_lpni);lnet_peer_ni_decref_locked (best_lpni);
drivers/staging/lustre/lnet/lnet/peer.c +352 -35
449 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/router.c +1 -1
@@ -1734,7 +1734,7 @@ lnet_notify(struct lnet_ni *ni, lnet_nid_t nid, int alive, time64_t when)return -ESHUTDOWN ; } - lp =lnet_find_peer_ni_locked (nid, cpt); + lp =lnet_find_peer_ni_locked (nid);if (!lp) {/* nid not found */ lnet_net_unlock (cpt);
PATCH 11/34 LU-7734 lnet: configure local NI from DLC
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
This patch adds the ability to configure multiple network interfaces on the same network. This can be done via the lnetctl CLI interface or through a YAML configuration. Refer to the multi-rail HLD for more details on the syntax.
It also deprecates ip2nets kernel parsing. All string parsing and network maching now happens in the DLC userspace library.
New IOCTLs are added for adding/deleting local NIs, to keep backwards compatibility with older version of the DLC and lnetctl.
The changes also include parsing and matching ip2nets syntax at the user level and then passing down the network interfaces down to the kernel to be configured.
Reviewed-on: http://review.whamcloud.com/18886
--- .../lustre/include/linux/libcfs/libcfs_string.h | 12 - .../staging/lustre/include/linux/lnet/lib-lnet.h | 13 - .../lustre/include/uapi/linux/lnet/libcfs_ioctl.h | 6 .../lustre/include/uapi/linux/lnet/lnet-dlc.h | 57 ++ .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 3 drivers/staging/lustre/lnet/lnet/api-ni.c | 479 +++++++++++++++++--- drivers/staging/lustre/lnet/lnet/config.c | 107 +++- drivers/staging/lustre/lnet/lnet/module.c | 70 ++- drivers/staging/lustre/lnet/lnet/peer.c | 21 + drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 2 drivers/staging/lustre/lustre/ptlrpc/service.c | 4 11 files changed, 650 insertions(+), 124 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_string.h +1 -11
@@ -83,20 +83,10 @@ int cfs_expr_list_print(char *buffer, int count, struct cfs_expr_list *expr_list);int cfs_expr_list_values (struct cfs_expr_list *expr_list,int max,u32 **values); -static inline void -cfs_expr_list_values_free (u32 *values,int num) -{ -/* -* This array is allocated by kvalloc(), so it shouldn't be freed -* by OBD_FREE() if it's called by module other than libcfs & LNet, -* otherwise we will see fake memory leak -*/ -kvfree (values); -} -void cfs_expr_list_free (struct cfs_expr_list *expr_list);int cfs_expr_list_parse (char *str,int len,unsigned int min,unsigned int max,struct cfs_expr_list **elpp); +void cfs_expr_list_free (struct cfs_expr_list *expr_list);void cfs_expr_list_free_list (struct list_head *list);#endif
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +9 -4
@@ -377,6 +377,9 @@ lnet_net_alloc(__u32 net_type, struct list_head *netlist);struct lnet_ni *lnet_ni_alloc (struct lnet_net *net,struct cfs_expr_list *el,char *iface); +struct lnet_ni * +lnet_ni_alloc_w_cpt_array (struct lnet_net *net,__u32 *cpts,__u32 ncpts, +char *iface);static inline int lnet_nid2peerhash (lnet_nid_t nid)
@@ -401,7 +404,7 @@ int lnet_cpt_of_nid(lnet_nid_t nid, struct lnet_ni *ni);struct lnet_ni *lnet_nid2ni_locked (lnet_nid_t nid,int cpt);struct lnet_ni *lnet_nid2ni_addref (lnet_nid_t nid);struct lnet_ni *lnet_net2ni_locked (__u32 net,int cpt); -struct lnet_ni *lnet_net2ni (__u32 net); +struct lnet_ni *lnet_net2ni_addref (__u32 net);bool lnet_is_ni_healthy_locked (struct lnet_ni *ni);struct lnet_net *lnet_get_net_locked (u32 net_id);
@@ -435,9 +438,10 @@ int lnet_rtrpools_enable(void);void lnet_rtrpools_disable (void );void lnet_rtrpools_free (int keep_pools);struct lnet_remotenet *lnet_find_rnet_locked (__u32 net); -int lnet_dyn_add_ni (lnet_pid_t requested_pid, -struct lnet_ioctl_config_data *conf); -int lnet_dyn_del_ni (__u32 net); +int lnet_dyn_add_net (struct lnet_ioctl_config_data *conf); +int lnet_dyn_del_net (__u32 net); +int lnet_dyn_add_ni (struct lnet_ioctl_config_ni *conf); +int lnet_dyn_del_ni (struct lnet_ioctl_config_ni *conf);int lnet_clear_lazy_portal (struct lnet_ni *ni,int portal,char *reason);struct lnet_net *lnet_get_net_locked (__u32 net_id);
@@ -646,6 +650,7 @@ int lnet_find_or_create_peer_locked(lnet_nid_t dst_nid, int cpt, struct lnet_peer **peer);int lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt);struct lnet_peer_ni *lnet_find_peer_ni_locked (lnet_nid_t nid); +void lnet_peer_net_added (struct lnet_net *net);void lnet_peer_tables_cleanup (struct lnet_ni *ni);void lnet_peer_uninit (void );int lnet_peer_tables_create (void );
drivers/staging/lustre/include/uapi/linux/lnet/libcfs_ioctl.h +5 -1
@@ -139,6 +139,10 @@ struct libcfs_debug_ioctl_data {#define IOC_LIBCFS_ADD_PEER_NI _IOWR(IOC_LIBCFS_TYPE, 92, IOCTL_CONFIG_SIZE)#define IOC_LIBCFS_DEL_PEER_NI _IOWR(IOC_LIBCFS_TYPE, 93, IOCTL_CONFIG_SIZE)#define IOC_LIBCFS_GET_PEER_NI _IOWR(IOC_LIBCFS_TYPE, 94, IOCTL_CONFIG_SIZE) -#define IOC_LIBCFS_MAX_NR 94 +#define IOC_LIBCFS_ADD_LOCAL_NI _IOWR(IOC_LIBCFS_TYPE, 95, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_DEL_LOCAL_NI _IOWR(IOC_LIBCFS_TYPE, 96, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_GET_LOCAL_NI _IOWR(IOC_LIBCFS_TYPE, 97, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_DBG _IOWR(IOC_LIBCFS_TYPE, 98, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_MAX_NR 98#endif /* __LIBCFS_IOCTL_H__ */
drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h +57 -0
81 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +2 -1
@@ -2700,7 +2700,8 @@ ksocknal_net_start_threads(struct ksock_net *net, __u32 *cpts, int ncpts)int rc;int i; -LASSERT (ncpts >0 && ncpts <=cfs_cpt_number (lnet_cpt_table ())); +if (ncpts >0 && ncpts >cfs_cpt_number (lnet_cpt_table ())) +return -EINVAL ;for (i =0 ; i < ncpts; i++) {struct ksock_sched_info *info;
drivers/staging/lustre/lnet/lnet/api-ni.c +415 -64
602 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/config.c +82 -25
163 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/module.c +56 -14
105 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/peer.c +21 -0
@@ -47,6 +47,27 @@ lnet_peer_remove_from_remote_list(struct lnet_peer_ni *lpni) } } +void +lnet_peer_net_added (struct lnet_net *net) +{ +struct lnet_peer_ni *lpni, *tmp; + +list_for_each_entry_safe (lpni, tmp, &the_lnet.ln_remote_peer_ni_list, + lpni_on_remote_peer_ni_list) { +if (LNET_NIDNET (lpni->lpni_nid) == net->net_id) { + lpni->lpni_net = net; + lpni->lpni_txcredits = + lpni->lpni_mintxcredits = + lpni->lpni_net->net_tunables.lct_peer_tx_credits; + lpni->lpni_rtrcredits = + lpni->lpni_minrtrcredits = +lnet_peer_buffer_credits (lpni->lpni_net); + +lnet_peer_remove_from_remote_list (lpni); + } + } +} +void lnet_peer_tables_destroy (void ) {
drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +1 -1
@@ -726,7 +726,7 @@ static int ptlrpcd_init(void) ptlrpcds_cpt_idx[cpt] = i; } -cfs_expr_list_values_free (cpts, rc); +kfree (cpts); ncpts = rc; } ptlrpcds_num = ncpts;
drivers/staging/lustre/lustre/ptlrpc/service.c +1 -3
@@ -2780,9 +2780,7 @@ ptlrpc_service_free(struct ptlrpc_service *svc)ptlrpc_service_for_each_part (svcpt, i, svc)kfree (svcpt); -if (svc->srv_cpts) -cfs_expr_list_values_free (svc->srv_cpts, svc->srv_ncpts); - +kfree (svc->srv_cpts);kfree (svc); }
PATCH 11/34 LU-7734 lnet: configure local NI from DLC
Quoted 11 lines
From: Amir Shehata <[email protected]>
This patch adds the ability to configure multiple network interfaces on the same network. This can be done via the lnetctl CLI interface or through a YAML configuration. Refer to the multi-rail HLD for more details on the syntax.
It also deprecates ip2nets kernel parsing. All string parsing and network maching now happens in the DLC userspace library.
Quoted 6 lines
New IOCTLs are added for adding/deleting local NIs, to keep backwards compatibility with older version of the DLC and lnetctl.
The changes also include parsing and matching ip2nets syntax at the user level and then passing down the network interfaces down to the kernel to be configured.
Nak. This patch introduces a regression in lnet_ioctl() found in module.c
Quoted 18 lines
Signed-off-by Amir Shehata <[email protected]>Change-Id I19ee7dc76514beb6f34de6517d19654d6468bcecReviewed-on: http://review.whamcloud.com/18886
Tested-by Maloo <[email protected]>Signed-off-by NeilBrown <[email protected]>--- .../lustre/include/linux/libcfs/libcfs_string.h | 12 - .../staging/lustre/include/linux/lnet/lib-lnet.h | 13 - .../lustre/include/uapi/linux/lnet/libcfs_ioctl.h | 6 .../lustre/include/uapi/linux/lnet/lnet-dlc.h | 57 ++ .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 3 drivers/staging/lustre/lnet/lnet/api-ni.c | 479 +++++++++++++++++--- drivers/staging/lustre/lnet/lnet/config.c | 107 +++- drivers/staging/lustre/lnet/lnet/module.c | 70 ++- drivers/staging/lustre/lnet/lnet/peer.c | 21 + drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 2 drivers/staging/lustre/lustre/ptlrpc/service.c | 4 11 files changed, 650 insertions(+), 124 deletions(-)
.....
Quoted 103 lines
drivers/staging/lustre/lnet/lnet/module.c +49
-14@@ -92,7 +92,7 @@ lnet_unconfigure(void) }static int -lnet_dyn_configure (struct libcfs_ioctl_hdr *hdr) +lnet_dyn_configure_net (struct libcfs_ioctl_hdr *hdr) {struct lnet_ioctl_config_data *conf = (struct lnet_ioctl_config_data *)hdr;@@ -102,19 +102,17 @@ lnet_dyn_configure(struct libcfs_ioctl_hdr *hdr)return -EINVAL ;mutex_lock (&lnet_config_mutex); -if (!the_lnet.ln_niinit_self) { +if (the_lnet.ln_niinit_self) + rc =lnet_dyn_add_net (conf); +else rc = -EINVAL ; - goto out_unlock; - } - rc =lnet_dyn_add_ni (LNET_PID_LUSTRE , conf); -out_unlock:mutex_unlock (&lnet_config_mutex);return rc; }static int -lnet_dyn_unconfigure (struct libcfs_ioctl_hdr *hdr) +lnet_dyn_unconfigure_net (struct libcfs_ioctl_hdr *hdr) {struct lnet_ioctl_config_data *conf = (struct lnet_ioctl_config_data *)hdr;@@ -124,12 +122,50 @@ lnet_dyn_unconfigure(struct libcfs_ioctl_hdr *hdr)return -EINVAL ;mutex_lock (&lnet_config_mutex); -if (!the_lnet.ln_niinit_self) { +if (the_lnet.ln_niinit_self) + rc =lnet_dyn_del_net (conf->cfg_net); +else + rc = -EINVAL ; +mutex_unlock (&lnet_config_mutex); + +return rc; +} + +static int +lnet_dyn_configure_ni (struct libcfs_ioctl_hdr *hdr) +{ +struct lnet_ioctl_config_ni *conf = + (struct lnet_ioctl_config_ni *)hdr; +int rc; + +if (conf->lic_cfg_hdr.ioc_len <sizeof (*conf)) +return -EINVAL ; + +mutex_lock (&lnet_config_mutex); +if (the_lnet.ln_niinit_self) + rc =lnet_dyn_add_ni (conf); +else + rc = -EINVAL ; +mutex_unlock (&lnet_config_mutex); + +return rc; +} + +static int +lnet_dyn_unconfigure_ni (struct libcfs_ioctl_hdr *hdr) +{ +struct lnet_ioctl_config_ni *conf = + (struct lnet_ioctl_config_ni *)hdr; +int rc; + +if (conf->lic_cfg_hdr.ioc_len <sizeof (*conf)) +return -EINVAL ; + +mutex_lock (&lnet_config_mutex); +if (the_lnet.ln_niinit_self) + rc =lnet_dyn_del_ni (conf); +else rc = -EINVAL ; - goto out_unlock; - } - rc =lnet_dyn_del_ni (conf->cfg_net); -out_unlock:mutex_unlock (&lnet_config_mutex);return rc;@@ -161,11 +197,17 @@ lnet_ioctl(struct notifier_block *nb,break ;case IOC_LIBCFS_ADD_NET : - rc =lnet_dyn_configure (hdr); + rc =lnet_dyn_configure_net (hdr);break ;case IOC_LIBCFS_DEL_NET : - rc =lnet_dyn_unconfigure (hdr);
drivers/staging/lustre/lnet/lnet/module.c lnet_ioctl(struct notifier_block *nb, · line 213
Quoted 10 lines
drivers/staging/lustre/lnet/lnet/module.c +7
-0+ rc =lnet_dyn_unconfigure_net (hdr); + +case IOC_LIBCFS_ADD_LOCAL_NI : +return lnet_dyn_configure_ni (hdr); + +case IOC_LIBCFS_DEL_LOCAL_NI : +return lnet_dyn_unconfigure_ni (hdr);break ;default :
While the above is mostly correct for the OpenSFS branch that is not the case for the linux client version. The above code assumes we are using libc_register_ioctl() but that was replace by the block_notifier handling for ioctls instead. What we want instead is
case IOC_LIBCFS_DEL_NET:
rc = lnet_dyn_unconfigure_net(hdr);
break;
case IOC_LIBCFS_ADD_LOCAL_NI:
rc = lnet_dyn_configure_ni(hdr);
break;
case IOC_LIBCFS_DEL_LOCAL_NI:
rc = lnet_dyn_unconfigure_ni(hdr);
break;that way the return value is generated by notifier_from_ioctl_errno(rc). This resolves the last bug in see in this patch set with my testing.
PATCH 11/34 LU-7734 lnet: configure local NI from DLC
Quoted 172 lines · James Simmons
Quoted 10 lines
From: Amir Shehata <[email protected]>
This patch adds the ability to configure multiple network interfaces on the same network. This can be done via the lnetctl CLI interface or through a YAML configuration. Refer to the multi-rail HLD for more details on the syntax.
It also deprecates ip2nets kernel parsing. All string parsing and network maching now happens in the DLC userspace library.
Quoted 6 lines
New IOCTLs are added for adding/deleting local NIs, to keep backwards compatibility with older version of the DLC and lnetctl.
The changes also include parsing and matching ip2nets syntax at the user level and then passing down the network interfaces down to the kernel to be configured.
Nak. This patch introduces a regression in
lnet_ioctl()found inmodule.cQuoted 18 lines
Signed-off-by Amir Shehata <[email protected]>Change-Id I19ee7dc76514beb6f34de6517d19654d6468bcecReviewed-on: http://review.whamcloud.com/18886
Tested-by Maloo <[email protected]>Signed-off-by NeilBrown <[email protected]>--- .../lustre/include/linux/libcfs/libcfs_string.h | 12 - .../staging/lustre/include/linux/lnet/lib-lnet.h | 13 - .../lustre/include/uapi/linux/lnet/libcfs_ioctl.h | 6 .../lustre/include/uapi/linux/lnet/lnet-dlc.h | 57 ++ .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 3 drivers/staging/lustre/lnet/lnet/api-ni.c | 479 +++++++++++++++++--- drivers/staging/lustre/lnet/lnet/config.c | 107 +++- drivers/staging/lustre/lnet/lnet/module.c | 70 ++- drivers/staging/lustre/lnet/lnet/peer.c | 21 + drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 2 drivers/staging/lustre/lustre/ptlrpc/service.c | 4 11 files changed, 650 insertions(+), 124 deletions(-).....
Quoted 103 lines
drivers/staging/lustre/lnet/lnet/module.c +49
-14@@ -92,7 +92,7 @@ lnet_unconfigure(void) }static int -lnet_dyn_configure (struct libcfs_ioctl_hdr *hdr) +lnet_dyn_configure_net (struct libcfs_ioctl_hdr *hdr) {struct lnet_ioctl_config_data *conf = (struct lnet_ioctl_config_data *)hdr;@@ -102,19 +102,17 @@ lnet_dyn_configure(struct libcfs_ioctl_hdr *hdr)return -EINVAL ;mutex_lock (&lnet_config_mutex); -if (!the_lnet.ln_niinit_self) { +if (the_lnet.ln_niinit_self) + rc =lnet_dyn_add_net (conf); +else rc = -EINVAL ; - goto out_unlock; - } - rc =lnet_dyn_add_ni (LNET_PID_LUSTRE , conf); -out_unlock:mutex_unlock (&lnet_config_mutex);return rc; }static int -lnet_dyn_unconfigure (struct libcfs_ioctl_hdr *hdr) +lnet_dyn_unconfigure_net (struct libcfs_ioctl_hdr *hdr) {struct lnet_ioctl_config_data *conf = (struct lnet_ioctl_config_data *)hdr;@@ -124,12 +122,50 @@ lnet_dyn_unconfigure(struct libcfs_ioctl_hdr *hdr)return -EINVAL ;mutex_lock (&lnet_config_mutex); -if (!the_lnet.ln_niinit_self) { +if (the_lnet.ln_niinit_self) + rc =lnet_dyn_del_net (conf->cfg_net); +else + rc = -EINVAL ; +mutex_unlock (&lnet_config_mutex); + +return rc; +} + +static int +lnet_dyn_configure_ni (struct libcfs_ioctl_hdr *hdr) +{ +struct lnet_ioctl_config_ni *conf = + (struct lnet_ioctl_config_ni *)hdr; +int rc; + +if (conf->lic_cfg_hdr.ioc_len <sizeof (*conf)) +return -EINVAL ; + +mutex_lock (&lnet_config_mutex); +if (the_lnet.ln_niinit_self) + rc =lnet_dyn_add_ni (conf); +else + rc = -EINVAL ; +mutex_unlock (&lnet_config_mutex); + +return rc; +} + +static int +lnet_dyn_unconfigure_ni (struct libcfs_ioctl_hdr *hdr) +{ +struct lnet_ioctl_config_ni *conf = + (struct lnet_ioctl_config_ni *)hdr; +int rc; + +if (conf->lic_cfg_hdr.ioc_len <sizeof (*conf)) +return -EINVAL ; + +mutex_lock (&lnet_config_mutex); +if (the_lnet.ln_niinit_self) + rc =lnet_dyn_del_ni (conf); +else rc = -EINVAL ; - goto out_unlock; - } - rc =lnet_dyn_del_ni (conf->cfg_net); -out_unlock:mutex_unlock (&lnet_config_mutex);return rc;@@ -161,11 +197,17 @@ lnet_ioctl(struct notifier_block *nb,break ;case IOC_LIBCFS_ADD_NET : - rc =lnet_dyn_configure (hdr); + rc =lnet_dyn_configure_net (hdr);break ;case IOC_LIBCFS_DEL_NET : - rc =lnet_dyn_unconfigure (hdr);drivers/staging/lustre/lnet/lnet/module.c lnet_ioctl(struct notifier_block *nb, · line 213
Quoted 10 lines
drivers/staging/lustre/lnet/lnet/module.c +7
-0+ rc =lnet_dyn_unconfigure_net (hdr); + +case IOC_LIBCFS_ADD_LOCAL_NI : +return lnet_dyn_configure_ni (hdr); + +case IOC_LIBCFS_DEL_LOCAL_NI : +return lnet_dyn_unconfigure_ni (hdr);break ;default :While the above is mostly correct for the OpenSFS branch that is not the case for the linux client version. The above code assumes we are using
libc_register_ioctl()but that was replace by theblock_notifierhandling for ioctls instead. What we want instead iscase IOC_LIBCFS_DEL_NET: rc = lnet_dyn_unconfigure_net(hdr); break; case IOC_LIBCFS_ADD_LOCAL_NI: rc = lnet_dyn_configure_ni(hdr); break; case IOC_LIBCFS_DEL_LOCAL_NI: rc = lnet_dyn_unconfigure_ni(hdr); break;
Quoted 2 lines
that way the return value is generated by
notifier_from_ioctl_errno(rc). This resolves the last bug in see in this patch set with my testing.
Darn - I should have noticed that ! I've fixed it now.
Thanks a lot,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20181002/bb579732/attachment-0001.sig>
PATCH 12/34 LU-7734 lnet: NUMA support
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
This patch adds NUMA node support. NUMA node information is stored in the CPT table. A NUMA node mask is maintained for the entire table as well as for each CPT to track the NUMA nodes related to each of the CPTs. Following key APIs added:
cfs_cpt_of_node(): returns the CPT of particular NUMA node cfs_cpt_distance(): calculates the distance between two CPTs
When the LND device is started it finds the NUMA node of the physical device and then from there it finds the CPT, which is subsequently stored in the NI structure.
When selecting the NI, the MD CPT is determined and the distance between the MD CPT and the device CPT is calculated. The NI with the shortest distance is preferred.
If the device or system is not NUMA aware then the CPT for the device will default to CFS_CPT_ANY and the distance calculated when CFS_CPT_ANY is used is largest in the system. IE, none NUMA aware devices are least preferred.
A NUMA range value can be set. If the value is large enough it amounts to basically turning off NUMA criterion completely.
Reviewed-on: http://review.whamcloud.com/18916
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 1 .../staging/lustre/include/linux/lnet/lib-types.h | 3 .../lustre/include/uapi/linux/lnet/libcfs_ioctl.h | 6 + .../lustre/include/uapi/linux/lnet/lnet-dlc.h | 6 + .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 4 + .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 13 ++ drivers/staging/lustre/lnet/lnet/api-ni.c | 27 +++ drivers/staging/lustre/lnet/lnet/lib-move.c | 160 +++++++++++++++++--- 8 files changed, 195 insertions(+), 25 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +1 -0
@@ -408,6 +408,7 @@ struct lnet_ni *lnet_net2ni_addref(__u32 net);bool lnet_is_ni_healthy_locked (struct lnet_ni *ni);struct lnet_net *lnet_get_net_locked (u32 net_id); +extern unsigned int lnet_numa_range;extern int portal_rotor;int lnet_lib_init (void );
drivers/staging/lustre/include/linux/lnet/lib-types.h +3 -0
@@ -346,6 +346,9 @@ struct lnet_ni {/* lnd tunables set explicitly */ bool ni_lnd_tunables_set; +/* physical device CPT */ +int dev_cpt; +/* sequence number used to round robin over nis within a net */ u32 ni_seq;
drivers/staging/lustre/include/uapi/linux/lnet/libcfs_ioctl.h +4 -2
@@ -142,7 +142,9 @@ struct libcfs_debug_ioctl_data {#define IOC_LIBCFS_ADD_LOCAL_NI _IOWR(IOC_LIBCFS_TYPE, 95, IOCTL_CONFIG_SIZE)#define IOC_LIBCFS_DEL_LOCAL_NI _IOWR(IOC_LIBCFS_TYPE, 96, IOCTL_CONFIG_SIZE)#define IOC_LIBCFS_GET_LOCAL_NI _IOWR(IOC_LIBCFS_TYPE, 97, IOCTL_CONFIG_SIZE) -#define IOC_LIBCFS_DBG _IOWR(IOC_LIBCFS_TYPE, 98, IOCTL_CONFIG_SIZE) -#define IOC_LIBCFS_MAX_NR 98 +#define IOC_LIBCFS_SET_NUMA_RANGE _IOWR(IOC_LIBCFS_TYPE, 98, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_GET_NUMA_RANGE _IOWR(IOC_LIBCFS_TYPE, 99, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_DBG _IOWR(IOC_LIBCFS_TYPE, 100, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_MAX_NR 100#endif /* __LIBCFS_IOCTL_H__ */
drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h +6 -0
@@ -162,6 +162,7 @@ struct lnet_ioctl_config_ni {__u32 lic_status;__u32 lic_tcp_bonding;__u32 lic_idx; +__s32 lic_dev_cpt;char lic_bulk[0 ]; };
@@ -213,6 +214,11 @@ struct lnet_ioctl_peer_cfg {char prcfg_bulk[0 ]; }; +struct lnet_ioctl_numa_range { +struct libcfs_ioctl_hdr nr_hdr; +__u32 nr_range; +}; +struct lnet_ioctl_lnet_stats {struct libcfs_ioctl_hdr st_hdr;struct lnet_counters st_cntrs;
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +4 -0
@@ -2829,6 +2829,7 @@ static int kiblnd_startup(struct lnet_ni *ni)unsigned long flags;int rc;int newdev; +int node_id;LASSERT (ni->ni_net->net_lnd == &the_o2iblnd);
@@ -2878,6 +2879,9 @@ static int kiblnd_startup(struct lnet_ni *ni)if (!ibdev) goto failed; + node_id =dev_to_node (ibdev->ibd_hdev->ibh_ibdev->dma_device); + ni->dev_cpt =cfs_cpt_of_node (lnet_cpt_table (), node_id); + net->ibn_dev = ibdev; ni->ni_nid =LNET_MKNID (LNET_NIDNET (ni->ni_nid), ibdev->ibd_ifip);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +13 -0
@@ -38,6 +38,7 @@* Author: Eric Barton <[email protected]> */ +#include <linux/pci.h> #include "socklnd.h" #include <linux/inetdevice.h>
@@ -2726,6 +2727,8 @@ ksocknal_startup(struct lnet_ni *ni)struct ksock_net *net;int rc;int i; +struct net_device *net_dev; +int node_id;LASSERT (ni->ni_net->net_lnd == &the_ksocklnd);
@@ -2773,6 +2776,16 @@ ksocknal_startup(struct lnet_ni *ni) } } + net_dev =dev_get_by_name (&init_net, + net->ksnn_interfaces[0 ].ksni_name); +if (net_dev) { + node_id =dev_to_node (&net_dev->dev); + ni->dev_cpt =cfs_cpt_of_node (lnet_cpt_table (), node_id); +dev_put (net_dev); + }else { + ni->dev_cpt =CFS_CPT_ANY ; + } +/* call it before add it to ksocknal_data.ksnd_nets */ rc =ksocknal_net_start_threads (net, ni->ni_cpts, ni->ni_ncpts);if (rc)
drivers/staging/lustre/lnet/lnet/api-ni.c +27 -0
@@ -64,6 +64,12 @@ module_param(use_tcp_bonding, int, 0444);MODULE_PARM_DESC (use_tcp_bonding,"Set to 1 to use socklnd bonding. 0 to use Multi-Rail" ); +unsigned int lnet_numa_range; +EXPORT_SYMBOL (lnet_numa_range); +module_param (lnet_numa_range, uint,0444 ); +MODULE_PARM_DESC (lnet_numa_range, +"NUMA range to consider during Multi-Rail selection" ); +/* * This sequence number keeps track of how many times DLC was used to * update the configuration. It is incremented on any DLC update and
@@ -1896,6 +1902,7 @@ lnet_fill_ni_info(struct lnet_ni *ni, struct lnet_ioctl_config_ni *cfg_ni, cfg_ni->lic_nid = ni->ni_nid; cfg_ni->lic_status = ni->ni_status->ns_status; cfg_ni->lic_tcp_bonding = use_tcp_bonding; + cfg_ni->lic_dev_cpt = ni->dev_cpt;memcpy (&tun->lt_cmn, &ni->ni_net->net_tunables,sizeof (tun->lt_cmn));
@@ -2642,6 +2649,26 @@ LNetCtl(unsigned int cmd, void *arg)mutex_unlock (&the_lnet.ln_api_mutex);return rc; +case IOC_LIBCFS_SET_NUMA_RANGE : { +struct lnet_ioctl_numa_range *numa; + + numa = arg; +if (numa->nr_hdr.ioc_len !=sizeof (*numa)) +return -EINVAL ; + lnet_numa_range = numa->nr_range; +return 0 ; + } + +case IOC_LIBCFS_GET_NUMA_RANGE : { +struct lnet_ioctl_numa_range *numa; + + numa = arg; +if (numa->nr_hdr.ioc_len !=sizeof (*numa)) +return -EINVAL ; + numa->nr_range = lnet_numa_range; +return 0 ; + } +case IOC_LIBCFS_GET_BUF : {struct lnet_ioctl_pool_cfg *pool_cfg;size_t total =sizeof (*config) +sizeof (*pool_cfg);
drivers/staging/lustre/lnet/lnet/lib-move.c +137 -23
225 lines not on this page · raw message
PATCH 12/34 LU-7734 lnet: NUMA support
Quoted 24 lines
From: Amir Shehata <[email protected]>
This patch adds NUMA node support. NUMA node information is stored in the CPT table. A NUMA node mask is maintained for the entire table as well as for each CPT to track the NUMA nodes related to each of the CPTs. Following key APIs added:
cfs_cpt_of_node(): returns the CPT of particular NUMA nodecfs_cpt_distance(): calculates the distance between two CPTsWhen the LND device is started it finds the NUMA node of the physical device and then from there it finds the CPT, which is subsequently stored in the NI structure.
When selecting the NI, the MD CPT is determined and the distance between the MD CPT and the device CPT is calculated. The NI with the shortest distance is preferred.
If the device or system is not NUMA aware then the CPT for the device will default to
CFS_CPT_ANYand the distance calculated whenCFS_CPT_ANYis used is largest in the system. IE, none NUMA aware devices are least preferred.
Quoted 8 lines
A NUMA range value can be set. If the value is large enough it amounts to basically turning off NUMA criterion completely.
Signed-off-by Amir Shehata <[email protected]>Change-Id I2d7c63f8e8fc8e8a6a249b0d6bfdd08fd090a837Reviewed-on: http://review.whamcloud.com/18916
Tested-by JenkinsTested-by Maloo <[email protected]>
We can remove the Test-by: as well.
Quoted 429 lines
Reviewed-by Olaf Weber <[email protected]>Reviewed-by Doug Oucharek <[email protected]>Signed-off-by NeilBrown <[email protected]>--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 1 .../staging/lustre/include/linux/lnet/lib-types.h | 3 .../lustre/include/uapi/linux/lnet/libcfs_ioctl.h | 6 + .../lustre/include/uapi/linux/lnet/lnet-dlc.h | 6 + .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 4 + .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 13 ++ drivers/staging/lustre/lnet/lnet/api-ni.c | 27 +++ drivers/staging/lustre/lnet/lnet/lib-move.c | 160 +++++++++++++++++--- 8 files changed, 195 insertions(+), 25 deletions(-)drivers/staging/lustre/include/linux/lnet/lib-lnet.h +1
-0@@ -408,6 +408,7 @@ struct lnet_ni *lnet_net2ni_addref(__u32 net);bool lnet_is_ni_healthy_locked (struct lnet_ni *ni);struct lnet_net *lnet_get_net_locked (u32 net_id); +extern unsigned int lnet_numa_range;extern int portal_rotor;int lnet_lib_init (void );drivers/staging/lustre/include/linux/lnet/lib-types.h +3
-0@@ -346,6 +346,9 @@ struct lnet_ni {/* lnd tunables set explicitly */ bool ni_lnd_tunables_set; +/* physical device CPT */ +int dev_cpt; +/* sequence number used to round robin over nis within a net */ u32 ni_seq;drivers/staging/lustre/include/uapi/linux/lnet/libcfs_ioctl.h +4
-2@@ -142,7 +142,9 @@ struct libcfs_debug_ioctl_data {#define IOC_LIBCFS_ADD_LOCAL_NI _IOWR(IOC_LIBCFS_TYPE, 95, IOCTL_CONFIG_SIZE)#define IOC_LIBCFS_DEL_LOCAL_NI _IOWR(IOC_LIBCFS_TYPE, 96, IOCTL_CONFIG_SIZE)#define IOC_LIBCFS_GET_LOCAL_NI _IOWR(IOC_LIBCFS_TYPE, 97, IOCTL_CONFIG_SIZE) -#define IOC_LIBCFS_DBG _IOWR(IOC_LIBCFS_TYPE, 98, IOCTL_CONFIG_SIZE) -#define IOC_LIBCFS_MAX_NR 98 +#define IOC_LIBCFS_SET_NUMA_RANGE _IOWR(IOC_LIBCFS_TYPE, 98, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_GET_NUMA_RANGE _IOWR(IOC_LIBCFS_TYPE, 99, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_DBG _IOWR(IOC_LIBCFS_TYPE, 100, IOCTL_CONFIG_SIZE) +#define IOC_LIBCFS_MAX_NR 100#endif /* __LIBCFS_IOCTL_H__ */ drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h +6
-0@@ -162,6 +162,7 @@ struct lnet_ioctl_config_ni {__u32 lic_status;__u32 lic_tcp_bonding;__u32 lic_idx; +__s32 lic_dev_cpt;char lic_bulk[0 ]; };@@ -213,6 +214,11 @@ struct lnet_ioctl_peer_cfg {char prcfg_bulk[0 ]; }; +struct lnet_ioctl_numa_range { +struct libcfs_ioctl_hdr nr_hdr; +__u32 nr_range; +}; +struct lnet_ioctl_lnet_stats {struct libcfs_ioctl_hdr st_hdr;struct lnet_counters st_cntrs;drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +4
-0@@ -2829,6 +2829,7 @@ static int kiblnd_startup(struct lnet_ni *ni)unsigned long flags;int rc;int newdev; +int node_id;LASSERT (ni->ni_net->net_lnd == &the_o2iblnd);@@ -2878,6 +2879,9 @@ static int kiblnd_startup(struct lnet_ni *ni)if (!ibdev) goto failed; + node_id =dev_to_node (ibdev->ibd_hdev->ibh_ibdev->dma_device); + ni->dev_cpt =cfs_cpt_of_node (lnet_cpt_table (), node_id); + net->ibn_dev = ibdev; ni->ni_nid =LNET_MKNID (LNET_NIDNET (ni->ni_nid), ibdev->ibd_ifip);drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +13
-0@@ -38,6 +38,7 @@* Author: Eric Barton <[email protected]> */ +#include <linux/pci.h> #include "socklnd.h" #include <linux/inetdevice.h> @@ -2726,6 +2727,8 @@ ksocknal_startup(struct lnet_ni *ni)struct ksock_net *net;int rc;int i; +struct net_device *net_dev; +int node_id;LASSERT (ni->ni_net->net_lnd == &the_ksocklnd);@@ -2773,6 +2776,16 @@ ksocknal_startup(struct lnet_ni *ni) } } + net_dev =dev_get_by_name (&init_net, + net->ksnn_interfaces[0 ].ksni_name); +if (net_dev) { + node_id =dev_to_node (&net_dev->dev); + ni->dev_cpt =cfs_cpt_of_node (lnet_cpt_table (), node_id); +dev_put (net_dev); + }else { + ni->dev_cpt =CFS_CPT_ANY ; + } +/* call it before add it to ksocknal_data.ksnd_nets */ rc =ksocknal_net_start_threads (net, ni->ni_cpts, ni->ni_ncpts);if (rc)drivers/staging/lustre/lnet/lnet/api-ni.c +27
-0@@ -64,6 +64,12 @@ module_param(use_tcp_bonding, int, 0444);MODULE_PARM_DESC (use_tcp_bonding,"Set to 1 to use socklnd bonding. 0 to use Multi-Rail" ); +unsigned int lnet_numa_range; +EXPORT_SYMBOL (lnet_numa_range); +module_param (lnet_numa_range, uint,0444 ); +MODULE_PARM_DESC (lnet_numa_range, +"NUMA range to consider during Multi-Rail selection" ); +/* * This sequence number keeps track of how many times DLC was used to * update the configuration. It is incremented on any DLC update and @@ -1896,6 +1902,7 @@ lnet_fill_ni_info(struct lnet_ni *ni, struct lnet_ioctl_config_ni *cfg_ni, cfg_ni->lic_nid = ni->ni_nid; cfg_ni->lic_status = ni->ni_status->ns_status; cfg_ni->lic_tcp_bonding = use_tcp_bonding; + cfg_ni->lic_dev_cpt = ni->dev_cpt;memcpy (&tun->lt_cmn, &ni->ni_net->net_tunables,sizeof (tun->lt_cmn));@@ -2642,6 +2649,26 @@ LNetCtl(unsigned int cmd, void *arg)mutex_unlock (&the_lnet.ln_api_mutex);return rc; +case IOC_LIBCFS_SET_NUMA_RANGE : { +struct lnet_ioctl_numa_range *numa; + + numa = arg; +if (numa->nr_hdr.ioc_len !=sizeof (*numa)) +return -EINVAL ; + lnet_numa_range = numa->nr_range; +return 0 ; + } + +case IOC_LIBCFS_GET_NUMA_RANGE : { +struct lnet_ioctl_numa_range *numa; + + numa = arg; +if (numa->nr_hdr.ioc_len !=sizeof (*numa)) +return -EINVAL ; + numa->nr_range = lnet_numa_range; +return 0 ; + } +case IOC_LIBCFS_GET_BUF : {struct lnet_ioctl_pool_cfg *pool_cfg;size_t total =sizeof (*config) +sizeof (*pool_cfg);drivers/staging/lustre/lnet/lnet/lib-move.c +137
-23@@ -1109,6 +1109,10 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,int best_credits =0 ;u32 seq, seq2;int best_lpni_credits =INT_MIN ; +int md_cpt =0 ; +unsigned int shortest_distance =UINT_MAX ; +unsigned int distance =0 ; +bool found_ir = false; again:/* @@ -1127,12 +1131,20 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid, routing = false; local_net =NULL ; best_ni =NULL ; + shortest_distance =UINT_MAX ; + found_ir = false;if (the_lnet.ln_shutdown) {lnet_net_unlock (cpt);return -ESHUTDOWN ; } +if (msg->msg_md) +/* get the cpt of the MD, used during NUMA based selection */ + md_cpt =lnet_cpt_of_cookie (msg->msg_md->md_lh.lh_cookie); +else + md_cpt =CFS_CPT_ANY ; +/* * initialize the variables which could be reused if we go to * again @@ -1258,34 +1270,113 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,continue ;/* -* Second jab at determining best_ni -* if we get here then the peer we're trying to send -* to is on a directly connected network, and we'll -* need to pick the local_ni on that network to send -* from +* Iterate through the NIs in this local Net and select +* the NI to send from. The selection is determined by +* these 3 criterion in the following priority: +* 1. NUMA +* 2. NI available credits +* 3. Round Robin */ while ((ni =lnet_get_next_ni_locked (local_net, ni))) {if (!lnet_is_ni_healthy_locked (ni))continue ; -/* TODO: compare NUMA distance */ -if (ni->ni_tx_queues[cpt]->tq_credits <= - best_credits) { + +/* +* calculate the distance from the cpt on which +* the message memory is allocated to the CPT of +* the NI's physical device +*/ + distance =cfs_cpt_distance (lnet_cpt_table (), + md_cpt, + ni->dev_cpt); + +/* +* If we already have a closer NI within the NUMA +* range provided, then there is no need to +* consider the current NI. Move on to the next +* one. +*/ +if (distance > shortest_distance && + distance > lnet_numa_range) +continue ; + +if (distance < shortest_distance && + distance > lnet_numa_range) {/* -* all we want is to read tq_credits -* value as an approximation of how -* busy the NI is. No need to grab a lock +* The current NI is the closest one that we +* have found, even though it's not in the +* NUMA range specified. This occurs if +* the NUMA range is less than the least +* of the distances in the system. +* In effect NUMA range consideration is +* turned off. */ -continue ; - }else if (best_ni) { -if ((best_ni)->ni_seq - ni->ni_seq <=0 ) + shortest_distance = distance; + }else if ((distance <= shortest_distance && + distance < lnet_numa_range) || + distance == shortest_distance) { +/* +* This NI is either within range or it's +* equidistant. In both of these cases we +* would want to select the NI based on +* its available credits first, and then +* via Round Robin. +*/ +if (distance <= shortest_distance && + distance < lnet_numa_range) { +/* +* If this is the first NI that's +* within range, then set the +* shortest distance to the range +* specified by the user. In +* effect we're saying that all +* NIs that fall within this NUMA +* range shall be dealt with as +* having equal NUMA weight. Which +* will mean that we should select +* through that set by their +* available credits first +* followed by Round Robin. +* +* And since this is the first NI +* in the range, let's just set it +* as our best_ni for now. The +* following NIs found in the +* range will be dealt with as +* mentioned previously. +*/ + shortest_distance = lnet_numa_range; +if (!found_ir) { + found_ir = true; + goto set_ni; + } + } +/* +* This NI is NUMA equidistant let's +* select using credits followed by Round +* Robin. +*/ +if (ni->ni_tx_queues[cpt]->tq_credits < + best_credits) {continue ; - (best_ni)->ni_seq = ni->ni_seq +1 ; + }else if (ni->ni_tx_queues[cpt]->tq_credits == + best_credits) { +if (best_ni && + best_ni->ni_seq <= ni->ni_seq) +continue ; + } } - +set_ni: best_ni = ni; best_credits = ni->ni_tx_queues[cpt]->tq_credits; } } +/* +* Now that we selected the NI to use increment its sequence +* number so the Round Robin algorithm will detect that it has +* been used and pick the next NI. +*/ + best_ni->ni_seq++;if (!best_ni) {lnet_net_unlock (cpt);@@ -1372,29 +1463,52 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid, best_lpni =NULL ;while ((lpni =lnet_get_next_peer_ni_locked (peer, peer_net, lpni))) {/* -* if this peer ni is not healty just skip it, no point in +* if this peer ni is not healthy just skip it, no point in * examining it further */ if (!lnet_is_peer_ni_healthy_locked (lpni))continue ; ni_is_pref =lnet_peer_is_ni_pref_locked (lpni, best_ni); +/* if this is a preferred peer use it */ if (!preferred && ni_is_pref) { preferred = true; }else if (preferred && !ni_is_pref) { +/* +* this is not the preferred peer so let's ignore +* it. +*/ continue ; - }else if (lpni->lpni_txcredits <= best_lpni_credits) { + }else if (lpni->lpni_txcredits < best_lpni_credits) { +/* +* We already have a peer that has more credits +* available than this one. No need to consider +* this peer further. +*/ continue ; - }else if (best_lpni) { -if (best_lpni->lpni_seq - lpni->lpni_seq <=0 ) -continue ; - best_lpni->lpni_seq = lpni->lpni_seq +1 ; + }else if (lpni->lpni_txcredits == best_lpni_credits) { +/* +* The best peer found so far and the current peer +* have the same number of available credits let's +* make sure to select between them using Round +* Robin +*/ +if (best_lpni) { +if (best_lpni->lpni_seq <= lpni->lpni_seq) +continue ; + } } best_lpni = lpni; best_lpni_credits = lpni->lpni_txcredits; } +/* +* Increment sequence number of the peer selected so that we can +* pick the next one in Round Robin. +*/ + best_lpni->lpni_seq++; +/* if we still can't find a peer ni then we can't reach it */ if (!best_lpni) { u32 net_id = peer_net ? peer_net->lpn_net_id :@@ -1403,7 +1517,7 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,lnet_net_unlock (cpt);LCONSOLE_WARN ("no peer_ni found on peer net %s\n" ,libcfs_net2str (net_id)); - goto again; +return -EHOSTUNREACH ; } send:
PATCH 13/34 LU-7734 lnet: Primary NID and traffic distribution
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
When receiving messages from a multi-rail peer we must keep track of both the source NID and the primary NID of the peer. When sending a reply message or RPC respone, the source NID is preferred. But most other uses require identifcation of the peer regardless of which source NID the message came from, and so the primary NID of the peer must then be used.
An example for this is the creation of match entries. Another occurs when an event is created: the initiator should be the primary NID, to ensure upper layers (PtlRPC and Lustre) always see the same NID for that peer.
This change also contains code to have PtlRPC use LNET_NID_ANY for the 'self' parameter of LNetPut() and LNetGet() when it doesn't care which NI it sends from, and to provide a local/peer NID pair when it does. This can be broken out into a separate change.
Reviewed-on: http://review.whamcloud.com/18938
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 1 .../staging/lustre/include/linux/lnet/lib-types.h | 2 + .../lustre/include/uapi/linux/lnet/lnet-types.h | 4 +- drivers/staging/lustre/lnet/lnet/lib-move.c | 49 ++++++++++++-------- drivers/staging/lustre/lnet/lnet/lib-msg.c | 10 +++- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 3 + drivers/staging/lustre/lnet/lnet/peer.c | 18 +++++++ drivers/staging/lustre/lustre/include/lustre_net.h | 2 + drivers/staging/lustre/lustre/ptlrpc/events.c | 5 ++ drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 16 +++---- 10 files changed, 77 insertions(+), 33 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +1 -0
@@ -652,6 +652,7 @@ int lnet_find_or_create_peer_locked(lnet_nid_t dst_nid, int cpt,int lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt);struct lnet_peer_ni *lnet_find_peer_ni_locked (lnet_nid_t nid);void lnet_peer_net_added (struct lnet_net *net); +lnet_nid_t lnet_peer_primary_nid (lnet_nid_t nid);void lnet_peer_tables_cleanup (struct lnet_ni *ni);void lnet_peer_uninit (void );int lnet_peer_tables_create (void );
drivers/staging/lustre/include/linux/lnet/lib-types.h +2 -0
@@ -61,6 +61,8 @@ struct lnet_msg {struct list_head msg_list;/* Q for credits/MD */ struct lnet_process_id msg_target; +/* Primary NID of the source. */ +lnet_nid_t msg_initiator;/* where is it from, it's only for building event */ lnet_nid_t msg_from;__u32 msg_type;
drivers/staging/lustre/include/uapi/linux/lnet/lnet-types.h +3 -1
@@ -563,10 +563,12 @@ struct lnet_event {struct lnet_process_id target;/** The identifier (nid, pid) of the initiator. */ struct lnet_process_id initiator; +/** The source NID on the initiator. */ +struct lnet_process_id source;/** * The NID of the immediate sender. If the request has been forwarded * by routers, this is the NID of the last hop; otherwise it's the -* same as the initiator. +* same as the source. */ lnet_nid_t sender;/** Indicates the type of the event. */
drivers/staging/lustre/lnet/lnet/lib-move.c +29 -20
97 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lib-msg.c +8 -2
@@ -70,13 +70,19 @@ lnet_build_msg_event(struct lnet_msg *msg, enum lnet_event_kind ev_type) ev->target.pid =le32_to_cpu (hdr->dest_pid); ev->initiator.nid =LNET_NID_ANY ; ev->initiator.pid = the_lnet.ln_pid; + ev->source.nid =LNET_NID_ANY ; + ev->source.pid = the_lnet.ln_pid; ev->sender =LNET_NID_ANY ; }else {/* event for passive message */ ev->target.pid = hdr->dest_pid; ev->target.nid = hdr->dest_nid; ev->initiator.pid = hdr->src_pid; - ev->initiator.nid = hdr->src_nid; +/* Multi-Rail: resolve src_nid to "primary" peer NID */ + ev->initiator.nid = msg->msg_initiator; +/* Multi-Rail: track source NID. */ + ev->source.pid = hdr->src_pid; + ev->source.nid = hdr->src_nid; ev->rlength = hdr->payload_length; ev->sender = msg->msg_from; ev->mlength = msg->msg_wanted;
@@ -381,7 +387,7 @@ lnet_complete_msg_locked(struct lnet_msg *msg, int cpt) ack_wmd = msg->msg_hdr.msg.put.ack_wmd; -lnet_prep_send (msg,LNET_MSG_ACK , msg->msg_ev.initiator,0 ,0 ); +lnet_prep_send (msg,LNET_MSG_ACK , msg->msg_ev.source,0 ,0 ); msg->msg_hdr.msg.ack.dst_wmd = ack_wmd; msg->msg_hdr.msg.ack.match_bits = msg->msg_ev.match_bits;
drivers/staging/lustre/lnet/lnet/lib-ptl.c +2 -1
@@ -687,7 +687,8 @@ lnet_ptl_attach_md(struct lnet_me *me, struct lnet_libmd *md,LASSERT (msg->msg_rx_delayed || head == &ptl->ptl_msg_stealing); hdr = &msg->msg_hdr; - info.mi_id.nid = hdr->src_nid; +/* Multi-Rail: Primary peer NID */ + info.mi_id.nid = msg->msg_initiator; info.mi_id.pid = hdr->src_pid; info.mi_opc =LNET_MD_OP_PUT ; info.mi_portal = hdr->msg.put.ptl_index;
drivers/staging/lustre/lnet/lnet/peer.c +18 -0
@@ -394,6 +394,24 @@ lnet_peer_is_ni_pref_locked(struct lnet_peer_ni *lpni, struct lnet_ni *ni)return false; } +lnet_nid_t +lnet_peer_primary_nid (lnet_nid_t nid) +{ +struct lnet_peer_ni *lpni; +lnet_nid_t primary_nid = nid; +int cpt; + + cpt =lnet_net_lock_current (); + lpni =lnet_find_peer_ni_locked (nid); +if (lpni) { + primary_nid = lpni->lpni_peer_net->lpn_peer->lp_primary_nid; +lnet_peer_ni_decref_locked (lpni); + } +lnet_net_unlock (cpt); + +return primary_nid; +} +static void lnet_try_destroy_peer_hierarchy_locked (struct lnet_peer_ni *lpni) {
drivers/staging/lustre/lustre/include/lustre_net.h +2 -0
@@ -882,6 +882,8 @@ struct ptlrpc_request {lnet_nid_t rq_self;/** Peer description (the other side) */ struct lnet_process_id rq_peer; +/** Descriptor for the NID from which the peer sent the request. */ +struct lnet_process_id rq_source;/** * service time estimate (secs) * If the request is not served by this time, it is marked as timed out.
drivers/staging/lustre/lustre/ptlrpc/events.c +4 -1
@@ -342,7 +342,9 @@ void request_in_callback(struct lnet_event *ev)if (ev->type ==LNET_EVENT_PUT && ev->status ==0 ) req->rq_reqdata_len = ev->mlength;ktime_get_real_ts64 (&req->rq_arrival_time); +/* Multi-Rail: keep track of both initiator and source NID. */ req->rq_peer = ev->initiator; + req->rq_source = ev->source; req->rq_self = ev->target.nid; req->rq_rqbd = rqbd; req->rq_phase =RQ_PHASE_NEW ;
@@ -350,7 +352,8 @@ void request_in_callback(struct lnet_event *ev)CDEBUG (D_INFO ,"incoming req@%p x%llu msgsize %u\n" , req, req->rq_xid, ev->mlength); -CDEBUG (D_RPCTRACE ,"peer: %s\n" ,libcfs_id2str (req->rq_peer)); +CDEBUG (D_RPCTRACE ,"peer: %s (source: %s)\n" , +libcfs_id2str (req->rq_peer),libcfs_id2str (req->rq_source));spin_lock (&svcpt->scp_lock);
drivers/staging/lustre/lustre/ptlrpc/niobuf.c +8 -8
@@ -47,14 +47,14 @@*/ static int ptl_send_buf (struct lnet_handle_md *mdh,void *base,int len,enum lnet_ack_req ack,struct ptlrpc_cb_id *cbid, -struct ptlrpc_connection *conn,int portal,__u64 xid, -unsigned int offset) +lnet_nid_t self,struct lnet_process_id peer_id, +int portal,__u64 xid,unsigned int offset) {int rc;struct lnet_md md;LASSERT (portal !=0 ); -CDEBUG (D_INFO ,"conn=%p id %s\n" , conn,libcfs_id2str (conn->c_peer)); +CDEBUG (D_INFO ,"peer_id %s\n" ,libcfs_id2str (peer_id)); md.start = base; md.length = len; md.threshold = (ack ==LNET_ACK_REQ ) ?2 :1 ;
@@ -79,8 +79,8 @@ static int ptl_send_buf(struct lnet_handle_md *mdh, void *base, int len,CDEBUG (D_NET ,"Sending %d bytes to portal %d, xid %lld, offset %u\n" , len, portal, xid, offset); - rc =LNetPut (conn->c_self, *mdh, ack, - conn->c_peer, portal, xid, offset,0 ); + rc =LNetPut (self, *mdh, ack, + peer_id, portal, xid, offset,0 );if (unlikely (rc !=0 )) {int rc2;/* We're going to get an UNLINK event when I unlink below,
@@ -88,7 +88,7 @@ static int ptl_send_buf(struct lnet_handle_md *mdh, void *base, int len,* I fall through and return success here! */ CERROR ("LNetPut(%s, %d, %lld) failed: %d\n" , -libcfs_id2str (conn->c_peer), portal, xid, rc); +libcfs_id2str (peer_id), portal, xid, rc); rc2 =LNetMDUnlink (*mdh);LASSERTF (rc2 ==0 ,"rc2 = %d\n" , rc2); }
@@ -415,7 +415,7 @@ int ptlrpc_send_reply(struct ptlrpc_request *req, int flags) rc =ptl_send_buf (&rs->rs_md_h, rs->rs_repbuf, rs->rs_repdata_len, (rs->rs_difficult && !rs->rs_no_ack) ?LNET_ACK_REQ :LNET_NOACK_REQ , - &rs->rs_cb_id, conn, + &rs->rs_cb_id, req->rq_self, req->rq_source,ptlrpc_req2svc (req)->srv_rep_portal, req->rq_xid, req->rq_reply_off); out:
@@ -683,7 +683,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) rc =ptl_send_buf (&request->rq_req_md_h, request->rq_reqbuf, request->rq_reqdata_len,LNET_NOACK_REQ , &request->rq_req_cbid, - connection, +LNET_NID_ANY , connection->c_peer, request->rq_request_portal, request->rq_xid,0 );if (likely (rc ==0 ))
PATCH 14/34 LU-7734 lnet: handle non-MR peers
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
Add the ability to declare a peer to be non-MR from the DLC interface. By default if a peer is configured from DLC it is assumed to be MR capable, except when the non-mr flag is set.
For non-MR peers always use the same NI to communicate with it. If multiple NIs are used to communicate with a non-MR peer the peer will consider that it's talking to different peers which could cause upper layers to be confused.
Reviewed-on: http://review.whamcloud.com/19305
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 17 ++++++++++++++++- .../lustre/include/uapi/linux/lnet/lnet-dlc.h | 1 + drivers/staging/lustre/lnet/lnet/api-ni.c | 3 ++- drivers/staging/lustre/lnet/lnet/lib-move.c | 13 +++++++++++++ drivers/staging/lustre/lnet/lnet/peer.c | 7 ++++--- 5 files changed, 36 insertions(+), 5 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +16 -1
@@ -661,7 +661,7 @@ struct lnet_peer_net *lnet_peer_get_net_locked(struct lnet_peer *peer, u32 net_id);bool lnet_peer_is_ni_pref_locked (struct lnet_peer_ni *lpni,struct lnet_ni *ni); -int lnet_add_peer_ni_to_peer (lnet_nid_t key_nid,lnet_nid_t nid); +int lnet_add_peer_ni_to_peer (lnet_nid_t key_nid,lnet_nid_t nid,bool mr);int lnet_del_peer_ni_from_peer (lnet_nid_t key_nid,lnet_nid_t nid);int lnet_get_peer_info (__u32 idx,lnet_nid_t *primary_nid,lnet_nid_t *nid,struct lnet_peer_ni_credit_info *peer_ni_info);
@@ -672,6 +672,21 @@ int lnet_get_peer_ni_info(__u32 peer_index, __u64 *nid, __u32 *peer_rtr_credits, __u32 *peer_min_rtr_credtis, __u32 *peer_tx_qnob); +static inline __u32 +lnet_get_num_peer_nis (struct lnet_peer *peer) +{ +struct lnet_peer_net *lpn; +struct lnet_peer_ni *lpni; +__u32 count =0 ; + +list_for_each_entry (lpn, &peer->lp_peer_nets, lpn_on_peer_list) +list_for_each_entry (lpni, &lpn->lpn_peer_nis, + lpni_on_peer_net_list) + count++; + +return count; +} +static inline bool lnet_is_peer_ni_healthy_locked (struct lnet_peer_ni *lpni) {
drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h +1 -0
@@ -211,6 +211,7 @@ struct lnet_ioctl_peer_cfg {lnet_nid_t prcfg_key_nid;lnet_nid_t prcfg_cfg_nid;__u32 prcfg_idx; +bool prcfg_mr;char prcfg_bulk[0 ]; };
drivers/staging/lustre/lnet/lnet/api-ni.c +2 -1
@@ -2689,7 +2689,8 @@ LNetCtl(unsigned int cmd, void *arg)return -EINVAL ;return lnet_add_peer_ni_to_peer (cfg->prcfg_key_nid, - cfg->prcfg_cfg_nid); + cfg->prcfg_cfg_nid, + cfg->prcfg_mr); }case IOC_LIBCFS_DEL_PEER_NI : {
drivers/staging/lustre/lnet/lnet/lib-move.c +13 -0
@@ -1164,6 +1164,12 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,return -EHOSTUNREACH ; } +if (!peer->lp_multi_rail &&lnet_get_num_peer_nis (peer) >1 ) { +CERROR ("peer %s is declared to be non MR capable, yet configured with more than one NID\n" , +libcfs_nid2str (dst_nid)); +return -EINVAL ; + } +/* * STEP 1: first jab at determineing best_ni * if src_nid is explicitly specified, then best_ni is already
@@ -1361,6 +1367,13 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,*/ best_ni->ni_seq++; +/* +* if the peer is not MR capable, then we should always send to it +* using the first NI in the NET we determined. +*/ +if (!peer->lp_multi_rail && local_net) + best_ni =lnet_net2ni_locked (local_net->net_id, cpt); +if (!best_ni) {lnet_net_unlock (cpt); LCONSOLE_WARN("No local ni found to send from to %s\n",
drivers/staging/lustre/lnet/lnet/peer.c +4 -3
@@ -477,6 +477,7 @@ lnet_build_peer_hierarchy(struct lnet_peer_ni *lpni) peer_net->lpn_peer = peer; lpni->lpni_peer_net = peer_net; peer->lp_primary_nid = lpni->lpni_nid; + peer->lp_multi_rail = false;list_add_tail (&peer_net->lpn_on_peer_list, &peer->lp_peer_nets);list_add_tail (&lpni->lpni_on_peer_net_list, &peer_net->lpn_peer_nis);list_add_tail (&peer->lp_on_lnet_peer_list, &the_lnet.ln_peers);
@@ -502,7 +503,7 @@ lnet_peer_get_net_locked(struct lnet_peer *peer, u32 net_id)* is unique */ int -lnet_add_peer_ni_to_peer (lnet_nid_t key_nid,lnet_nid_t nid) +lnet_add_peer_ni_to_peer (lnet_nid_t key_nid,lnet_nid_t nid,bool mr) {struct lnet_peer_ni *lpni, *lpni2;struct lnet_peer *peer;
@@ -535,14 +536,14 @@ lnet_add_peer_ni_to_peer(lnet_nid_t key_nid, lnet_nid_t nid)return -EINVAL ; } peer = lpni->lpni_peer_net->lpn_peer; - peer->lp_multi_rail = true; + peer->lp_multi_rail = mr;lnet_peer_ni_decref_locked (lpni);lnet_net_unlock (cpt2); }else {lnet_net_lock (LNET_LOCK_EX ); rc =lnet_nid2peerni_locked (&lpni, nid,LNET_LOCK_EX );if (rc ==0 ) { - lpni->lpni_peer_net->lpn_peer->lp_multi_rail = true; + lpni->lpni_peer_net->lpn_peer->lp_multi_rail = mr;lnet_peer_ni_decref_locked (lpni); }lnet_net_unlock (LNET_LOCK_EX );
PATCH 15/34 LU-7734 lnet: handle N NIs to 1 LND peer
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
This patch changes o2iblnd only, as socklnd already handles this case. In the new design you can have multiple NIs communicating to one peer. In the o2ilbnd the kib_peer has a pointer to the NI which implies a 1:1 relationship.
This patch changes kiblnd_find_peer_locked() to use the peer NID and the NI NID as the key. This way a new peer will be created for each unique NI/peer_NI pair.
This is similar to how socklnd handles this case.
Reviewed-on: http://review.whamcloud.com/19306
--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 13 ++++++++++--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 2 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 8 ++++---- 3 files changed, 15 insertions(+), 8 deletions(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +10 -3
@@ -379,7 +379,7 @@ void kiblnd_destroy_peer(struct kib_peer *peer)atomic_dec (&net->ibn_npeers); } -struct kib_peer *kiblnd_find_peer_locked (lnet_nid_t nid) +struct kib_peer *kiblnd_find_peer_locked (struct lnet_ni *ni,lnet_nid_t nid) {/* * the caller is responsible for accounting the additional reference
@@ -391,7 +391,14 @@ struct kib_peer *kiblnd_find_peer_locked(lnet_nid_t nid)list_for_each_entry (peer, peer_list, ibp_list) {LASSERT (!kiblnd_peer_idle (peer)); -if (peer->ibp_nid != nid) +/* +* Match a peer if its NID and the NID of the local NI it +* communicates over are the same. Otherwise don't match +* the peer, which will result in a new lnd peer being +* created. +*/ +if (peer->ibp_nid != nid || + peer->ibp_ni->ni_nid != ni->ni_nid)continue ; CDEBUG(D_NET, "got peer [%p] -> %s (%d) version: %x\n",
@@ -1041,7 +1048,7 @@ static void kiblnd_query(struct lnet_ni *ni, lnet_nid_t nid, time64_t *when)read_lock_irqsave (glock, flags); - peer =kiblnd_find_peer_locked (nid); + peer =kiblnd_find_peer_locked (ni, nid);if (peer) last_alive = peer->ibp_last_alive;
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +1 -1
@@ -1019,7 +1019,7 @@ void kiblnd_destroy_peer(struct kib_peer *peer);bool kiblnd_reconnect_peer (struct kib_peer *peer);void kiblnd_destroy_dev (struct kib_dev *dev);void kiblnd_unlink_peer_locked (struct kib_peer *peer); -struct kib_peer *kiblnd_find_peer_locked (lnet_nid_t nid); +struct kib_peer *kiblnd_find_peer_locked (struct lnet_ni *ni,lnet_nid_t nid);int kiblnd_close_stale_conns_locked (struct kib_peer *peer,int version,__u64 incarnation);int kiblnd_close_peer_conns_locked (struct kib_peer *peer,int why);
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +4 -4
@@ -1370,7 +1370,7 @@ kiblnd_launch_tx(struct lnet_ni *ni, struct kib_tx *tx, lnet_nid_t nid)*/ read_lock_irqsave (g_lock, flags); - peer =kiblnd_find_peer_locked (nid); + peer =kiblnd_find_peer_locked (ni, nid);if (peer && !list_empty (&peer->ibp_conns)) {/* Found a peer with an established connection */ conn =kiblnd_get_conn_locked (peer);
@@ -1388,7 +1388,7 @@ kiblnd_launch_tx(struct lnet_ni *ni, struct kib_tx *tx, lnet_nid_t nid)/* Re-try with a write lock */ write_lock (g_lock); - peer =kiblnd_find_peer_locked (nid); + peer =kiblnd_find_peer_locked (ni, nid);if (peer) {if (list_empty (&peer->ibp_conns)) {/* found a peer, but it's still connecting... */
@@ -1426,7 +1426,7 @@ kiblnd_launch_tx(struct lnet_ni *ni, struct kib_tx *tx, lnet_nid_t nid)write_lock_irqsave (g_lock, flags); - peer2 =kiblnd_find_peer_locked (nid); + peer2 =kiblnd_find_peer_locked (ni, nid);if (peer2) {if (list_empty (&peer2->ibp_conns)) {/* found a peer, but it's still connecting... */
@@ -2388,7 +2388,7 @@ kiblnd_passive_connect(struct rdma_cm_id *cmid, void *priv, int priv_nob)write_lock_irqsave (g_lock, flags); - peer2 =kiblnd_find_peer_locked (nid); + peer2 =kiblnd_find_peer_locked (ni, nid);if (peer2) {if (!peer2->ibp_version) { peer2->ibp_version = version;
PATCH 16/34 LU-7734 lnet: rename LND peer to peer_ni
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
Patch to rename LND peers to peer_ni to reflect the fact that these constructs reflect an actual connection between a local NI and remote peer NI.
Reviewed-on: http://review.whamcloud.com/19307
--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 232 ++++--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 118 ++-- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 512 ++++++++------- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 662 ++++++++++---------- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 66 +- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 207 +++--- .../lustre/lnet/klnds/socklnd/socklnd_lib.c | 4 .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 14 8 files changed, 928 insertions(+), 887 deletions(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +118 -114
@@ -258,7 +258,7 @@ int kiblnd_unpack_msg(struct kib_msg *msg, int nob) msg->ibm_cksum = msg_cksum;if (flip) { -/* leave magic unflipped as a clue to peer endianness */ +/* leave magic unflipped as a clue to peer_ni endianness */ msg->ibm_version = version;BUILD_BUG_ON (sizeof (msg->ibm_type) !=1 );BUILD_BUG_ON (sizeof (msg->ibm_credits) !=1 );
@@ -315,10 +315,10 @@ int kiblnd_unpack_msg(struct kib_msg *msg, int nob)return 0 ; } -int kiblnd_create_peer (struct lnet_ni *ni,struct kib_peer **peerp, +int kiblnd_create_peer (struct lnet_ni *ni,struct kib_peer_ni **peerp,lnet_nid_t nid) { -struct kib_peer *peer; +struct kib_peer_ni *peer_ni;struct kib_net *net = ni->ni_data;int cpt =lnet_cpt_of_nid (nid, ni);unsigned long flags;
@@ -326,23 +326,23 @@ int kiblnd_create_peer(struct lnet_ni *ni, struct kib_peer **peerp,LASSERT (net);LASSERT (nid !=LNET_NID_ANY ); - peer =kzalloc_cpt (sizeof (*peer),GFP_NOFS , cpt); -if (!peer) { -CERROR ("Cannot allocate peer\n" ); + peer_ni =kzalloc_cpt (sizeof (*peer_ni),GFP_NOFS , cpt); +if (!peer_ni) { +CERROR ("Cannot allocate peer_ni\n" );return -ENOMEM ; } - peer->ibp_ni = ni; - peer->ibp_nid = nid; - peer->ibp_error =0 ; - peer->ibp_last_alive =0 ; - peer->ibp_max_frags =kiblnd_cfg_rdma_frags (peer->ibp_ni); - peer->ibp_queue_depth = ni->ni_net->net_tunables.lct_peer_tx_credits; -atomic_set (&peer->ibp_refcount,1 );/* 1 ref for caller */ + peer_ni->ibp_ni = ni; + peer_ni->ibp_nid = nid; + peer_ni->ibp_error =0 ; + peer_ni->ibp_last_alive =0 ; + peer_ni->ibp_max_frags =kiblnd_cfg_rdma_frags (peer_ni->ibp_ni); + peer_ni->ibp_queue_depth = ni->ni_net->net_tunables.lct_peer_tx_credits; +atomic_set (&peer_ni->ibp_refcount,1 );/* 1 ref for caller */ -INIT_LIST_HEAD (&peer->ibp_list);/* not in the peer table yet */ -INIT_LIST_HEAD (&peer->ibp_conns); -INIT_LIST_HEAD (&peer->ibp_tx_queue); +INIT_LIST_HEAD (&peer_ni->ibp_list); +INIT_LIST_HEAD (&peer_ni->ibp_conns); +INIT_LIST_HEAD (&peer_ni->ibp_tx_queue);write_lock_irqsave (&kiblnd_data.kib_global_lock, flags);
@@ -354,93 +354,94 @@ int kiblnd_create_peer(struct lnet_ni *ni, struct kib_peer **peerp,write_unlock_irqrestore (&kiblnd_data.kib_global_lock, flags); - *peerp = peer; + *peerp = peer_ni;return 0 ; } -void kiblnd_destroy_peer (struct kib_peer *peer) +void kiblnd_destroy_peer (struct kib_peer_ni *peer_ni) { -struct kib_net *net = peer->ibp_ni->ni_data; +struct kib_net *net = peer_ni->ibp_ni->ni_data;LASSERT (net); -LASSERT (!atomic_read (&peer->ibp_refcount)); -LASSERT (!kiblnd_peer_active (peer)); -LASSERT (kiblnd_peer_idle (peer)); -LASSERT (list_empty (&peer->ibp_tx_queue)); +LASSERT (!atomic_read (&peer_ni->ibp_refcount)); +LASSERT (!kiblnd_peer_active (peer_ni)); +LASSERT (kiblnd_peer_idle (peer_ni)); +LASSERT (list_empty (&peer_ni->ibp_tx_queue)); -kfree (peer); +kfree (peer_ni);/* -* NB a peer's connections keep a reference on their peer until +* NB a peer_ni's connections keep a reference on their peer_ni until * they are destroyed, so we can be assured that _all_ state to do -* with this peer has been cleaned up when its refcount drops to +* with this peer_ni has been cleaned up when its refcount drops to * zero. */ atomic_dec (&net->ibn_npeers); } -struct kib_peer *kiblnd_find_peer_locked (struct lnet_ni *ni,lnet_nid_t nid) +struct kib_peer_ni *kiblnd_find_peer_locked (struct lnet_ni *ni,lnet_nid_t nid) {/* * the caller is responsible for accounting the additional reference * that this creates */ struct list_head *peer_list =kiblnd_nid2peerlist (nid); -struct kib_peer *peer; +struct kib_peer_ni *peer_ni; -list_for_each_entry (peer, peer_list, ibp_list) { -LASSERT (!kiblnd_peer_idle (peer)); +list_for_each_entry (peer_ni, peer_list, ibp_list) { +LASSERT (!kiblnd_peer_idle (peer_ni));/* -* Match a peer if its NID and the NID of the local NI it +* Match a peer_ni if its NID and the NID of the local NI it * communicates over are the same. Otherwise don't match -* the peer, which will result in a new lnd peer being +* the peer_ni, which will result in a new lnd peer_ni being * created. */ -if (peer->ibp_nid != nid || - peer->ibp_ni->ni_nid != ni->ni_nid) +if (peer_ni->ibp_nid != nid || + peer_ni->ibp_ni->ni_nid != ni->ni_nid)continue ; -CDEBUG (D_NET ,"got peer [%p] -> %s (%d) version: %x\n" , - peer,libcfs_nid2str (nid), -atomic_read (&peer->ibp_refcount), - peer->ibp_version); -return peer; +CDEBUG (D_NET ,"got peer_ni [%p] -> %s (%d) version: %x\n" , + peer_ni,libcfs_nid2str (nid), +atomic_read (&peer_ni->ibp_refcount), + peer_ni->ibp_version); +return peer_ni; }return NULL ; } -void kiblnd_unlink_peer_locked (struct kib_peer *peer) +void kiblnd_unlink_peer_locked (struct kib_peer_ni *peer_ni) { -LASSERT (list_empty (&peer->ibp_conns)); +LASSERT (list_empty (&peer_ni->ibp_conns)); -LASSERT (kiblnd_peer_active (peer)); -list_del_init (&peer->ibp_list); +LASSERT (kiblnd_peer_active (peer_ni)); +list_del_init (&peer_ni->ibp_list);/* lose peerlist's ref */ -kiblnd_peer_decref (peer); +kiblnd_peer_decref (peer_ni); }static int kiblnd_get_peer_info (struct lnet_ni *ni,int index,lnet_nid_t *nidp,int *count) { -struct kib_peer *peer; +struct kib_peer_ni *peer_ni;int i;unsigned long flags;read_lock_irqsave (&kiblnd_data.kib_global_lock, flags);for (i =0 ; i < kiblnd_data.kib_peer_hash_size; i++) { -list_for_each_entry (peer, &kiblnd_data.kib_peers[i], ibp_list) { -LASSERT (!kiblnd_peer_idle (peer)); +list_for_each_entry (peer_ni, &kiblnd_data.kib_peers[i], + ibp_list) { +LASSERT (!kiblnd_peer_idle (peer_ni)); -if (peer->ibp_ni != ni) +if (peer_ni->ibp_ni != ni)continue ;if (index-- >0 )continue ; - *nidp = peer->ibp_nid; - *count =atomic_read (&peer->ibp_refcount); + *nidp = peer_ni->ibp_nid; + *count =atomic_read (&peer_ni->ibp_refcount);read_unlock_irqrestore (&kiblnd_data.kib_global_lock, flags);
@@ -452,34 +453,33 @@ static int kiblnd_get_peer_info(struct lnet_ni *ni, int index,return -ENOENT ; } -static void kiblnd_del_peer_locked (struct kib_peer *peer) +static void kiblnd_del_peer_locked (struct kib_peer_ni *peer_ni) {struct list_head *ctmp;struct list_head *cnxt;struct kib_conn *conn; -if (list_empty (&peer->ibp_conns)) { -kiblnd_unlink_peer_locked (peer); +if (list_empty (&peer_ni->ibp_conns)) { +kiblnd_unlink_peer_locked (peer_ni); }else { -list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { +list_for_each_safe (ctmp, cnxt, &peer_ni->ibp_conns) { conn = list_entry(ctmp, struct kib_conn, ibc_list);kiblnd_close_conn_locked (conn,0 ); } -/* NB closing peer's last conn unlinked it. */ +/* NB closing peer_ni's last conn unlinked it. */ }/* -* NB peer now unlinked; might even be freed if the peer table had the -* last ref on it. +* NB peer_ni now unlinked; might even be freed if the peer_ni +* table had the last ref on it. */ }static int kiblnd_del_peer (struct lnet_ni *ni,lnet_nid_t nid) {LIST_HEAD (zombies); -struct list_head *ptmp; -struct list_head *pnxt; -struct kib_peer *peer; +struct kib_peer_ni *pnxt; +struct kib_peer_ni *peer_ni;int lo;int hi;int i;
@@ -497,24 +497,24 @@ static int kiblnd_del_peer(struct lnet_ni *ni, lnet_nid_t nid) }for (i = lo; i <= hi; i++) { -list_for_each_safe (ptmp, pnxt, &kiblnd_data.kib_peers[i]) { - peer = list_entry(ptmp, struct kib_peer, ibp_list); -LASSERT (!kiblnd_peer_idle (peer)); +list_for_each_entry_safe (peer_ni, pnxt, + &kiblnd_data.kib_peers[i], ibp_list) { +LASSERT (!kiblnd_peer_idle (peer_ni)); -if (peer->ibp_ni != ni) +if (peer_ni->ibp_ni != ni)continue ; -if (!(nid ==LNET_NID_ANY || peer->ibp_nid == nid)) +if (!(nid ==LNET_NID_ANY || peer_ni->ibp_nid == nid))continue ; -if (!list_empty (&peer->ibp_tx_queue)) { -LASSERT (list_empty (&peer->ibp_conns)); +if (!list_empty (&peer_ni->ibp_tx_queue)) { +LASSERT (list_empty (&peer_ni->ibp_conns)); -list_splice_init (&peer->ibp_tx_queue, +list_splice_init (&peer_ni->ibp_tx_queue, &zombies); } -kiblnd_del_peer_locked (peer); +kiblnd_del_peer_locked (peer_ni); rc =0 ;/* matched something */ } }
@@ -528,7 +528,7 @@ static int kiblnd_del_peer(struct lnet_ni *ni, lnet_nid_t nid)static struct kib_conn *kiblnd_get_conn_by_idx (struct lnet_ni *ni,int index) { -struct kib_peer *peer; +struct kib_peer_ni *peer_ni;struct kib_conn *conn;int i;unsigned long flags;
@@ -536,13 +536,15 @@ static struct kib_conn *kiblnd_get_conn_by_idx(struct lnet_ni *ni, int index)read_lock_irqsave (&kiblnd_data.kib_global_lock, flags);for (i =0 ; i < kiblnd_data.kib_peer_hash_size; i++) { -list_for_each_entry (peer, &kiblnd_data.kib_peers[i], ibp_list) { -LASSERT (!kiblnd_peer_idle (peer)); +list_for_each_entry (peer_ni, &kiblnd_data.kib_peers[i], + ibp_list) { +LASSERT (!kiblnd_peer_idle (peer_ni)); -if (peer->ibp_ni != ni) +if (peer_ni->ibp_ni != ni)continue ; -list_for_each_entry (conn, &peer->ibp_conns, ibc_list) { +list_for_each_entry (conn, &peer_ni->ibp_conns, + ibc_list) {if (index-- >0 )continue ;
@@ -620,20 +622,23 @@ static int kiblnd_get_completion_vector(struct kib_conn *conn, int cpt)return 1 ; } -struct kib_conn *kiblnd_create_conn (struct kib_peer *peer,struct rdma_cm_id *cmid, +struct kib_conn *kiblnd_create_conn (struct kib_peer_ni *peer_ni, +struct rdma_cm_id *cmid,int state,int version) {/* * CAVEAT EMPTOR: -* If the new conn is created successfully it takes over the caller's -* ref on 'peer'. It also "owns" 'cmid' and destroys it when it itself -* is destroyed. On failure, the caller's ref on 'peer' remains and -* she must dispose of 'cmid'. (Actually I'd block forever if I tried -* to destroy 'cmid' here since I'm called from the CM which still has +* +* If the new conn is created successfully it takes over the +* caller's ref on 'peer_ni'. It also "owns" 'cmid' and +* destroys it when it itself is destroyed. On failure, the +* caller's ref on 'peer_ni' remains and she must dispose of +* 'cmid'. (Actually I'd block forever if I tried to destroy +* 'cmid' here since I'm called from the CM which still has * its ref on 'cmid'). */ rwlock_t *glock = &kiblnd_data.kib_global_lock; -struct kib_net *net = peer->ibp_ni->ni_data; +struct kib_net *net = peer_ni->ibp_ni->ni_data;struct kib_dev *dev;struct ib_qp_init_attr *init_qp_attr;struct kib_sched_info *sched;
@@ -650,7 +655,7 @@ struct kib_conn *kiblnd_create_conn(struct kib_peer *peer, struct rdma_cm_id *cm dev = net->ibn_dev; - cpt =lnet_cpt_of_nid (peer->ibp_nid, peer->ibp_ni); + cpt =lnet_cpt_of_nid (peer_ni->ibp_nid, peer_ni->ibp_ni); sched = kiblnd_data.kib_scheds[cpt];LASSERT (sched->ibs_nthreads >0 );
@@ -658,24 +663,24 @@ struct kib_conn *kiblnd_create_conn(struct kib_peer *peer, struct rdma_cm_id *cm init_qp_attr =kzalloc_cpt (sizeof (*init_qp_attr),GFP_NOFS , cpt);if (!init_qp_attr) {CERROR ("Can't allocate qp_attr for %s\n" , -libcfs_nid2str (peer->ibp_nid)); +libcfs_nid2str (peer_ni->ibp_nid)); goto failed_0; } conn =kzalloc_cpt (sizeof (*conn),GFP_NOFS , cpt);if (!conn) {CERROR ("Can't allocate connection for %s\n" , -libcfs_nid2str (peer->ibp_nid)); +libcfs_nid2str (peer_ni->ibp_nid)); goto failed_1; } conn->ibc_state =IBLND_CONN_INIT ; conn->ibc_version = version; - conn->ibc_peer = peer;/* I take the caller's ref */ + conn->ibc_peer = peer_ni;/* I take the caller's ref */ cmid->context = conn;/* for future CM callbacks */ conn->ibc_cmid = cmid; - conn->ibc_max_frags = peer->ibp_max_frags; - conn->ibc_queue_depth = peer->ibp_queue_depth; + conn->ibc_max_frags = peer_ni->ibp_max_frags; + conn->ibc_queue_depth = peer_ni->ibp_queue_depth;INIT_LIST_HEAD (&conn->ibc_early_rxs);INIT_LIST_HEAD (&conn->ibc_tx_noops);
@@ -834,7 +839,7 @@ struct kib_conn *kiblnd_create_conn(struct kib_peer *peer, struct rdma_cm_id *cmvoid kiblnd_destroy_conn (struct kib_conn *conn) {struct rdma_cm_id *cmid = conn->ibc_cmid; -struct kib_peer *peer = conn->ibc_peer; +struct kib_peer_ni *peer_ni = conn->ibc_peer;int rc;LASSERT (!in_interrupt ());
@@ -883,26 +888,26 @@ void kiblnd_destroy_conn(struct kib_conn *conn)/* See CAVEAT EMPTOR above in kiblnd_create_conn */ if (conn->ibc_state !=IBLND_CONN_INIT ) { -struct kib_net *net = peer->ibp_ni->ni_data; +struct kib_net *net = peer_ni->ibp_ni->ni_data; -kiblnd_peer_decref (peer); +kiblnd_peer_decref (peer_ni);rdma_destroy_id (cmid);atomic_dec (&net->ibn_nconns); } } -int kiblnd_close_peer_conns_locked (struct kib_peer *peer,int why) +int kiblnd_close_peer_conns_locked (struct kib_peer_ni *peer_ni,int why) {struct kib_conn *conn;struct list_head *ctmp;struct list_head *cnxt;int count =0 ; -list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { +list_for_each_safe (ctmp, cnxt, &peer_ni->ibp_conns) { conn = list_entry(ctmp, struct kib_conn, ibc_list);CDEBUG (D_NET ,"Closing conn -> %s, version: %x, reason: %d\n" , -libcfs_nid2str (peer->ibp_nid), +libcfs_nid2str (peer_ni->ibp_nid), conn->ibc_version, why);kiblnd_close_conn_locked (conn, why);
@@ -912,7 +917,7 @@ int kiblnd_close_peer_conns_locked(struct kib_peer *peer, int why)return count; } -int kiblnd_close_stale_conns_locked (struct kib_peer *peer, +int kiblnd_close_stale_conns_locked (struct kib_peer_ni *peer_ni,int version,__u64 incarnation) {struct kib_conn *conn;
@@ -920,7 +925,7 @@ int kiblnd_close_stale_conns_locked(struct kib_peer *peer,struct list_head *cnxt;int count =0 ; -list_for_each_safe (ctmp, cnxt, &peer->ibp_conns) { +list_for_each_safe (ctmp, cnxt, &peer_ni->ibp_conns) { conn = list_entry(ctmp, struct kib_conn, ibc_list); if (conn->ibc_version == version &&
@@ -929,7 +934,7 @@ int kiblnd_close_stale_conns_locked(struct kib_peer *peer,CDEBUG (D_NET ,"Closing stale conn -> %s version: %x, incarnation:%#llx(%x, %#llx)\n" , -libcfs_nid2str (peer->ibp_nid), +libcfs_nid2str (peer_ni->ibp_nid), conn->ibc_version, conn->ibc_incarnation, version, incarnation);
@@ -942,9 +947,8 @@ int kiblnd_close_stale_conns_locked(struct kib_peer *peer,static int kiblnd_close_matching_conns (struct lnet_ni *ni,lnet_nid_t nid) { -struct kib_peer *peer; -struct list_head *ptmp; -struct list_head *pnxt; +struct kib_peer_ni *peer_ni; +struct kib_peer_ni *pnxt;int lo;int hi;int i;
@@ -962,17 +966,17 @@ static int kiblnd_close_matching_conns(struct lnet_ni *ni, lnet_nid_t nid) }for (i = lo; i <= hi; i++) { -list_for_each_safe (ptmp, pnxt, &kiblnd_data.kib_peers[i]) { - peer = list_entry(ptmp, struct kib_peer, ibp_list); -LASSERT (!kiblnd_peer_idle (peer)); +list_for_each_entry_safe (peer_ni, pnxt, + &kiblnd_data.kib_peers[i], ibp_list) { +LASSERT (!kiblnd_peer_idle (peer_ni)); -if (peer->ibp_ni != ni) +if (peer_ni->ibp_ni != ni)continue ; -if (!(nid ==LNET_NID_ANY || nid == peer->ibp_nid)) +if (!(nid ==LNET_NID_ANY || nid == peer_ni->ibp_nid))continue ; - count +=kiblnd_close_peer_conns_locked (peer,0 ); + count +=kiblnd_close_peer_conns_locked (peer_ni,0 ); } }
@@ -1043,14 +1047,14 @@ static void kiblnd_query(struct lnet_ni *ni, lnet_nid_t nid, time64_t *when)time64_t last_alive =0 ;time64_t now =ktime_get_seconds ();rwlock_t *glock = &kiblnd_data.kib_global_lock; -struct kib_peer *peer; +struct kib_peer_ni *peer_ni;unsigned long flags;read_lock_irqsave (glock, flags); - peer =kiblnd_find_peer_locked (ni, nid); -if (peer) - last_alive = peer->ibp_last_alive; + peer_ni =kiblnd_find_peer_locked (ni, nid); +if (peer_ni) + last_alive = peer_ni->ibp_last_alive;read_unlock_irqrestore (glock, flags);
@@ -1058,14 +1062,14 @@ static void kiblnd_query(struct lnet_ni *ni, lnet_nid_t nid, time64_t *when) *when = last_alive;/* -* peer is not persistent in hash, trigger peer creation +* peer_ni is not persistent in hash, trigger peer_ni creation * and connection establishment with a NULL tx */ -if (!peer) +if (!peer_ni)kiblnd_launch_tx (ni,NULL , nid); -CDEBUG (D_NET ,"Peer %s %p, alive %lld secs ago\n" , -libcfs_nid2str (nid), peer, +CDEBUG (D_NET ,"peer_ni %s %p, alive %lld secs ago\n" , +libcfs_nid2str (nid), peer_ni, last_alive ? now - last_alive :-1 ); }
@@ -2595,7 +2599,7 @@ static void kiblnd_shutdown(struct lnet_ni *ni)/* nuke all existing peers within this net */ kiblnd_del_peer (ni,LNET_NID_ANY ); -/* Wait for all peer state to clean up */ +/* Wait for all peer_ni state to clean up */ i =2 ;while (atomic_read (&net->ibn_npeers)) { i++;
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +60 -58
242 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +259 -253
1,237 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +340 -322
1,026 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +36 -30
66 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +106 -101
207 lines not on this page · raw message
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +2 -2
Lines of this file are not shown. View the raw message.
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +7 -7
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
PATCH 17/34 LU-7734 lnet: Add peer_ni and NI stats for DLC
In reply to NeilBrownFrom: Doug Oucharek <[email protected]>
This patch adds three stats to the peer_ni and NI structures:send_count, recv_count, and drop_count. These stats get printed when you do an "lnetctl net show -v" (for NI) and "lnetctl peer show" (for peer_ni).
Reviewed-on: http://review.whamcloud.com/20170
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 3 +- .../staging/lustre/include/linux/lnet/lib-types.h | 11 +++++++ .../lustre/include/uapi/linux/lnet/lnet-dlc.h | 6 ++++ drivers/staging/lustre/lnet/lnet/api-ni.c | 32 +++++++++++++++----- drivers/staging/lustre/lnet/lnet/lib-move.c | 4 +++ drivers/staging/lustre/lnet/lnet/lib-msg.c | 8 +++++ drivers/staging/lustre/lnet/lnet/peer.c | 7 ++++ 7 files changed, 61 insertions(+), 10 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +2 -1
@@ -664,7 +664,8 @@ bool lnet_peer_is_ni_pref_locked(struct lnet_peer_ni *lpni,int lnet_add_peer_ni_to_peer (lnet_nid_t key_nid,lnet_nid_t nid,bool mr);int lnet_del_peer_ni_from_peer (lnet_nid_t key_nid,lnet_nid_t nid);int lnet_get_peer_info (__u32 idx,lnet_nid_t *primary_nid,lnet_nid_t *nid, -struct lnet_peer_ni_credit_info *peer_ni_info); +struct lnet_peer_ni_credit_info *peer_ni_info, +struct lnet_ioctl_element_stats *peer_ni_stats); int lnet_get_peer_ni_info(__u32 peer_index, __u64 *nid, char alivness[LNET_MAX_STR_LEN], __u32 *cpt_iter, __u32 *refcount,
drivers/staging/lustre/include/linux/lnet/lib-types.h +11 -0
@@ -271,6 +271,12 @@ enum lnet_ni_state {LNET_NI_STATE_DELETING }; +struct lnet_element_stats { +atomic_t send_count; +atomic_t recv_count; +atomic_t drop_count; +}; +struct lnet_net {/* chain on the ln_nets */ struct list_head net_list;
@@ -348,6 +354,9 @@ struct lnet_ni {/* lnd tunables set explicitly */ bool ni_lnd_tunables_set; +/* NI statistics */ +struct lnet_element_stats ni_stats; +/* physical device CPT */ int dev_cpt;
@@ -403,6 +412,8 @@ struct lnet_peer_ni {struct list_head lpni_rtrq;/* chain on router list */ struct list_head lpni_rtr_list; +/* statistics kept on each peer NI */ +struct lnet_element_stats lpni_stats;/* # tx credits available */ int lpni_txcredits;struct lnet_peer_net *lpni_peer_net;
drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h +6 -0
@@ -142,6 +142,12 @@ struct lnet_ioctl_config_data {char cfg_bulk[0 ]; }; +struct lnet_ioctl_element_stats { +u32 send_count; +u32 recv_count; +u32 drop_count; +}; +/* * lnet_ioctl_config_ni * This structure describes an NI configuration. There are multiple components
drivers/staging/lustre/lnet/lnet/api-ni.c +24 -8
@@ -1881,6 +1881,7 @@ static int lnet_handle_dbg_task(struct lnet_ioctl_dbg *dbg,static void lnet_fill_ni_info (struct lnet_ni *ni,struct lnet_ioctl_config_ni *cfg_ni,struct lnet_ioctl_config_lnd_tunables *tun, +struct lnet_ioctl_element_stats *stats,__u32 tun_size) {size_t min_size =0 ;
@@ -1906,6 +1907,11 @@ lnet_fill_ni_info(struct lnet_ni *ni, struct lnet_ioctl_config_ni *cfg_ni,memcpy (&tun->lt_cmn, &ni->ni_net->net_tunables,sizeof (tun->lt_cmn)); +if (stats) { + stats->send_count =atomic_read (&ni->ni_stats.send_count); + stats->recv_count =atomic_read (&ni->ni_stats.recv_count); + } +/* * tun->lt_tun will always be present, but in order to be * backwards compatible, we need to deal with the cases when
@@ -2102,13 +2108,14 @@ lnet_get_net_config(struct lnet_ioctl_config_data *config)int lnet_get_ni_config (struct lnet_ioctl_config_ni *cfg_ni,struct lnet_ioctl_config_lnd_tunables *tun, +struct lnet_ioctl_element_stats *stats,__u32 tun_size) {struct lnet_ni *ni;int cpt;int rc = -ENOENT ; -if (!cfg_ni || !tun) +if (!cfg_ni || !tun || !stats)return -EINVAL ; cpt =lnet_net_lock_current ();
@@ -2118,7 +2125,7 @@ lnet_get_ni_config(struct lnet_ioctl_config_ni *cfg_ni,if (ni) { rc =0 ;lnet_ni_lock (ni); -lnet_fill_ni_info (ni, cfg_ni, tun, tun_size); +lnet_fill_ni_info (ni, cfg_ni, tun, stats, tun_size);lnet_ni_unlock (ni); }
@@ -2583,20 +2590,24 @@ LNetCtl(unsigned int cmd, void *arg)case IOC_LIBCFS_GET_LOCAL_NI : {struct lnet_ioctl_config_ni *cfg_ni;struct lnet_ioctl_config_lnd_tunables *tun =NULL ; +struct lnet_ioctl_element_stats *stats;__u32 tun_size; cfg_ni = arg;/* get the tunables if they are available */ if (cfg_ni->lic_cfg_hdr.ioc_len < -sizeof (*cfg_ni) +sizeof (*tun)) +sizeof (*cfg_ni) +sizeof (*stats) +sizeof (*tun))return -EINVAL ; + stats = (struct lnet_ioctl_element_stats *) + cfg_ni->lic_bulk; tun = (struct lnet_ioctl_config_lnd_tunables *) - cfg_ni->lic_bulk; + (cfg_ni->lic_bulk +sizeof (*stats)); - tun_size = cfg_ni->lic_cfg_hdr.ioc_len -sizeof (*cfg_ni); + tun_size = cfg_ni->lic_cfg_hdr.ioc_len -sizeof (*cfg_ni) - +sizeof (*stats); -return lnet_get_ni_config (cfg_ni, tun, tun_size); +return lnet_get_ni_config (cfg_ni, tun, stats, tun_size); }case IOC_LIBCFS_GET_NET : {
@@ -2724,15 +2735,20 @@ LNetCtl(unsigned int cmd, void *arg)case IOC_LIBCFS_GET_PEER_NI : {struct lnet_ioctl_peer_cfg *cfg = arg;struct lnet_peer_ni_credit_info *lpni_cri; -size_t total =sizeof (*cfg) +sizeof (*lpni_cri); +struct lnet_ioctl_element_stats *lpni_stats; +size_t total =sizeof (*cfg) +sizeof (*lpni_cri) + +sizeof (*lpni_stats);if (cfg->prcfg_hdr.ioc_len < total)return -EINVAL ; lpni_cri = (struct lnet_peer_ni_credit_info *)cfg->prcfg_bulk; + lpni_stats = (struct lnet_ioctl_element_stats *) + (cfg->prcfg_bulk +sizeof (*lpni_cri));return lnet_get_peer_info (cfg->prcfg_idx, &cfg->prcfg_key_nid, - &cfg->prcfg_cfg_nid, lpni_cri); + &cfg->prcfg_cfg_nid, lpni_cri, + lpni_stats); }case IOC_LIBCFS_NOTIFY_ROUTER : {
drivers/staging/lustre/lnet/lnet/lib-move.c +4 -0
@@ -614,6 +614,10 @@ lnet_post_send_locked(struct lnet_msg *msg, int do_send) the_lnet.ln_counters[cpt]->drop_count++; the_lnet.ln_counters[cpt]->drop_length += msg->msg_len;lnet_net_unlock (cpt); +if (msg->msg_txpeer) +atomic_inc (&msg->msg_txpeer->lpni_stats.drop_count); +if (msg->msg_txni) +atomic_inc (&msg->msg_txni->ni_stats.drop_count);CNETERR ("Dropping message for %s: peer not alive\n" ,libcfs_id2str (msg->msg_target));
drivers/staging/lustre/lnet/lnet/lib-msg.c +8 -0
@@ -215,6 +215,10 @@ lnet_msg_decommit_tx(struct lnet_msg *msg, int status) } counters->send_count++; +if (msg->msg_txpeer) +atomic_inc (&msg->msg_txpeer->lpni_stats.send_count); +if (msg->msg_txni) +atomic_inc (&msg->msg_txni->ni_stats.send_count); out:lnet_return_tx_credits_locked (msg); msg->msg_tx_committed =0 ;
@@ -270,6 +274,10 @@ lnet_msg_decommit_rx(struct lnet_msg *msg, int status) } counters->recv_count++; +if (msg->msg_rxpeer) +atomic_inc (&msg->msg_rxpeer->lpni_stats.recv_count); +if (msg->msg_rxni) +atomic_inc (&msg->msg_rxni->ni_stats.recv_count);if (ev->type ==LNET_EVENT_PUT || ev->type ==LNET_EVENT_REPLY ) counters->recv_length += msg->msg_wanted;
drivers/staging/lustre/lnet/lnet/peer.c +6 -1
@@ -973,7 +973,8 @@ lnet_get_peer_ni_info(__u32 peer_index, __u64 *nid, }int lnet_get_peer_info (__u32 idx,lnet_nid_t *primary_nid,lnet_nid_t *nid, -struct lnet_peer_ni_credit_info *peer_ni_info) +struct lnet_peer_ni_credit_info *peer_ni_info, +struct lnet_ioctl_element_stats *peer_ni_stats) {struct lnet_peer_ni *lpni =NULL ;struct lnet_peer_net *lpn =NULL ;
@@ -1000,5 +1001,9 @@ int lnet_get_peer_info(__u32 idx, lnet_nid_t *primary_nid, lnet_nid_t *nid, peer_ni_info->cr_peer_min_rtr_credits = lpni->lpni_mintxcredits; peer_ni_info->cr_peer_tx_qnob = lpni->lpni_txqnob; + peer_ni_stats->send_count =atomic_read (&lpni->lpni_stats.send_count); + peer_ni_stats->recv_count =atomic_read (&lpni->lpni_stats.recv_count); + peer_ni_stats->drop_count =atomic_read (&lpni->lpni_stats.drop_count); +return 0 ; }
PATCH 18/34 LU-7734 lnet: peer/peer_ni handling adjustments
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
A peer can be added by specifying a list of NIDs
The first NID shall be used as the primary NID. The rest of the NIDs will be added under the primary NID
A peer can be added by explicitly specifying the key NID, and then by adding a set of other NIDs, all done through one API call
If a key NID already exists, but it's not an MR NI, then adding that Key NID from DLC shall convert that NI to an MR NI
If a key NID already exists, and it is an MR NI, then re-adding the Key NID shall have no effect
if a Key NID already exists as part of another peer, then adding that NID as part of another peer or as primary shall fail
if a NID is being added to a peer NI and that NID is a non-MR, then that NID is moved under the peer and is made to be MR capable
if a NID is being added to a peer and that NID is an MR NID and part of another peer, then the operation shall fail
if a NID is being added to a peer and it is already part of that Peer then the operation is a no-op.
Moreover, the code is structured to consider the addition of Dynamic Discovery in later patches.
Reviewed-on: http://review.whamcloud.com/20531
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 9 .../staging/lustre/include/linux/lnet/lib-types.h | 10 drivers/staging/lustre/lnet/lnet/api-ni.c | 77 +- drivers/staging/lustre/lnet/lnet/lib-move.c | 32 - drivers/staging/lustre/lnet/lnet/peer.c | 907 +++++++++++--------- drivers/staging/lustre/lnet/lnet/router.c | 8 6 files changed, 600 insertions(+), 443 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +4 -5
@@ -647,13 +647,12 @@ u32 lnet_get_dlc_seq_locked(void);struct lnet_peer_ni *lnet_get_next_peer_ni_locked (struct lnet_peer *peer,struct lnet_peer_net *peer_net,struct lnet_peer_ni *prev); -int lnet_find_or_create_peer_locked (lnet_nid_t dst_nid,int cpt, -struct lnet_peer **peer); -int lnet_nid2peerni_locked (struct lnet_peer_ni **lpp,lnet_nid_t nid,int cpt); +struct lnet_peer *lnet_find_or_create_peer_locked (lnet_nid_t dst_nid,int cpt); +struct lnet_peer_ni *lnet_nid2peerni_locked (lnet_nid_t nid,int cpt);struct lnet_peer_ni *lnet_find_peer_ni_locked (lnet_nid_t nid);void lnet_peer_net_added (struct lnet_net *net);lnet_nid_t lnet_peer_primary_nid (lnet_nid_t nid); -void lnet_peer_tables_cleanup (struct lnet_ni *ni); +void lnet_peer_tables_cleanup (struct lnet_net *net);void lnet_peer_uninit (void );int lnet_peer_tables_create (void );void lnet_debug_peer (lnet_nid_t nid);
@@ -664,7 +663,7 @@ bool lnet_peer_is_ni_pref_locked(struct lnet_peer_ni *lpni,int lnet_add_peer_ni_to_peer (lnet_nid_t key_nid,lnet_nid_t nid,bool mr);int lnet_del_peer_ni_from_peer (lnet_nid_t key_nid,lnet_nid_t nid);int lnet_get_peer_info (__u32 idx,lnet_nid_t *primary_nid,lnet_nid_t *nid, -struct lnet_peer_ni_credit_info *peer_ni_info, +bool *mr,struct lnet_peer_ni_credit_info *peer_ni_info,struct lnet_ioctl_element_stats *peer_ni_stats); int lnet_get_peer_ni_info(__u32 peer_index, __u64 *nid, char alivness[LNET_MAX_STR_LEN],
drivers/staging/lustre/include/linux/lnet/lib-types.h +6 -4
@@ -281,9 +281,9 @@ struct lnet_net {/* chain on the ln_nets */ struct list_head net_list; -/* net ID, which is compoed of +/* net ID, which is composed of * (net_type << 16) | net_num. -* net_type can be one of the enumarated types defined in +* net_type can be one of the enumerated types defined in * lnet/include/lnet/nidstr.h */ __u32 net_id;
@@ -513,11 +513,13 @@ struct lnet_peer_table {/* /proc validity stamp */ int pt_version;/* # peers extant */ -int pt_number; +atomic_t pt_number;/* # zombies to go to deathrow (and not there yet) */ int pt_zombies;/* zombie peers */ -struct list_head pt_deathrow; +struct list_head pt_zombie_list; +/* protect list and count */ +spinlock_t pt_zombie_lock;/* NID->peer hash */ struct list_head *pt_hash; };
drivers/staging/lustre/lnet/lnet/api-ni.c +56 -21
157 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/lib-move.c +17 -15
@@ -1156,10 +1156,10 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid, lpni =NULL ; seq =lnet_get_dlc_seq_locked (); - rc =lnet_find_or_create_peer_locked (dst_nid, cpt, &peer); -if (rc !=0 ) { + peer =lnet_find_or_create_peer_locked (dst_nid, cpt); +if (IS_ERR (peer)) {lnet_net_unlock (cpt); -return rc; +return PTR_ERR (peer); }/* If peer is not healthy then can not send anything to it */
@@ -1364,13 +1364,6 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid, best_credits = ni->ni_tx_queues[cpt]->tq_credits; } } -/* -* Now that we selected the NI to use increment its sequence -* number so the Round Robin algorithm will detect that it has -* been used and pick the next NI. -*/ - best_ni->ni_seq++; -/* * if the peer is not MR capable, then we should always send to it * using the first NI in the NET we determined.
@@ -1385,6 +1378,13 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,return -EINVAL ; } +/* +* Now that we selected the NI to use increment its sequence +* number so the Round Robin algorithm will detect that it has +* been used and pick the next NI. +*/ + best_ni->ni_seq++; +if (routing) goto send;
@@ -1452,7 +1452,7 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid, }CDEBUG (D_NET ,"Best route to %s via %s for %s %d\n" , -libcfs_nid2str (lpni->lpni_nid), +libcfs_nid2str (dst_nid),libcfs_nid2str (best_gw->lpni_nid),lnet_msgtyp2str (msg->msg_type), msg->msg_len);
@@ -2065,6 +2065,7 @@ lnet_parse(struct lnet_ni *ni, struct lnet_hdr *hdr, lnet_nid_t from_nid,lnet_pid_t dest_pid;lnet_nid_t dest_nid;lnet_nid_t src_nid; +struct lnet_peer_ni *lpni;__u32 payload_length;__u32 type;
@@ -2226,18 +2227,19 @@ lnet_parse(struct lnet_ni *ni, struct lnet_hdr *hdr, lnet_nid_t from_nid, msg->msg_initiator =lnet_peer_primary_nid (src_nid);lnet_net_lock (cpt); - rc =lnet_nid2peerni_locked (&msg->msg_rxpeer, from_nid, cpt); -if (rc) { + lpni =lnet_nid2peerni_locked (from_nid, cpt); +if (IS_ERR (lpni)) {lnet_net_unlock (cpt); -CERROR ("%s, src %s: Dropping %s (error %d looking up sender)\n" , +CERROR ("%s, src %s: Dropping %s (error %ld looking up sender)\n" ,libcfs_nid2str (from_nid),libcfs_nid2str (src_nid), -lnet_msgtyp2str (type), rc); +lnet_msgtyp2str (type),PTR_ERR (lpni));kfree (msg);if (rc == -ESHUTDOWN )/* We are shutting down. Don't do anything more */ return 0 ; goto drop; } + msg->msg_rxpeer = lpni; msg->msg_rxni = ni;lnet_ni_addref_locked (ni, cpt);
drivers/staging/lustre/lnet/lnet/peer.c +512 -395
1,159 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/router.c +5 -3
@@ -296,6 +296,7 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway,struct lnet_route *route;struct lnet_route *route2;struct lnet_ni *ni; +struct lnet_peer_ni *lpni;int add_route;int rc;
@@ -332,13 +333,14 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway,lnet_net_lock (LNET_LOCK_EX ); - rc =lnet_nid2peerni_locked (&route->lr_gateway, gateway,LNET_LOCK_EX ); -if (rc) { + lpni =lnet_nid2peerni_locked (gateway,LNET_LOCK_EX ); +if (IS_ERR (lpni)) {lnet_net_unlock (LNET_LOCK_EX );kfree (route);kfree (rnet); + rc =PTR_ERR (lpni);if (rc == -EHOSTUNREACH )/* gateway is not on a local net */ return rc;/* ignore the route entry */ CERROR("Error %d creating route %s %d %s\n", rc,
@@ -346,7 +348,7 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway, libcfs_nid2str(gateway));return rc; } - + route->lr_gateway = lpni;LASSERT (!the_lnet.ln_shutdown); rnet2 =lnet_find_rnet_locked (net);
PATCH 19/34 LU-7734 lnet: proper cpt locking
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
1. add a per NI credits, which is just the total credits assigned on NI creation
2. Whenever percpt credits are added or decremented, we mirror that in the NI credits
3. We use the NI credits to determine best NI
4. After we have completed the peer_ni/ni selection we determine the cpt to use for locking:
cpt_of_nid(lpni->nid, ni)
The lpni_cpt is not enough to protect all the fields in the lnet_peer_ni structure. This is due to the fact that multiple NIs can talk to the same peer, and functions can be called with different cpts locked. To properly protect the fields in the lnet_peer_ni structure, a spin lock is introduced for the purpose.
Reviewed-on: http://review.whamcloud.com/20701
--- .../staging/lustre/include/linux/lnet/lib-types.h | 15 +++-- drivers/staging/lustre/lnet/lnet/api-ni.c | 3 + drivers/staging/lustre/lnet/lnet/lib-move.c | 58 ++++++++++++------ drivers/staging/lustre/lnet/lnet/peer.c | 2 + drivers/staging/lustre/lnet/lnet/router.c | 63 +++++++++++++++++++- 5 files changed, 113 insertions(+), 28 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-types.h +10 -5
@@ -330,6 +330,9 @@ struct lnet_ni {/* instance-specific data */ void *ni_data; +/* per ni credits */ +atomic_t ni_tx_credits; +/* percpt TX queues */ struct lnet_tx_queue **ni_tx_queues;
@@ -414,6 +417,8 @@ struct lnet_peer_ni {struct list_head lpni_rtr_list;/* statistics kept on each peer NI */ struct lnet_element_stats lpni_stats; +/* spin lock protecting credits and lpni_txq / lpni_rtrq */ +spinlock_t lpni_lock;/* # tx credits available */ int lpni_txcredits;struct lnet_peer_net *lpni_peer_net;
@@ -424,13 +429,13 @@ struct lnet_peer_ni {/* low water mark */ int lpni_minrtrcredits;/* alive/dead? */ - unsigned int lpni_alive:1; +bool lpni_alive;/* notification outstanding? */ - unsigned int lpni_notify:1; +bool lpni_notify;/* outstanding notification for LND? */ - unsigned int lpni_notifylnd:1; +bool lpni_notifylnd;/* some thread is handling notification */ - unsigned int lpni_notifying:1; +bool lpni_notifying;/* SEND event outstanding from ping */ unsigned int lpni_ping_notsent;/* # times router went dead<->alive */
@@ -461,7 +466,7 @@ struct lnet_peer_ni {u32 lpni_seq;/* health flag */ bool lpni_healthy; -/* returned RC ping features */ +/* returned RC ping features. Protected with lpni_lock */ unsigned int lpni_ping_feats;/* routers on this peer */ struct list_head lpni_routes;
drivers/staging/lustre/lnet/lnet/api-ni.c +3 -0
@@ -1382,6 +1382,9 @@ lnet_startup_lndni(struct lnet_ni *ni, struct lnet_lnd_tunables *tun) seed =LNET_NIDADDR (ni->ni_nid);add_device_randomness (&seed,sizeof (seed)); +atomic_set (&ni->ni_tx_credits, +lnet_ni_tq_credits (ni) * ni->ni_ncpts); + CDEBUG(D_LNI, "Added LNI %s [%d/%d/%d/%d]\n", libcfs_nid2str(ni->ni_nid), ni->ni_net->net_tunables.lct_peer_tx_credits,
drivers/staging/lustre/lnet/lnet/lib-move.c +39 -19
141 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/peer.c +2 -0
@@ -117,6 +117,8 @@ lnet_peer_ni_alloc(lnet_nid_t nid)INIT_LIST_HEAD (&lpni->lpni_on_peer_net_list);INIT_LIST_HEAD (&lpni->lpni_on_remote_peer_ni_list); +spin_lock_init (&lpni->lpni_lock); + lpni->lpni_alive = !lnet_peers_start_down ();/* 1 bit!! */ lpni->lpni_last_alive =ktime_get_seconds ();/* assumes alive */ lpni->lpni_ping_feats =LNET_PING_FEAT_INVAL ;
drivers/staging/lustre/lnet/lnet/router.c +59 -4
169 lines not on this page · raw message
PATCH 20/34 LU-7734 lnet: protect peer_ni credits
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
Currently multiple NIs can talk to the same peer_ni. The per-CPT lnet_net_lock therefore no longer protects the lpni against concurrent updates. To resolve this issue a spinlock is added to the lnet_peer_ni, which must be locked when the peer NI credits, delayed message queue, and delayed routed message queue are modified. The lock is not taken when reporting credits.
Reviewed-on: http://review.whamcloud.com/20702
--- drivers/staging/lustre/lnet/lnet/lib-move.c | 40 ++++++++++++++++++++------- drivers/staging/lustre/lnet/lnet/peer.c | 8 ++++- drivers/staging/lustre/lnet/lnet/router.c | 3 +- 3 files changed, 38 insertions(+), 13 deletions(-)
drivers/staging/lustre/lnet/lnet/lib-move.c +30 -10
@@ -657,6 +657,7 @@ lnet_post_send_locked(struct lnet_msg *msg, int do_send) }if (!msg->msg_peertxcredit) { +spin_lock (&lp->lpni_lock);LASSERT ((lp->lpni_txcredits <0 ) == !list_empty (&lp->lpni_txq));
@@ -670,8 +671,10 @@ lnet_post_send_locked(struct lnet_msg *msg, int do_send)if (lp->lpni_txcredits <0 ) { msg->msg_tx_delayed =1 ;list_add_tail (&msg->msg_list, &lp->lpni_txq); +spin_unlock (&lp->lpni_lock);return LNET_CREDIT_WAIT ; } +spin_unlock (&lp->lpni_lock); }if (!msg->msg_txcredit) {
@@ -744,6 +747,7 @@ lnet_post_routed_recv_locked(struct lnet_msg *msg, int do_recv)LASSERT (!do_recv || msg->msg_rx_delayed);if (!msg->msg_peerrtrcredit) { +spin_lock (&lp->lpni_lock);LASSERT ((lp->lpni_rtrcredits <0 ) == !list_empty (&lp->lpni_rtrq));
@@ -757,8 +761,10 @@ lnet_post_routed_recv_locked(struct lnet_msg *msg, int do_recv)LASSERT (msg->msg_rx_ready_delay); msg->msg_rx_delayed =1 ;list_add_tail (&msg->msg_list, &lp->lpni_rtrq); +spin_unlock (&lp->lpni_lock);return LNET_CREDIT_WAIT ; } +spin_unlock (&lp->lpni_lock); } rbp =lnet_msg2bufpool (msg);
@@ -822,6 +828,7 @@ lnet_return_tx_credits_locked(struct lnet_msg *msg)LASSERT (msg2->msg_txni == ni);LASSERT (msg2->msg_tx_delayed); +LASSERT (msg2->msg_tx_cpt == msg->msg_tx_cpt); (void )lnet_post_send_locked (msg2,1 ); }
@@ -831,6 +838,7 @@ lnet_return_tx_credits_locked(struct lnet_msg *msg)/* give back peer txcredits */ msg->msg_peertxcredit =0 ; +spin_lock (&txpeer->lpni_lock);LASSERT ((txpeer->lpni_txcredits <0 ) == !list_empty (&txpeer->lpni_txq));
@@ -842,11 +850,22 @@ lnet_return_tx_credits_locked(struct lnet_msg *msg) msg2 =list_entry (txpeer->lpni_txq.next, struct lnet_msg, msg_list);list_del (&msg2->msg_list); +spin_unlock (&txpeer->lpni_lock);LASSERT (msg2->msg_txpeer == txpeer);LASSERT (msg2->msg_tx_delayed); +if (msg2->msg_tx_cpt != msg->msg_tx_cpt) { +lnet_net_unlock (msg->msg_tx_cpt); +lnet_net_lock (msg2->msg_tx_cpt); + } (void )lnet_post_send_locked (msg2,1 ); +if (msg2->msg_tx_cpt != msg->msg_tx_cpt) { +lnet_net_unlock (msg2->msg_tx_cpt); +lnet_net_lock (msg->msg_tx_cpt); + } + }else { +spin_unlock (&txpeer->lpni_lock); } }
@@ -887,17 +906,12 @@ lnet_schedule_blocked_locked(struct lnet_rtrbufpool *rbp)void lnet_drop_routed_msgs_locked (struct list_head *list,int cpt) { -struct list_head drop;struct lnet_msg *msg; -INIT_LIST_HEAD (&drop); - -list_splice_init (list, &drop); -lnet_net_unlock (cpt); -while (!list_empty (&drop)) { - msg = list_first_entry(&drop, struct lnet_msg, msg_list); +while (!list_empty (list)) { + msg = list_first_entry(list, struct lnet_msg, msg_list);lnet_ni_recv (msg->msg_rxni, msg->msg_private,NULL ,0 ,0 ,0 , msg->msg_hdr.payload_length);list_del_init (&msg->msg_list);
@@ -968,6 +982,7 @@ lnet_return_rx_credits_locked(struct lnet_msg *msg)/* give back peer router credits */ msg->msg_peerrtrcredit =0 ; +spin_lock (&rxpeer->lpni_lock);LASSERT ((rxpeer->lpni_rtrcredits <0 ) == !list_empty (&rxpeer->lpni_rtrq));
@@ -977,14 +992,19 @@ lnet_return_rx_credits_locked(struct lnet_msg *msg)* peer. */ if (!the_lnet.ln_routing) { -lnet_drop_routed_msgs_locked (&rxpeer->lpni_rtrq, - msg->msg_rx_cpt); +LIST_HEAD (drop); + +list_splice_init (&rxpeer->lpni_rtrq, &drop); +spin_unlock (&rxpeer->lpni_lock); +lnet_drop_routed_msgs_locked (&drop, msg->msg_rx_cpt); }else if (rxpeer->lpni_rtrcredits <=0 ) { msg2 =list_entry (rxpeer->lpni_rtrq.next, struct lnet_msg, msg_list);list_del (&msg2->msg_list); - +spin_unlock (&rxpeer->lpni_lock); (void )lnet_post_routed_recv_locked (msg2,1 ); + }else { +spin_unlock (&rxpeer->lpni_lock); } }if (rxni) {
drivers/staging/lustre/lnet/lnet/peer.c +6 -2
@@ -56,12 +56,16 @@ lnet_peer_net_added(struct lnet_net *net) lpni_on_remote_peer_ni_list) {if (LNET_NIDNET (lpni->lpni_nid) == net->net_id) { lpni->lpni_net = net; + +spin_lock (&lpni->lpni_lock); lpni->lpni_txcredits = - lpni->lpni_mintxcredits = lpni->lpni_net->net_tunables.lct_peer_tx_credits; + lpni->lpni_mintxcredits = + lpni->lpni_txcredits; lpni->lpni_rtrcredits = - lpni->lpni_minrtrcredits =lnet_peer_buffer_credits (lpni->lpni_net); + lpni->lpni_minrtrcredits = lpni->lpni_rtrcredits; +spin_unlock (&lpni->lpni_lock);lnet_peer_remove_from_remote_list (lpni); }
drivers/staging/lustre/lnet/lnet/router.c +2 -1
@@ -1358,7 +1358,8 @@ lnet_rtrpool_free_bufs(struct lnet_rtrbufpool *rbp, int cpt)INIT_LIST_HEAD (&tmp);lnet_net_lock (cpt); -lnet_drop_routed_msgs_locked (&rbp->rbp_msgs, cpt); +list_splice_init (&rbp->rbp_msgs, &tmp); +lnet_drop_routed_msgs_locked (&tmp, cpt);list_splice_init (&rbp->rbp_bufs, &tmp); rbp->rbp_req_nbuffers =0 ; rbp->rbp_nbuffers =0 ;
PATCH 21/34 LU-7734 lnet: simplify and fix lnet_select_pathway()
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
In lnet_select_pathway() we restart selection if the DLC seq counter changes. Provided we take a hold on the preferred lnet_peer_ni, we only need to restart if an lnet_ni was added or removed. Update the locations where lnet_incr_dlc_seq() is called to take this into account.
A number of local variables must be reset whenever we goto again. Do this immediately after the label for the global variables, and immediately before the block that uses them for the helper variables.
In the loop where NUMA distances are compared, use the NUMA range for distances smaller than the NUMA range, simplifying the subsequent comparisons between distances.
Remote the lo_sent output parameter. Instead do an early return with LNET_CREDIT_OK.
Move the increment of the best_lpni->lpni_seq number after the check that best_lpni isn't NULL.
When routing, the best_gw should be treated as the best_lpni for the purpose of determining the CPT to lock.
Reviewed-on: http://review.whamcloud.com/20720
--- drivers/staging/lustre/lnet/lnet/api-ni.c | 11 + drivers/staging/lustre/lnet/lnet/lib-move.c | 213 +++++++++++---------------- 2 files changed, 88 insertions(+), 136 deletions(-)
drivers/staging/lustre/lnet/lnet/api-ni.c +5 -6
@@ -72,10 +72,10 @@ MODULE_PARM_DESC(lnet_numa_range,/* * This sequence number keeps track of how many times DLC was used to -* update the configuration. It is incremented on any DLC update and -* checked when sending a message to determine if there is a need to -* re-run the selection algorithm to handle configuration change. -* Look at lnet_select_pathway() for more details on its usage. +* update the local NIs. It is incremented when a NI is added or +* removed and checked when sending a message to determine if there is +* a need to re-run the selection algorithm. See lnet_select_pathway() +* for more details on its usage. */ static atomic_t lnet_dlc_seq_no =ATOMIC_INIT (0 );
@@ -1223,6 +1223,7 @@ lnet_shutdown_lndni(struct lnet_ni *ni)lnet_net_lock (LNET_LOCK_EX ); ni->ni_state =LNET_NI_STATE_DELETING ;lnet_ni_unlink_locked (ni); +lnet_incr_dlc_seq ();lnet_net_unlock (LNET_LOCK_EX );/* clear messages for this NI on the lazy portal */
@@ -2723,7 +2724,6 @@ LNetCtl(unsigned int cmd, void *arg)return -EINVAL ;mutex_lock (&the_lnet.ln_api_mutex); -lnet_incr_dlc_seq (); rc =lnet_add_peer_ni_to_peer (cfg->prcfg_key_nid, cfg->prcfg_cfg_nid, cfg->prcfg_mr);
@@ -2738,7 +2738,6 @@ LNetCtl(unsigned int cmd, void *arg)return -EINVAL ;mutex_lock (&the_lnet.ln_api_mutex); -lnet_incr_dlc_seq (); rc =lnet_del_peer_ni_from_peer (cfg->prcfg_key_nid, cfg->prcfg_cfg_nid);mutex_unlock (&the_lnet.ln_api_mutex);
drivers/staging/lustre/lnet/lnet/lib-move.c +83 -130
354 lines not on this page · raw message
PATCH 22/34 LU-7734 lnet: fix lnet_peer_table_cleanup_locked()
In reply to NeilBrownFrom: Olaf Weber <[email protected]>
In lnet_peer_table_cleanup_locked() we delete the entire peer if the lnet_peer_ni for the primary NID of the peer is deleted. If the next lnet_peer_ni in the list belongs to the peer being deleted, then the next pointer kept by list_for_each_entry_safe() ends up pointing at freed memory.
Add a list_for_each_entry_from() loop to advance next to a peer_ni that does not belong to the peer being deleted and will therefore remain present in the list.
Reviewed-on: http://review.whamcloud.com/20824
--- drivers/staging/lustre/lnet/lnet/peer.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
drivers/staging/lustre/lnet/lnet/peer.c +16 -10
@@ -331,26 +331,32 @@ lnet_peer_table_cleanup_locked(struct lnet_net *net, struct lnet_peer_table *ptable) {int i; +struct lnet_peer_ni *next;struct lnet_peer_ni *lpni; -struct lnet_peer_ni *tmp;struct lnet_peer *peer;for (i =0 ; i <LNET_PEER_HASH_SIZE ; i++) { -list_for_each_entry_safe (lpni, tmp, &ptable->pt_hash[i], +list_for_each_entry_safe (lpni, next, &ptable->pt_hash[i], lpni_hashlist) {if (net && net != lpni->lpni_net)continue ; -/* -* check if by removing this peer ni we should be -* removing the entire peer. -*/ peer = lpni->lpni_peer_net->lpn_peer; - -if (peer->lp_primary_nid == lpni->lpni_nid) -lnet_peer_del_locked (peer); -else +if (peer->lp_primary_nid != lpni->lpni_nid) {lnet_peer_ni_del_locked (lpni); +continue ; + } +/* +* Removing the primary NID implies removing +* the entire peer. Advance next beyond any +* peer_ni that belongs to the same peer. +*/ +list_for_each_entry_from (next, &ptable->pt_hash[i], + lpni_hashlist) { +if (next->lpni_peer_net->lpn_peer != peer) +break ; + } +lnet_peer_del_locked (peer); } } }
PATCH 23/34 LU-7734 lnet: configuration fixes
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
Fix cpt configuration from DLC to configure the proper list of cpts in LNet. Check in LNet that no CPTs are outside the available CPTs in the system.
Fix peer_rtr_credits name to peer_tx_credits to reflect the actual value.
Reviewed-on: http://review.whamcloud.com/20862
--- .../lustre/include/uapi/linux/lnet/lnet-dlc.h | 4 +++- drivers/staging/lustre/lnet/lnet/api-ni.c | 9 +++++++-- drivers/staging/lustre/lnet/lnet/peer.c | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-)
drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h +3 -1
@@ -169,6 +169,7 @@ struct lnet_ioctl_config_ni {__u32 lic_tcp_bonding;__u32 lic_idx;__s32 lic_dev_cpt; +char pad[4 ];char lic_bulk[0 ]; };
@@ -177,9 +178,10 @@ struct lnet_peer_ni_credit_info {__u32 cr_refcount;__s32 cr_ni_peer_tx_credits;__s32 cr_peer_tx_credits; +__s32 cr_peer_min_tx_credits; +__u32 cr_peer_tx_qnob;__s32 cr_peer_rtr_credits;__s32 cr_peer_min_rtr_credits; -__u32 cr_peer_tx_qnob;__u32 cr_ncpt; };
drivers/staging/lustre/lnet/lnet/api-ni.c +7 -2
@@ -2283,7 +2283,7 @@ int lnet_dyn_add_ni(struct lnet_ioctl_config_ni *conf)struct lnet_net *net;struct lnet_ni *ni;struct lnet_ioctl_config_lnd_tunables *tun =NULL ; -int rc; +int rc, i;u32 net_id;/* get the tunables if they are available */
@@ -2303,6 +2303,11 @@ int lnet_dyn_add_ni(struct lnet_ioctl_config_ni *conf)if (!net)return -ENOMEM ; +for (i =0 ; i < conf->lic_ncpts; i++) { +if (conf->lic_cpts[i] >=LNET_CPT_NUMBER ) +return -EINVAL ; + } + ni =lnet_ni_alloc_w_cpt_array (net, conf->lic_cpts, conf->lic_ncpts, conf->lic_ni_intf[0 ]);if (!ni)
@@ -2760,7 +2765,7 @@ LNetCtl(unsigned int cmd, void *arg) &peer_info->pr_lnd_u.pr_peer_credits.cr_ni_peer_tx_credits, &peer_info->pr_lnd_u.pr_peer_credits.cr_peer_tx_credits, &peer_info->pr_lnd_u.pr_peer_credits.cr_peer_rtr_credits, - &peer_info->pr_lnd_u.pr_peer_credits.cr_peer_min_rtr_credits, + &peer_info->pr_lnd_u.pr_peer_credits.cr_peer_min_tx_credits, &peer_info->pr_lnd_u.pr_peer_credits.cr_peer_tx_qnob);mutex_unlock (&the_lnet.ln_api_mutex);return rc;
drivers/staging/lustre/lnet/lnet/peer.c +2 -1
@@ -1127,7 +1127,8 @@ int lnet_get_peer_info(__u32 idx, lnet_nid_t *primary_nid, lnet_nid_t *nid, lpni->lpni_net->net_tunables.lct_peer_tx_credits : 0; peer_ni_info->cr_peer_tx_credits = lpni->lpni_txcredits; peer_ni_info->cr_peer_rtr_credits = lpni->lpni_rtrcredits; - peer_ni_info->cr_peer_min_rtr_credits = lpni->lpni_mintxcredits; + peer_ni_info->cr_peer_min_rtr_credits = lpni->lpni_minrtrcredits; + peer_ni_info->cr_peer_min_tx_credits = lpni->lpni_mintxcredits; peer_ni_info->cr_peer_tx_qnob = lpni->lpni_txqnob; peer_ni_stats->send_count =atomic_read (&lpni->lpni_stats.send_count);
PATCH 24/34 LU-7734 lnet: fix lnet_select_pathway()
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
Fixed the selection algorithm to work properly with > 1 local networks. The behavior now is to iterate through all interfaces on all networks
Also removed the health variable from struct lnet_peer_net since it's never used.
Reviewed-on: http://review.whamcloud.com/20890
--- .../staging/lustre/include/linux/lnet/lib-types.h | 3 --- drivers/staging/lustre/lnet/lnet/lib-move.c | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-types.h +0 -3
@@ -504,9 +504,6 @@ struct lnet_peer_net {/* Net ID */ __u32 lpn_net_id; - -/* health flag */ -bool lpn_healthy; };/* peer hash size */
drivers/staging/lustre/lnet/lnet/lib-move.c +2 -2
@@ -1235,6 +1235,8 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,* b. Iterate through each of the peer_nets/nis to decide * the best peer/local_ni pair to use */ + shortest_distance =UINT_MAX ; + best_credits =INT_MIN ;list_for_each_entry (peer_net, &peer->lp_peer_nets, lpn_on_peer_list) {if (!lnet_is_peer_net_healthy_locked (peer_net))continue ;
@@ -1295,8 +1297,6 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,* 2. NI available credits * 3. Round Robin */ - shortest_distance =UINT_MAX ; - best_credits =INT_MIN ; ni =NULL ;while ((ni =lnet_get_next_ni_locked (local_net, ni))) {int ni_credits;
PATCH 25/34 LU-7734 lnet: Routing fixes part 1
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
This is the first part of a routing fix.
- Fix crash in lnet_parse_get()
- Resolve deadlock when adding a route.
- Fix an issue with dynamically turning on routing
- Set the final destination NID properly when routing a msg
Reviewed-on: http://review.whamcloud.com/21166
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 1 drivers/staging/lustre/lnet/lnet/lib-move.c | 23 +++++-- drivers/staging/lustre/lnet/lnet/peer.c | 62 ++++++++++++++++---- drivers/staging/lustre/lnet/lnet/router.c | 2 - 4 files changed, 67 insertions(+), 21 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +1 -0
@@ -649,6 +649,7 @@ struct lnet_peer_ni *lnet_get_next_peer_ni_locked(struct lnet_peer *peer, struct lnet_peer_ni *prev);struct lnet_peer *lnet_find_or_create_peer_locked (lnet_nid_t dst_nid,int cpt);struct lnet_peer_ni *lnet_nid2peerni_locked (lnet_nid_t nid,int cpt); +struct lnet_peer_ni *lnet_nid2peerni_ex (lnet_nid_t nid,int cpt);struct lnet_peer_ni *lnet_find_peer_ni_locked (lnet_nid_t nid);void lnet_peer_net_added (struct lnet_net *net);lnet_nid_t lnet_peer_primary_nid (lnet_nid_t nid);
drivers/staging/lustre/lnet/lnet/lib-move.c +15 -8
@@ -1566,17 +1566,10 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,*/ lnet_ni_addref_locked (msg->msg_txni, cpt); -/* -* set the destination nid in the message here because it's -* possible that we'd be sending to a different nid than the one -* originaly given. -*/ - msg->msg_hdr.dest_nid =cpu_to_le64 (msg->msg_txpeer->lpni_nid); -/* * Always set the target.nid to the best peer picked. Either the * nid will be one of the preconfigured NIDs, or the same NID as -* what was originaly set in the target or it will be the NID of +* what was originally set in the target or it will be the NID of * a router if this message should be routed */ msg->msg_target.nid = msg->msg_txpeer->lpni_nid;
@@ -1599,6 +1592,19 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,if (routing) { msg->msg_target_is_router =1 ; msg->msg_target.pid =LNET_PID_LUSTRE ; +/* +* since we're routing we want to ensure that the +* msg_hdr.dest_nid is set to the final destination. When +* the router receives this message it knows how to route +* it. +*/ + msg->msg_hdr.dest_nid =cpu_to_le64 (dst_nid); + }else { +/* +* if we're not routing set the dest_nid to the best peer +* ni that we picked earlier in the algorithm. +*/ + msg->msg_hdr.dest_nid =cpu_to_le64 (msg->msg_txpeer->lpni_nid); } rc =lnet_post_send_locked (msg,0 );
@@ -1757,6 +1763,7 @@ lnet_parse_get(struct lnet_ni *ni, struct lnet_msg *msg, int rdma_get) info.mi_rlength = hdr->msg.get.sink_length; info.mi_roffset = hdr->msg.get.src_offset; info.mi_mbits = hdr->msg.get.match_bits; + info.mi_cpt =lnet_cpt_of_nid (msg->msg_rxpeer->lpni_nid, ni); rc =lnet_ptl_match_md (&info, msg);if (rc ==LNET_MATCHMD_DROP ) {
drivers/staging/lustre/lnet/lnet/peer.c +50 -12
93 lines not on this page · raw message
drivers/staging/lustre/lnet/lnet/router.c +1 -1
@@ -358,7 +358,7 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway,lnet_net_lock (LNET_LOCK_EX ); - lpni =lnet_nid2peerni_locked (gateway,LNET_LOCK_EX ); + lpni =lnet_nid2peerni_ex (gateway,LNET_LOCK_EX );if (IS_ERR (lpni)) {lnet_net_unlock (LNET_LOCK_EX );
PATCH 26/34 LU-7734 lnet: Routing fixes part 2
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
Fix lnet_select_pathway() to handle the routing cases correctly. The following general cases are handled:
. Non-MR directly connected
. Non-MR not directly connected
. MR Directly connected
. MR Not directly connected
. No gateway
. Gateway is non-mr
. Gateway is mr
Reviewed-on: http://review.whamcloud.com/21167
--- drivers/staging/lustre/lnet/lnet/lib-move.c | 214 ++++++++++++++++++--------- drivers/staging/lustre/lnet/lnet/peer.c | 29 +++- 2 files changed, 167 insertions(+), 76 deletions(-)
drivers/staging/lustre/lnet/lnet/lib-move.c +145 -69
@@ -1145,6 +1145,7 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,__u32 seq;int cpt, cpt2, rc;bool routing; +bool routing2;bool ni_is_pref;bool preferred;int best_credits;
@@ -1168,6 +1169,7 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid, best_gw =NULL ; local_net =NULL ; routing = false; + routing2 = false; seq =lnet_get_dlc_seq_locked ();
@@ -1201,7 +1203,7 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid, }/* -* STEP 1: first jab at determineing best_ni +* STEP 1: first jab at determining best_ni * if src_nid is explicitly specified, then best_ni is already * pre-determiend for us. Otherwise we need to select the best * one to use later on
@@ -1215,17 +1217,122 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid, libcfs_nid2str(src_nid));return -EINVAL ; } + } + +if (msg->msg_type ==LNET_MSG_REPLY || + msg->msg_type ==LNET_MSG_ACK || + !peer->lp_multi_rail) { +/* +* for replies we want to respond on the same peer_ni we +* received the message on if possible. If not, then pick +* a peer_ni to send to +* +* if the peer is non-multi-rail then you want to send to +* the dst_nid provided as well. +* +* It is expected to find the lpni using dst_nid, since we +* created it earlier. +*/ + best_lpni =lnet_find_peer_ni_locked (dst_nid); +if (best_lpni) +lnet_peer_ni_decref_locked (best_lpni); -if (best_ni->ni_net->net_id !=LNET_NIDNET (dst_nid)) { +if (best_lpni && !lnet_get_net_locked (LNET_NIDNET (dst_nid))) { +/* +* this lpni is not on a local network so we need +* to route this reply. +*/ + best_gw =lnet_find_route_locked (NULL , + best_lpni->lpni_nid, + rtr_nid); +if (best_gw) { +/* +* RULE: Each node considers only the next-hop +* +* We're going to route the message, +* so change the peer to the router. +*/ +LASSERT (best_gw->lpni_peer_net); +LASSERT (best_gw->lpni_peer_net->lpn_peer); + peer = best_gw->lpni_peer_net->lpn_peer; + +/* +* if the router is not multi-rail +* then use the best_gw found to send +* the message to +*/ +if (!peer->lp_multi_rail) + best_lpni = best_gw; +else + best_lpni =NULL ; + + routing = true; + }else { + best_lpni =NULL ; + } + }else if (!best_lpni) {lnet_net_unlock (cpt); -LCONSOLE_WARN ("No route to %s via from %s\n" , -libcfs_nid2str (dst_nid), -libcfs_nid2str (src_nid)); +CERROR ("unable to send msg_type %d to originating %s. Destination NID not in DB\n" , + msg->msg_type,libcfs_nid2str (dst_nid));return -EINVAL ; } - goto pick_peer; } +/* +* if the peer is not MR capable, then we should always send to it +* using the first NI in the NET we determined. +*/ +if (!peer->lp_multi_rail) { +if (!best_lpni) { +lnet_net_unlock (cpt); +CERROR ("no route to %s\n" , +libcfs_nid2str (dst_nid)); +return -EHOSTUNREACH ; + } + +/* best ni could be set because src_nid was provided */ +if (!best_ni) { + best_ni =lnet_net2ni_locked ( + best_lpni->lpni_net->net_id, cpt); +if (!best_ni) { +lnet_net_unlock (cpt); +CERROR ("no path to %s from net %s\n" , +libcfs_nid2str (best_lpni->lpni_nid), +libcfs_net2str (best_lpni->lpni_net->net_id)); +return -EHOSTUNREACH ; + } + } + } + +if (best_ni == the_lnet.ln_loni) { +/* No send credit hassles with LOLND */ +lnet_ni_addref_locked (best_ni, cpt); + msg->msg_hdr.dest_nid =cpu_to_le64 (best_ni->ni_nid); +if (!msg->msg_routing) + msg->msg_hdr.src_nid =cpu_to_le64 (best_ni->ni_nid); + msg->msg_target.nid = best_ni->ni_nid; +lnet_msg_commit (msg, cpt); + msg->msg_txni = best_ni; +lnet_net_unlock (cpt); + +return LNET_CREDIT_OK ; + } + +/* +* if we already found a best_ni because src_nid is specified and +* best_lpni because we are replying to a message then just send +* the message +*/ +if (best_ni && best_lpni) + goto send; + +/* +* If we already found a best_ni because src_nid is specified then +* pick the peer then send the message +*/ +if (best_ni) + goto pick_peer; +/* * Decide whether we need to route to peer_ni. * Get the local net that I need to be on to be able to directly
@@ -1242,7 +1349,7 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,continue ; local_net =lnet_get_net_locked (peer_net->lpn_net_id); -if (!local_net) { +if (!local_net && !routing) {struct lnet_peer_ni *net_gw;/* * go through each peer_ni on that peer_net and
@@ -1263,14 +1370,11 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,if (!best_gw) { best_gw = net_gw; - best_lpni = lpni; }else { rc =lnet_compare_peers (net_gw, best_gw); -if (rc >0 ) { +if (rc >0 ) best_gw = net_gw; - best_lpni = lpni; - } } }
@@ -1279,9 +1383,9 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid, local_net =lnet_get_net_locked (LNET_NIDNET (best_gw->lpni_nid)); - routing = true; + routing2 = true; }else { - routing = false; + routing2 = false; best_gw =NULL ; }
@@ -1342,12 +1446,17 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid, } } -/* -* if the peer is not MR capable, then we should always send to it -* using the first NI in the NET we determined. -*/ -if (!peer->lp_multi_rail && local_net) - best_ni =lnet_net2ni_locked (local_net->net_id, cpt); +if (routing2) { +/* +* RULE: Each node considers only the next-hop +* +* We're going to route the message, so change the peer to +* the router. +*/ +LASSERT (best_gw->lpni_peer_net); +LASSERT (best_gw->lpni_peer_net->lpn_peer); + peer = best_gw->lpni_peer_net->lpn_peer; + }if (!best_ni) {lnet_net_unlock (cpt);
@@ -1363,43 +1472,11 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,*/ best_ni->ni_seq++; -if (routing) - goto send; - pick_peer: -if (best_ni == the_lnet.ln_loni) { -/* No send credit hassles with LOLND */ -lnet_ni_addref_locked (best_ni, cpt); - msg->msg_hdr.dest_nid =cpu_to_le64 (best_ni->ni_nid); -if (!msg->msg_routing) - msg->msg_hdr.src_nid =cpu_to_le64 (best_ni->ni_nid); - msg->msg_target.nid = best_ni->ni_nid; -lnet_msg_commit (msg, cpt); - msg->msg_txni = best_ni; -lnet_net_unlock (cpt); - -return LNET_CREDIT_OK ; - } - -if (msg->msg_type ==LNET_MSG_REPLY || - msg->msg_type ==LNET_MSG_ACK ) { -/* -* for replies we want to respond on the same peer_ni we -* received the message on if possible. If not, then pick -* a peer_ni to send to -*/ - best_lpni =lnet_find_peer_ni_locked (dst_nid); -if (best_lpni) { -lnet_peer_ni_decref_locked (best_lpni); - goto send; - }else { -CDEBUG (D_NET , -"unable to send msg_type %d to originating %s\n" , - msg->msg_type, -libcfs_nid2str (dst_nid)); - } - } - +/* +* At this point the best_ni is on a local network on which +* the peer has a peer_ni as well +*/ peer_net =lnet_peer_get_net_locked (peer, best_ni->ni_net->net_id);/*
@@ -1429,13 +1506,16 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,libcfs_nid2str (best_gw->lpni_nid), lnet_msgtyp2str(msg->msg_type), msg->msg_len); - best_lpni =lnet_find_peer_ni_locked (dst_nid); -LASSERT (best_lpni); -lnet_peer_ni_decref_locked (best_lpni); - - routing = true; - - goto send; + routing2 = true; +/* +* RULE: Each node considers only the next-hop +* +* We're going to route the message, so change the peer to +* the router. +*/ +LASSERT (best_gw->lpni_peer_net); +LASSERT (best_gw->lpni_peer_net->lpn_peer); + peer = best_gw->lpni_peer_net->lpn_peer; }else if (!lnet_is_peer_net_healthy_locked (peer_net)) {/* * this peer_net is unhealthy but we still have an opportunity
@@ -1459,6 +1539,7 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid, lpni =NULL ; best_lpni_credits =INT_MIN ; preferred = false; + best_lpni =NULL ;while ((lpni =lnet_get_next_peer_ni_locked (peer, peer_net, lpni))) {/* * if this peer ni is not healthy just skip it, no point in
@@ -1513,19 +1594,14 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid, } send: + routing = routing || routing2; +/* * Increment sequence number of the peer selected so that we * pick the next one in Round Robin. */ best_lpni->lpni_seq++; -/* -* When routing the best gateway found acts as the best peer -* NI to send to. -*/ -if (routing) - best_lpni = best_gw; -/* * grab a reference on the peer_ni so it sticks around even if * we need to drop and relock the lnet_net_lock below.
drivers/staging/lustre/lnet/lnet/peer.c +22 -7
@@ -225,11 +225,18 @@ lnet_try_destroy_peer_hierarchy_locked(struct lnet_peer_ni *lpni) }/* called with lnet_net_lock LNET_LOCK_EX held */ -static void +static int lnet_peer_ni_del_locked (struct lnet_peer_ni *lpni) {struct lnet_peer_table *ptable =NULL ; +/* don't remove a peer_ni if it's also a gateway */ +if (lpni->lpni_rtr_refcount >0 ) { +CERROR ("Peer NI %s is a gateway. Can not delete it\n" , +libcfs_nid2str (lpni->lpni_nid)); +return -EBUSY ; + } +lnet_peer_remove_from_remote_list (lpni);/* remove peer ni from the hash list. */
@@ -260,6 +267,8 @@ lnet_peer_ni_del_locked(struct lnet_peer_ni *lpni)/* decrement reference on peer */ lnet_peer_ni_decref_locked (lpni); + +return 0 ; }void lnet_peer_uninit (void )
@@ -313,17 +322,22 @@ lnet_peer_tables_create(void)return 0 ; } -static void +static int lnet_peer_del_locked (struct lnet_peer *peer) {struct lnet_peer_ni *lpni =NULL , *lpni2; +int rc =0 , rc2 =0 ; lpni =lnet_get_next_peer_ni_locked (peer,NULL , lpni);while (lpni) { lpni2 =lnet_get_next_peer_ni_locked (peer,NULL , lpni); -lnet_peer_ni_del_locked (lpni); + rc =lnet_peer_ni_del_locked (lpni); +if (rc !=0 ) + rc2 = rc; lpni = lpni2; } + +return rc2; } static void
@@ -899,6 +913,7 @@ lnet_del_peer_ni_from_peer(lnet_nid_t key_nid, lnet_nid_t nid)lnet_nid_t local_nid;struct lnet_peer *peer;struct lnet_peer_ni *lpni; +int rc;if (key_nid ==LNET_NID_ANY )return -EINVAL ;
@@ -919,17 +934,17 @@ lnet_del_peer_ni_from_peer(lnet_nid_t key_nid, lnet_nid_t nid)* entire peer */ lnet_net_lock (LNET_LOCK_EX ); -lnet_peer_del_locked (peer); + rc =lnet_peer_del_locked (peer);lnet_net_unlock (LNET_LOCK_EX ); -return 0 ; +return rc; }lnet_net_lock (LNET_LOCK_EX ); -lnet_peer_ni_del_locked (lpni); + rc =lnet_peer_ni_del_locked (lpni);lnet_net_unlock (LNET_LOCK_EX ); -return 0 ; +return rc; }void
PATCH 27/34 LU-7734 lnet: fix routing selection
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
Always prefer locally connected networks over routed networks. If there are multiple routed networks and no connected networks pick the best gateway to use. If all gateways are equal then round robin through them.
Renamed dev_cpt to ni_dev_cpt to maintain naming convention.
Reviewed-on: http://review.whamcloud.com/21326
--- .../staging/lustre/include/linux/lnet/lib-types.h | 4 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 4 drivers/staging/lustre/lnet/lnet/api-ni.c | 2 drivers/staging/lustre/lnet/lnet/lib-move.c | 217 +++++++++++--------- 5 files changed, 131 insertions(+), 98 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-types.h +3 -1
@@ -361,7 +361,7 @@ struct lnet_ni {struct lnet_element_stats ni_stats;/* physical device CPT */ -int dev_cpt; +int ni_dev_cpt;/* sequence number used to round robin over nis within a net */ u32 ni_seq;
@@ -464,6 +464,8 @@ struct lnet_peer_ni {int lpni_rtr_refcount;/* sequence number used to round robin over peer nis within a net */ u32 lpni_seq; +/* sequence number used to round robin over gateways */ +__u32 lpni_gw_seq;/* health flag */ bool lpni_healthy;/* returned RC ping features. Protected with lpni_lock */
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +1 -1
@@ -2891,7 +2891,7 @@ static int kiblnd_startup(struct lnet_ni *ni) goto failed; node_id =dev_to_node (ibdev->ibd_hdev->ibh_ibdev->dma_device); - ni->dev_cpt =cfs_cpt_of_node (lnet_cpt_table (), node_id); + ni->ni_dev_cpt =cfs_cpt_of_node (lnet_cpt_table (), node_id); net->ibn_dev = ibdev; ni->ni_nid =LNET_MKNID (LNET_NIDNET (ni->ni_nid), ibdev->ibd_ifip);
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +2 -2
@@ -2798,10 +2798,10 @@ ksocknal_startup(struct lnet_ni *ni) net->ksnn_interfaces[0].ksni_name);if (net_dev) { node_id =dev_to_node (&net_dev->dev); - ni->dev_cpt =cfs_cpt_of_node (lnet_cpt_table (), node_id); + ni->ni_dev_cpt =cfs_cpt_of_node (lnet_cpt_table (), node_id);dev_put (net_dev); }else { - ni->dev_cpt =CFS_CPT_ANY ; + ni->ni_dev_cpt =CFS_CPT_ANY ; }/* call it before add it to ksocknal_data.ksnd_nets */
drivers/staging/lustre/lnet/lnet/api-ni.c +1 -1
@@ -1910,7 +1910,7 @@ lnet_fill_ni_info(struct lnet_ni *ni, struct lnet_ioctl_config_ni *cfg_ni, cfg_ni->lic_nid = ni->ni_nid; cfg_ni->lic_status = ni->ni_status->ns_status; cfg_ni->lic_tcp_bonding = use_tcp_bonding; - cfg_ni->lic_dev_cpt = ni->dev_cpt; + cfg_ni->lic_dev_cpt = ni->ni_dev_cpt;memcpy (&tun->lt_cmn, &ni->ni_net->net_tunables,sizeof (tun->lt_cmn));
drivers/staging/lustre/lnet/lnet/lib-move.c +124 -93
298 lines not on this page · raw message
PATCH 28/34 LU-7734 lnet: Fix crash in router_proc.c
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
Fixed NULL access in the case when a peer is a remote peer. In that case lpni_net is NULL.
Reviewed-on: http://review.whamcloud.com/21327
--- drivers/staging/lustre/lnet/lnet/router_proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/lustre/lnet/lnet/router_proc.c +2 -1
@@ -492,7 +492,8 @@ static int proc_lnet_peers(struct ctl_table *table, int write,int nrefs =atomic_read (&peer->lpni_refcount);time64_t lastalive =-1 ;char *aliveness ="NA" ; -int maxcr = peer->lpni_net->net_tunables.lct_peer_tx_credits; +int maxcr = peer->lpni_net ? + peer->lpni_net->net_tunables.lct_peer_tx_credits :0 ;int txcr = peer->lpni_txcredits;int mintxcr = peer->lpni_mintxcredits;int rtrcr = peer->lpni_rtrcredits;
PATCH 29/34 LU-7734 lnet: double free in lnet_add_net_common()
In reply to NeilBrownFrom: Olaf Weber <[email protected]>
lnet_startup_lndnet() always consumes its net parameter, so we should not free net after the function has been called. This fixes a double free triggered by adding a network twice.
Eliminate the netl local variable.
Reviewed-on: http://review.whamcloud.com/21446
--- drivers/staging/lustre/lnet/lnet/api-ni.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/staging/lustre/lnet/lnet/api-ni.c +11 -12
@@ -2143,7 +2143,6 @@ lnet_get_ni_config(struct lnet_ioctl_config_ni *cfg_ni,static int lnet_add_net_common (struct lnet_net *net,struct lnet_ioctl_config_lnd_tunables *tun) { -struct lnet_net *netl =NULL ;u32 net_id;struct lnet_ping_info *pinfo;struct lnet_handle_md md_handle;
@@ -2162,8 +2161,8 @@ static int lnet_add_net_common(struct lnet_net *net,if (rnet) {CERROR ("Adding net %s will invalidate routing configuration\n" ,libcfs_net2str (net->net_id)); - rc = -EUSERS ; - goto failed1; +lnet_net_free (net); +return -EUSERS ; }/*
@@ -2180,8 +2179,11 @@ static int lnet_add_net_common(struct lnet_net *net, rc =lnet_ping_info_setup (&pinfo, &md_handle, net_ni_count +lnet_get_ni_count (), false); -if (rc <0 ) - goto failed1; +if (rc <0 ) { +lnet_net_free (net); +return rc; + } +if (tun)memcpy (&net->net_tunables, &tun->lt_cmn,sizeof (net->net_tunables));
@@ -2204,17 +2206,16 @@ static int lnet_add_net_common(struct lnet_net *net, goto failed;lnet_net_lock (LNET_LOCK_EX ); - netl =lnet_get_net_locked (net_id); + net =lnet_get_net_locked (net_id);lnet_net_unlock (LNET_LOCK_EX ); -LASSERT (netl); +LASSERT (net);/* * Start the acceptor thread if this is the first network * being added that requires the thread. */ -if (netl->net_lnd->lnd_accept && - num_acceptor_nets ==0 ) { +if (net->net_lnd->lnd_accept && num_acceptor_nets ==0 ) { rc =lnet_acceptor_start ();if (rc <0 ) {/* shutdown the net that we just started */
@@ -2225,7 +2226,7 @@ static int lnet_add_net_common(struct lnet_net *net, }lnet_net_lock (LNET_LOCK_EX ); -lnet_peer_net_added (netl); +lnet_peer_net_added (net);lnet_net_unlock (LNET_LOCK_EX );lnet_ping_target_update (pinfo, md_handle);
@@ -2235,8 +2236,6 @@ static int lnet_add_net_common(struct lnet_net *net, failed:lnet_ping_md_unlink (pinfo, &md_handle);lnet_ping_info_free (pinfo); -failed1: -lnet_net_free (net);return rc; }
PATCH 30/34 LU-7734 lnet: set primary NID in ptlrpc_connection_get()
In reply to NeilBrownFrom: Olaf Weber <[email protected]>
Set the NID in ptlrpc_connection::c_peer to the primary NID of a peer. This ensures that regardless of the NID used to start a connection, we consistently use the same NID (the primary NID) to identify a peer. It also means that PtlRPC will not create multiple connections to a peer.
The primary NID is obtained by calling LNetPrimaryNID(), an addition to the exported symbols of the LNet module. The name was chosen to match the existing naming pattern.
Test-Parameters: trivial
Reviewed-on: http://review.whamcloud.com/21710
--- drivers/staging/lustre/include/linux/lnet/api.h | 1 + drivers/staging/lustre/lnet/lnet/peer.c | 25 +++++++++++++++++++++ drivers/staging/lustre/lustre/ptlrpc/connection.c | 1 + 3 files changed, 27 insertions(+)
drivers/staging/lustre/include/linux/lnet/api.h +1 -0
@@ -77,6 +77,7 @@ int LNetNIFini(void);*/ int LNetGetId (unsigned int index,struct lnet_process_id *id);int LNetDist (lnet_nid_t nid,lnet_nid_t *srcnid,__u32 *order); +lnet_nid_t LNetPrimaryNID (lnet_nid_t nid);/** @} lnet_addr */
drivers/staging/lustre/lnet/lnet/peer.c +25 -0
@@ -610,6 +610,31 @@ lnet_peer_primary_nid(lnet_nid_t nid)return primary_nid; } +lnet_nid_t +LNetPrimaryNID (lnet_nid_t nid) +{ +struct lnet_peer_ni *lpni; +lnet_nid_t primary_nid = nid; +int rc =0 ; +int cpt; + + cpt =lnet_net_lock_current (); + lpni =lnet_nid2peerni_locked (nid, cpt); +if (IS_ERR (lpni)) { + rc =PTR_ERR (lpni); + goto out_unlock; + } + primary_nid = lpni->lpni_peer_net->lpn_peer->lp_primary_nid; +lnet_peer_ni_decref_locked (lpni); +out_unlock: +lnet_net_unlock (cpt); + +CDEBUG (D_NET ,"NID %s primary NID %s rc %d\n" ,libcfs_nid2str (nid), +libcfs_nid2str (primary_nid), rc); +return primary_nid; +} +EXPORT_SYMBOL (LNetPrimaryNID); +struct lnet_peer_net *lnet_peer_get_net_locked (struct lnet_peer *peer,u32 net_id) {
drivers/staging/lustre/lustre/ptlrpc/connection.c +1 -0
@@ -80,6 +80,7 @@ ptlrpc_connection_get(struct lnet_process_id peer, lnet_nid_t self, {struct ptlrpc_connection *conn, *conn2; + peer.nid =LNetPrimaryNID (peer.nid); conn =rhashtable_lookup_fast (&conn_hash, &peer, conn_hash_params);if (conn) {ptlrpc_connection_addref (conn);
PATCH 31/34 LU-7734 lnet: fix NULL access in lnet_peer_aliveness_enabled
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
When a peer is not on a local network, lpni->lpni_net is NULL. The lpni_net is access in lnet_peer_aliveness_enabled() without checking if it's NULL. Fixed.
Test-Parameters: trivial
Reviewed-on: http://review.whamcloud.com/22183
--- .../staging/lustre/include/linux/lnet/lib-types.h | 1 + 1 file changed, 1 insertion(+)
drivers/staging/lustre/include/linux/lnet/lib-types.h +1 -0
@@ -534,6 +534,7 @@ struct lnet_peer_table {*/ #define lnet_peer_aliveness_enabled (lp) \ (the_lnet.ln_routing && \ + (lp)->lpni_net && \ (lp)->lpni_net->net_tunables.lct_peer_timeout > 0)struct lnet_route {
PATCH 32/34 LU-7734 lnet: rename peer key_nid to prim_nid
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
To make the interface clear, renamed key_nid to prim_nid to indicate that this parameter refers to the peer's primary nid.
Reviewed-on: http://review.whamcloud.com/23460
--- .../lustre/include/uapi/linux/lnet/lnet-dlc.h | 2 - drivers/staging/lustre/lnet/lnet/api-ni.c | 6 +-- drivers/staging/lustre/lnet/lnet/peer.c | 42 ++++++++++---------- 3 files changed, 25 insertions(+), 25 deletions(-)
drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h +1 -1
@@ -216,7 +216,7 @@ struct lnet_ioctl_dbg {struct lnet_ioctl_peer_cfg {struct libcfs_ioctl_hdr prcfg_hdr; -lnet_nid_t prcfg_key_nid; +lnet_nid_t prcfg_prim_nid;lnet_nid_t prcfg_cfg_nid;__u32 prcfg_idx;bool prcfg_mr;
drivers/staging/lustre/lnet/lnet/api-ni.c +3 -3
@@ -2728,7 +2728,7 @@ LNetCtl(unsigned int cmd, void *arg)return -EINVAL ;mutex_lock (&the_lnet.ln_api_mutex); - rc =lnet_add_peer_ni_to_peer (cfg->prcfg_key_nid, + rc =lnet_add_peer_ni_to_peer (cfg->prcfg_prim_nid, cfg->prcfg_cfg_nid, cfg->prcfg_mr);mutex_unlock (&the_lnet.ln_api_mutex);
@@ -2742,7 +2742,7 @@ LNetCtl(unsigned int cmd, void *arg)return -EINVAL ;mutex_lock (&the_lnet.ln_api_mutex); - rc =lnet_del_peer_ni_from_peer (cfg->prcfg_key_nid, + rc =lnet_del_peer_ni_from_peer (cfg->prcfg_prim_nid, cfg->prcfg_cfg_nid);mutex_unlock (&the_lnet.ln_api_mutex);return rc;
@@ -2785,7 +2785,7 @@ LNetCtl(unsigned int cmd, void *arg) (cfg->prcfg_bulk +sizeof (*lpni_cri));mutex_lock (&the_lnet.ln_api_mutex); - rc =lnet_get_peer_info (cfg->prcfg_idx, &cfg->prcfg_key_nid, + rc =lnet_get_peer_info (cfg->prcfg_idx, &cfg->prcfg_prim_nid, &cfg->prcfg_cfg_nid, &cfg->prcfg_mr, lpni_cri, lpni_stats);mutex_unlock (&the_lnet.ln_api_mutex);
drivers/staging/lustre/lnet/lnet/peer.c +21 -21
114 lines not on this page · raw message
PATCH 33/34 lnet: use BIT() macro for LNET_MD_* flags
In reply to NeilBrownAs these are bit flags, it aids clarity to use the BIT() macro.
--- .../lustre/include/uapi/linux/lnet/lnet-types.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/staging/lustre/include/uapi/linux/lnet/lnet-types.h +9 -9
@@ -483,22 +483,22 @@ struct lnet_md {/** * Options for the MD structure. See lnet_md::options. */ -#define LNET_MD_OP_PUT (1 << 0) +#define LNET_MD_OP_PUT BIT(0)/** See lnet_md::options. */ -#define LNET_MD_OP_GET (1 << 1) +#define LNET_MD_OP_GET BIT(1)/** See lnet_md::options. */ -#define LNET_MD_MANAGE_REMOTE (1 << 2) -/* unused (1 << 3) */ +#define LNET_MD_MANAGE_REMOTE BIT(2) +/* unused BIT(3) */ /** See lnet_md::options. */ -#define LNET_MD_TRUNCATE (1 << 4) +#define LNET_MD_TRUNCATE BIT(4)/** See lnet_md::options. */ -#define LNET_MD_ACK_DISABLE (1 << 5) +#define LNET_MD_ACK_DISABLE BIT(5)/** See lnet_md::options. */ -#define LNET_MD_IOVEC (1 << 6) +#define LNET_MD_IOVEC BIT(6)/** See lnet_md::options. */ -#define LNET_MD_MAX_SIZE (1 << 7) +#define LNET_MD_MAX_SIZE BIT(7)/** See lnet_md::options. */ -#define LNET_MD_KIOV (1 << 8) +#define LNET_MD_KIOV BIT(8)/* For compatibility with Cray Portals */ #define LNET_MD_PHYS 0
PATCH 33/34 lnet: use BIT() macro for LNET_MD_* flags
Quoted 3 lines
As these are bit flags, it aids clarity to use the
BIT()macro.
Nak. BIT is not for UAPI headers. Including this will break building userland applications.
Quoted 44 lines
Signed-off-by NeilBrown <[email protected]>--- .../lustre/include/uapi/linux/lnet/lnet-types.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)drivers/staging/lustre/include/uapi/linux/lnet/lnet-types.h +9
-9@@ -483,22 +483,22 @@ struct lnet_md {/** * Options for the MD structure. See lnet_md::options. */ -#define LNET_MD_OP_PUT (1 << 0) +#define LNET_MD_OP_PUT BIT(0)/** See lnet_md::options. */ -#define LNET_MD_OP_GET (1 << 1) +#define LNET_MD_OP_GET BIT(1)/** See lnet_md::options. */ -#define LNET_MD_MANAGE_REMOTE (1 << 2) -/* unused (1 << 3) */ +#define LNET_MD_MANAGE_REMOTE BIT(2) +/* unused BIT(3) */ /** See lnet_md::options. */ -#define LNET_MD_TRUNCATE (1 << 4) +#define LNET_MD_TRUNCATE BIT(4)/** See lnet_md::options. */ -#define LNET_MD_ACK_DISABLE (1 << 5) +#define LNET_MD_ACK_DISABLE BIT(5)/** See lnet_md::options. */ -#define LNET_MD_IOVEC (1 << 6) +#define LNET_MD_IOVEC BIT(6)/** See lnet_md::options. */ -#define LNET_MD_MAX_SIZE (1 << 7) +#define LNET_MD_MAX_SIZE BIT(7)/** See lnet_md::options. */ -#define LNET_MD_KIOV (1 << 8) +#define LNET_MD_KIOV BIT(8)/* For compatibility with Cray Portals */ #define LNET_MD_PHYS 0
PATCH 33/34 lnet: use BIT() macro for LNET_MD_* flags
Quoted 5 lines · James Simmons
Quoted 2 lines
As these are bit flags, it aids clarity to use the
BIT()macro.Nak. BIT is not for UAPI headers. Including this will break building userland applications.
Apparently not everyone knows this:
$ git grep '[^A-Z_]BIT(' include/uapi/ | wc -l
11However, it makes sense - thanks.
I've removed all the BITs that I added.
NeilBrown
Quoted 40 lines
Quoted 40 lines
Signed-off-by NeilBrown <[email protected]>--- .../lustre/include/uapi/linux/lnet/lnet-types.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)drivers/staging/lustre/include/uapi/linux/lnet/lnet-types.h +9
-9@@ -483,22 +483,22 @@ struct lnet_md {/** * Options for the MD structure. See lnet_md::options. */ -#define LNET_MD_OP_PUT (1 << 0) +#define LNET_MD_OP_PUT BIT(0)/** See lnet_md::options. */ -#define LNET_MD_OP_GET (1 << 1) +#define LNET_MD_OP_GET BIT(1)/** See lnet_md::options. */ -#define LNET_MD_MANAGE_REMOTE (1 << 2) -/* unused (1 << 3) */ +#define LNET_MD_MANAGE_REMOTE BIT(2) +/* unused BIT(3) */ /** See lnet_md::options. */ -#define LNET_MD_TRUNCATE (1 << 4) +#define LNET_MD_TRUNCATE BIT(4)/** See lnet_md::options. */ -#define LNET_MD_ACK_DISABLE (1 << 5) +#define LNET_MD_ACK_DISABLE BIT(5)/** See lnet_md::options. */ -#define LNET_MD_IOVEC (1 << 6) +#define LNET_MD_IOVEC BIT(6)/** See lnet_md::options. */ -#define LNET_MD_MAX_SIZE (1 << 7) +#define LNET_MD_MAX_SIZE BIT(7)/** See lnet_md::options. */ -#define LNET_MD_KIOV (1 << 8) +#define LNET_MD_KIOV BIT(8)
Quoted 5 lines
drivers/staging/lustre/include/uapi/linux/lnet/lnet-types.h struct lnet_md { · line 504
Quoted 5 lines
drivers/staging/lustre/include/uapi/linux/lnet/lnet-types.h +0
-0/* For compatibility with Cray Portals */ #define LNET_MD_PHYS 0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20181002/ac115ffd/attachment.sig>
PATCH 34/34 LU-7734 lnet: cpt locking
In reply to NeilBrownFrom: Amir Shehata <[email protected]>
When source nid is specified it is necessary to also use the destination nid. Otherwise bulk transfer will end up on a different interface than the nearest interface to the memory. This has significant performance impact on NUMA systems such as the SGI UV.
The CPT which the MD describing the bulk buffers belongs to is not the same CPT of the actual pages of memory. Therefore, it is necessary to communicate the CPT of the pages to LNet, in order for LNet to select the nearest interface.
The MD which describes the pages of memory gets attached to an ME, to be matched later on. The MD which describes the message to be sent is different and this patch adds the handle of the bulk MD into the MD which ends up being accessible by lnet_select_pathway(). In that function a new API, lnet_cpt_of_md_page(), is called which returns the CPT of the buffers used for the bulk transfer. lnet_select_pathway() proceeds to use this CPT to select the nearest interface.
Reviewed-on: https://review.whamcloud.com/24085
--- .../staging/lustre/include/linux/lnet/lib-lnet.h | 1 + .../staging/lustre/include/linux/lnet/lib-types.h | 1 + .../lustre/include/uapi/linux/lnet/lnet-types.h | 12 ++++++++ drivers/staging/lustre/lnet/lnet/lib-md.c | 31 ++++++++++++++++++++ drivers/staging/lustre/lnet/lnet/lib-move.c | 20 ++++++++----- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 26 +++++++++++++---- 6 files changed, 78 insertions(+), 13 deletions(-)
drivers/staging/lustre/include/linux/lnet/lib-lnet.h +1 -0
@@ -595,6 +595,7 @@ void lnet_me_unlink(struct lnet_me *me);void lnet_md_unlink (struct lnet_libmd *md);void lnet_md_deconstruct (struct lnet_libmd *lmd,struct lnet_md *umd); +int lnet_cpt_of_md (struct lnet_libmd *md);void lnet_register_lnd (struct lnet_lnd *lnd);void lnet_unregister_lnd (struct lnet_lnd *lnd);
drivers/staging/lustre/include/linux/lnet/lib-types.h +1 -0
@@ -161,6 +161,7 @@ struct lnet_libmd {void *md_user_ptr;struct lnet_eq *md_eq;unsigned int md_niov;/* # frags */ +struct lnet_handle_md md_bulk_handle;union {struct kvec iov[LNET_MAX_IOV ];struct bio_vec kiov[LNET_MAX_IOV ];
drivers/staging/lustre/include/uapi/linux/lnet/lnet-types.h +12 -0
@@ -444,6 +444,7 @@ struct lnet_md {* - LNET_MD_IOVEC: The start and length fields specify an array of * struct iovec. * - LNET_MD_MAX_SIZE: The max_size field is valid. +* - LNET_MD_BULK_HANDLE: The bulk_handle field is valid. * * Note: * - LNET_MD_KIOV or LNET_MD_IOVEC allows for a scatter/gather
@@ -467,6 +468,15 @@ struct lnet_md {* descriptor are not logged. */ struct lnet_handle_eq eq_handle; +/** +* The bulk MD handle which was registered to describe the buffers +* either to be used to transfer data to the peer or receive data +* from the peer. This allows LNet to properly determine the NUMA +* node on which the memory was allocated and use that to select the +* nearest local network interface. This value is only used +* if the LNET_MD_BULK_HANDLE option is set. +*/ +struct lnet_handle_md bulk_handle; };/*
@@ -499,6 +509,8 @@ struct lnet_md {#define LNET_MD_MAX_SIZE BIT(7)/** See lnet_md::options. */ #define LNET_MD_KIOV BIT(8) +/** See lnet_md::options. */ +#define LNET_MD_BULK_HANDLE BIT(9)/* For compatibility with Cray Portals */ #define LNET_MD_PHYS 0
drivers/staging/lustre/lnet/lnet/lib-md.c +31 -0
@@ -84,6 +84,36 @@ lnet_md_unlink(struct lnet_libmd *md)kfree (md); } +int +lnet_cpt_of_md (struct lnet_libmd *md) +{ +int cpt =CFS_CPT_ANY ; + +if (!md) +return CFS_CPT_ANY ; + +if ((md->md_options &LNET_MD_BULK_HANDLE ) !=0 && + md->md_bulk_handle.cookie !=LNET_WIRE_HANDLE_COOKIE_NONE ) { + md =lnet_handle2md (&md->md_bulk_handle); + +if (!md) +return CFS_CPT_ANY ; + } + +if ((md->md_options &LNET_MD_KIOV ) !=0 ) { +if (md->md_iov.kiov[0 ].bv_page) + cpt =cfs_cpt_of_node ( +lnet_cpt_table (), +page_to_nid (md->md_iov.kiov[0 ].bv_page)); + }else if (md->md_iov.iov[0 ].iov_base) { + cpt =cfs_cpt_of_node ( +lnet_cpt_table (), +page_to_nid (virt_to_page (md->md_iov.iov[0 ].iov_base))); + } + +return cpt; +} +static int lnet_md_build (struct lnet_libmd *lmd,struct lnet_md *umd,int unlink) {
@@ -101,6 +131,7 @@ lnet_md_build(struct lnet_libmd *lmd, struct lnet_md *umd, int unlink) lmd->md_threshold = umd->threshold; lmd->md_refcount =0 ; lmd->md_flags = (unlink ==LNET_UNLINK ) ?LNET_MD_FLAG_AUTO_UNLINK :0 ; + lmd->md_bulk_handle = umd->bulk_handle;if (umd->options &LNET_MD_IOVEC ) {if (umd->options &LNET_MD_KIOV )/* Can't specify both */
drivers/staging/lustre/lnet/lnet/lib-move.c +13 -7
@@ -1225,6 +1225,11 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,* then we proceed, if there is, then we restart the operation. */ cpt =lnet_net_lock_current (); + + md_cpt =lnet_cpt_of_md (msg->msg_md); +if (md_cpt ==CFS_CPT_ANY ) + md_cpt = cpt; + again: best_ni =NULL ; best_lpni =NULL ;
@@ -1242,12 +1247,6 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,return -ESHUTDOWN ; } -if (msg->msg_md) -/* get the cpt of the MD, used during NUMA based selection */ - md_cpt =lnet_cpt_of_cookie (msg->msg_md->md_lh.lh_cookie); -else - md_cpt =CFS_CPT_ANY ; - peer =lnet_find_or_create_peer_locked (dst_nid, cpt);if (IS_ERR (peer)) {lnet_net_unlock (cpt);
@@ -1285,7 +1284,8 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,if (msg->msg_type ==LNET_MSG_REPLY || msg->msg_type ==LNET_MSG_ACK || - !peer->lp_multi_rail) { + !peer->lp_multi_rail || + best_ni) {/* * for replies we want to respond on the same peer_ni we * received the message on if possible. If not, then pick
@@ -1294,6 +1294,12 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,* if the peer is non-multi-rail then you want to send to * the dst_nid provided as well. * +* If the best_ni has already been determined, IE the +* src_nid has been specified, then use the +* destination_nid provided as well, since we're +* continuing a series of related messages for the same +* RPC. +* * It is expected to find the lpni using dst_nid, since we * created it earlier. */
drivers/staging/lustre/lustre/ptlrpc/niobuf.c +20 -6
@@ -48,7 +48,8 @@static int ptl_send_buf (struct lnet_handle_md *mdh,void *base,int len,enum lnet_ack_req ack,struct ptlrpc_cb_id *cbid,lnet_nid_t self,struct lnet_process_id peer_id, -int portal,__u64 xid,unsigned int offset) +int portal,__u64 xid,unsigned int offset, +struct lnet_handle_md *bulk_cookie) {int rc;struct lnet_md md;
@@ -61,13 +62,17 @@ static int ptl_send_buf(struct lnet_handle_md *mdh, void *base, int len, md.options =PTLRPC_MD_OPTIONS ; md.user_ptr = cbid; md.eq_handle = ptlrpc_eq_h; + md.bulk_handle.cookie =LNET_WIRE_HANDLE_COOKIE_NONE ; + +if (bulk_cookie) { + md.bulk_handle = *bulk_cookie; + md.options |=LNET_MD_BULK_HANDLE ; + }if (unlikely (ack ==LNET_ACK_REQ && -OBD_FAIL_CHECK_ORSET (OBD_FAIL_PTLRPC_ACK , -OBD_FAIL_ONCE ))) { +OBD_FAIL_CHECK_ORSET (OBD_FAIL_PTLRPC_ACK ,OBD_FAIL_ONCE )))/* don't ask for the ack to simulate failing client */ ack =LNET_NOACK_REQ ; - } rc =LNetMDBind (md,LNET_UNLINK , mdh);if (unlikely (rc !=0 )) {
@@ -417,7 +422,7 @@ int ptlrpc_send_reply(struct ptlrpc_request *req, int flags) LNET_ACK_REQ :LNET_NOACK_REQ , &rs->rs_cb_id, req->rq_self, req->rq_source,ptlrpc_req2svc (req)->srv_rep_portal, - req->rq_xid, req->rq_reply_off); + req->rq_xid, req->rq_reply_off, NULL); out:if (unlikely (rc !=0 ))ptlrpc_req_drop_rs (req);
@@ -474,12 +479,15 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)int rc;int rc2;unsigned int mpflag =0 ; +struct lnet_handle_md bulk_cookie;struct ptlrpc_connection *connection;struct lnet_handle_me reply_me_h;struct lnet_md reply_md;struct obd_import *imp = request->rq_import;struct obd_device *obd = imp->imp_obd; + bulk_cookie.cookie =LNET_WIRE_HANDLE_COOKIE_NONE ; +if (OBD_FAIL_CHECK (OBD_FAIL_PTLRPC_DROP_RPC ))return 0 ;
@@ -577,6 +585,12 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) rc =ptlrpc_register_bulk (request);if (rc !=0 ) goto out; +/* +* All the mds in the request will have the same cpt +* encoded in the cookie. So we can just get the first +* one. +*/ + bulk_cookie = request->rq_bulk->bd_mds[0 ]; }if (!noreply) {
@@ -685,7 +699,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)LNET_NOACK_REQ , &request->rq_req_cbid,LNET_NID_ANY , connection->c_peer, request->rq_request_portal, - request->rq_xid, 0); + request->rq_xid, 0, &bulk_cookie);if (likely (rc ==0 )) goto out;
cover lustre: remainder of multi-rail series.
In reply to NeilBrownQuoted 9 lines
Hi,
following is the remainder of the Multi-Rail series, ported todrivers/staging.
The previous series was only the first patch from upstream. This series is mostly the individual patches from upstream, though I did split some up a bit, and merged at least one bugfix back to where the bug was introduced.
Quoted 4 lines
Comments, review, and explanations of bits I didn't understand, are most welcome. I confess that I haven't looked at the code very closely, just a superficially scan for things that look odd (there weren't many).
Thanks for doing this. It makes my life easier. With the patches:
lustre: lnet: copy the correct amount of cpts to lnet_cpts
lustre: lnd: resolve IP query code in LND drivers
and the fixup in patch 11 it runs flawless in my testing. I do recommend land the two above patches first so no git bisect will end up blowing up someones nodes :-)
Just have a bunch of commit recommendations. I noticed some MR patches landed to the main lustre branch. Perhaps those should be fixed as well. The only reason I ask is that I worry about kernel developers might not like that style of commit messages. In the past Greg pointed such things out to me. Thanks for hearing me out about that concern.
I will poke Doug about looking at some of the commit messages you had concern about.
Quoted 85 lines
Thanks,
NeilBrown---
Amir Shehata (22):
LU-7734 lnet: Multi-Rail peer split
LU-7734 lnet: Multi-Rail local_ni/peer_ni selection LU-7734 lnet: configure peers from DLC
LU-7734 lnet: configure local NI from DLC
LU-7734 lnet: NUMA support
LU-7734 lnet: Primary NID and traffic distribution LU-7734 lnet: handle non-MR peers
LU-7734 lnet: handle N NIs to 1 LND peer
LU-7734 lnet: rename LND peer topeer_ni
LU-7734 lnet: peer/peer_ni handling adjustments LU-7734 lnet: proper cpt locking
LU-7734 lnet: protectpeer_nicredits
LU-7734 lnet: simplify and fixlnet_select_pathway()LU-7734 lnet: configuration fixes
LU-7734 lnet: fixlnet_select_pathway()
LU-7734 lnet: Routing fixes part 1
LU-7734 lnet: Routing fixes part 2
LU-7734 lnet: fix routing selection
LU-7734 lnet: Fix crash inrouter_proc.c
LU-7734 lnet: fix NULL access inlnet_peer_aliveness_enabledLU-7734 lnet: rename peerkey_nidtoprim_nidLU-7734 lnet: cpt lockingDoug Oucharek (1):
LU-7734 lnet: Addpeer_niand NI stats for DLCNeilBrown (8):
lnet: replace alllp_fields withlpni_
lnet: change structlnet_peerto structlnet_peer_ni
lnet: Changelpni_refcounttoatomic_t
lnet: change some function names - add 'ni'.
lnet: makelnet_nid_cpt_hashnon-static.
lnet: introducelnet_find_peer_ni_locked()
lnet:lnet_peer_tables_cleanup: use an exclusive lock.
lnet: useBIT()macro for LNET_MD_* flagsOlaf Weber (3):
LU-7734 lnet: fixlnet_peer_table_cleanup_locked()LU-7734 lnet: double free inlnet_add_net_common()LU-7734 lnet: set primary NID inptlrpc_connection_get().../lustre/include/linux/libcfs/libcfs_string.h | 12 drivers/staging/lustre/include/linux/lnet/api.h | 1 .../staging/lustre/include/linux/lnet/lib-lnet.h | 151 ++- .../staging/lustre/include/linux/lnet/lib-types.h | 157 ++- .../lustre/include/uapi/linux/lnet/libcfs_ioctl.h | 11 .../lustre/include/uapi/linux/lnet/lnet-dlc.h | 104 ++ .../lustre/include/uapi/linux/lnet/lnet-types.h | 34 - .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 237 ++-- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 118 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 516 ++++----- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 678 ++++++------ .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 66 + .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 207 ++-- .../lustre/lnet/klnds/socklnd/socklnd_lib.c | 4 .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 14 drivers/staging/lustre/lnet/lnet/api-ni.c | 650 ++++++++++- drivers/staging/lustre/lnet/lnet/config.c | 107 +- drivers/staging/lustre/lnet/lnet/lib-md.c | 31 + drivers/staging/lustre/lnet/lnet/lib-move.c | 957 +++++++++++++--- drivers/staging/lustre/lnet/lnet/lib-msg.c | 18 drivers/staging/lustre/lnet/lnet/lib-ptl.c | 3 drivers/staging/lustre/lnet/lnet/module.c | 70 + drivers/staging/lustre/lnet/lnet/peer.c | 1169 +++++++++++++++++--- drivers/staging/lustre/lnet/lnet/router.c | 341 +++--- drivers/staging/lustre/lnet/lnet/router_proc.c | 66 + drivers/staging/lustre/lustre/include/lustre_net.h | 2 drivers/staging/lustre/lustre/ptlrpc/connection.c | 1 drivers/staging/lustre/lustre/ptlrpc/events.c | 5 drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 40 - drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 2 drivers/staging/lustre/lustre/ptlrpc/service.c | 4 31 files changed, 4056 insertions(+), 1720 deletions(-)--
Signature
cover lustre: remainder of multi-rail series.
Quoted 13 lines · James Simmons
Quoted 8 lines
Hi,
following is the remainder of the Multi-Rail series, ported todrivers/staging.
The previous series was only the first patch from upstream. This series is mostly the individual patches from upstream, though I did split some up a bit, and merged at least one bugfix back to where the bug was introduced.Quoted 4 lines
Comments, review, and explanations of bits I didn't understand, are most welcome. I confess that I haven't looked at the code very closely, just a superficially scan for things that look odd (there weren't many).
Quoted 4 lines
Thanks for doing this. It makes my life easier. With the patches:
lustre: lnet: copy the correct amount of cpts to
lnet_cpts
lustre: lnd: resolve IP query code in LND drivers
I've moved these two to the top of the series.
Quoted 10 lines
and the fixup in patch 11 it runs flawless in my testing. I do recommend land the two above patches first so no git bisect will end up blowing up someones nodes :-)
Just have a bunch of commit recommendations. I noticed some MR patches landed to the main lustre branch. Perhaps those should be fixed as well. The only reason I ask is that I worry about kernel developers might not like that style of commit messages. In the past Greg pointed such things out to me. Thanks for hearing me out about that concern.
While I hope that this will eventually get merged by Linus pulling my tree, complete with history, that might not work out. New clean patches might be required.
But if pulling my tree is an option, Greg (at least) cannot in good faith complain about the commit messages or patch breakdown as he explicitly said that we would be freed from that requirement by working out-of-tree. So I'm inclined not to put much effort into things that don't benefit us now.
Quoted 3 lines
I will poke Doug about looking at some of the commit messages you had concern about.
Thanks,
NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20181002/2e4a2df7/attachment.sig>
cover lustre: remainder of multi-rail series.
In reply to NeilBrownQuoted 9 lines
Hi,
following is the remainder of the Multi-Rail series, ported todrivers/staging.
The previous series was only the first patch from upstream. This series is mostly the individual patches from upstream, though I did split some up a bit, and merged at least one bugfix back to where the bug was introduced.
Quoted 4 lines
Comments, review, and explanations of bits I didn't understand, are most welcome. I confess that I haven't looked at the code very closely, just a superficially scan for things that look odd (there weren't many).
Found another bug in the router setup code. I'm tracking it down.
Quoted 85 lines
Thanks,
NeilBrown---
Amir Shehata (22):
LU-7734 lnet: Multi-Rail peer split
LU-7734 lnet: Multi-Rail local_ni/peer_ni selection LU-7734 lnet: configure peers from DLC
LU-7734 lnet: configure local NI from DLC
LU-7734 lnet: NUMA support
LU-7734 lnet: Primary NID and traffic distribution LU-7734 lnet: handle non-MR peers
LU-7734 lnet: handle N NIs to 1 LND peer
LU-7734 lnet: rename LND peer topeer_ni
LU-7734 lnet: peer/peer_ni handling adjustments LU-7734 lnet: proper cpt locking
LU-7734 lnet: protectpeer_nicredits
LU-7734 lnet: simplify and fixlnet_select_pathway()LU-7734 lnet: configuration fixes
LU-7734 lnet: fixlnet_select_pathway()
LU-7734 lnet: Routing fixes part 1
LU-7734 lnet: Routing fixes part 2
LU-7734 lnet: fix routing selection
LU-7734 lnet: Fix crash inrouter_proc.c
LU-7734 lnet: fix NULL access inlnet_peer_aliveness_enabledLU-7734 lnet: rename peerkey_nidtoprim_nidLU-7734 lnet: cpt lockingDoug Oucharek (1):
LU-7734 lnet: Addpeer_niand NI stats for DLCNeilBrown (8):
lnet: replace alllp_fields withlpni_
lnet: change structlnet_peerto structlnet_peer_ni
lnet: Changelpni_refcounttoatomic_t
lnet: change some function names - add 'ni'.
lnet: makelnet_nid_cpt_hashnon-static.
lnet: introducelnet_find_peer_ni_locked()
lnet:lnet_peer_tables_cleanup: use an exclusive lock.
lnet: useBIT()macro for LNET_MD_* flagsOlaf Weber (3):
LU-7734 lnet: fixlnet_peer_table_cleanup_locked()LU-7734 lnet: double free inlnet_add_net_common()LU-7734 lnet: set primary NID inptlrpc_connection_get().../lustre/include/linux/libcfs/libcfs_string.h | 12 drivers/staging/lustre/include/linux/lnet/api.h | 1 .../staging/lustre/include/linux/lnet/lib-lnet.h | 151 ++- .../staging/lustre/include/linux/lnet/lib-types.h | 157 ++- .../lustre/include/uapi/linux/lnet/libcfs_ioctl.h | 11 .../lustre/include/uapi/linux/lnet/lnet-dlc.h | 104 ++ .../lustre/include/uapi/linux/lnet/lnet-types.h | 34 - .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 237 ++-- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 118 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 516 ++++----- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 678 ++++++------ .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 66 + .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 207 ++-- .../lustre/lnet/klnds/socklnd/socklnd_lib.c | 4 .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 14 drivers/staging/lustre/lnet/lnet/api-ni.c | 650 ++++++++++- drivers/staging/lustre/lnet/lnet/config.c | 107 +- drivers/staging/lustre/lnet/lnet/lib-md.c | 31 + drivers/staging/lustre/lnet/lnet/lib-move.c | 957 +++++++++++++--- drivers/staging/lustre/lnet/lnet/lib-msg.c | 18 drivers/staging/lustre/lnet/lnet/lib-ptl.c | 3 drivers/staging/lustre/lnet/lnet/module.c | 70 + drivers/staging/lustre/lnet/lnet/peer.c | 1169 +++++++++++++++++--- drivers/staging/lustre/lnet/lnet/router.c | 341 +++--- drivers/staging/lustre/lnet/lnet/router_proc.c | 66 + drivers/staging/lustre/lustre/include/lustre_net.h | 2 drivers/staging/lustre/lustre/ptlrpc/connection.c | 1 drivers/staging/lustre/lustre/ptlrpc/events.c | 5 drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 40 - drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 2 drivers/staging/lustre/lustre/ptlrpc/service.c | 4 31 files changed, 4056 insertions(+), 1720 deletions(-)--
Signature