* [PATCH net-next] cxgb4: Set initial IRQ affinity hints
@ 2019-05-31 6:14 Nirranjan Kirubaharan
2019-05-31 11:05 ` kbuild test robot
2019-06-02 20:33 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Nirranjan Kirubaharan @ 2019-05-31 6:14 UTC (permalink / raw)
To: davem, netdev, vishal, dt, indranil
Spread initial IRQ affinity hints across the device node CPUs,
for nic queue and uld queue IRQs, to load balance and avoid all
interrupts on CPU0.
Signed-off-by: Nirranjan Kirubaharan <nirranjan@chelsio.com>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 7 +++-
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 56 +++++++++++++++++++++----
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c | 21 +++++++---
3 files changed, 69 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
index 7c06e2aebc9e..52d1ca20ee06 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
@@ -880,6 +880,7 @@ struct uld_msix_info {
unsigned short vec;
char desc[IFNAMSIZ + 10];
unsigned int idx;
+ cpumask_var_t aff_mask;
};
struct vf_info {
@@ -940,9 +941,10 @@ struct adapter {
struct cxgb4_virt_res vres;
unsigned int swintr;
- struct {
+ struct msix_info {
unsigned short vec;
char desc[IFNAMSIZ + 10];
+ cpumask_var_t aff_mask;
} msix_info[MAX_INGQ + 1];
struct uld_msix_info *msix_info_ulds; /* msix info for uld's */
struct uld_msix_bmap msix_bmap_ulds; /* msix bitmap for all uld */
@@ -1900,5 +1902,8 @@ int t4_set_vlan_acl(struct adapter *adap, unsigned int mbox, unsigned int vf,
int cxgb4_thermal_init(struct adapter *adap);
int cxgb4_thermal_remove(struct adapter *adap);
+int cxgb4_set_msix_aff(struct adapter *adap, unsigned short vec,
+ cpumask_var_t aff_mask, int idx);
+void cxgb4_clear_msix_aff(unsigned short vec, cpumask_var_t aff_mask);
#endif /* __CXGB4_H__ */
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 7d7df59f9a70..46a41a02c788 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -702,9 +702,38 @@ static void name_msix_vecs(struct adapter *adap)
}
}
+int cxgb4_set_msix_aff(struct adapter *adap, unsigned short vec,
+ cpumask_var_t aff_mask, int idx)
+{
+ int rv;
+
+ if (!zalloc_cpumask_var(&aff_mask, GFP_KERNEL)) {
+ dev_err(adap->pdev_dev, "alloc_cpumask_var failed\n");
+ return -ENOMEM;
+ }
+
+ cpumask_set_cpu(cpumask_local_spread(idx, dev_to_node(adap->pdev_dev)),
+ aff_mask);
+
+ rv = irq_set_affinity_hint(vec, aff_mask);
+ if (rv)
+ dev_warn(adap->pdev_dev,
+ "irq_set_affinity_hint %u failed %d\n",
+ vec, rv);
+
+ return 0;
+}
+
+void cxgb4_clear_msix_aff(unsigned short vec, cpumask_var_t aff_mask)
+{
+ irq_set_affinity_hint(vec, NULL);
+ free_cpumask_var(aff_mask);
+}
+
static int request_msix_queue_irqs(struct adapter *adap)
{
struct sge *s = &adap->sge;
+ struct msix_info *minfo;
int err, ethqidx;
int msi_index = 2;
@@ -714,32 +743,43 @@ static int request_msix_queue_irqs(struct adapter *adap)
return err;
for_each_ethrxq(s, ethqidx) {
- err = request_irq(adap->msix_info[msi_index].vec,
+ minfo = &adap->msix_info[msi_index];
+ err = request_irq(minfo->vec,
t4_sge_intr_msix, 0,
- adap->msix_info[msi_index].desc,
+ minfo->desc,
&s->ethrxq[ethqidx].rspq);
if (err)
goto unwind;
+
+ cxgb4_set_msix_aff(adap, minfo->vec,
+ minfo->aff_mask, ethqidx);
msi_index++;
}
return 0;
unwind:
- while (--ethqidx >= 0)
- free_irq(adap->msix_info[--msi_index].vec,
- &s->ethrxq[ethqidx].rspq);
+ while (--ethqidx >= 0) {
+ --msi_index;
+ minfo = &adap->msix_info[msi_index];
+ cxgb4_clear_msix_aff(minfo->vec, minfo->aff_mask);
+ free_irq(minfo->vec, &s->ethrxq[ethqidx].rspq);
+ }
free_irq(adap->msix_info[1].vec, &s->fw_evtq);
return err;
}
static void free_msix_queue_irqs(struct adapter *adap)
{
- int i, msi_index = 2;
struct sge *s = &adap->sge;
+ struct msix_info *minfo;
+ int i, msi_index = 2;
free_irq(adap->msix_info[1].vec, &s->fw_evtq);
- for_each_ethrxq(s, i)
- free_irq(adap->msix_info[msi_index++].vec, &s->ethrxq[i].rspq);
+ for_each_ethrxq(s, i) {
+ minfo = &adap->msix_info[msi_index++];
+ cxgb4_clear_msix_aff(minfo->vec, minfo->aff_mask);
+ free_irq(minfo->vec, &s->ethrxq[i].rspq);
+ }
}
/**
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
index 6c685b920713..8d45315c71d4 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
@@ -352,25 +352,32 @@ static void free_queues_uld(struct adapter *adap, unsigned int uld_type)
request_msix_queue_irqs_uld(struct adapter *adap, unsigned int uld_type)
{
struct sge_uld_rxq_info *rxq_info = adap->sge.uld_rxq_info[uld_type];
+ struct uld_msix_info *minfo;
int err = 0;
unsigned int idx, bmap_idx;
for_each_uldrxq(rxq_info, idx) {
bmap_idx = rxq_info->msix_tbl[idx];
- err = request_irq(adap->msix_info_ulds[bmap_idx].vec,
+ minfo = &adap->msix_info_ulds[bmap_idx];
+ err = request_irq(minfo->vec,
t4_sge_intr_msix, 0,
- adap->msix_info_ulds[bmap_idx].desc,
+ minfo->desc,
&rxq_info->uldrxq[idx].rspq);
if (err)
goto unwind;
+
+ cxgb4_set_msix_aff(adap, minfo->vec,
+ minfo->aff_mask, idx);
}
return 0;
+
unwind:
while (idx-- > 0) {
bmap_idx = rxq_info->msix_tbl[idx];
+ minfo = &adap->msix_info_ulds[bmap_idx];
+ cxgb4_clear_msix_aff(minfo->vec, minfo->aff_mask);
free_msix_idx_in_bmap(adap, bmap_idx);
- free_irq(adap->msix_info_ulds[bmap_idx].vec,
- &rxq_info->uldrxq[idx].rspq);
+ free_irq(minfo->vec, &rxq_info->uldrxq[idx].rspq);
}
return err;
}
@@ -379,14 +386,16 @@ static void free_queues_uld(struct adapter *adap, unsigned int uld_type)
free_msix_queue_irqs_uld(struct adapter *adap, unsigned int uld_type)
{
struct sge_uld_rxq_info *rxq_info = adap->sge.uld_rxq_info[uld_type];
+ struct uld_msix_info *minfo;
unsigned int idx, bmap_idx;
for_each_uldrxq(rxq_info, idx) {
bmap_idx = rxq_info->msix_tbl[idx];
+ minfo = &adap->msix_info_ulds[bmap_idx];
+ cxgb4_clear_msix_aff(minfo->vec, minfo->aff_mask);
free_msix_idx_in_bmap(adap, bmap_idx);
- free_irq(adap->msix_info_ulds[bmap_idx].vec,
- &rxq_info->uldrxq[idx].rspq);
+ free_irq(minfo->vec, &rxq_info->uldrxq[idx].rspq);
}
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] cxgb4: Set initial IRQ affinity hints
2019-05-31 6:14 [PATCH net-next] cxgb4: Set initial IRQ affinity hints Nirranjan Kirubaharan
@ 2019-05-31 11:05 ` kbuild test robot
2019-06-02 20:33 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2019-05-31 11:05 UTC (permalink / raw)
To: Nirranjan Kirubaharan; +Cc: kbuild-all, davem, netdev, vishal, dt, indranil
[-- Attachment #1: Type: text/plain, Size: 2577 bytes --]
Hi Nirranjan,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Nirranjan-Kirubaharan/cxgb4-Set-initial-IRQ-affinity-hints/20190531-180720
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=xtensa
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c: In function 'cxgb4_set_msix_aff':
>> drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:710:26: error: passing argument 1 of 'zalloc_cpumask_var' from incompatible pointer type [-Werror=incompatible-pointer-types]
if (!zalloc_cpumask_var(&aff_mask, GFP_KERNEL)) {
^
In file included from include/linux/rcupdate.h:31:0,
from include/linux/rculist.h:11,
from include/linux/dcache.h:7,
from include/linux/fs.h:8,
from include/linux/debugfs.h:15,
from drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:40:
include/linux/cpumask.h:737:20: note: expected 'struct cpumask (*)[1]' but argument is of type 'struct cpumask **'
static inline bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/zalloc_cpumask_var +710 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
704
705 int cxgb4_set_msix_aff(struct adapter *adap, unsigned short vec,
706 cpumask_var_t aff_mask, int idx)
707 {
708 int rv;
709
> 710 if (!zalloc_cpumask_var(&aff_mask, GFP_KERNEL)) {
711 dev_err(adap->pdev_dev, "alloc_cpumask_var failed\n");
712 return -ENOMEM;
713 }
714
715 cpumask_set_cpu(cpumask_local_spread(idx, dev_to_node(adap->pdev_dev)),
716 aff_mask);
717
718 rv = irq_set_affinity_hint(vec, aff_mask);
719 if (rv)
720 dev_warn(adap->pdev_dev,
721 "irq_set_affinity_hint %u failed %d\n",
722 vec, rv);
723
724 return 0;
725 }
726
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 58663 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] cxgb4: Set initial IRQ affinity hints
2019-05-31 6:14 [PATCH net-next] cxgb4: Set initial IRQ affinity hints Nirranjan Kirubaharan
2019-05-31 11:05 ` kbuild test robot
@ 2019-06-02 20:33 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-06-02 20:33 UTC (permalink / raw)
To: nirranjan; +Cc: netdev, vishal, dt, indranil
From: Nirranjan Kirubaharan <nirranjan@chelsio.com>
Date: Thu, 30 May 2019 23:14:28 -0700
> + while (--ethqidx >= 0) {
> + --msi_index;
It is more canonical to use "msi_index--;" here.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-02 20:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31 6:14 [PATCH net-next] cxgb4: Set initial IRQ affinity hints Nirranjan Kirubaharan
2019-05-31 11:05 ` kbuild test robot
2019-06-02 20:33 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.