[v5,21/21] doc: add external memory feature to programmer's guide

Message ID c450565d44c94cf07f34281e9bac0ec92aaf4778.1537960448.git.anatoly.burakov@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Support externally allocated memory in DPDK |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Anatoly Burakov Sept. 26, 2018, 11:22 a.m. UTC
  Add a short chapter on usage of external memory in DPDK to the
Programmer's Guide.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 .../prog_guide/env_abstraction_layer.rst      | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)
  

Comments

Kovacevic, Marko Sept. 26, 2018, 3:19 p.m. UTC | #1
> Add a short chapter on usage of external memory in DPDK to the
> Programmer's Guide.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>  .../prog_guide/env_abstraction_layer.rst      | 37 +++++++++++++++++++
>  1 file changed, 37 insertions(+)

> +The expected workflow is as follows:
> +
> +* Get a pointer to memory area
> +* Create a named heap
> +* Add memory area(s) to the heap
> +  * If IOVA table is not specified, IOVA addresses will be assumed to be
> +    unavailable, and DMA mappings will not be performed
> +  * Other processes must attach to the memory area before they can use
> +it
> +* Get socket ID used for the heap
> +* Use normal DPDK allocation procedures, using supplied socket ID
> +* If memory area is no longer needed, it can be removed from the heap
> +  * Other processes must detach from this memory area before it can be
> +removed
> +* If heap is no longer needed, remove it
> +  * Socket ID will become invalid and will not be reused


Hi Anatoly,

Im getting an error when doing 

make-doc-guides-html

/dpdk/doc/guides/prog_guide/env_abstraction_layer.rst:241: WARNING: Unexpected indentation.
/dpdk/doc/guides/prog_guide/env_abstraction_layer.rst:242: WARNING: Block quote ends without a blank line; unexpected unindent.

This is due to the indentation of your inner bullet points instead of two spaces put 4
For all four that you have.

Thanks,
Marko K
  
Anatoly Burakov Sept. 26, 2018, 4 p.m. UTC | #2
On 26-Sep-18 4:19 PM, Kovacevic, Marko wrote:
>> Add a short chapter on usage of external memory in DPDK to the
>> Programmer's Guide.
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>> ---
>>   .../prog_guide/env_abstraction_layer.rst      | 37 +++++++++++++++++++
>>   1 file changed, 37 insertions(+)
> 
>> +The expected workflow is as follows:
>> +
>> +* Get a pointer to memory area
>> +* Create a named heap
>> +* Add memory area(s) to the heap
>> +  * If IOVA table is not specified, IOVA addresses will be assumed to be
>> +    unavailable, and DMA mappings will not be performed
>> +  * Other processes must attach to the memory area before they can use
>> +it
>> +* Get socket ID used for the heap
>> +* Use normal DPDK allocation procedures, using supplied socket ID
>> +* If memory area is no longer needed, it can be removed from the heap
>> +  * Other processes must detach from this memory area before it can be
>> +removed
>> +* If heap is no longer needed, remove it
>> +  * Socket ID will become invalid and will not be reused
> 
> 
> Hi Anatoly,
> 
> Im getting an error when doing
> 
> make-doc-guides-html
> 
> /dpdk/doc/guides/prog_guide/env_abstraction_layer.rst:241: WARNING: Unexpected indentation.
> /dpdk/doc/guides/prog_guide/env_abstraction_layer.rst:242: WARNING: Block quote ends without a blank line; unexpected unindent.
> 
> This is due to the indentation of your inner bullet points instead of two spaces put 4
> For all four that you have.
> 
> Thanks,
> Marko K
> 
Hi Marko,

Those are supposed to be sub-bullet points, i.e. 2nd level. Does it have 
to be six?
  
Kovacevic, Marko Sept. 26, 2018, 4:17 p.m. UTC | #3
> > Hi Anatoly,
> >
> > Im getting an error when doing
> >
> > make-doc-guides-html
> >
> > /dpdk/doc/guides/prog_guide/env_abstraction_layer.rst:241: WARNING:
> Unexpected indentation.
> > /dpdk/doc/guides/prog_guide/env_abstraction_layer.rst:242: WARNING:
> Block quote ends without a blank line; unexpected unindent.
> >
> > This is due to the indentation of your inner bullet points instead of
> > two spaces put 4 For all four that you have.
> >
> > Thanks,
> > Marko K
> >
> Hi Marko,
> 
> Those are supposed to be sub-bullet points, i.e. 2nd level. Does it have to be
> six?
> 
> --
> Thanks,
> Anatoly

Yeah I understand that it is supposed to be sub-bullets but the output is skewed when you only have 
2 spaces for them instead of having 2 have 4 not 6
  

Patch

diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst
index d362c9209..f2191b695 100644
--- a/doc/guides/prog_guide/env_abstraction_layer.rst
+++ b/doc/guides/prog_guide/env_abstraction_layer.rst
@@ -213,6 +213,43 @@  Normally, these options do not need to be changed.
     can later be mapped into that preallocated VA space (if dynamic memory mode
     is enabled), and can optionally be mapped into it at startup.
 
+Support for Externally Allocated Memory
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+It is possible to use externally allocated memory in DPDK, using a set of malloc
+heap API's. Support for externally allocated memory is implemented through
+overloading the socket ID - externally allocated heaps will have socket ID's
+that would be considered invalid under normal circumstances. Requesting an
+allocation to take place from a specified externally allocated memory is a
+matter of supplying the correct socket ID to DPDK allocator, either directly
+(e.g. through a call to ``rte_malloc``) or indirectly (through data
+structure-specific allocation API's such as ``rte_ring_create``).
+
+Since there is no way DPDK can verify whether memory are is available or valid,
+this responsibility falls on the shoulders of the user. All multiprocess
+synchronization is also user's responsibility, as well as ensuring  that all
+calls to add/attach/detach/remove memory are done in the correct order. It is
+not required to attach to a memory area in all processes - only attach to memory
+areas as needed.
+
+The expected workflow is as follows:
+
+* Get a pointer to memory area
+* Create a named heap
+* Add memory area(s) to the heap
+  * If IOVA table is not specified, IOVA addresses will be assumed to be
+    unavailable, and DMA mappings will not be performed
+  * Other processes must attach to the memory area before they can use it
+* Get socket ID used for the heap
+* Use normal DPDK allocation procedures, using supplied socket ID
+* If memory area is no longer needed, it can be removed from the heap
+  * Other processes must detach from this memory area before it can be removed
+* If heap is no longer needed, remove it
+  * Socket ID will become invalid and will not be reused
+
+For more information, please refer to ``rte_malloc`` API documentation,
+specifically the ``rte_malloc_heap_*`` family of function calls.
+
 PCI Access
 ~~~~~~~~~~