Skip to contentSkip to conversation

IB/hfi1, rdmavt, core: Misc fixes and improvements for 4.7

PATCH In review Dennis Dalessandro 2 participants 17 messages May 12, 2016 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover IB/hfi1, rdmavt, core: Misc fixes and improvements for 4.7

Here are some patches that address a few bugs and a couple other clean ups that did not make it in time for 4.6. There are also a couple performance related patches as well.

There are more clean-ups on the way to address some of the feedback received during reviews of other patches, however this stuff stands on its own so separating it out into its own series.

This patch series applies on Doug's k.o/for-4.7 branch.

Patches can also be viewed in my repo at:
https://github.com/ddalessa/kernel/tree/for-4.7

---

Ashutosh Dixit (1):
IB/hfi1: Change hfi1_init loop to preserve error returns

Dean Luick (2):
IB/hfi1: Remove no-op QSFP reset code IB/hfi1: Immediately apply congestion setting MAD

Easwar Hariharan (3):
IB/hfi1: Ignore non-temperature warnings on a downed link IB/hfi1: Wait for QSFP modules to initialize IB/hfi1: Correct external device configuration shift

Jakub Pawlak (1):
IB/hfi1: Correct log message strings

Jianxin Xiong (2):
IB/hfi1: Keep SC_USER as the last send context type ib_pack.h: Add opcode definition for send with invalidate

Jubin John (2):
IB/hfi1: Remove unnecessary header
IB/hfi1: Fix hfi_rcvhdr tracepoint

Mike Marciniszyn (3):
IB/hfi1: Fix pio wait counter double increment IB/hfi1: Fix potential panic with sdma drained mechanism IB/rdmavt: Increase CQ callback thread priority

Mitko Haralanov (1):
IB/hfi1: Improve performance of interval RB trees

 drivers/infiniband/sw/rdmavt/cq.c    |    1 
 drivers/staging/rdma/hfi1/chip.c     |   32 ++++++++----
 drivers/staging/rdma/hfi1/diag.c     |    2 -
 drivers/staging/rdma/hfi1/driver.c   |    2 -
 drivers/staging/rdma/hfi1/hfi.h      |    6 +-
 drivers/staging/rdma/hfi1/init.c     |    6 +-
 drivers/staging/rdma/hfi1/mad.c      |   93 ++++++++++++++++++++++------------
 drivers/staging/rdma/hfi1/mmu_rb.c   |   22 ++++----
 drivers/staging/rdma/hfi1/pio.h      |    8 +--
 drivers/staging/rdma/hfi1/platform.c |   21 +++++---
 drivers/staging/rdma/hfi1/platform.h |    1 
 drivers/staging/rdma/hfi1/qp.c       |    1 
 drivers/staging/rdma/hfi1/sdma.c     |    2 -
 drivers/staging/rdma/hfi1/sysfs.c    |    4 +
 drivers/staging/rdma/hfi1/trace.h    |    2 -
 drivers/staging/rdma/hfi1/verbs.c    |    2 -
 include/rdma/ib_pack.h               |    5 ++
 17 files changed, 128 insertions(+), 82 deletions(-)
Signature · 5 lines
-Denny
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20160512172050.9741.84190.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org

#2 lore raw

PATCH 1/15 IB/hfi1: Ignore non-temperature warnings on a downed link

From: Easwar Hariharan <[email protected]>

QSFP modules can raise an interrupt to inform us of expected conditions while the link is down, such as RX power low. Actively ignore these conditions when the link is down as they only add reporting noise. Continue reporting conditions that are valid at all times, such as temperature alarms and warnings.

---
 drivers/staging/rdma/hfi1/chip.c |   17 +++++++++++------
 drivers/staging/rdma/hfi1/diag.c |    2 +-
 drivers/staging/rdma/hfi1/hfi.h  |    1 +
 3 files changed, 13 insertions(+), 7 deletions(-)
drivers/staging/rdma/hfi1/chip.c +11 -6
index dcae8e7..f6ae0ba 100644
@@ -6105,7 +6105,7 @@ int acquire_lcb_access(struct hfi1_devdata *dd, int sleep_ok)
 	}
 
 	/* this access is valid only when the link is up */
-	if ((ppd->host_link_state & HLS_UP) == 0) {
+	if (ppd->host_link_state & HLS_DOWN) {
 		dd_dev_info(dd, "%s: link state %s not up\n",
 			    __func__, link_state_name(ppd->host_link_state));
 		ret = -EBUSY;
@@ -7429,7 +7429,7 @@ void apply_link_downgrade_policy(struct hfi1_pportdata *ppd, int refresh_widths)
 retry:
 	mutex_lock(&ppd->hls_lock);
 	/* only apply if the link is up */
-	if (!(ppd->host_link_state & HLS_UP)) {
+	if (ppd->host_link_state & HLS_DOWN) {
 		/* still going up..wait and retry */
 		if (ppd->host_link_state & HLS_GOING_UP) {
 			if (++tries < 1000) {
@@ -9252,6 +9252,12 @@ static int handle_qsfp_error_conditions(struct hfi1_pportdata *ppd,
 		dd_dev_info(dd, "%s: QSFP cable temperature too low\n",
 			    __func__);
 
+	/*
+	 * The remaining alarms/warnings don't matter if the link is down.
+	 */
+	if (ppd->host_link_state & HLS_DOWN)
+		return 0;
+
 	if ((qsfp_interrupt_status[1] & QSFP_HIGH_VCC_ALARM) ||
 	    (qsfp_interrupt_status[1] & QSFP_HIGH_VCC_WARNING))
 		dd_dev_info(dd, "%s: QSFP supply voltage too high\n",
@@ -9346,9 +9352,8 @@ void qsfp_event(struct work_struct *work)
 		return;
 
 	/*
-	 * Turn DC back on after cables has been
-	 * re-inserted. Up until now, the DC has been in
-	 * reset to save power.
+	 * Turn DC back on after cable has been re-inserted. Up until
+	 * now, the DC has been in reset to save power.
 	 */
 	dc_start(dd);
 
@@ -10074,7 +10079,7 @@ u32 driver_physical_state(struct hfi1_pportdata *ppd)
  */
 u32 driver_logical_state(struct hfi1_pportdata *ppd)
 {
-	if (ppd->host_link_state && !(ppd->host_link_state & HLS_UP))
+	if (ppd->host_link_state && (ppd->host_link_state & HLS_DOWN))
 		return IB_PORT_DOWN;
 
 	switch (ppd->host_link_state & HLS_UP) {
drivers/staging/rdma/hfi1/diag.c +1 -1
index 4cf6e8d..d262918 100644
@@ -996,7 +996,7 @@ static long hfi1_assign_snoop_link_credits(struct hfi1_pportdata *ppd,
 	u16  per_vl_credits;
 	__be16 be_per_vl_credits;
 
-	if (!(ppd->host_link_state & HLS_UP))
+	if (ppd->host_link_state & HLS_DOWN)
 		goto err_exit;
 	if (total_credits  <  vl15_credits)
 		goto err_exit;
drivers/staging/rdma/hfi1/hfi.h +1 -0
index 7351898..6485a1d 100644
@@ -453,6 +453,7 @@ struct rvt_sge_state;
 #define HLS_LINK_COOLDOWN BIT(__HLS_LINK_COOLDOWN_BP)
 
 #define HLS_UP (HLS_UP_INIT | HLS_UP_ARMED | HLS_UP_ACTIVE)
+#define HLS_DOWN ~(HLS_UP)
 
 /* use this MTU size if none other is given */
 #define HFI1_DEFAULT_ACTIVE_MTU 10240

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

PATCH 2/15 IB/hfi1: Wait for QSFP modules to initialize

In reply to a message not in the archive

From: Easwar Hariharan <[email protected]>

The function level reset in init_chip() and subsequent write of all 1s to the ASIC_QSFP registers effectively resets attached active and optical QSFP modules that pay attention to the RESET_N pin.

We subsequently try to access the QSFP management interface to qualify and tune the channel and fabric SerDes before enough time (2 seconds per SFF 8679 spec for QSFP28 modules) has elapsed for the module to finish initialization. This fails and causes the failure of the channel tuning algorithm, preventing us from bringing the link up.

This patch checks the port type prior to beginning channel and SerDes tuning, and if found to be QSFP, watches for the QSFP initialization complete interrupt, with a maximum timeout of 2 seconds, to allow the initialization to complete.

---
 drivers/staging/rdma/hfi1/chip.c     |   10 +++++++++-
 drivers/staging/rdma/hfi1/platform.c |   17 +++++++++++------
 drivers/staging/rdma/hfi1/platform.h |    1 +
 3 files changed, 21 insertions(+), 7 deletions(-)
drivers/staging/rdma/hfi1/chip.c +9 -1
index f6ae0ba..ce4c275 100644
@@ -9485,7 +9485,15 @@ int bringup_serdes(struct hfi1_pportdata *ppd)
 			return ret;
 	}
 
-	/* tune the SERDES to a ballpark setting for
+	get_port_type(ppd);
+	if (ppd->port_type == PORT_TYPE_QSFP) {
+		set_qsfp_int_n(ppd, 0);
+		wait_for_qsfp_init(ppd);
+		set_qsfp_int_n(ppd, 1);
+	}
+
+	/*
+	 * Tune the SerDes to a ballpark setting for
 	 * optimal signal and bit error rate
 	 * Needs to be done before starting the link
 	 */
drivers/staging/rdma/hfi1/platform.c +11 -6
index 8fe8a20..dfa413c 100644
@@ -87,6 +87,17 @@ void free_platform_config(struct hfi1_devdata *dd)
 	 */
 }
 
+void get_port_type(struct hfi1_pportdata *ppd)
+{
+	int ret;
+
+	ret = get_platform_config_field(ppd->dd, PLATFORM_CONFIG_PORT_TABLE, 0,
+					PORT_TABLE_PORT_TYPE, &ppd->port_type,
+					4);
+	if (ret)
+		ppd->port_type = PORT_TYPE_UNKNOWN;
+}
+
 int set_qsfp_tx(struct hfi1_pportdata *ppd, int on)
 {
 	u8 tx_ctrl_byte = on ? 0x0 : 0xF;
@@ -784,12 +795,6 @@ void tune_serdes(struct hfi1_pportdata *ppd)
 		return;
 	}
 
-	ret = get_platform_config_field(ppd->dd, PLATFORM_CONFIG_PORT_TABLE, 0,
-					PORT_TABLE_PORT_TYPE, &ppd->port_type,
-					4);
-	if (ret)
-		ppd->port_type = PORT_TYPE_UNKNOWN;
-
 	switch (ppd->port_type) {
 	case PORT_TYPE_DISCONNECTED:
 		ppd->offline_disabled_reason =
drivers/staging/rdma/hfi1/platform.h +1 -0
index 19620cf..e2c2161 100644
@@ -298,6 +298,7 @@ enum link_tuning_encoding {
 /* platform.c */
 void get_platform_config(struct hfi1_devdata *dd);
 void free_platform_config(struct hfi1_devdata *dd);
+void get_port_type(struct hfi1_pportdata *ppd);
 int set_qsfp_tx(struct hfi1_pportdata *ppd, int on);
 void tune_serdes(struct hfi1_pportdata *ppd);
 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

PATCH 3/15 IB/hfi1: Correct external device configuration shift

In reply to a message not in the archive

From: Easwar Hariharan <[email protected]>

The external device configuration was incorrectly shifted to byte 3 of the 32 bit DC_HOST_COMM_SETTINGS instead of byte 0. This patch corrects the shift and provides the cable capability information in byte 0.

---
 drivers/staging/rdma/hfi1/platform.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rdma/hfi1/platform.c +2 -2
index dfa413c..ae0e498 100644
@@ -575,8 +575,8 @@ static void apply_tunings(
 		ret = read_8051_config(ppd->dd, DC_HOST_COMM_SETTINGS,
 				       GENERAL_CONFIG, &config_data);
 		/* Clear, then set the external device config field */
-		config_data &= ~(0xFF << 24);
-		config_data |= (external_device_config << 24);
+		config_data &= ~(u32)0xFF;
+		config_data |= external_device_config;
 		ret = load_8051_config(ppd->dd, DC_HOST_COMM_SETTINGS,
 				       GENERAL_CONFIG, config_data);
 		if (ret != HCMD_SUCCESS)

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

PATCH 4/15 IB/hfi1: Remove no-op QSFP reset code

In reply to a message not in the archive

From: Dean Luick <[email protected]>

The RESET_N bit of the ASIC_QSFPn_OE register is not used by the hardware. Remove code that tries to use it - it does nothing.

---
 drivers/staging/rdma/hfi1/chip.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/staging/rdma/hfi1/chip.c +0 -3
index ce4c275..ec0953e 100644
@@ -9212,9 +9212,6 @@ void reset_qsfp(struct hfi1_pportdata *ppd)
 
 	/* Reset the QSFP */
 	mask = (u64)QSFP_HFI0_RESET_N;
-	qsfp_mask = read_csr(dd, dd->hfi1_id ? ASIC_QSFP2_OE : ASIC_QSFP1_OE);
-	qsfp_mask |= mask;
-	write_csr(dd, dd->hfi1_id ? ASIC_QSFP2_OE : ASIC_QSFP1_OE, qsfp_mask);
 
 	qsfp_mask = read_csr(dd,
 			     dd->hfi1_id ? ASIC_QSFP2_OUT : ASIC_QSFP1_OUT);

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw

PATCH 5/15 IB/hfi1: Fix pio wait counter double increment

In reply to a message not in the archive

From: Mike Marciniszyn <[email protected]>

The code unconditionlly increments the pio wait counter making the counter inacurate and unusable.

Fixes 14553ca11039 ("staging/rdma/hfi1: Adaptive PIO for short messages")
---
 drivers/staging/rdma/hfi1/verbs.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/rdma/hfi1/verbs.c +0 -1
index 9cdc85f..f3531fd 100644
@@ -946,7 +946,6 @@ static int pio_wait(struct rvt_qp *qp,
 
 			dev->n_piowait += !!(flag & RVT_S_WAIT_PIO);
 			dev->n_piodrain += !!(flag & RVT_S_WAIT_PIO_DRAIN);
-			dev->n_piowait++;
 			qp->s_flags |= flag;
 			was_empty = list_empty(&sc->piowait);
 			list_add_tail(&priv->s_iowait.list, &sc->piowait);

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

PATCH 6/15 IB/hfi1: Fix potential panic with sdma drained mechanism

In reply to a message not in the archive

From: Mike Marciniszyn <[email protected]>

The guard is backwards, potentially causing the SDMA client to panic if a wait structure was not specified.

psm and verbs are not exposed to the issue, but fix the code just to be correct.

Fixes a545f5308b6c ("staging/rdma/hfi: fix CQ completion order issue")
---
 drivers/staging/rdma/hfi1/sdma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/rdma/hfi1/sdma.c +1 -1
index abb8ebc..e938017 100644
@@ -376,7 +376,7 @@ static inline void complete_tx(struct sdma_engine *sde,
 	sdma_txclean(sde->dd, tx);
 	if (complete)
 		(*complete)(tx, res);
-	if (iowait_sdma_dec(wait) && wait)
+	if (wait && iowait_sdma_dec(wait))
 		iowait_drain_wakeup(wait);
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

PATCH 7/15 IB/hfi1: Improve performance of interval RB trees

In reply to a message not in the archive

From: Mitko Haralanov <[email protected]>

The interval RB tree management functions use handlers to store user-specific callback for the various tree operations. These handlers are put on a doubly-linked list. When a RB tree function is called, the list is searched for the handler of the particular tree.

The list which holds the handlers is modified very rarely - when a handler is created and when a handler is removed. On the other hand, it is searched very often. This a perfect usage scenario for RCU.

The result is a much lower overhead of traversing the list as most of the time no locking will be required.

---
 drivers/staging/rdma/hfi1/mmu_rb.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)
drivers/staging/rdma/hfi1/mmu_rb.c +11 -11
index 2b0e91d..b7a80aa 100644
@@ -45,6 +45,7 @@
  *
  */
 #include <linux/list.h>
+#include <linux/rculist.h>
 #include <linux/mmu_notifier.h>
 #include <linux/interval_tree_generic.h>
 
@@ -97,7 +98,6 @@ static unsigned long mmu_node_last(struct mmu_rb_node *node)
 int hfi1_mmu_rb_register(struct rb_root *root, struct mmu_rb_ops *ops)
 {
 	struct mmu_rb_handler *handlr;
-	unsigned long flags;
 
 	if (!ops->invalidate)
 		return -EINVAL;
@@ -111,9 +111,9 @@ int hfi1_mmu_rb_register(struct rb_root *root, struct mmu_rb_ops *ops)
 	INIT_HLIST_NODE(&handlr->mn.hlist);
 	spin_lock_init(&handlr->lock);
 	handlr->mn.ops = &mn_opts;
-	spin_lock_irqsave(&mmu_rb_lock, flags);
-	list_add_tail(&handlr->list, &mmu_rb_handlers);
-	spin_unlock_irqrestore(&mmu_rb_lock, flags);
+	spin_lock(&mmu_rb_lock);
+	list_add_tail_rcu(&handlr->list, &mmu_rb_handlers);
+	spin_unlock(&mmu_rb_lock);
 
 	return mmu_notifier_register(&handlr->mn, current->mm);
 }
@@ -130,9 +130,10 @@ void hfi1_mmu_rb_unregister(struct rb_root *root)
 	if (current->mm)
 		mmu_notifier_unregister(&handler->mn, current->mm);
 
-	spin_lock_irqsave(&mmu_rb_lock, flags);
-	list_del(&handler->list);
-	spin_unlock_irqrestore(&mmu_rb_lock, flags);
+	spin_lock(&mmu_rb_lock);
+	list_del_rcu(&handler->list);
+	spin_unlock(&mmu_rb_lock);
+	synchronize_rcu();
 
 	spin_lock_irqsave(&handler->lock, flags);
 	if (!RB_EMPTY_ROOT(root)) {
@@ -271,16 +272,15 @@ void hfi1_mmu_rb_remove(struct rb_root *root, struct mmu_rb_node *node)
 static struct mmu_rb_handler *find_mmu_handler(struct rb_root *root)
 {
 	struct mmu_rb_handler *handler;
-	unsigned long flags;
 
-	spin_lock_irqsave(&mmu_rb_lock, flags);
-	list_for_each_entry(handler, &mmu_rb_handlers, list) {
+	rcu_read_lock();
+	list_for_each_entry_rcu(handler, &mmu_rb_handlers, list) {
 		if (handler->root == root)
 			goto unlock;
 	}
 	handler = NULL;
 unlock:
-	spin_unlock_irqrestore(&mmu_rb_lock, flags);
+	rcu_read_unlock();
 	return handler;
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

PATCH 8/15 IB/hfi1: Remove unnecessary header

In reply to a message not in the archive

From: Jubin John <[email protected]>

While running perftests, there is a significant utilization of the random number daemon. This is due to the linux/random.h header being included in qp.c and verbs.c. However, none of the functions from this header are being used in these files, so remove the unnecessary header.

---
 drivers/staging/rdma/hfi1/qp.c    |    1 -
 drivers/staging/rdma/hfi1/verbs.c |    1 -
 2 files changed, 0 insertions(+), 2 deletions(-)
drivers/staging/rdma/hfi1/qp.c +0 -1
index 91eb423..c626508 100644
@@ -49,7 +49,6 @@
 #include <linux/vmalloc.h>
 #include <linux/hash.h>
 #include <linux/module.h>
-#include <linux/random.h>
 #include <linux/seq_file.h>
 #include <rdma/rdma_vt.h>
 #include <rdma/rdmavt_qp.h>
drivers/staging/rdma/hfi1/verbs.c +0 -1
index f3531fd..ae92ac5 100644
@@ -52,7 +52,6 @@
 #include <linux/utsname.h>
 #include <linux/rculist.h>
 #include <linux/mm.h>
-#include <linux/random.h>
 #include <linux/vmalloc.h>
 
 #include "hfi.h"

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw

PATCH 9/15 IB/hfi1: Fix hfi_rcvhdr tracepoint

In reply to a message not in the archive

From: Jubin John <[email protected]>

The hfi_rcvhdr tracepoint has the ctxt and eflags switched in the prototype of the trace event, compared to the args and usage of the trace function. Fix this by swapping these 2 fields in the trace event prototype.

---
 drivers/staging/rdma/hfi1/trace.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/rdma/hfi1/trace.h +1 -1
index 3cb0391..a6c1adf 100644
@@ -74,8 +74,8 @@ __print_symbolic(etype,                         \
 
 TRACE_EVENT(hfi1_rcvhdr,
 	    TP_PROTO(struct hfi1_devdata *dd,
-		     u64 eflags,
 		     u32 ctxt,
+		     u64 eflags,
 		     u32 etype,
 		     u32 hlen,
 		     u32 tlen,

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw

PATCH 10/15 IB/rdmavt: Increase CQ callback thread priority

In reply to a message not in the archive

From: Mike Marciniszyn <[email protected]>

The priority of the send engines is higher than the CQ completion thread potentially causing completions to be starved for very fast interfaces.

Change the CQ kthread to match the send engine threads to minimize this delay for ULP completion processing.

---
 drivers/infiniband/sw/rdmavt/cq.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/infiniband/sw/rdmavt/cq.c +1 -0
index b1ffc8b..6ca6fa8 100644
@@ -525,6 +525,7 @@ int rvt_driver_cq_init(struct rvt_dev_info *rdi)
 		return PTR_ERR(task);
 	}
 
+	set_user_nice(task, MIN_NICE);
 	cpu = cpumask_first(cpumask_of_node(rdi->dparms.node));
 	kthread_bind(task, cpu);
 	wake_up_process(task);

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#12 lore raw

PATCH 11/15 IB/hfi1: Correct log message strings

In reply to a message not in the archive

From: Jakub Pawlak <[email protected]>

Remove "IB" keyword from log messages.
Correct comment for thermal sensor init function.

---
 drivers/staging/rdma/hfi1/chip.c   |    2 +-
 drivers/staging/rdma/hfi1/driver.c |    2 +-
 drivers/staging/rdma/hfi1/hfi.h    |    5 ++---
 drivers/staging/rdma/hfi1/sysfs.c  |    4 ++--
 4 files changed, 6 insertions(+), 7 deletions(-)
drivers/staging/rdma/hfi1/chip.c +1 -1
index ec0953e..d8cc329 100644
@@ -14588,7 +14588,7 @@ u64 create_pbc(struct hfi1_pportdata *ppd, u64 flags, int srate_mbs, u32 vl,
 		   (reason), (ret))
 
 /*
- * Initialize the Avago Thermal sensor.
+ * Initialize the thermal sensor.
  *
  * After initialization, enable polling of thermal sensor through
  * SBus interface. In order for this to work, the SBus Master
drivers/staging/rdma/hfi1/driver.c +1 -1
index 700c6fa..c75b0ae 100644
@@ -1161,7 +1161,7 @@ int hfi1_set_lid(struct hfi1_pportdata *ppd, u32 lid, u8 lmc)
 	ppd->lmc = lmc;
 	hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_LIDLMC, 0);
 
-	dd_dev_info(dd, "IB%u:%u got a lid: 0x%x\n", dd->unit, ppd->port, lid);
+	dd_dev_info(dd, "port %u: got a lid: 0x%x\n", ppd->port, lid);
 
 	return 0;
 }
drivers/staging/rdma/hfi1/hfi.h +2 -3
index 6485a1d..75911cd 100644
@@ -1883,9 +1883,8 @@ static inline u64 hfi1_pkt_base_sdma_integrity(struct hfi1_devdata *dd)
 		get_unit_name((dd)->unit), ##__VA_ARGS__)
 
 #define hfi1_dev_porterr(dd, port, fmt, ...) \
-	dev_err(&(dd)->pcidev->dev, "%s: IB%u:%u " fmt, \
-			get_unit_name((dd)->unit), (dd)->unit, (port), \
-			##__VA_ARGS__)
+	dev_err(&(dd)->pcidev->dev, "%s: port %u: " fmt, \
+			get_unit_name((dd)->unit), (port), ##__VA_ARGS__)
 
 /*
  * this is used for formatting hw error messages...
drivers/staging/rdma/hfi1/sysfs.c +2 -2
index 2ff5a14..db1a617 100644
@@ -729,8 +729,8 @@ int hfi1_create_port_files(struct ib_device *ibdev, u8 port_num,
 	}
 
 	dd_dev_info(dd,
-		    "IB%u: Congestion Control Agent enabled for port %d\n",
-		    dd->unit, port_num);
+		    "Congestion Control Agent enabled for port %d\n",
+		    port_num);
 
 	return 0;
 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#13 lore raw

PATCH 12/15 IB/hfi1: Immediately apply congestion setting MAD

In reply to a message not in the archive

From: Dean Luick <[email protected]>

The handling of the congestion setting MAD packet only saved off the values, waiting for a congestion control table packet before going active. Instead, immediately apply the values.

---
 drivers/staging/rdma/hfi1/mad.c |   93 +++++++++++++++++++++++++--------------
 1 files changed, 60 insertions(+), 33 deletions(-)
drivers/staging/rdma/hfi1/mad.c +60 -33
index ed58cf2..17882dc 100644
@@ -3363,6 +3363,50 @@ static int __subn_get_opa_cong_setting(struct opa_smp *smp, u32 am,
 	return reply((struct ib_mad_hdr *)smp);
 }
 
+/*
+ * Apply congestion control information stored in the ppd to the
+ * active structure.
+ */
+static void apply_cc_state(struct hfi1_pportdata *ppd)
+{
+	struct cc_state *old_cc_state, *new_cc_state;
+
+	new_cc_state = kzalloc(sizeof(*new_cc_state), GFP_KERNEL);
+	if (!new_cc_state)
+		return;
+
+	/*
+	 * Hold the lock for updating *and* to prevent ppd information
+	 * from changing during the update.
+	 */
+	spin_lock(&ppd->cc_state_lock);
+
+	old_cc_state = get_cc_state(ppd);
+	if (!old_cc_state) {
+		/* never active, or shutting down */
+		spin_unlock(&ppd->cc_state_lock);
+		kfree(new_cc_state);
+		return;
+	}
+
+	*new_cc_state = *old_cc_state;
+
+	new_cc_state->cct.ccti_limit = ppd->total_cct_entry - 1;
+	memcpy(new_cc_state->cct.entries, ppd->ccti_entries,
+	       ppd->total_cct_entry * sizeof(struct ib_cc_table_entry));
+
+	new_cc_state->cong_setting.port_control = IB_CC_CCS_PC_SL_BASED;
+	new_cc_state->cong_setting.control_map = ppd->cc_sl_control_map;
+	memcpy(new_cc_state->cong_setting.entries, ppd->congestion_entries,
+	       OPA_MAX_SLS * sizeof(struct opa_congestion_setting_entry));
+
+	rcu_assign_pointer(ppd->cc_state, new_cc_state);
+
+	spin_unlock(&ppd->cc_state_lock);
+
+	call_rcu(&old_cc_state->rcu, cc_state_reclaim);
+}
+
 static int __subn_set_opa_cong_setting(struct opa_smp *smp, u32 am, u8 *data,
 				       struct ib_device *ibdev, u8 port,
 				       u32 *resp_len)
@@ -3374,6 +3418,11 @@ static int __subn_set_opa_cong_setting(struct opa_smp *smp, u32 am, u8 *data,
 	struct opa_congestion_setting_entry_shadow *entries;
 	int i;
 
+	/*
+	 * Save details from packet into the ppd.  Hold the cc_state_lock so
+	 * our information is consistent with anyone trying to apply the state.
+	 */
+	spin_lock(&ppd->cc_state_lock);
 	ppd->cc_sl_control_map = be32_to_cpu(p->control_map);
 
 	entries = ppd->congestion_entries;
@@ -3384,6 +3433,10 @@ static int __subn_set_opa_cong_setting(struct opa_smp *smp, u32 am, u8 *data,
 			p->entries[i].trigger_threshold;
 		entries[i].ccti_min = p->entries[i].ccti_min;
 	}
+	spin_unlock(&ppd->cc_state_lock);
+
+	/* now apply the information */
+	apply_cc_state(ppd);
 
 	return __subn_get_opa_cong_setting(smp, am, data, ibdev, port,
 					   resp_len);
@@ -3526,7 +3579,6 @@ static int __subn_set_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data,
 	int i, j;
 	u32 sentry, eentry;
 	u16 ccti_limit;
-	struct cc_state *old_cc_state, *new_cc_state;
 
 	/* sanity check n_blocks, start_block */
 	if (n_blocks == 0 ||
@@ -3546,45 +3598,20 @@ static int __subn_set_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data,
 		return reply((struct ib_mad_hdr *)smp);
 	}
 
-	new_cc_state = kzalloc(sizeof(*new_cc_state), GFP_KERNEL);
-	if (!new_cc_state)
-		goto getit;
-
+	/*
+	 * Save details from packet into the ppd.  Hold the cc_state_lock so
+	 * our information is consistent with anyone trying to apply the state.
+	 */
 	spin_lock(&ppd->cc_state_lock);
-
-	old_cc_state = get_cc_state(ppd);
-
-	if (!old_cc_state) {
-		spin_unlock(&ppd->cc_state_lock);
-		kfree(new_cc_state);
-		return reply((struct ib_mad_hdr *)smp);
-	}
-
-	*new_cc_state = *old_cc_state;
-
-	new_cc_state->cct.ccti_limit = ccti_limit;
-
-	entries = ppd->ccti_entries;
 	ppd->total_cct_entry = ccti_limit + 1;
-
+	entries = ppd->ccti_entries;
 	for (j = 0, i = sentry; i < eentry; j++, i++)
 		entries[i].entry = be16_to_cpu(p->ccti_entries[j].entry);
-
-	memcpy(new_cc_state->cct.entries, entries,
-	       eentry * sizeof(struct ib_cc_table_entry));
-
-	new_cc_state->cong_setting.port_control = IB_CC_CCS_PC_SL_BASED;
-	new_cc_state->cong_setting.control_map = ppd->cc_sl_control_map;
-	memcpy(new_cc_state->cong_setting.entries, ppd->congestion_entries,
-	       OPA_MAX_SLS * sizeof(struct opa_congestion_setting_entry));
-
-	rcu_assign_pointer(ppd->cc_state, new_cc_state);
-
 	spin_unlock(&ppd->cc_state_lock);
 
-	call_rcu(&old_cc_state->rcu, cc_state_reclaim);
+	/* now apply the information */
+	apply_cc_state(ppd);
 
-getit:
 	return __subn_get_opa_cc_table(smp, am, data, ibdev, port, resp_len);
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#14 lore raw

PATCH 13/15 IB/hfi1: Keep SC_USER as the last send context type

In reply to a message not in the archive

From: Jianxin Xiong <[email protected]>

SC_USER needs to be the last send context type to ensure other send context types get their allocation when num_user_contexts is set to a large number.

This fixes a panic when the module parameter num_user_contexts is set to 141 and larger.

---
 drivers/staging/rdma/hfi1/pio.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rdma/hfi1/pio.h +4 -4
index 53a08ed..464cbd2 100644
@@ -49,10 +49,10 @@
 
 /* send context types */
 #define SC_KERNEL 0
-#define SC_ACK    1
-#define SC_USER   2
-#define SC_VL15   3
-#define SC_MAX    4
+#define SC_VL15   1
+#define SC_ACK    2
+#define SC_USER   3	/* must be the last one: it may take all left */
+#define SC_MAX    4	/* count of send context types */
 
 /* invalid send context index */
 #define INVALID_SCI 0xff

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#15 lore raw

PATCH 14/15 ib_pack.h: Add opcode definition for send with invalidate

In reply to a message not in the archive

From: Jianxin Xiong <[email protected]>

The opcode for "SEND Last with Invalidate" and "SEND Only with Invalidate" have been defined for RC in IBA Specification Vol 1 since Release 1.2. Add the definition to the header file in preparation of supporting these opcodes in rdmavt based drivers.

---
 include/rdma/ib_pack.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
include/rdma/ib_pack.h +5 -0
index 0f3daae..b13419c 100644
@@ -103,6 +103,9 @@ enum {
 	IB_OPCODE_ATOMIC_ACKNOWLEDGE                = 0x12,
 	IB_OPCODE_COMPARE_SWAP                      = 0x13,
 	IB_OPCODE_FETCH_ADD                         = 0x14,
+	/* opcode 0x15 is reserved */
+	IB_OPCODE_SEND_LAST_WITH_INVALIDATE         = 0x16,
+	IB_OPCODE_SEND_ONLY_WITH_INVALIDATE         = 0x17,
 
 	/* real constants follow -- see comment about above IB_OPCODE()
 	   macro for more details */
@@ -129,6 +132,8 @@ enum {
 	IB_OPCODE(RC, ATOMIC_ACKNOWLEDGE),
 	IB_OPCODE(RC, COMPARE_SWAP),
 	IB_OPCODE(RC, FETCH_ADD),
+	IB_OPCODE(RC, SEND_LAST_WITH_INVALIDATE),
+	IB_OPCODE(RC, SEND_ONLY_WITH_INVALIDATE),
 
 	/* UC */
 	IB_OPCODE(UC, SEND_FIRST),

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#16 lore raw

PATCH 15/15 IB/hfi1: Change hfi1_init loop to preserve error returns

In reply to a message not in the archive

From: Ashutosh Dixit <[email protected]>

If one iteration of the loop causes an error return and a later iteration doesn't, the later iteration causes the earlier error condition to be lost. This could result in driver probe succeeding when it should have failed. Therefore save off the error return in the loop itself rather than outside the loop.

---
 drivers/staging/rdma/hfi1/init.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rdma/hfi1/init.c +3 -3
index 502b7cf..9e71abf 100644
@@ -732,12 +732,12 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit)
 		lastfail = hfi1_create_rcvhdrq(dd, rcd);
 		if (!lastfail)
 			lastfail = hfi1_setup_eagerbufs(rcd);
-		if (lastfail)
+		if (lastfail) {
 			dd_dev_err(dd,
 				   "failed to allocate kernel ctxt's rcvhdrq and/or egr bufs\n");
+			ret = lastfail;
+		}
 	}
-	if (lastfail)
-		ret = lastfail;
 
 	/* Allocate enough memory for user event notification. */
 	len = PAGE_ALIGN(dd->chip_rcv_contexts * HFI1_MAX_SHARED_CTXTS *

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#17 lore raw
In reply to a message not in the archive
Quoted 57 lines · Dennis Dalessandro

Here are some patches that address a few bugs and a couple other clean ups that did not make it in time for 4.6. There are also a couple performance related patches as well.

There are more clean-ups on the way to address some of the feedback received during reviews of other patches, however this stuff stands on its own so separating it out into its own series.

This patch series applies on Doug's k.o/for-4.7 branch.

Patches can also be viewed in my repo at:
https://github.com/ddalessa/kernel/tree/for-4.7

---

Ashutosh Dixit (1):
IB/hfi1: Change hfi1_init loop to preserve error returns

Dean Luick (2):
IB/hfi1: Remove no-op QSFP reset code IB/hfi1: Immediately apply congestion setting MAD

Easwar Hariharan (3):
IB/hfi1: Ignore non-temperature warnings on a downed link IB/hfi1: Wait for QSFP modules to initialize IB/hfi1: Correct external device configuration shift

Jakub Pawlak (1):
IB/hfi1: Correct log message strings

Jianxin Xiong (2):
IB/hfi1: Keep SC_USER as the last send context type ib_pack.h: Add opcode definition for send with invalidate

Jubin John (2):
IB/hfi1: Remove unnecessary header
IB/hfi1: Fix hfi_rcvhdr tracepoint

Mike Marciniszyn (3):
IB/hfi1: Fix pio wait counter double increment IB/hfi1: Fix potential panic with sdma drained mechanism IB/rdmavt: Increase CQ callback thread priority

Mitko Haralanov (1):
IB/hfi1: Improve performance of interval RB trees

 drivers/infiniband/sw/rdmavt/cq.c    |    1 
 drivers/staging/rdma/hfi1/chip.c     |   32 ++++++++----
 drivers/staging/rdma/hfi1/diag.c     |    2 -
 drivers/staging/rdma/hfi1/driver.c   |    2 -
 drivers/staging/rdma/hfi1/hfi.h      |    6 +-
 drivers/staging/rdma/hfi1/init.c     |    6 +-
 drivers/staging/rdma/hfi1/mad.c      |   93 ++++++++++++++++++++++------------
 drivers/staging/rdma/hfi1/mmu_rb.c   |   22 ++++----
 drivers/staging/rdma/hfi1/pio.h      |    8 +--
 drivers/staging/rdma/hfi1/platform.c |   21 +++++---
Quoted 9 lines
 drivers/staging/rdma/hfi1/platform.h |    1 
 drivers/staging/rdma/hfi1/qp.c       |    1 
 drivers/staging/rdma/hfi1/sdma.c     |    2 -
 drivers/staging/rdma/hfi1/sysfs.c    |    4 +
 drivers/staging/rdma/hfi1/trace.h    |    2 -
 drivers/staging/rdma/hfi1/verbs.c    |    2 -
 include/rdma/ib_pack.h               |    5 ++
 17 files changed, 128 insertions(+), 82 deletions(-)

These all look fine, applied.

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD