* [dpdk-dev] [PATCH] net/qede: fix alloc from socket 0
@ 2018-02-23 12:53 Pascal Mazon
2018-02-25 6:38 ` Patil, Harish
2018-02-26 8:01 ` [dpdk-dev] [PATCH v2] " Pascal Mazon
0 siblings, 2 replies; 5+ messages in thread
From: Pascal Mazon @ 2018-02-23 12:53 UTC (permalink / raw)
To: dev, Rasesh Mody, Harish Patil, Shahed Shaikh; +Cc: pascal.mazon, stable
In case osal_dma_alloc_coherent() is called from a management thread,
core_id turn out to be LCORE_ID_ANY, and the resulting socket for alloc
will be socket 0.
This is not desirable when using a NIC from socket 1 which might very
likely be configured to use memory from that socket only.
In that case, allocation will fail.
To address this, use master lcore instead when called from mgmt thread.
The associated socket should have memory available.
Fixes: ec94dbc57362 ("qede: add base driver")
Cc: stable@dpdk.org
Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
---
drivers/net/qede/base/bcm_osal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index fe42f3256400..0760cdcb9523 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -133,7 +133,7 @@ void *osal_dma_alloc_coherent(struct ecore_dev *p_dev,
snprintf(mz_name, sizeof(mz_name) - 1, "%lx",
(unsigned long)rte_get_timer_cycles());
if (core_id == (unsigned int)LCORE_ID_ANY)
- core_id = 0;
+ core_id = rte_get_master_lcore();
socket_id = rte_lcore_to_socket_id(core_id);
mz = rte_memzone_reserve_aligned(mz_name, size,
socket_id, 0, RTE_CACHE_LINE_SIZE);
--
2.16.1.72.g5be1f00a9
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] net/qede: fix alloc from socket 0
2018-02-23 12:53 [dpdk-dev] [PATCH] net/qede: fix alloc from socket 0 Pascal Mazon
@ 2018-02-25 6:38 ` Patil, Harish
2018-02-26 8:01 ` [dpdk-dev] [PATCH v2] " Pascal Mazon
1 sibling, 0 replies; 5+ messages in thread
From: Patil, Harish @ 2018-02-25 6:38 UTC (permalink / raw)
To: Pascal Mazon, dev, Mody, Rasesh, Shaikh, Shahed; +Cc: stable
-----Original Message-----
From: Pascal Mazon <pascal.mazon@6wind.com>
Date: Friday, February 23, 2018 at 4:53 AM
To: "dev@dpdk.org" <dev@dpdk.org>, "Mody, Rasesh"
<Rasesh.Mody@cavium.com>, Harish Patil <Harish.Patil@cavium.com>, "Shaikh,
Shahed" <Shahed.Shaikh@cavium.com>
Cc: "pascal.mazon@6wind.com" <pascal.mazon@6wind.com>, "stable@dpdk.org"
<stable@dpdk.org>
Subject: [PATCH] net/qede: fix alloc from socket 0
>In case osal_dma_alloc_coherent() is called from a management thread,
>core_id turn out to be LCORE_ID_ANY, and the resulting socket for alloc
>will be socket 0.
>
>This is not desirable when using a NIC from socket 1 which might very
>likely be configured to use memory from that socket only.
>In that case, allocation will fail.
>
>To address this, use master lcore instead when called from mgmt thread.
>The associated socket should have memory available.
>
>Fixes: ec94dbc57362 ("qede: add base driver")
>Cc: stable@dpdk.org
>
>Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
>---
> drivers/net/qede/base/bcm_osal.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/net/qede/base/bcm_osal.c
>b/drivers/net/qede/base/bcm_osal.c
>index fe42f3256400..0760cdcb9523 100644
>--- a/drivers/net/qede/base/bcm_osal.c
>+++ b/drivers/net/qede/base/bcm_osal.c
>@@ -133,7 +133,7 @@ void *osal_dma_alloc_coherent(struct ecore_dev *p_dev,
> snprintf(mz_name, sizeof(mz_name) - 1, "%lx",
> (unsigned long)rte_get_timer_cycles());
> if (core_id == (unsigned int)LCORE_ID_ANY)
>- core_id = 0;
>+ core_id = rte_get_master_lcore();
> socket_id = rte_lcore_to_socket_id(core_id);
> mz = rte_memzone_reserve_aligned(mz_name, size,
> socket_id, 0, RTE_CACHE_LINE_SIZE);
>--
>2.16.1.72.g5be1f00a9
>
Hi Pascal,
Looks good.
Can you please similar change in osal_dma_alloc_coherent_aligned() also?
Thanks.
Acked-by: Harish Patil <harish.patil@cavium.com>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v2] net/qede: fix alloc from socket 0
2018-02-23 12:53 [dpdk-dev] [PATCH] net/qede: fix alloc from socket 0 Pascal Mazon
2018-02-25 6:38 ` Patil, Harish
@ 2018-02-26 8:01 ` Pascal Mazon
2018-02-26 18:38 ` Patil, Harish
1 sibling, 1 reply; 5+ messages in thread
From: Pascal Mazon @ 2018-02-26 8:01 UTC (permalink / raw)
To: dev, Rasesh Mody, Harish Patil, Shahed Shaikh; +Cc: pascal.mazon, stable
In case osal_dma_alloc_coherent() or osal_dma_alloc_coherent_aligned() are
called from a management thread, core_id turn out to be LCORE_ID_ANY, and
the resulting socket for alloc will be socket 0.
This is not desirable when using a NIC from socket 1 which might very
likely be configured to use memory from that socket only.
In that case, allocation will fail.
To address this, use master lcore instead when called from mgmt thread.
The associated socket should have memory available.
Fixes: ec94dbc57362 ("qede: add base driver")
Cc: stable@dpdk.org
Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Acked-by: Harish Patil <harish.patil@cavium.com>
---
v2:
- Add similar change in osal_dma_alloc_coherent_aligned()
drivers/net/qede/base/bcm_osal.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
index fe42f3256400..91017b89aa26 100644
--- a/drivers/net/qede/base/bcm_osal.c
+++ b/drivers/net/qede/base/bcm_osal.c
@@ -133,7 +133,7 @@ void *osal_dma_alloc_coherent(struct ecore_dev *p_dev,
snprintf(mz_name, sizeof(mz_name) - 1, "%lx",
(unsigned long)rte_get_timer_cycles());
if (core_id == (unsigned int)LCORE_ID_ANY)
- core_id = 0;
+ core_id = rte_get_master_lcore();
socket_id = rte_lcore_to_socket_id(core_id);
mz = rte_memzone_reserve_aligned(mz_name, size,
socket_id, 0, RTE_CACHE_LINE_SIZE);
@@ -172,7 +172,7 @@ void *osal_dma_alloc_coherent_aligned(struct ecore_dev *p_dev,
snprintf(mz_name, sizeof(mz_name) - 1, "%lx",
(unsigned long)rte_get_timer_cycles());
if (core_id == (unsigned int)LCORE_ID_ANY)
- core_id = 0;
+ core_id = rte_get_master_lcore();
socket_id = rte_lcore_to_socket_id(core_id);
mz = rte_memzone_reserve_aligned(mz_name, size, socket_id, 0, align);
if (!mz) {
--
2.16.1.72.g5be1f00a9
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/qede: fix alloc from socket 0
2018-02-26 8:01 ` [dpdk-dev] [PATCH v2] " Pascal Mazon
@ 2018-02-26 18:38 ` Patil, Harish
2018-03-07 13:17 ` Ferruh Yigit
0 siblings, 1 reply; 5+ messages in thread
From: Patil, Harish @ 2018-02-26 18:38 UTC (permalink / raw)
To: Pascal Mazon, dev, Mody, Rasesh, Shaikh, Shahed; +Cc: stable
-----Original Message-----
From: Pascal Mazon <pascal.mazon@6wind.com>
Date: Monday, February 26, 2018 at 12:01 AM
To: "dev@dpdk.org" <dev@dpdk.org>, "Mody, Rasesh"
<Rasesh.Mody@cavium.com>, Harish Patil <Harish.Patil@cavium.com>, "Shaikh,
Shahed" <Shahed.Shaikh@cavium.com>
Cc: "pascal.mazon@6wind.com" <pascal.mazon@6wind.com>, "stable@dpdk.org"
<stable@dpdk.org>
Subject: [PATCH v2] net/qede: fix alloc from socket 0
>In case osal_dma_alloc_coherent() or osal_dma_alloc_coherent_aligned() are
>called from a management thread, core_id turn out to be LCORE_ID_ANY, and
>the resulting socket for alloc will be socket 0.
>
>This is not desirable when using a NIC from socket 1 which might very
>likely be configured to use memory from that socket only.
>In that case, allocation will fail.
>
>To address this, use master lcore instead when called from mgmt thread.
>The associated socket should have memory available.
>
>Fixes: ec94dbc57362 ("qede: add base driver")
>Cc: stable@dpdk.org
>
>Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
>Acked-by: Harish Patil <harish.patil@cavium.com>
>---
>
>v2:
> - Add similar change in osal_dma_alloc_coherent_aligned()
>
> drivers/net/qede/base/bcm_osal.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/qede/base/bcm_osal.c
>b/drivers/net/qede/base/bcm_osal.c
>index fe42f3256400..91017b89aa26 100644
>--- a/drivers/net/qede/base/bcm_osal.c
>+++ b/drivers/net/qede/base/bcm_osal.c
>@@ -133,7 +133,7 @@ void *osal_dma_alloc_coherent(struct ecore_dev *p_dev,
> snprintf(mz_name, sizeof(mz_name) - 1, "%lx",
> (unsigned long)rte_get_timer_cycles());
> if (core_id == (unsigned int)LCORE_ID_ANY)
>- core_id = 0;
>+ core_id = rte_get_master_lcore();
> socket_id = rte_lcore_to_socket_id(core_id);
> mz = rte_memzone_reserve_aligned(mz_name, size,
> socket_id, 0, RTE_CACHE_LINE_SIZE);
>@@ -172,7 +172,7 @@ void *osal_dma_alloc_coherent_aligned(struct
>ecore_dev *p_dev,
> snprintf(mz_name, sizeof(mz_name) - 1, "%lx",
> (unsigned long)rte_get_timer_cycles());
> if (core_id == (unsigned int)LCORE_ID_ANY)
>- core_id = 0;
>+ core_id = rte_get_master_lcore();
> socket_id = rte_lcore_to_socket_id(core_id);
> mz = rte_memzone_reserve_aligned(mz_name, size, socket_id, 0, align);
> if (!mz) {
>--
>2.16.1.72.g5be1f00a9
>
Acked-by: Harish Patil <harish.patil@cavium.com>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/qede: fix alloc from socket 0
2018-02-26 18:38 ` Patil, Harish
@ 2018-03-07 13:17 ` Ferruh Yigit
0 siblings, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2018-03-07 13:17 UTC (permalink / raw)
To: Patil, Harish, Pascal Mazon, dev, Mody, Rasesh, Shaikh, Shahed; +Cc: stable
On 2/26/2018 6:38 PM, Patil, Harish wrote:
> -----Original Message-----
> From: Pascal Mazon <pascal.mazon@6wind.com>
> Date: Monday, February 26, 2018 at 12:01 AM
> To: "dev@dpdk.org" <dev@dpdk.org>, "Mody, Rasesh"
> <Rasesh.Mody@cavium.com>, Harish Patil <Harish.Patil@cavium.com>, "Shaikh,
> Shahed" <Shahed.Shaikh@cavium.com>
> Cc: "pascal.mazon@6wind.com" <pascal.mazon@6wind.com>, "stable@dpdk.org"
> <stable@dpdk.org>
> Subject: [PATCH v2] net/qede: fix alloc from socket 0
>
>> In case osal_dma_alloc_coherent() or osal_dma_alloc_coherent_aligned() are
>> called from a management thread, core_id turn out to be LCORE_ID_ANY, and
>> the resulting socket for alloc will be socket 0.
>>
>> This is not desirable when using a NIC from socket 1 which might very
>> likely be configured to use memory from that socket only.
>> In that case, allocation will fail.
>>
>> To address this, use master lcore instead when called from mgmt thread.
>> The associated socket should have memory available.
>>
>> Fixes: ec94dbc57362 ("qede: add base driver")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
>> Acked-by: Harish Patil <harish.patil@cavium.com>
> Acked-by: Harish Patil <harish.patil@cavium.com>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-03-07 13:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-23 12:53 [dpdk-dev] [PATCH] net/qede: fix alloc from socket 0 Pascal Mazon
2018-02-25 6:38 ` Patil, Harish
2018-02-26 8:01 ` [dpdk-dev] [PATCH v2] " Pascal Mazon
2018-02-26 18:38 ` Patil, Harish
2018-03-07 13:17 ` Ferruh Yigit
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).