linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next V6 0/2] cpumask,net: Affinity hint helper function
@ 2014-05-25 14:47 Amir Vadai
  2014-05-25 14:47 ` [PATCH net-next V6 1/2] cpumask: Utility function to set n'th cpu - local cpu first Amir Vadai
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Amir Vadai @ 2014-05-25 14:47 UTC (permalink / raw)
  To: David S. Miller
  Cc: Amir Vadai, Or Gerlitz, netdev, Yevgeny Petrilin, Yuval Atias,
	linux-kernel

Hi,

This patchset will set affinity hint to influence IRQs to be allocated on the
same NUMA node as the one where the card resides. As discussed in
http://www.spinics.net/lists/netdev/msg271497.html

If the number of IRQs allocated is greater than the number of local NUMA cores, all
local cores will be used first, and the rest of the IRQs will be on a remote
NUMA node.
If no NUMA support - IRQ's and cores will be mapped 1:1

Since the utility function to calculate the mapping could be useful in other mq
drivers in the kernel, it was added to cpumask.[ch]

This patchset was tested and applied on top of net-next since the first
consumer is a network device (mlx4_en).  Over commit 506724c: "tg3: Override
clock, link aware and link idle mode during NVRAM dump"

I couldn't find a maintainer for cpumask.c, so only added the kernel mailing
list

Amir

Changes from V5:
- Moved the utility function from kernel/irq/manage.c to lib/cpumask.c, and
  renamed it's name accordingly to cpumask_set_cpu_local_first()
- Added some comments as Thomas Gleixner suggested
- Changed -EINVAL to -EAGAIN, that describes the error situtation better.

Changes from V4:
- Patch 1/2: irq: Utility function to get affinity_hint by policy
  Thank you Ben for the great review:
  - Moved the function it kernel/irq/manage.c since it could be useful for
    block mq devices
  - Fixed Typo's
  - Use cpumask_t * instead of cpumask_var_t in function header  
  - Restructured the function to remove NULL assignment in a cpumask_var_t
  - Fix for offline local CPU's

Changes from V3:
- Patch 2/2: net/mlx4_en: Use affinity hint
  - somehow patch file was corrupted

Changes from V2:
- Patch 1/2: net: Utility function to get affinity_hint by policy
  - Fixed style issues

Changes from V1:
- Patch 1/2: net: Utility function to get affinity_hint by policy
  - Fixed error flow to return -EINVAL on error (thanks govind)
- Patch 2/2: net/mlx4_en: Use affinity hint
  - Set ring->affinity_hint to NULL on error

Changes from V0:
- Fixed small style issues


Amir Vadai (1):
  cpumask: Utility function to set n'th cpu - local cpu first

Yuval Atias (1):
  net/mlx4_en: Use affinity hint

 drivers/infiniband/hw/mlx4/main.c              |  2 +-
 drivers/net/ethernet/mellanox/mlx4/en_cq.c     |  6 ++-
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 30 ++++++++++++
 drivers/net/ethernet/mellanox/mlx4/eq.c        | 13 +++++-
 drivers/net/ethernet/mellanox/mlx4/mlx4_en.h   |  1 +
 include/linux/cpumask.h                        |  2 +
 include/linux/mlx4/device.h                    |  2 +-
 lib/cpumask.c                                  | 64 ++++++++++++++++++++++++++
 8 files changed, 116 insertions(+), 4 deletions(-)

-- 
1.8.3.4


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH net-next V6 1/2] cpumask: Utility function to set n'th cpu - local cpu first
  2014-05-25 14:47 [PATCH net-next V6 0/2] cpumask,net: Affinity hint helper function Amir Vadai
@ 2014-05-25 14:47 ` Amir Vadai
  2014-05-27 19:24   ` David Miller
  2014-05-25 14:47 ` [PATCH net-next V6 2/2] net/mlx4_en: Use affinity hint Amir Vadai
  2014-06-02  2:17 ` [PATCH net-next V6 0/2] cpumask,net: Affinity hint helper function David Miller
  2 siblings, 1 reply; 13+ messages in thread
From: Amir Vadai @ 2014-05-25 14:47 UTC (permalink / raw)
  To: David S. Miller
  Cc: Amir Vadai, Or Gerlitz, netdev, Yevgeny Petrilin, Yuval Atias,
	linux-kernel

This function sets the n'th cpu - local cpu's first.
For example: in a 16 cores server with even cpu's local, will get the
following values:
cpumask_set_cpu_local_first(0, numa, cpumask) => cpu 0 is set
cpumask_set_cpu_local_first(1, numa, cpumask) => cpu 2 is set
...
cpumask_set_cpu_local_first(7, numa, cpumask) => cpu 14 is set
cpumask_set_cpu_local_first(8, numa, cpumask) => cpu 1 is set
cpumask_set_cpu_local_first(9, numa, cpumask) => cpu 3 is set
...
cpumask_set_cpu_local_first(15, numa, cpumask) => cpu 15 is set

Curently this function will be used by multi queue networking devices to
calculate the irq affinity mask, such that as many local cpu's as
possible will be utilized to handle the mq device irq's.

Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
 include/linux/cpumask.h |  2 ++
 lib/cpumask.c           | 64 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+)

diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index d08e4d2..3551d66 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -257,6 +257,8 @@ static inline void cpumask_set_cpu(unsigned int cpu, struct cpumask *dstp)
 	set_bit(cpumask_check(cpu), cpumask_bits(dstp));
 }
 
+int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp);
+
 /**
  * cpumask_clear_cpu - clear a cpu in a cpumask
  * @cpu: cpu number (< nr_cpu_ids)
diff --git a/lib/cpumask.c b/lib/cpumask.c
index b810b75..14049a9 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -163,4 +163,68 @@ void __init free_bootmem_cpumask_var(cpumask_var_t mask)
 {
 	memblock_free_early(__pa(mask), cpumask_size());
 }
+
+/**
+ * cpumask_set_cpu_local_first - set i'th cpu with local numa cpu's first
+ *
+ * @i: index number
+ * @numa_node: local numa_node
+ * @dstp: cpumask with the relevant cpu bit set according to the policy
+ *
+ * This function sets the cpumask according to a numa aware policy.
+ * cpumask could be used as an affinity hint for the IRQ related to a
+ * queue. When the policy is to spread queues across cores - local cores
+ * first.
+ *
+ * Returns 0 on success, -ENOMEM for no memory, and -EAGAIN when failed to set
+ * the cpu bit and need to re-call the function.
+ */
+int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp)
+{
+	cpumask_var_t mask;
+	int cpu;
+	int ret = 0;
+
+	if (!zalloc_cpumask_var(&mask, GFP_KERNEL))
+		return -ENOMEM;
+
+	i %= num_online_cpus();
+
+	if (!cpumask_of_node(numa_node)) {
+		/* Use all online cpu's for non numa aware system */
+		cpumask_copy(mask, cpu_online_mask);
+	} else {
+		int n;
+
+		cpumask_and(mask,
+			    cpumask_of_node(numa_node), cpu_online_mask);
+
+		n = cpumask_weight(mask);
+		if (i >= n) {
+			i -= n;
+
+			/* If index > number of local cpu's, mask out local
+			 * cpu's
+			 */
+			cpumask_andnot(mask, cpu_online_mask, mask);
+		}
+	}
+
+	for_each_cpu(cpu, mask) {
+		if (--i < 0)
+			goto out;
+	}
+
+	ret = -EAGAIN;
+
+out:
+	free_cpumask_var(mask);
+
+	if (!ret)
+		cpumask_set_cpu(cpu, dstp);
+
+	return ret;
+}
+EXPORT_SYMBOL(cpumask_set_cpu_local_first);
+
 #endif
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH net-next V6 2/2] net/mlx4_en: Use affinity hint
  2014-05-25 14:47 [PATCH net-next V6 0/2] cpumask,net: Affinity hint helper function Amir Vadai
  2014-05-25 14:47 ` [PATCH net-next V6 1/2] cpumask: Utility function to set n'th cpu - local cpu first Amir Vadai
@ 2014-05-25 14:47 ` Amir Vadai
  2014-06-02  4:16   ` Eric Dumazet
  2014-06-02  2:17 ` [PATCH net-next V6 0/2] cpumask,net: Affinity hint helper function David Miller
  2 siblings, 1 reply; 13+ messages in thread
From: Amir Vadai @ 2014-05-25 14:47 UTC (permalink / raw)
  To: David S. Miller
  Cc: Amir Vadai, Or Gerlitz, netdev, Yevgeny Petrilin, Yuval Atias,
	linux-kernel

From: Yuval Atias <yuvala@mellanox.com>

The “affinity hint” mechanism is used by the user space
daemon, irqbalancer, to indicate a preferred CPU mask for irqs.
Irqbalancer can use this hint to balance the irqs between the
cpus indicated by the mask.

We wish the HCA to preferentially map the IRQs it uses to numa cores
close to it.  To accomplish this, we use cpumask_set_cpu_local_first(), that
sets the affinity hint according the following policy:
First it maps IRQs to “close” numa cores.  If these are exhausted, the
remaining IRQs are mapped to “far” numa cores.

Signed-off-by: Yuval Atias <yuvala@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
 drivers/infiniband/hw/mlx4/main.c              |  2 +-
 drivers/net/ethernet/mellanox/mlx4/en_cq.c     |  6 +++++-
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 30 ++++++++++++++++++++++++++
 drivers/net/ethernet/mellanox/mlx4/eq.c        | 13 ++++++++++-
 drivers/net/ethernet/mellanox/mlx4/mlx4_en.h   |  1 +
 include/linux/mlx4/device.h                    |  2 +-
 6 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index a9638ae..8c88960 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -1837,7 +1837,7 @@ static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev)
 				 i, j, dev->pdev->bus->name);
 			/* Set IRQ for specific name (per ring) */
 			if (mlx4_assign_eq(dev, name, NULL,
-					   &ibdev->eq_table[eq])) {
+					   &ibdev->eq_table[eq], NULL)) {
 				/* Use legacy (same as mlx4_en driver) */
 				pr_warn("Can't allocate EQ %d; reverting to legacy\n", eq);
 				ibdev->eq_table[eq] =
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_cq.c b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
index 636963d..ea2cd72 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_cq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_cq.c
@@ -118,11 +118,15 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq,
 	if (cq->is_tx == RX) {
 		if (mdev->dev->caps.comp_pool) {
 			if (!cq->vector) {
+				struct mlx4_en_rx_ring *ring =
+					priv->rx_ring[cq->ring];
+
 				sprintf(name, "%s-%d", priv->dev->name,
 					cq->ring);
 				/* Set IRQ for specific name (per ring) */
 				if (mlx4_assign_eq(mdev->dev, name, rmap,
-						   &cq->vector)) {
+						   &cq->vector,
+						   ring->affinity_mask)) {
 					cq->vector = (cq->ring + 1 + priv->port)
 					    % mdev->dev->caps.num_comp_vectors;
 					mlx4_warn(mdev, "Failed assigning an EQ to %s, falling back to legacy EQ's\n",
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 5bb7eda..826d150 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1531,6 +1531,32 @@ static void mlx4_en_linkstate(struct work_struct *work)
 	mutex_unlock(&mdev->state_lock);
 }
 
+static void mlx4_en_init_affinity_hint(struct mlx4_en_priv *priv, int ring_idx)
+{
+	struct mlx4_en_rx_ring *ring = priv->rx_ring[ring_idx];
+	int numa_node = priv->mdev->dev->numa_node;
+
+	if (numa_node == -1)
+		return;
+
+	if (!zalloc_cpumask_var(&ring->affinity_mask, GFP_KERNEL)) {
+		en_err(priv, "Failed to allocate core mask\n");
+		return;
+	}
+
+	if (cpumask_set_cpu_local_first(ring_idx, numa_node,
+					ring->affinity_mask)) {
+		en_err(priv, "Failed setting affinity hint\n");
+		free_cpumask_var(ring->affinity_mask);
+		ring->affinity_mask = NULL;
+	}
+}
+
+static void mlx4_en_free_affinity_hint(struct mlx4_en_priv *priv, int ring_idx)
+{
+	free_cpumask_var(priv->rx_ring[ring_idx]->affinity_mask);
+	priv->rx_ring[ring_idx]->affinity_mask = NULL;
+}
 
 int mlx4_en_start_port(struct net_device *dev)
 {
@@ -1572,6 +1598,8 @@ int mlx4_en_start_port(struct net_device *dev)
 
 		mlx4_en_cq_init_lock(cq);
 
+		mlx4_en_init_affinity_hint(priv, i);
+
 		err = mlx4_en_activate_cq(priv, cq, i);
 		if (err) {
 			en_err(priv, "Failed activating Rx CQ\n");
@@ -1852,6 +1880,8 @@ void mlx4_en_stop_port(struct net_device *dev, int detach)
 			msleep(1);
 		mlx4_en_deactivate_rx_ring(priv, priv->rx_ring[i]);
 		mlx4_en_deactivate_cq(priv, cq);
+
+		mlx4_en_free_affinity_hint(priv, i);
 	}
 }
 
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 947364d..02cf97d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -1376,7 +1376,7 @@ int mlx4_test_interrupts(struct mlx4_dev *dev)
 EXPORT_SYMBOL(mlx4_test_interrupts);
 
 int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap,
-		   int *vector)
+		   int *vector, cpumask_var_t cpu_hint_mask)
 {
 
 	struct mlx4_priv *priv = mlx4_priv(dev);
@@ -1411,6 +1411,15 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap,
 			}
 			mlx4_assign_irq_notifier(priv, dev,
 						 priv->eq_table.eq[vec].irq);
+			if (cpu_hint_mask) {
+				err = irq_set_affinity_hint(
+						priv->eq_table.eq[vec].irq,
+						cpu_hint_mask);
+				if (err) {
+					mlx4_warn(dev, "Failed setting affinity hint\n");
+					/*we dont want to break here*/
+				}
+			}
 
 			eq_set_ci(&priv->eq_table.eq[vec], 1);
 		}
@@ -1441,6 +1450,8 @@ void mlx4_release_eq(struct mlx4_dev *dev, int vec)
 			irq_set_affinity_notifier(
 				priv->eq_table.eq[vec].irq,
 				NULL);
+			irq_set_affinity_hint(priv->eq_table.eq[vec].irq,
+					      NULL);
 			free_irq(priv->eq_table.eq[vec].irq,
 				 &priv->eq_table.eq[vec]);
 			priv->msix_ctl.pool_bm &= ~(1ULL << i);
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index 88d5cf6..61d7c36 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -313,6 +313,7 @@ struct mlx4_en_rx_ring {
 	unsigned long csum_ok;
 	unsigned long csum_none;
 	int hwtstamp_rx_filter;
+	cpumask_var_t affinity_mask;
 };
 
 struct mlx4_en_cq {
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 74f5aa8..8b194aa 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -1161,7 +1161,7 @@ int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr);
 int mlx4_SYNC_TPT(struct mlx4_dev *dev);
 int mlx4_test_interrupts(struct mlx4_dev *dev);
 int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap,
-		   int *vector);
+		   int *vector, cpumask_t *cpu_hint_mask);
 void mlx4_release_eq(struct mlx4_dev *dev, int vec);
 
 int mlx4_get_phys_port_id(struct mlx4_dev *dev);
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next V6 1/2] cpumask: Utility function to set n'th cpu - local cpu first
  2014-05-25 14:47 ` [PATCH net-next V6 1/2] cpumask: Utility function to set n'th cpu - local cpu first Amir Vadai
@ 2014-05-27 19:24   ` David Miller
  2014-05-28  5:49     ` Or Gerlitz
  0 siblings, 1 reply; 13+ messages in thread
From: David Miller @ 2014-05-27 19:24 UTC (permalink / raw)
  To: amirv; +Cc: ogerlitz, netdev, yevgenyp, yuvala, linux-kernel

From: Amir Vadai <amirv@mellanox.com>
Date: Sun, 25 May 2014 17:47:26 +0300

> This function sets the n'th cpu - local cpu's first.
> For example: in a 16 cores server with even cpu's local, will get the
> following values:
> cpumask_set_cpu_local_first(0, numa, cpumask) => cpu 0 is set
> cpumask_set_cpu_local_first(1, numa, cpumask) => cpu 2 is set
> ...
> cpumask_set_cpu_local_first(7, numa, cpumask) => cpu 14 is set
> cpumask_set_cpu_local_first(8, numa, cpumask) => cpu 1 is set
> cpumask_set_cpu_local_first(9, numa, cpumask) => cpu 3 is set
> ...
> cpumask_set_cpu_local_first(15, numa, cpumask) => cpu 15 is set
> 
> Curently this function will be used by multi queue networking devices to
> calculate the irq affinity mask, such that as many local cpu's as
> possible will be utilized to handle the mq device irq's.
> 
> Signed-off-by: Amir Vadai <amirv@mellanox.com>

I would like someone who cares about these cpumask interfaces to provide
a review.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next V6 1/2] cpumask: Utility function to set n'th cpu - local cpu first
  2014-05-27 19:24   ` David Miller
@ 2014-05-28  5:49     ` Or Gerlitz
  0 siblings, 0 replies; 13+ messages in thread
From: Or Gerlitz @ 2014-05-28  5:49 UTC (permalink / raw)
  To: David Miller
  Cc: Amir Vadai, Or Gerlitz, netdev, Yevgeny Petrilin, Yuval Atias,
	linux-kernel

On Tue, May 27, 2014 at 10:24 PM, David Miller <davem@davemloft.net> wrote:

> I would like someone who cares about these cpumask interfaces to provide
> a review.

understood, still, looking in the git log of that file didn't yield
much only 1-2 commits per years for 2011/12/13, so, any concrete
suggestion?

Or.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next V6 0/2] cpumask,net: Affinity hint helper function
  2014-05-25 14:47 [PATCH net-next V6 0/2] cpumask,net: Affinity hint helper function Amir Vadai
  2014-05-25 14:47 ` [PATCH net-next V6 1/2] cpumask: Utility function to set n'th cpu - local cpu first Amir Vadai
  2014-05-25 14:47 ` [PATCH net-next V6 2/2] net/mlx4_en: Use affinity hint Amir Vadai
@ 2014-06-02  2:17 ` David Miller
  2 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2014-06-02  2:17 UTC (permalink / raw)
  To: amirv; +Cc: ogerlitz, netdev, yevgenyp, yuvala, linux-kernel

From: Amir Vadai <amirv@mellanox.com>
Date: Sun, 25 May 2014 17:47:25 +0300

> This patchset will set affinity hint to influence IRQs to be allocated on the
> same NUMA node as the one where the card resides. As discussed in
> http://www.spinics.net/lists/netdev/msg271497.html
> 
> If the number of IRQs allocated is greater than the number of local NUMA cores, all
> local cores will be used first, and the rest of the IRQs will be on a remote
> NUMA node.
> If no NUMA support - IRQ's and cores will be mapped 1:1
> 
> Since the utility function to calculate the mapping could be useful in other mq
> drivers in the kernel, it was added to cpumask.[ch]
> 
> This patchset was tested and applied on top of net-next since the first
> consumer is a network device (mlx4_en).  Over commit 506724c: "tg3: Override
> clock, link aware and link idle mode during NVRAM dump"
> 
> I couldn't find a maintainer for cpumask.c, so only added the kernel mailing
> list

Applied to net-next, thanks.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next V6 2/2] net/mlx4_en: Use affinity hint
  2014-05-25 14:47 ` [PATCH net-next V6 2/2] net/mlx4_en: Use affinity hint Amir Vadai
@ 2014-06-02  4:16   ` Eric Dumazet
  2014-06-02  4:37     ` Eric Dumazet
  2014-06-02  4:54     ` David Miller
  0 siblings, 2 replies; 13+ messages in thread
From: Eric Dumazet @ 2014-06-02  4:16 UTC (permalink / raw)
  To: Amir Vadai
  Cc: David S. Miller, Or Gerlitz, netdev, Yevgeny Petrilin,
	Yuval Atias, linux-kernel

On Sun, 2014-05-25 at 17:47 +0300, Amir Vadai wrote:
> From: Yuval Atias <yuvala@mellanox.com>
> 
> The “affinity hint” mechanism is used by the user space
> daemon, irqbalancer, to indicate a preferred CPU mask for irqs.
> Irqbalancer can use this hint to balance the irqs between the
> cpus indicated by the mask.
> 
> We wish the HCA to preferentially map the IRQs it uses to numa cores
> close to it.  To accomplish this, we use cpumask_set_cpu_local_first(), that
> sets the affinity hint according the following policy:
> First it maps IRQs to “close” numa cores.  If these are exhausted, the
> remaining IRQs are mapped to “far” numa cores.
> 
> Signed-off-by: Yuval Atias <yuvala@mellanox.com>
> Signed-off-by: Amir Vadai <amirv@mellanox.com>
> ---

  CC [M]  drivers/net/ethernet/mellanox/mlx4/en_netdev.o
drivers/net/ethernet/mellanox/mlx4/en_netdev.c: In function ‘mlx4_en_init_affinity_hint’:
drivers/net/ethernet/mellanox/mlx4/en_netdev.c:1546:23: error: incompatible types when assigning to type ‘cpumask_var_t’ from type ‘void *’
drivers/net/ethernet/mellanox/mlx4/en_netdev.c: In function ‘mlx4_en_free_affinity_hint’:
drivers/net/ethernet/mellanox/mlx4/en_netdev.c:1553:41: error: incompatible types when assigning to type ‘cpumask_var_t’ from type ‘void *’



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next V6 2/2] net/mlx4_en: Use affinity hint
  2014-06-02  4:16   ` Eric Dumazet
@ 2014-06-02  4:37     ` Eric Dumazet
  2014-06-02  4:56       ` David Miller
  2014-06-02  4:54     ` David Miller
  1 sibling, 1 reply; 13+ messages in thread
From: Eric Dumazet @ 2014-06-02  4:37 UTC (permalink / raw)
  To: Amir Vadai
  Cc: David S. Miller, Or Gerlitz, netdev, Yevgeny Petrilin,
	Yuval Atias, linux-kernel

On Sun, 2014-06-01 at 21:16 -0700, Eric Dumazet wrote:
> On Sun, 2014-05-25 at 17:47 +0300, Amir Vadai wrote:
> > From: Yuval Atias <yuvala@mellanox.com>
> > 
> > The “affinity hint” mechanism is used by the user space
> > daemon, irqbalancer, to indicate a preferred CPU mask for irqs.
> > Irqbalancer can use this hint to balance the irqs between the
> > cpus indicated by the mask.
> > 
> > We wish the HCA to preferentially map the IRQs it uses to numa cores
> > close to it.  To accomplish this, we use cpumask_set_cpu_local_first(), that
> > sets the affinity hint according the following policy:
> > First it maps IRQs to “close” numa cores.  If these are exhausted, the
> > remaining IRQs are mapped to “far” numa cores.
> > 
> > Signed-off-by: Yuval Atias <yuvala@mellanox.com>
> > Signed-off-by: Amir Vadai <amirv@mellanox.com>
> > ---
> 
>   CC [M]  drivers/net/ethernet/mellanox/mlx4/en_netdev.o
> drivers/net/ethernet/mellanox/mlx4/en_netdev.c: In function ‘mlx4_en_init_affinity_hint’:
> drivers/net/ethernet/mellanox/mlx4/en_netdev.c:1546:23: error: incompatible types when assigning to type ‘cpumask_var_t’ from type ‘void *’
> drivers/net/ethernet/mellanox/mlx4/en_netdev.c: In function ‘mlx4_en_free_affinity_hint’:
> drivers/net/ethernet/mellanox/mlx4/en_netdev.c:1553:41: error: incompatible types when assigning to type ‘cpumask_var_t’ from type ‘void *’


And :

ERROR: "cpumask_set_cpu_local_first" [drivers/net/ethernet/mellanox/mlx4/mlx4_en.ko] undefined!


$ git grep -n cpumask_set_cpu_local_first
drivers/net/ethernet/mellanox/mlx4/en_netdev.c:1542:    if (cpumask_set_cpu_local_first(ring_idx, numa_node,
include/linux/cpumask.h:260:int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp);
lib/cpumask.c:168: * cpumask_set_cpu_local_first - set i'th cpu with local numa cpu's first
lib/cpumask.c:182:int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp)
lib/cpumask.c:228:EXPORT_SYMBOL(cpumask_set_cpu_local_first);

Fixes are needed if CONFIG_CPUMASK_OFFSTACK is not used.
	
$ grep CONFIG_CPUMASK_OFFSTACK .config
$ echo $?
1



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next V6 2/2] net/mlx4_en: Use affinity hint
  2014-06-02  4:16   ` Eric Dumazet
  2014-06-02  4:37     ` Eric Dumazet
@ 2014-06-02  4:54     ` David Miller
  1 sibling, 0 replies; 13+ messages in thread
From: David Miller @ 2014-06-02  4:54 UTC (permalink / raw)
  To: eric.dumazet; +Cc: amirv, ogerlitz, netdev, yevgenyp, yuvala, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: Text/Plain; charset=iso-8859-7, Size: 871 bytes --]

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sun, 01 Jun 2014 21:16:50 -0700

>   CC [M]  drivers/net/ethernet/mellanox/mlx4/en_netdev.o
> drivers/net/ethernet/mellanox/mlx4/en_netdev.c: In function ¡mlx4_en_init_affinity_hint¢:
> drivers/net/ethernet/mellanox/mlx4/en_netdev.c:1546:23: error: incompatible types when assigning to type ¡cpumask_var_t¢ from type ¡void *¢
> drivers/net/ethernet/mellanox/mlx4/en_netdev.c: In function ¡mlx4_en_free_affinity_hint¢:
> drivers/net/ethernet/mellanox/mlx4/en_netdev.c:1553:41: error: incompatible types when assigning to type ¡cpumask_var_t¢ from type ¡void *¢

What configuration/compiler combination generates this warning?  I didn't
see it with allmodconfig.
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next V6 2/2] net/mlx4_en: Use affinity hint
  2014-06-02  4:37     ` Eric Dumazet
@ 2014-06-02  4:56       ` David Miller
  2014-06-02  5:13         ` Eric Dumazet
  0 siblings, 1 reply; 13+ messages in thread
From: David Miller @ 2014-06-02  4:56 UTC (permalink / raw)
  To: eric.dumazet; +Cc: amirv, ogerlitz, netdev, yevgenyp, yuvala, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: Text/Plain; charset=iso-8859-7, Size: 1671 bytes --]

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sun, 01 Jun 2014 21:37:11 -0700

> On Sun, 2014-06-01 at 21:16 -0700, Eric Dumazet wrote:
>>   CC [M]  drivers/net/ethernet/mellanox/mlx4/en_netdev.o
>> drivers/net/ethernet/mellanox/mlx4/en_netdev.c: In function ¡mlx4_en_init_affinity_hint¢:
>> drivers/net/ethernet/mellanox/mlx4/en_netdev.c:1546:23: error: incompatible types when assigning to type ¡cpumask_var_t¢ from type ¡void *¢
>> drivers/net/ethernet/mellanox/mlx4/en_netdev.c: In function ¡mlx4_en_free_affinity_hint¢:
>> drivers/net/ethernet/mellanox/mlx4/en_netdev.c:1553:41: error: incompatible types when assigning to type ¡cpumask_var_t¢ from type ¡void *¢
> 
> 
> And :
> 
> ERROR: "cpumask_set_cpu_local_first" [drivers/net/ethernet/mellanox/mlx4/mlx4_en.ko] undefined!
> 
> 
> $ git grep -n cpumask_set_cpu_local_first
> drivers/net/ethernet/mellanox/mlx4/en_netdev.c:1542:    if (cpumask_set_cpu_local_first(ring_idx, numa_node,
> include/linux/cpumask.h:260:int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp);
> lib/cpumask.c:168: * cpumask_set_cpu_local_first - set i'th cpu with local numa cpu's first
> lib/cpumask.c:182:int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp)
> lib/cpumask.c:228:EXPORT_SYMBOL(cpumask_set_cpu_local_first);
> 
> Fixes are needed if CONFIG_CPUMASK_OFFSTACK is not used.
> 	
> $ grep CONFIG_CPUMASK_OFFSTACK .config
> $ echo $?
> 1
> 

Indeed you have to provide a dummy version for a non-SMP build etc.

I'm reverting.

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next V6 2/2] net/mlx4_en: Use affinity hint
  2014-06-02  4:56       ` David Miller
@ 2014-06-02  5:13         ` Eric Dumazet
  2014-06-02  7:10           ` David Miller
  2014-06-02 14:08           ` Amir Vadai
  0 siblings, 2 replies; 13+ messages in thread
From: Eric Dumazet @ 2014-06-02  5:13 UTC (permalink / raw)
  To: David Miller; +Cc: amirv, ogerlitz, netdev, yevgenyp, yuvala, linux-kernel

On Sun, 2014-06-01 at 21:56 -0700, David Miller wrote:

> Indeed you have to provide a dummy version for a non-SMP build etc.
> 
> I'm reverting.
> 

Hi David. I think your revert took one wrong commit.


# git show ee39facbf82e73e468c504d2b40e83e2d223c28c | diffstat -p1 -w70
 drivers/net/ethernet/micrel/ks8851.c |   50 ++++++++++---------
 include/linux/cpumask.h              |    2 
 lib/cpumask.c                        |   64 -------------------------
 3 files changed, 28 insertions(+), 88 deletions(-)




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next V6 2/2] net/mlx4_en: Use affinity hint
  2014-06-02  5:13         ` Eric Dumazet
@ 2014-06-02  7:10           ` David Miller
  2014-06-02 14:08           ` Amir Vadai
  1 sibling, 0 replies; 13+ messages in thread
From: David Miller @ 2014-06-02  7:10 UTC (permalink / raw)
  To: eric.dumazet; +Cc: amirv, ogerlitz, netdev, yevgenyp, yuvala, linux-kernel

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sun, 01 Jun 2014 22:13:12 -0700

> On Sun, 2014-06-01 at 21:56 -0700, David Miller wrote:
> 
>> Indeed you have to provide a dummy version for a non-SMP build etc.
>> 
>> I'm reverting.
>> 
> 
> Hi David. I think your revert took one wrong commit.

Thanks I'll fix it up.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH net-next V6 2/2] net/mlx4_en: Use affinity hint
  2014-06-02  5:13         ` Eric Dumazet
  2014-06-02  7:10           ` David Miller
@ 2014-06-02 14:08           ` Amir Vadai
  1 sibling, 0 replies; 13+ messages in thread
From: Amir Vadai @ 2014-06-02 14:08 UTC (permalink / raw)
  To: Eric Dumazet, David Miller
  Cc: ogerlitz, netdev, yevgenyp, yuvala, linux-kernel

On 6/2/2014 8:13 AM, Eric Dumazet wrote:
> On Sun, 2014-06-01 at 21:56 -0700, David Miller wrote:
>
>> Indeed you have to provide a dummy version for a non-SMP build etc.
>>
>> I'm reverting.
>>
>
> Hi David. I think your revert took one wrong commit.
>
>
> # git show ee39facbf82e73e468c504d2b40e83e2d223c28c | diffstat -p1 -w70
>   drivers/net/ethernet/micrel/ks8851.c |   50 ++++++++++---------
>   include/linux/cpumask.h              |    2
>   lib/cpumask.c                        |   64 -------------------------
>   3 files changed, 28 insertions(+), 88 deletions(-)
>
>
>

Hi,

Yeh, Eric is right and it seems that 2a82e40 "net: ks8851: Don't use 
regulator_get_optional()" was reverted by mistake instead of 70a640d: 
"net/mlx4_en: Use affinity hint"

I'm working on a fixed version of the affinity patches - this time I 
will double check the CONFIG_SMP/CONFIG_CPUMASK_OFFSTACK combinations.

I'm preparing a public git with Mellanox updates, so that Mellanox 
drivers patches will pass 0-DAY kernel build testing, before landing in 
net-next.

Amir

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-06-02 14:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-25 14:47 [PATCH net-next V6 0/2] cpumask,net: Affinity hint helper function Amir Vadai
2014-05-25 14:47 ` [PATCH net-next V6 1/2] cpumask: Utility function to set n'th cpu - local cpu first Amir Vadai
2014-05-27 19:24   ` David Miller
2014-05-28  5:49     ` Or Gerlitz
2014-05-25 14:47 ` [PATCH net-next V6 2/2] net/mlx4_en: Use affinity hint Amir Vadai
2014-06-02  4:16   ` Eric Dumazet
2014-06-02  4:37     ` Eric Dumazet
2014-06-02  4:56       ` David Miller
2014-06-02  5:13         ` Eric Dumazet
2014-06-02  7:10           ` David Miller
2014-06-02 14:08           ` Amir Vadai
2014-06-02  4:54     ` David Miller
2014-06-02  2:17 ` [PATCH net-next V6 0/2] cpumask,net: Affinity hint helper function David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).