All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: Shreyansh Jain <shreyansh.jain@nxp.com>, ferruh.yigit@intel.com
Cc: dev@dpdk.org
Subject: Re: [PATCH 3/5] common/dpaax: add library for PA VA translation table
Date: Tue, 25 Sep 2018 14:28:20 +0100	[thread overview]
Message-ID: <afdf0eb5-433f-0e65-1772-3564a129bf44@intel.com> (raw)
In-Reply-To: <20180925125423.7505-4-shreyansh.jain@nxp.com>

On 25-Sep-18 1:54 PM, Shreyansh Jain wrote:
> A common library, valid for dpaaX drivers, which is used to maintain
> a local copy of PA->VA translations.
> 
> In case of physical addressing mode (one of the option for FSLMC, and
> only option for DPAA bus), the addresses of descriptors Rx'd are
> physical. These need to be converted into equivalent VA for rte_mbuf
> and other similar calls.
> 
> Using the rte_mem_virt2iova or rte_mem_virt2phy is expensive. This
> library is an attempt to reduce the overall cost associated with
> this translation.
> 
> A small table is maintained, containing continuous entries
> representing a continguous physical range. Each of these entries
> stores the equivalent VA, which is fed during mempool creation, or
> memory allocation/deallocation callbacks.
> 
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---

Hi Shreyansh,

So, basically, you're reimplementing old DPDK's memory view (storing 
VA's in a PA-centric way). Makes sense :)

I should caution you that right now, external memory allocator 
implementation does *not* trigger any callbacks for newly added memory. 
So, anything coming from external memory will not be reflected in your 
table, unless it happens to be already there before 
dpaax_iova_table_populate() gets called. This patchset makes a good 
argument for why perhaps it should trigger callbacks. Thoughts?

Also, a couple of nitpicks below.

>   config/common_base                            |   5 +
>   config/common_linuxapp                        |   5 +
>   drivers/common/Makefile                       |   4 +
>   drivers/common/dpaax/Makefile                 |  31 ++
>   drivers/common/dpaax/dpaax_iova_table.c       | 509 ++++++++++++++++++
>   drivers/common/dpaax/dpaax_iova_table.h       | 104 ++++
>   drivers/common/dpaax/dpaax_logs.h             |  39 ++
>   drivers/common/dpaax/meson.build              |  12 +

<snip>

> +	DPAAX_DEBUG("Add: Found slot at (%"PRIu64")[(%zu)] for vaddr:(%p),"
> +		    " phy(%"PRIu64"), len(%zu)", entry[i].start, e_offset,
> +		    vaddr, paddr, length);
> +	return 0;
> +}
> +
> +int
> +dpaax_iova_table_del(phys_addr_t paddr, size_t len __rte_unused)

len is not unused.

> +{
> +	int found = 0;
> +	unsigned int i;
> +	size_t e_offset;
> +	struct dpaax_iovat_element *entry;
> +	phys_addr_t align_paddr;
> +
> +	align_paddr = paddr & DPAAX_MEM_SPLIT_MASK;
> +
> +	/* Check if paddr is available in table */

<snip>

> +static inline void *
> +dpaax_iova_table_get_va(phys_addr_t paddr) {
> +	unsigned int i = 0, index;
> +	void *vaddr = 0;
> +	phys_addr_t paddr_align = paddr & DPAAX_MEM_SPLIT_MASK;
> +	size_t offset = paddr & DPAAX_MEM_SPLIT_MASK_OFF;
> +	struct dpaax_iovat_element *entry;
> +
> +	entry = dpaax_iova_table_p->entries;
> +
> +	do {
> +		if (unlikely(i > dpaax_iova_table_p->count))
> +			break;
> +
> +		if (paddr_align < entry[i].start) {
> +			/* Incorrect paddr; Not in memory range */
> +			return 0;

NULL?

-- 
Thanks,
Anatoly

  reply	other threads:[~2018-09-25 13:28 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25 12:54 [PATCH 0/5] Add a PA-VA Translation table for DPAAx Shreyansh Jain
2018-09-25 12:54 ` [PATCH 1/5] bus/fslmc: fix physical addressing check Shreyansh Jain
2018-09-25 12:54 ` [PATCH 2/5] drivers: common as dependency for bus Shreyansh Jain
2018-09-25 12:54 ` [PATCH 3/5] common/dpaax: add library for PA VA translation table Shreyansh Jain
2018-09-25 13:28   ` Burakov, Anatoly [this message]
2018-09-25 13:39     ` Shreyansh Jain
2018-09-25 13:51       ` Burakov, Anatoly
2018-09-25 14:00         ` Shreyansh Jain
2018-09-25 14:08           ` Burakov, Anatoly
2018-09-26 10:16             ` Burakov, Anatoly
2018-10-09 10:45       ` Shreyansh Jain
2018-10-11  9:03         ` Burakov, Anatoly
2018-10-11 10:02           ` Shreyansh Jain
2018-10-11 10:07             ` Shreyansh Jain
2018-10-11 10:13               ` Burakov, Anatoly
2018-10-11 10:39                 ` Shreyansh Jain
2018-10-11 10:46                   ` Burakov, Anatoly
2018-10-11 10:09             ` Burakov, Anatoly
2018-09-25 12:54 ` [PATCH 4/5] dpaa: enable dpaax library Shreyansh Jain
2018-09-25 12:54 ` [PATCH 5/5] fslmc: " Shreyansh Jain
2018-10-09 11:25 ` [PATCH v2 0/5] Add a PA-VA Translation table for DPAAx Shreyansh Jain
2018-10-09 11:25   ` [PATCH v2 1/5] bus/fslmc: fix physical addressing check Shreyansh Jain
2018-10-12  9:01     ` Pavan Nikhilesh
2018-10-12 10:44       ` Shreyansh Jain
2018-10-12 16:29         ` Pavan Nikhilesh
2018-10-09 11:25   ` [PATCH v2 2/5] drivers: common as dependency for bus Shreyansh Jain
2018-10-09 11:25   ` [PATCH v2 3/5] common/dpaax: add library for PA VA translation table Shreyansh Jain
2018-10-09 11:25   ` [PATCH v2 4/5] dpaa: enable dpaax library Shreyansh Jain
2018-10-09 11:25   ` [PATCH v2 5/5] fslmc: " Shreyansh Jain
2018-10-13 12:21   ` [PATCH v3 0/5] Add a PA-VA Translation table for DPAAx Shreyansh Jain
2018-10-13 12:21     ` [PATCH v3 1/5] bus/fslmc: fix physical addressing check Shreyansh Jain
2018-10-13 16:08       ` Pavan Nikhilesh
2018-10-15  6:36         ` Shreyansh Jain
2018-10-13 12:21     ` [PATCH v3 2/5] drivers: common as dependency for bus Shreyansh Jain
2018-10-13 12:21     ` [PATCH v3 3/5] common/dpaax: add library for PA VA translation table Shreyansh Jain
2018-10-13 12:21     ` [PATCH v3 4/5] dpaa: enable dpaax library Shreyansh Jain
2018-10-13 12:21     ` [PATCH v3 5/5] fslmc: " Shreyansh Jain
2018-10-15  6:41     ` [PATCH v4 0/5] Add a PA-VA Translation table for DPAAx Shreyansh Jain
2018-10-15  6:41       ` [PATCH v4 1/5] bus/fslmc: fix physical addressing check Shreyansh Jain
2018-10-15  6:41       ` [PATCH v4 2/5] drivers: common as dependency for bus Shreyansh Jain
2018-10-15  6:42       ` [PATCH v4 3/5] common/dpaax: add library for PA VA translation table Shreyansh Jain
2018-10-15  6:42       ` [PATCH v4 4/5] dpaa: enable dpaax library Shreyansh Jain
2018-10-15  6:42       ` [PATCH v4 5/5] fslmc: " Shreyansh Jain
2018-10-15 12:01       ` [PATCH v5 0/5] Shreyansh Jain
2018-10-15 12:01         ` [PATCH v5 1/5] bus/fslmc: fix physical addressing check Shreyansh Jain
2018-10-16 10:02           ` Thomas Monjalon
2018-10-15 12:01         ` [PATCH v5 2/5] drivers: common as dependency for bus Shreyansh Jain
2018-10-15 12:01         ` [PATCH v5 3/5] common/dpaax: add library for PA VA translation table Shreyansh Jain
2018-10-15 23:17           ` Thomas Monjalon
2018-10-15 12:01         ` [PATCH v5 4/5] dpaa: enable dpaax library Shreyansh Jain
2018-10-15 12:01         ` [PATCH v5 5/5] fslmc: " Shreyansh Jain
2018-10-16 10:18         ` [PATCH v5 0/5] Thomas Monjalon

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=afdf0eb5-433f-0e65-1772-3564a129bf44@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=shreyansh.jain@nxp.com \
    /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 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.