dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Rajesh Ravi <rajesh.ravi@broadcom.com>
To: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Cc: Ajit Khaparde <ajit.khaparde@broadcom.com>,
	dev@dpdk.org,
	 Jonathan Richardson <jonathan.richardson@broadcom.com>,
	 Scott Branden <scott.branden@broadcom.com>,
	 Vikram Mysore Prakash <vikram.prakash@broadcom.com>,
	Srinath Mannam <srinath.mannam@broadcom.com>
Subject: Re: [dpdk-dev] [PATCH] eal: add option --iso-cmem for external custom memory
Date: Tue, 22 Oct 2019 13:26:39 +0530	[thread overview]
Message-ID: <CAAr5zNdS37jULy6vmWsnr-uL3hP0nV8OOQSYrFOi==wM-xpHSg@mail.gmail.com> (raw)
In-Reply-To: <CAAr5zNcLsTc_OGUfvfnBpXDZCGJYLUGcW4Pbfe5d-2yPjTaJkw@mail.gmail.com>

Hi Anatoly,
I tried calling rte_vfio_dma_map() but, it  failed for me because

vfio_dma_mem_map() failed with error:VFIO support not initialized  because:
default_vfio_cfg->vfio_iommu_type=NULL ( container_dma_map calls
vfio_dma_mem_map  with vfio_cfg =  default_vfio_cfg )

call sequence:  rte_vfio_dma_map() -->container_dma_map()
--> vfio_dma_mem_map

Regards,
Rajesh

On Mon, Oct 21, 2019 at 9:16 PM Rajesh Ravi <rajesh.ravi@broadcom.com>
wrote:

> Thanks Anatoly for prompt response. Sorry for the delayed response, I
> took some time to reverify with SPDK.
>
> Infact, I do want the iommu mapping to be performed. I don't want it to be
> bypassed by type1_map() [lib/librte_eal/linuxapp/eal/eal_vfio.c] for
> external memory.
>
> Then, if I understood correctly, you suggested to call rte_vfio_dma_map()
> as an alternative.
>
> *Context & clarification*
>
> 1) We 're using DPDK to manage/allocate memory for SPDK through heap API.
>
>   The only DPDK APIs we 're calling are:
>   A)rte_malloc_heap_memory_add() to add external memory to heap.
>   B)rte_malloc_heap_get_socket() & rte_malloc_socket() to allocate memory
>
> *  Are you suggesting to make a call to  rte_vfio_dma_map() from spdk, in
> addition to the APIs listed under 1)A & 1)B instead of modifying DPDK vfio
> functions?*
>    Please confirm, Probably I missed the context and might not have
> understood fully.
>
>
> 2) .dma_user_map_func=vfio_type1_dma_mem_map() is called from 2 paths in
> dpdk. In either case call to dma_user_map_func() is skipped.
>
>    A) *During the startup, as you said before:*
>      rte_vfio_setup_device() --> type1_map()
>
>    B)During allocation event:
>         vfio_mem_event_callback()  (type=RTE_MEM_EVENT_ALLOC,..)
> -->vfio_dma_mem_map() -->dma_user_map_func()
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
> *Conclusion*
>
> So we have 2 alternatives:
>
> A) make additional call to  rte_vfio_dma_map() API after adding external
> memory using rte_malloc_heap_memory_add()  API.
>
> B) remove msl->external check which bypasses call to  dma_user_map_func()
> in DPDK.
>
> I modified DPDK functions [Option B) ]. I guess you 're suggesting option
> A)
>
> Please confirm.
>
>
> Regards,
> Rajesh
>
>
>
>
>
>
>
>
>
>
>
>
> On Fri, Oct 18, 2019 at 10:23 PM Burakov, Anatoly <
> anatoly.burakov@intel.com> wrote:
>
>> On 18-Oct-19 11:54 AM, Rajesh Ravi wrote:
>> > + Srinath
>> >
>> > Thanks Anatoly for reviewing this. Please find my reply inline  below:
>> >
>> > [Anatoly] First of all, what is "iso-cmem"? It doesn't seem to have any
>> > defined
>> > meaning nor any relation to any existing functionality, and it's not
>> > explained anywhere what is "isolated cmem".
>> > [Rajesh] I 'll correct commit message to include clearer explanation.
>> > _
>> > _
>> > _Context & purpose_
>> > We 're using this to improve SPDK performance. When NVMe completion
>> > queues are allocated from a certain memory range,
>> > out of order competions completions  are enabled with our PCIe and it
>> > improves performance.
>> >
>> > _Usage_
>> > spdk_env_init()-->(calls rte_eal_init(), and then calls
>> > )spdk_env_dpdk_post_init() [file: spdk/lib/env_dpdk/init.c]
>> > --> spdk_mem_map_init()
>> > [lib/env_dpdk/memory.c]-->map_cmem_virtual_area() [this is our custom
>> > function]
>> > In map_cmem_virtual_area(): we 're mmaping anonymous &  private region
>> > and then creating iova table which makes iova addresses which fall in
>> > custom memory region.
>> > Then we call rte_malloc_heap_memory_add() and then allocate NVMe
>> > completion queues from this heap.
>> >
>> > [Anatoly] More importantly, why is this necessary? Type1 map only
>> bypasses
>> > external segments when adding memory at startup - it doesn't stop you
>> > from calling rte_vfio_dma_map() to map the memory with VFIO when you
>> > create the segment.
>> > [Rajesh] Please correct me if I'm wrong or  missing some thing here.
>> >    A) We wanted to create a heap from which we can allocate dynamically
>> >
>> >    B) I see that type1_map()
>> > [file:dpdk/lib/librte_eal/linuxapp/eal/eal_vfio.c] getting called once
>> > rte_malloc_heap_memory_add()() was invoked.
>> >         SPDK uses type1 dma map [spdk/lib/env_dpdk/memory.c]
>> >          vfio_type1_dma_map() is registered for .dma_map_func member
>> > [dpdk/lib/librte_eal/linuxapp/eal/eal_vfio.c]
>> >          So type1_map is called. Not sure whether we can change this.
>> >
>>
>> I'm not sure i'm following. You mean you *don't* want this mapping to be
>> performed?
>>
>> --
>> Thanks,
>> Anatoly
>>
>
>
> --
> Regards,
> Rajesh
>


-- 
Regards,
Rajesh

  reply	other threads:[~2019-10-23 21:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15  5:30 [dpdk-dev] [PATCH] eal: add option --iso-cmem for external custom memory Ajit Khaparde
2019-10-17 15:45 ` Burakov, Anatoly
2019-10-18 10:54   ` Rajesh Ravi
2019-10-18 16:53     ` Burakov, Anatoly
2019-10-21 15:46       ` Rajesh Ravi
2019-10-22  7:56         ` Rajesh Ravi [this message]
2019-10-24 11:43           ` Burakov, Anatoly
2019-10-25 12:53             ` Rajesh Ravi
2019-10-25 15:02               ` Burakov, Anatoly
2019-10-30 19:50                 ` Rajesh Ravi
2019-11-04 10:25                   ` Burakov, Anatoly
2019-11-05 11:41                     ` Burakov, Anatoly
2019-11-05 14:10                       ` Rajesh Ravi
2019-11-05 15:18                         ` Burakov, Anatoly
2019-11-05 17:13                           ` Burakov, Anatoly
2019-11-06 13:55                             ` David Marchand
2019-11-07 15:51                               ` David Marchand
2019-11-07 16:16                                 ` Rajesh Ravi

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='CAAr5zNdS37jULy6vmWsnr-uL3hP0nV8OOQSYrFOi==wM-xpHSg@mail.gmail.com' \
    --to=rajesh.ravi@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=jonathan.richardson@broadcom.com \
    --cc=scott.branden@broadcom.com \
    --cc=srinath.mannam@broadcom.com \
    --cc=vikram.prakash@broadcom.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 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).