Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Oct 2017 14:43:30 +0000 (UTC)
From:      Stephen Hurd <shurd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r324318 - in head/sys: dev/bnxt dev/e1000 kern net
Message-ID:  <201710051443.v95EhUGJ000914@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: shurd
Date: Thu Oct  5 14:43:30 2017
New Revision: 324318
URL: https://svnweb.freebsd.org/changeset/base/324318

Log:
  Fix "taskqgroup_attach: setaffinity failed: 3" with iflib drivers
  
  Improved logging added in r323879 exposed an error during
  attach. We need the irq, not the rid to work correctly. em uses
  shared irqs, so it will use the same irq for TX as RX. bnxt does
  not use shared irqs, or TX irqs at all, so there's no need to set
  the TX irq affinity.
  
  Reviewed by:	sbruno
  Approved by:	sbruno (mentor)
  Sponsored by:	Limelight Networks
  Differential Revision:	https://reviews.freebsd.org/D12496

Modified:
  head/sys/dev/bnxt/if_bnxt.c
  head/sys/dev/e1000/if_em.c
  head/sys/kern/subr_gtaskqueue.c
  head/sys/net/iflib.c
  head/sys/net/iflib.h

Modified: head/sys/dev/bnxt/if_bnxt.c
==============================================================================
--- head/sys/dev/bnxt/if_bnxt.c	Thu Oct  5 13:29:54 2017	(r324317)
+++ head/sys/dev/bnxt/if_bnxt.c	Thu Oct  5 14:43:30 2017	(r324318)
@@ -1649,8 +1649,7 @@ bnxt_msix_intr_assign(if_ctx_t ctx, int msix)
 	}
 
 	for (i=0; i<softc->scctx->isc_ntxqsets; i++)
-		iflib_softirq_alloc_generic(ctx, i + 1, IFLIB_INTR_TX, NULL, i,
-		    "tx_cp");
+		iflib_softirq_alloc_generic(ctx, NULL, IFLIB_INTR_TX, NULL, i, "tx_cp");
 
 	return rc;
 

Modified: head/sys/dev/e1000/if_em.c
==============================================================================
--- head/sys/dev/e1000/if_em.c	Thu Oct  5 13:29:54 2017	(r324317)
+++ head/sys/dev/e1000/if_em.c	Thu Oct  5 14:43:30 2017	(r324318)
@@ -1954,7 +1954,9 @@ em_if_msix_intr_assign(if_ctx_t ctx, int msix)
 		rid = vector + 1;
 		snprintf(buf, sizeof(buf), "txq%d", i);
 		tx_que = &adapter->tx_queues[i];
-		iflib_softirq_alloc_generic(ctx, rid, IFLIB_INTR_TX, tx_que, tx_que->me, buf);
+		iflib_softirq_alloc_generic(ctx,
+		    &adapter->rx_queues[i % adapter->rx_num_queues].que_irq,
+		    IFLIB_INTR_TX, tx_que, tx_que->me, buf);
 
 		tx_que->msix = (vector % adapter->tx_num_queues);
 

Modified: head/sys/kern/subr_gtaskqueue.c
==============================================================================
--- head/sys/kern/subr_gtaskqueue.c	Thu Oct  5 13:29:54 2017	(r324317)
+++ head/sys/kern/subr_gtaskqueue.c	Thu Oct  5 14:43:30 2017	(r324318)
@@ -681,7 +681,7 @@ taskqgroup_attach(struct taskqgroup *qgroup, struct gr
 		mtx_unlock(&qgroup->tqg_lock);
 		error = intr_setaffinity(irq, CPU_WHICH_IRQ, &mask);
 		if (error)
-			printf("%s: setaffinity failed: %d\n", __func__, error);
+			printf("%s: setaffinity failed for %s: %d\n", __func__, gtask->gt_name, error);
 	} else
 		mtx_unlock(&qgroup->tqg_lock);
 }

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c	Thu Oct  5 13:29:54 2017	(r324317)
+++ head/sys/net/iflib.c	Thu Oct  5 14:43:30 2017	(r324318)
@@ -5003,21 +5003,22 @@ iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, in
 
 	if (tqrid != -1) {
 		cpuid = find_nth(ctx, &cpus, qid);
-		taskqgroup_attach_cpu(tqg, gtask, q, cpuid, irq->ii_rid, name);
+		taskqgroup_attach_cpu(tqg, gtask, q, cpuid, rman_get_start(irq->ii_res), name);
 	} else {
-		taskqgroup_attach(tqg, gtask, q, tqrid, name);
+		taskqgroup_attach(tqg, gtask, q, rman_get_start(irq->ii_res), name);
 	}
 
 	return (0);
 }
 
 void
-iflib_softirq_alloc_generic(if_ctx_t ctx, int rid, iflib_intr_type_t type,  void *arg, int qid, char *name)
+iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type,  void *arg, int qid, char *name)
 {
 	struct grouptask *gtask;
 	struct taskqgroup *tqg;
 	gtask_fn_t *fn;
 	void *q;
+	int irq_num = -1;
 
 	switch (type) {
 	case IFLIB_INTR_TX:
@@ -5025,25 +5026,28 @@ iflib_softirq_alloc_generic(if_ctx_t ctx, int rid, ifl
 		gtask = &ctx->ifc_txqs[qid].ift_task;
 		tqg = qgroup_if_io_tqg;
 		fn = _task_fn_tx;
+		if (irq != NULL)
+			irq_num = rman_get_start(irq->ii_res);
 		break;
 	case IFLIB_INTR_RX:
 		q = &ctx->ifc_rxqs[qid];
 		gtask = &ctx->ifc_rxqs[qid].ifr_task;
 		tqg = qgroup_if_io_tqg;
 		fn = _task_fn_rx;
+		if (irq != NULL)
+			irq_num = rman_get_start(irq->ii_res);
 		break;
 	case IFLIB_INTR_IOV:
 		q = ctx;
 		gtask = &ctx->ifc_vflr_task;
 		tqg = qgroup_if_config_tqg;
-		rid = -1;
 		fn = _task_fn_iov;
 		break;
 	default:
 		panic("unknown net intr type");
 	}
 	GROUPTASK_INIT(gtask, 0, fn, q);
-	taskqgroup_attach(tqg, gtask, q, rid, name);
+	taskqgroup_attach(tqg, gtask, q, irq_num, name);
 }
 
 void

Modified: head/sys/net/iflib.h
==============================================================================
--- head/sys/net/iflib.h	Thu Oct  5 13:29:54 2017	(r324317)
+++ head/sys/net/iflib.h	Thu Oct  5 14:43:30 2017	(r324318)
@@ -361,7 +361,7 @@ int iflib_irq_alloc(if_ctx_t, if_irq_t, int, driver_fi
 int iflib_irq_alloc_generic(if_ctx_t ctx, if_irq_t irq, int rid,
 							iflib_intr_type_t type, driver_filter_t *filter,
 							void *filter_arg, int qid, char *name);
-void iflib_softirq_alloc_generic(if_ctx_t ctx, int rid, iflib_intr_type_t type,  void *arg, int qid, char *name);
+void iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type,  void *arg, int qid, char *name);
 
 void iflib_irq_free(if_ctx_t ctx, if_irq_t irq);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710051443.v95EhUGJ000914>