DPDK patches and discussions
 help / color / Atom feed
* [dpdk-dev] [PATCH] kni: fix bug 389 - Crash in librte_kni driver due to noncontiguous pages
@ 2020-02-10 19:47 Scott Wasson
  2020-02-11  9:28 ` Ferruh Yigit
  2020-02-14 10:00 ` [dpdk-dev] [PATCH v2] kni: fix not contiguous FIFO Ferruh Yigit
  0 siblings, 2 replies; 6+ messages in thread
From: Scott Wasson @ 2020-02-10 19:47 UTC (permalink / raw)
  To: ferruh.yigit; +Cc: dev, stable, scott_wasson, iryzhov

Fixes: edd2fafbc0b8 ("kni: allocate memory dynamically for each device")
Cc: iryzhov@nfware.com
Cc: stable@dpdk.org

Signed-off-by: Scott Wasson <scott_wasson@affirmednetworks.com>
---
 lib/librte_kni/rte_kni.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index e388751..df4a021 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -145,31 +145,31 @@ enum kni_ops_status {
 	char mz_name[RTE_MEMZONE_NAMESIZE];
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_TX_Q_MZ_NAME_FMT, kni->name);
-	kni->m_tx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
+	kni->m_tx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
 	KNI_MEM_CHECK(kni->m_tx_q == NULL, tx_q_fail);
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_RX_Q_MZ_NAME_FMT, kni->name);
-	kni->m_rx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
+	kni->m_rx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
 	KNI_MEM_CHECK(kni->m_rx_q == NULL, rx_q_fail);
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_ALLOC_Q_MZ_NAME_FMT, kni->name);
-	kni->m_alloc_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
+	kni->m_alloc_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
 	KNI_MEM_CHECK(kni->m_alloc_q == NULL, alloc_q_fail);
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_FREE_Q_MZ_NAME_FMT, kni->name);
-	kni->m_free_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
+	kni->m_free_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
 	KNI_MEM_CHECK(kni->m_free_q == NULL, free_q_fail);
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_REQ_Q_MZ_NAME_FMT, kni->name);
-	kni->m_req_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
+	kni->m_req_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
 	KNI_MEM_CHECK(kni->m_req_q == NULL, req_q_fail);
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_RESP_Q_MZ_NAME_FMT, kni->name);
-	kni->m_resp_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
+	kni->m_resp_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
 	KNI_MEM_CHECK(kni->m_resp_q == NULL, resp_q_fail);
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_SYNC_ADDR_MZ_NAME_FMT, kni->name);
-	kni->m_sync_addr = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
+	kni->m_sync_addr = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
 	KNI_MEM_CHECK(kni->m_sync_addr == NULL, sync_addr_fail);
 
 	return 0;
-- 
1.7.6.3


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

* Re: [dpdk-dev] [PATCH] kni: fix bug 389 - Crash in librte_kni driver due to noncontiguous pages
  2020-02-10 19:47 [dpdk-dev] [PATCH] kni: fix bug 389 - Crash in librte_kni driver due to noncontiguous pages Scott Wasson
@ 2020-02-11  9:28 ` Ferruh Yigit
  2020-02-11 12:18   ` Burakov, Anatoly
  2020-02-14 10:00 ` [dpdk-dev] [PATCH v2] kni: fix not contiguous FIFO Ferruh Yigit
  1 sibling, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2020-02-11  9:28 UTC (permalink / raw)
  To: Scott Wasson; +Cc: dev, stable, iryzhov, Anatoly Burakov

On 2/10/2020 7:47 PM, Scott Wasson wrote:
> Fixes: edd2fafbc0b8 ("kni: allocate memory dynamically for each device")
> Cc: iryzhov@nfware.com
> Cc: stable@dpdk.org

I suggest following patch subject:
"kni: fix not contiguous FIFO"

And I little detail in the comment log can be good:
"
KNI requires FIFO to be physically contiguous, with existing
'rte_memzone_reserve()' API this is not guaranteed by default and as a result
KNI rings and packet delivery is broken.

Fixing it by providing 'RTE_MEMZONE_IOVA_CONTIG' flag to ask physically
contiguous memory.
"

And the Fixes tag should show the commit that updates the
'rte_memzone_reserve()' API to not provide physically contiguous memory.
@Anatoly, can you help finding that commit?


> 
> Signed-off-by: Scott Wasson <scott_wasson@affirmednetworks.com>
> ---
>  lib/librte_kni/rte_kni.c |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
> index e388751..df4a021 100644
> --- a/lib/librte_kni/rte_kni.c
> +++ b/lib/librte_kni/rte_kni.c
> @@ -145,31 +145,31 @@ enum kni_ops_status {
>  	char mz_name[RTE_MEMZONE_NAMESIZE];
>  
>  	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_TX_Q_MZ_NAME_FMT, kni->name);
> -	kni->m_tx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
> +	kni->m_tx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);

Can you please break the line, so it doesn't go beyond 80 chars?

>  	KNI_MEM_CHECK(kni->m_tx_q == NULL, tx_q_fail);
>  
>  	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_RX_Q_MZ_NAME_FMT, kni->name);
> -	kni->m_rx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
> +	kni->m_rx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>  	KNI_MEM_CHECK(kni->m_rx_q == NULL, rx_q_fail);
>  
>  	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_ALLOC_Q_MZ_NAME_FMT, kni->name);
> -	kni->m_alloc_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
> +	kni->m_alloc_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>  	KNI_MEM_CHECK(kni->m_alloc_q == NULL, alloc_q_fail);
>  
>  	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_FREE_Q_MZ_NAME_FMT, kni->name);
> -	kni->m_free_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
> +	kni->m_free_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>  	KNI_MEM_CHECK(kni->m_free_q == NULL, free_q_fail);
>  
>  	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_REQ_Q_MZ_NAME_FMT, kni->name);
> -	kni->m_req_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
> +	kni->m_req_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>  	KNI_MEM_CHECK(kni->m_req_q == NULL, req_q_fail);
>  
>  	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_RESP_Q_MZ_NAME_FMT, kni->name);
> -	kni->m_resp_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
> +	kni->m_resp_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>  	KNI_MEM_CHECK(kni->m_resp_q == NULL, resp_q_fail);
>  
>  	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_SYNC_ADDR_MZ_NAME_FMT, kni->name);
> -	kni->m_sync_addr = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
> +	kni->m_sync_addr = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>  	KNI_MEM_CHECK(kni->m_sync_addr == NULL, sync_addr_fail);
>  
>  	return 0;
> 


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

* Re: [dpdk-dev] [PATCH] kni: fix bug 389 - Crash in librte_kni driver due to noncontiguous pages
  2020-02-11  9:28 ` Ferruh Yigit
@ 2020-02-11 12:18   ` Burakov, Anatoly
  2020-02-11 14:09     ` Ferruh Yigit
  0 siblings, 1 reply; 6+ messages in thread
From: Burakov, Anatoly @ 2020-02-11 12:18 UTC (permalink / raw)
  To: Ferruh Yigit, Scott Wasson; +Cc: dev, stable, iryzhov

On 11-Feb-20 9:28 AM, Ferruh Yigit wrote:
> On 2/10/2020 7:47 PM, Scott Wasson wrote:
>> Fixes: edd2fafbc0b8 ("kni: allocate memory dynamically for each device")
>> Cc: iryzhov@nfware.com
>> Cc: stable@dpdk.org
> 
> I suggest following patch subject:
> "kni: fix not contiguous FIFO"
> 
> And I little detail in the comment log can be good:
> "
> KNI requires FIFO to be physically contiguous, with existing
> 'rte_memzone_reserve()' API this is not guaranteed by default and as a result
> KNI rings and packet delivery is broken.
> 
> Fixing it by providing 'RTE_MEMZONE_IOVA_CONTIG' flag to ask physically
> contiguous memory.
> "
> 
> And the Fixes tag should show the commit that updates the
> 'rte_memzone_reserve()' API to not provide physically contiguous memory.
> @Anatoly, can you help finding that commit?

The commit that added the ability to reserve contiguous memory was added 
before the memory subsystem itself started allocating non-contiguous 
memory, but all other drivers/libraries had added support for 
IOVA-contiguous memory as separate commits (see 74dbbcd6f8 for example).

So, technically, the "offending commit" is the *omission* of KNI from 
these changes. But, the API itself was added in 23fa86e529e, so that's 
what we should use for Fixes: tag IMO.

> 
> 
>>
>> Signed-off-by: Scott Wasson <scott_wasson@affirmednetworks.com>
>> ---
>>   lib/librte_kni/rte_kni.c |   14 +++++++-------
>>   1 files changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
>> index e388751..df4a021 100644
>> --- a/lib/librte_kni/rte_kni.c
>> +++ b/lib/librte_kni/rte_kni.c
>> @@ -145,31 +145,31 @@ enum kni_ops_status {
>>   	char mz_name[RTE_MEMZONE_NAMESIZE];
>>   
>>   	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_TX_Q_MZ_NAME_FMT, kni->name);
>> -	kni->m_tx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
>> +	kni->m_tx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
> 
> Can you please break the line, so it doesn't go beyond 80 chars?
> 
>>   	KNI_MEM_CHECK(kni->m_tx_q == NULL, tx_q_fail);
>>   
>>   	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_RX_Q_MZ_NAME_FMT, kni->name);
>> -	kni->m_rx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
>> +	kni->m_rx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>>   	KNI_MEM_CHECK(kni->m_rx_q == NULL, rx_q_fail);
>>   
>>   	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_ALLOC_Q_MZ_NAME_FMT, kni->name);
>> -	kni->m_alloc_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
>> +	kni->m_alloc_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>>   	KNI_MEM_CHECK(kni->m_alloc_q == NULL, alloc_q_fail);
>>   
>>   	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_FREE_Q_MZ_NAME_FMT, kni->name);
>> -	kni->m_free_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
>> +	kni->m_free_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>>   	KNI_MEM_CHECK(kni->m_free_q == NULL, free_q_fail);
>>   
>>   	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_REQ_Q_MZ_NAME_FMT, kni->name);
>> -	kni->m_req_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
>> +	kni->m_req_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>>   	KNI_MEM_CHECK(kni->m_req_q == NULL, req_q_fail);
>>   
>>   	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_RESP_Q_MZ_NAME_FMT, kni->name);
>> -	kni->m_resp_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
>> +	kni->m_resp_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>>   	KNI_MEM_CHECK(kni->m_resp_q == NULL, resp_q_fail);
>>   
>>   	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_SYNC_ADDR_MZ_NAME_FMT, kni->name);
>> -	kni->m_sync_addr = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
>> +	kni->m_sync_addr = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>>   	KNI_MEM_CHECK(kni->m_sync_addr == NULL, sync_addr_fail);
>>   
>>   	return 0;
>>
> 


-- 
Thanks,
Anatoly

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

* Re: [dpdk-dev] [PATCH] kni: fix bug 389 - Crash in librte_kni driver due to noncontiguous pages
  2020-02-11 12:18   ` Burakov, Anatoly
@ 2020-02-11 14:09     ` Ferruh Yigit
  0 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2020-02-11 14:09 UTC (permalink / raw)
  To: Burakov, Anatoly, Scott Wasson; +Cc: dev, stable, iryzhov

On 2/11/2020 12:18 PM, Burakov, Anatoly wrote:
> On 11-Feb-20 9:28 AM, Ferruh Yigit wrote:
>> On 2/10/2020 7:47 PM, Scott Wasson wrote:
>>> Fixes: edd2fafbc0b8 ("kni: allocate memory dynamically for each device")
>>> Cc: iryzhov@nfware.com
>>> Cc: stable@dpdk.org
>>
>> I suggest following patch subject:
>> "kni: fix not contiguous FIFO"
>>
>> And I little detail in the comment log can be good:
>> "
>> KNI requires FIFO to be physically contiguous, with existing
>> 'rte_memzone_reserve()' API this is not guaranteed by default and as a result
>> KNI rings and packet delivery is broken.
>>
>> Fixing it by providing 'RTE_MEMZONE_IOVA_CONTIG' flag to ask physically
>> contiguous memory.
>> "
>>
>> And the Fixes tag should show the commit that updates the
>> 'rte_memzone_reserve()' API to not provide physically contiguous memory.
>> @Anatoly, can you help finding that commit?
> 
> The commit that added the ability to reserve contiguous memory was added 
> before the memory subsystem itself started allocating non-contiguous 
> memory, but all other drivers/libraries had added support for 
> IOVA-contiguous memory as separate commits (see 74dbbcd6f8 for example).
> 
> So, technically, the "offending commit" is the *omission* of KNI from 
> these changes. But, the API itself was added in 23fa86e529e, so that's 
> what we should use for Fixes: tag IMO.

+1, it won't be accurate but giving the API commit will give enough detail for
LTS maintainers, so OK to use it for fixes tag:

Fixes: 23fa86e529e4 ("memzone: enable IOVA-contiguous reserving")
Cc: stable@dpdk.org

Thanks,
ferruh

> 
>>
>>
>>>
>>> Signed-off-by: Scott Wasson <scott_wasson@affirmednetworks.com>
>>> ---
>>>   lib/librte_kni/rte_kni.c |   14 +++++++-------
>>>   1 files changed, 7 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
>>> index e388751..df4a021 100644
>>> --- a/lib/librte_kni/rte_kni.c
>>> +++ b/lib/librte_kni/rte_kni.c
>>> @@ -145,31 +145,31 @@ enum kni_ops_status {
>>>   	char mz_name[RTE_MEMZONE_NAMESIZE];
>>>   
>>>   	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_TX_Q_MZ_NAME_FMT, kni->name);
>>> -	kni->m_tx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
>>> +	kni->m_tx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>>
>> Can you please break the line, so it doesn't go beyond 80 chars?
>>
>>>   	KNI_MEM_CHECK(kni->m_tx_q == NULL, tx_q_fail);
>>>   
>>>   	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_RX_Q_MZ_NAME_FMT, kni->name);
>>> -	kni->m_rx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
>>> +	kni->m_rx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>>>   	KNI_MEM_CHECK(kni->m_rx_q == NULL, rx_q_fail);
>>>   
>>>   	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_ALLOC_Q_MZ_NAME_FMT, kni->name);
>>> -	kni->m_alloc_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
>>> +	kni->m_alloc_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>>>   	KNI_MEM_CHECK(kni->m_alloc_q == NULL, alloc_q_fail);
>>>   
>>>   	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_FREE_Q_MZ_NAME_FMT, kni->name);
>>> -	kni->m_free_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
>>> +	kni->m_free_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>>>   	KNI_MEM_CHECK(kni->m_free_q == NULL, free_q_fail);
>>>   
>>>   	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_REQ_Q_MZ_NAME_FMT, kni->name);
>>> -	kni->m_req_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
>>> +	kni->m_req_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>>>   	KNI_MEM_CHECK(kni->m_req_q == NULL, req_q_fail);
>>>   
>>>   	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_RESP_Q_MZ_NAME_FMT, kni->name);
>>> -	kni->m_resp_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
>>> +	kni->m_resp_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>>>   	KNI_MEM_CHECK(kni->m_resp_q == NULL, resp_q_fail);
>>>   
>>>   	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_SYNC_ADDR_MZ_NAME_FMT, kni->name);
>>> -	kni->m_sync_addr = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
>>> +	kni->m_sync_addr = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG);
>>>   	KNI_MEM_CHECK(kni->m_sync_addr == NULL, sync_addr_fail);
>>>   
>>>   	return 0;
>>>
>>
> 
> 


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

* [dpdk-dev] [PATCH v2] kni: fix not contiguous FIFO
  2020-02-10 19:47 [dpdk-dev] [PATCH] kni: fix bug 389 - Crash in librte_kni driver due to noncontiguous pages Scott Wasson
  2020-02-11  9:28 ` Ferruh Yigit
@ 2020-02-14 10:00 ` Ferruh Yigit
  2020-02-14 11:30   ` [dpdk-dev] [dpdk-stable] " David Marchand
  1 sibling, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2020-02-14 10:00 UTC (permalink / raw)
  To: dev, Anatoly Burakov; +Cc: Ferruh Yigit, Scott Wasson, stable

From: Scott Wasson <scott_wasson@affirmednetworks.com>

KNI requires FIFO to be physically contiguous, with existing
'rte_memzone_reserve()' API this is not guaranteed by default and as a
result KNI rings and packet delivery may be broken if reserved memory
is not physically contiguous.

Fixing it by providing 'RTE_MEMZONE_IOVA_CONTIG' flag to ask physically
contiguous memory.

Fixes: 23fa86e529e4 ("memzone: enable IOVA-contiguous reserving")
Cc: stable@dpdk.org

Signed-off-by: Scott Wasson <scott_wasson@affirmednetworks.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 lib/librte_kni/rte_kni.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index e388751e3..bcf82cc2d 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -145,31 +145,38 @@ kni_reserve_mz(struct rte_kni *kni)
 	char mz_name[RTE_MEMZONE_NAMESIZE];
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_TX_Q_MZ_NAME_FMT, kni->name);
-	kni->m_tx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
+	kni->m_tx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY,
+			RTE_MEMZONE_IOVA_CONTIG);
 	KNI_MEM_CHECK(kni->m_tx_q == NULL, tx_q_fail);
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_RX_Q_MZ_NAME_FMT, kni->name);
-	kni->m_rx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
+	kni->m_rx_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY,
+			RTE_MEMZONE_IOVA_CONTIG);
 	KNI_MEM_CHECK(kni->m_rx_q == NULL, rx_q_fail);
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_ALLOC_Q_MZ_NAME_FMT, kni->name);
-	kni->m_alloc_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
+	kni->m_alloc_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY,
+			RTE_MEMZONE_IOVA_CONTIG);
 	KNI_MEM_CHECK(kni->m_alloc_q == NULL, alloc_q_fail);
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_FREE_Q_MZ_NAME_FMT, kni->name);
-	kni->m_free_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
+	kni->m_free_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY,
+			RTE_MEMZONE_IOVA_CONTIG);
 	KNI_MEM_CHECK(kni->m_free_q == NULL, free_q_fail);
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_REQ_Q_MZ_NAME_FMT, kni->name);
-	kni->m_req_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
+	kni->m_req_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY,
+			RTE_MEMZONE_IOVA_CONTIG);
 	KNI_MEM_CHECK(kni->m_req_q == NULL, req_q_fail);
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_RESP_Q_MZ_NAME_FMT, kni->name);
-	kni->m_resp_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
+	kni->m_resp_q = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY,
+			RTE_MEMZONE_IOVA_CONTIG);
 	KNI_MEM_CHECK(kni->m_resp_q == NULL, resp_q_fail);
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE, KNI_SYNC_ADDR_MZ_NAME_FMT, kni->name);
-	kni->m_sync_addr = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
+	kni->m_sync_addr = rte_memzone_reserve(mz_name, KNI_FIFO_SIZE, SOCKET_ID_ANY,
+			RTE_MEMZONE_IOVA_CONTIG);
 	KNI_MEM_CHECK(kni->m_sync_addr == NULL, sync_addr_fail);
 
 	return 0;
-- 
2.24.1


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

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2] kni: fix not contiguous FIFO
  2020-02-14 10:00 ` [dpdk-dev] [PATCH v2] kni: fix not contiguous FIFO Ferruh Yigit
@ 2020-02-14 11:30   ` " David Marchand
  0 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2020-02-14 11:30 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Anatoly Burakov, Scott Wasson, dpdk stable

On Fri, Feb 14, 2020 at 11:01 AM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> From: Scott Wasson <scott_wasson@affirmednetworks.com>
>
> KNI requires FIFO to be physically contiguous, with existing
> 'rte_memzone_reserve()' API this is not guaranteed by default and as a
> result KNI rings and packet delivery may be broken if reserved memory
> is not physically contiguous.
>
> Fixing it by providing 'RTE_MEMZONE_IOVA_CONTIG' flag to ask physically
> contiguous memory.
>

Bugzilla ID: 389
> Fixes: 23fa86e529e4 ("memzone: enable IOVA-contiguous reserving")
> Cc: stable@dpdk.org
>
> Signed-off-by: Scott Wasson <scott_wasson@affirmednetworks.com>
> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied, thanks.


--
David Marchand


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

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10 19:47 [dpdk-dev] [PATCH] kni: fix bug 389 - Crash in librte_kni driver due to noncontiguous pages Scott Wasson
2020-02-11  9:28 ` Ferruh Yigit
2020-02-11 12:18   ` Burakov, Anatoly
2020-02-11 14:09     ` Ferruh Yigit
2020-02-14 10:00 ` [dpdk-dev] [PATCH v2] kni: fix not contiguous FIFO Ferruh Yigit
2020-02-14 11:30   ` [dpdk-dev] [dpdk-stable] " David Marchand

DPDK patches and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox