DPDK patches and discussions
 help / color / Atom feed
* [dpdk-dev] [PATCH] mem: clarify documentation for rte_mem_virt2iova
@ 2019-11-14 14:13 Anatoly Burakov
  2019-11-18 13:14 ` Olivier Matz
  0 siblings, 1 reply; 4+ messages in thread
From: Anatoly Burakov @ 2019-11-14 14:13 UTC (permalink / raw)
  To: dev

It may not be immediately clear that rte_mem_virt2iova does not actually
check the internal memseg table, and will instead either return VA (in
IOVA as VA mode), or will fall back to kernel page table walk (in IOVA
as PA mode).

Add a note to API documentation indicating the above.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/common/include/rte_memory.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h
index bf81a2faa8..3d8d0bd697 100644
--- a/lib/librte_eal/common/include/rte_memory.h
+++ b/lib/librte_eal/common/include/rte_memory.h
@@ -110,6 +110,11 @@ phys_addr_t rte_mem_virt2phy(const void *virt);
 /**
  * Get IO virtual address of any mapped virtual address in the current process.
  *
+ * @note This function will not check internal page table. Instead, in IOVA as
+ *       PA mode, it will fall back to getting real physical address (which may
+ *       not match the expected IOVA, such as what was specified for external
+ *       memory).
+ *
  * @param virt
  *   The virtual address.
  * @return
-- 
2.17.1

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

* Re: [dpdk-dev] [PATCH] mem: clarify documentation for rte_mem_virt2iova
  2019-11-14 14:13 [dpdk-dev] [PATCH] mem: clarify documentation for rte_mem_virt2iova Anatoly Burakov
@ 2019-11-18 13:14 ` Olivier Matz
  2019-11-25 23:32   ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Olivier Matz @ 2019-11-18 13:14 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev

On Thu, Nov 14, 2019 at 02:13:06PM +0000, Anatoly Burakov wrote:
> It may not be immediately clear that rte_mem_virt2iova does not actually
> check the internal memseg table, and will instead either return VA (in
> IOVA as VA mode), or will fall back to kernel page table walk (in IOVA
> as PA mode).
> 
> Add a note to API documentation indicating the above.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>

Reviewed-by: Olivier Matz <olivier.matz@6wind.com>

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

* Re: [dpdk-dev] [PATCH] mem: clarify documentation for rte_mem_virt2iova
  2019-11-18 13:14 ` Olivier Matz
@ 2019-11-25 23:32   ` Thomas Monjalon
  2019-11-26 12:54     ` Burakov, Anatoly
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2019-11-25 23:32 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, Olivier Matz

18/11/2019 14:14, Olivier Matz:
> On Thu, Nov 14, 2019 at 02:13:06PM +0000, Anatoly Burakov wrote:
> > It may not be immediately clear that rte_mem_virt2iova does not actually
> > check the internal memseg table, and will instead either return VA (in
> > IOVA as VA mode), or will fall back to kernel page table walk (in IOVA
> > as PA mode).
> > 
> > Add a note to API documentation indicating the above.
> > 
> > Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> Reviewed-by: Olivier Matz <olivier.matz@6wind.com>

Applied, thanks



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

* Re: [dpdk-dev] [PATCH] mem: clarify documentation for rte_mem_virt2iova
  2019-11-25 23:32   ` Thomas Monjalon
@ 2019-11-26 12:54     ` Burakov, Anatoly
  0 siblings, 0 replies; 4+ messages in thread
From: Burakov, Anatoly @ 2019-11-26 12:54 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Olivier Matz

On 25-Nov-19 11:32 PM, Thomas Monjalon wrote:
> 18/11/2019 14:14, Olivier Matz:
>> On Thu, Nov 14, 2019 at 02:13:06PM +0000, Anatoly Burakov wrote:
>>> It may not be immediately clear that rte_mem_virt2iova does not actually
>>> check the internal memseg table, and will instead either return VA (in
>>> IOVA as VA mode), or will fall back to kernel page table walk (in IOVA
>>> as PA mode).
>>>
>>> Add a note to API documentation indicating the above.
>>>
>>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>>
>> Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
> 
> Applied, thanks
> 

There are multiple places where this function is used, and its use is 
not compatible with external memory. I think we should replace all 
usages of this function to rte_mem_virt2memseg(), and rename this 
function, because its actual intended usage is *not* VA->IOVA 
translation, but instead is akin to figuring out what IOVA address 
*should* be with current IOVA settings, regardless of any internal page 
table and current VFIO mappings.

-- 
Thanks,
Anatoly

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14 14:13 [dpdk-dev] [PATCH] mem: clarify documentation for rte_mem_virt2iova Anatoly Burakov
2019-11-18 13:14 ` Olivier Matz
2019-11-25 23:32   ` Thomas Monjalon
2019-11-26 12:54     ` Burakov, Anatoly

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