X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lnet%2Fklnds%2Fgnilnd%2Fgnilnd.h;h=9f6b36bb34b170f7f094456cc920f4321ff60ab1;hp=d82e97106c40b8a046f50b8b78ce0b1fc42dfd51;hb=88f761bc00c7fb29db4f80594ae864493bdd5071;hpb=31be9f94d72287d7077ffc00d392a71056f61f4d diff --git a/lnet/klnds/gnilnd/gnilnd.h b/lnet/klnds/gnilnd/gnilnd.h index d82e971..9f6b36b 100644 --- a/lnet/klnds/gnilnd/gnilnd.h +++ b/lnet/klnds/gnilnd/gnilnd.h @@ -3,7 +3,7 @@ * * Copyright (C) 2009-2012 Cray, Inc. * - * Copyright (c) 2013, 2014, Intel Corporation. + * Copyright (c) 2014, Intel Corporation. * * Derived from work by: Eric Barton * Author: Nic Henke @@ -99,7 +99,6 @@ /* fixed constants */ #define GNILND_MAXDEVS 1 /* max # of GNI devices currently supported */ #define GNILND_MBOX_CREDITS 256 /* number of credits per mailbox */ -#define GNILND_COOKIE 0xa3579 /* cookie used by along with ptag by GNI */ #define GNILND_CONN_MAGIC 0xa100f /* magic value for verifying connection validity */ /* checksum values */ #define GNILND_CHECKSUM_OFF 0 /* checksum turned off */ @@ -120,7 +119,6 @@ #define GNILND_COMPUTE 1 /* compute image */ #define GNILND_FAST_RECONNECT 1 /* Fast Reconnect option */ #else -#define GNILND_SCHED_THREADS 3 /* default # of kgnilnd_scheduler threads */ #define GNILND_FMABLK 1024 /* default number of mboxes per fmablk */ #define GNILND_SCHED_NICE -20 /* default nice value for scheduler threads */ #define GNILND_COMPUTE 0 /* service image */ @@ -141,6 +139,8 @@ /* Max number of connections to keep in purgatory per peer */ #define GNILND_PURGATORY_MAX 5 +/* Closing, don't put in purgatory */ +#define GNILND_NOPURG 222 /* payload size to add to the base mailbox size * This is subtracting 2 from the concurrent_sends as 4 messages are included in the size @@ -460,6 +460,7 @@ typedef struct kgn_tunables { int *kgn_bte_dlvr_mode; /* BTE delivery mode mask */ int *kgn_bte_relaxed_ordering; /* relaxed ordering (PASSPW) on BTE transfers */ int *kgn_ptag; /* PTAG for cdm_create */ + int *kgn_pkey; /* PKEY for cdm_create */ int *kgn_max_retransmits; /* max number of FMA retransmits */ int *kgn_nwildcard; /* # wildcard per net to post */ int *kgn_nice; /* nice value for kgnilnd threads */ @@ -484,8 +485,10 @@ typedef struct kgn_tunables { int *kgn_fast_reconn; /* fast reconnection on conn timeout */ int *kgn_efault_lbug; /* LBUG on receiving an EFAULT */ int *kgn_max_purgatory; /* # conns/peer to keep in purgatory */ + int *kgn_thread_affinity; /* bind scheduler threads to cpus */ + int *kgn_thread_safe; /* use thread safe kgni API */ #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM - cfs_sysctl_table_header_t *kgn_sysctl; /* sysctl interface */ + struct ctl_table_header *kgn_sysctl; /* sysctl interface */ #endif } kgn_tunables_t; @@ -588,6 +591,8 @@ typedef struct kgn_device { atomic_t gnd_n_schedule; atomic_t gnd_canceled_dgrams; /* # of outstanding cancels */ struct rw_semaphore gnd_conn_sem; /* serialize connection changes/data movement */ + void *gnd_smdd_hold_buf; /* buffer to keep smdd */ + gni_mem_handle_t gnd_smdd_hold_hndl; /* buffer mem handle */ } kgn_device_t; typedef struct kgn_net { @@ -884,34 +889,15 @@ extern int _kgnilnd_schedule_conn(kgn_conn_t *conn, const char *caller, int line #define kgnilnd_schedule_conn(conn) \ _kgnilnd_schedule_conn(conn, __func__, __LINE__, 0); -#define kgnilnd_schedule_conn_refheld(conn, refheld) \ +#define kgnilnd_schedule_conn_refheld(conn, refheld) \ _kgnilnd_schedule_conn(conn, __func__, __LINE__, refheld); -static inline int -kgnilnd_thread_start(int(*fn)(void *arg), void *arg, char *name, int id) -{ - struct task_struct *thrd = kthread_run(fn, arg, "%s_%02d", name, id); - if (IS_ERR(thrd)) - return PTR_ERR(thrd); - - atomic_inc(&kgnilnd_data.kgn_nthreads); - return 0; -} - static inline void kgnilnd_thread_fini(void) { atomic_dec(&kgnilnd_data.kgn_nthreads); } -static inline int kgnilnd_gl_mutex_trylock(struct mutex *lock) -{ - if (kgnilnd_data.kgn_enable_gl_mutex) - return mutex_trylock(lock); - else - return 1; -} - static inline void kgnilnd_gl_mutex_lock(struct mutex *lock) { if (kgnilnd_data.kgn_enable_gl_mutex) @@ -949,14 +935,11 @@ static inline void kgnilnd_conn_mutex_unlock(struct mutex *lock) * This function must not be used in interrupt context. The * mutex must be released by the same task that acquired it. */ -static inline int kgnilnd_mutex_trylock(struct mutex *lock) +static inline int __kgnilnd_mutex_trylock(struct mutex *lock) { int ret; unsigned long timeout; - if (!kgnilnd_data.kgn_enable_gl_mutex) - return 1; - LASSERT(!in_interrupt()); for (timeout = jiffies + 1; time_before(jiffies, timeout);) { @@ -968,6 +951,31 @@ static inline int kgnilnd_mutex_trylock(struct mutex *lock) return 0; } +static inline int kgnilnd_mutex_trylock(struct mutex *lock) +{ + if (!kgnilnd_data.kgn_enable_gl_mutex) + return 1; + + return __kgnilnd_mutex_trylock(lock); +} + +static inline int kgnilnd_trylock(struct mutex *cq_lock, + struct mutex *c_lock) +{ + if (kgnilnd_data.kgn_enable_gl_mutex) + return __kgnilnd_mutex_trylock(cq_lock); + else + return __kgnilnd_mutex_trylock(c_lock); +} + +static inline void *kgnilnd_vzalloc(int size) +{ + void *ret = __vmalloc(size, __GFP_HIGHMEM | GFP_NOFS | __GFP_ZERO, + PAGE_KERNEL); + LIBCFS_ALLOC_POST(ret, size); + return ret; +} + /* Copied from DEBUG_REQ in Lustre - the dance is needed to save stack space */ extern void @@ -1733,7 +1741,7 @@ int kgnilnd_eager_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, void **new_private); int kgnilnd_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed, unsigned int niov, - struct iovec *iov, lnet_kiov_t *kiov, + struct kvec *iov, lnet_kiov_t *kiov, unsigned int offset, unsigned int mlen, unsigned int rlen); __u16 kgnilnd_cksum_kiov(unsigned int nkiov, lnet_kiov_t *kiov, unsigned int offset, unsigned int nob, int dump_blob); @@ -1775,6 +1783,7 @@ int kgnilnd_reaper(void *arg); int kgnilnd_scheduler(void *arg); int kgnilnd_dgram_mover(void *arg); int kgnilnd_rca(void *arg); +int kgnilnd_thread_start(int(*fn)(void *arg), void *arg, char *name, int id); int kgnilnd_create_conn(kgn_conn_t **connp, kgn_device_t *dev); int kgnilnd_conn_isdup_locked(kgn_peer_t *peer, kgn_conn_t *newconn); @@ -1977,6 +1986,8 @@ kgnilnd_conn_dgram_type2str(kgn_dgram_type_t type) /* pulls in tunables per platform and adds in nid/nic conversion * if RCA wasn't available at build time */ #include "gnilnd_hss_ops.h" +/* API wrapper functions - include late to pick up all of the other defines */ +#include "gnilnd_api_wrap.h" #if defined(CONFIG_CRAY_GEMINI) #include "gnilnd_gemini.h" @@ -1986,7 +1997,38 @@ kgnilnd_conn_dgram_type2str(kgn_dgram_type_t type) #error "Undefined Network Hardware Type" #endif -/* API wrapper functions - include late to pick up all of the other defines */ -#include "gnilnd_api_wrap.h" +extern uint32_t kgni_driver_version; + +static inline void +kgnilnd_check_kgni_version(void) +{ + uint32_t *kdv; + + kgnilnd_data.kgn_enable_gl_mutex = 1; + kdv = symbol_get(kgni_driver_version); + if (!kdv) { + LCONSOLE_INFO("Not using thread safe locking -" + " no symbol kgni_driver_version\n"); + return; + } + + /* Thread-safe kgni implemented in minor ver 0x44/45, code rev 0xb9 */ + if (*kdv < GNI_VERSION_CHECK(0, GNILND_KGNI_TS_MINOR_VER, 0xb9)) { + symbol_put(kgni_driver_version); + LCONSOLE_INFO("Not using thread safe locking, gni version 0x%x," + " need >= 0x%x\n", *kdv, + GNI_VERSION_CHECK(0, GNILND_KGNI_TS_MINOR_VER, 0xb9)); + return; + } + + symbol_put(kgni_driver_version); + + if (!*kgnilnd_tunables.kgn_thread_safe) { + return; + } + + /* Use thread-safe locking */ + kgnilnd_data.kgn_enable_gl_mutex = 0; +} #endif /* _GNILND_GNILND_H_ */