From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>,
Scott Wasson <scott_wasson@affirmednetworks.com>
Cc: dev@dpdk.org, stable@dpdk.org, iryzhov@nfware.com
Subject: Re: [dpdk-dev] [PATCH] kni: fix bug 389 - Crash in librte_kni driver due to noncontiguous pages
Date: Tue, 11 Feb 2020 12:18:11 +0000 [thread overview]
Message-ID: <7ef855f1-f032-fca0-c699-6d15ea481dbe@intel.com> (raw)
In-Reply-To: <570fb7fd-6cac-ec87-66a1-d82b82fa62f6@intel.com>
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
next prev parent reply other threads:[~2020-02-11 12:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-10 19:47 Scott Wasson
2020-02-11 9:28 ` Ferruh Yigit
2020-02-11 12:18 ` Burakov, Anatoly [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7ef855f1-f032-fca0-c699-6d15ea481dbe@intel.com \
--to=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=iryzhov@nfware.com \
--cc=scott_wasson@affirmednetworks.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).