eal: add request to map reserved physical memory
PATCH 1/1 eal: add request to map reserved physical memory
From: Srinath Mannam <[email protected]>
Reserved physical memory is requested from kernel and it will be mapped to user space.
This memory will be mapped to IOVA using VFIO. And this memory will be provided to SPDK to allocate NVMe CQs.
--- lib/librte_eal/common/eal_common_options.c | 5 ++ lib/librte_eal/common/eal_internal_cfg.h | 1 + lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/common/include/rte_eal.h | 8 ++++ lib/librte_eal/common/include/rte_malloc.h | 7 +++ lib/librte_eal/common/rte_malloc.c | 17 +++++++ lib/librte_eal/linuxapp/eal/eal.c | 75 ++++++++++++++++++++++++++++++ 7 files changed, 115 insertions(+)
lib/librte_eal/common/eal_common_options.c +5 -0
@@ -73,6 +73,7 @@ eal_long_options[] = { {OPT_VDEV, 1, NULL, OPT_VDEV_NUM }, {OPT_VFIO_INTR, 1, NULL, OPT_VFIO_INTR_NUM }, {OPT_VMWARE_TSC_MAP, 0, NULL, OPT_VMWARE_TSC_MAP_NUM }, + {OPT_ISO_CMEM, 0, NULL, OPT_ISO_CMEM_NUM }, {0, 0, NULL, 0 } };
@@ -1119,6 +1120,10 @@ eal_parse_common_option(int opt, const char *optarg, conf->no_pci =1 ;break ; +case OPT_ISO_CMEM_NUM : + conf->iso_cmem =1 ; +break ; +case OPT_NO_HPET_NUM : conf->no_hpet =1 ;break ;
lib/librte_eal/common/eal_internal_cfg.h +1 -0
@@ -37,6 +37,7 @@ struct internal_config {volatile unsigned no_hugetlbfs;/**< true to disable hugetlbfs */ unsigned hugepage_unlink;/**< true to unlink backing files */ volatile unsigned no_pci;/**< true to disable PCI */ +unsigned int iso_cmem;/**< true to enable isolated cmem */ volatile unsigned no_hpet;/**< true to disable HPET */ volatile unsigned vmware_tsc_map;/**< true to use VMware TSC mapping * instead of native TSC */
lib/librte_eal/common/eal_options.h +2 -0
@@ -55,6 +55,8 @@ enum {OPT_VFIO_INTR_NUM , #define OPT_VMWARE_TSC_MAP "vmware-tsc-map"OPT_VMWARE_TSC_MAP_NUM , +#define OPT_ISO_CMEM "iso-cmem" +OPT_ISO_CMEM_NUM , OPT_LONG_MAX_NUM };
lib/librte_eal/common/include/rte_eal.h +8 -0
@@ -73,6 +73,14 @@ struct rte_config {struct rte_mem_config *mem_config; } __attribute__((__packed__)); +/** +* Get the global custom memory segment structure. +* +* @return +* A pointer to the global cmemseg structure. +*/ +struct rte_memseg *rte_eal_get_iso_cmemseg (void ); +/** * Get the global configuration structure. *
lib/librte_eal/common/include/rte_malloc.h +7 -0
@@ -156,6 +156,13 @@ rte_realloc(void *ptr, size_t size, unsigned align);void *rte_malloc_socket (const char *type,size_t size,unsigned align,int socket); +/** +* This function allocates memory from the huge-page area of memory or +* from reserved memory. +*/ +void * +rte_malloc_cmem (const char *type,size_t size,size_t align,int socket); +/** * Allocate zero'ed memory from the heap. *
lib/librte_eal/common/rte_malloc.c +17 -0
@@ -33,6 +33,23 @@ void rte_free(void *addr)rte_panic ("Fatal error: Invalid memory\n" ); } +/* +* Allocate memory on cmem heap if cmem segment available else allocate +* from normal heap. +*/ +void * +rte_malloc_cmem (const char *type,size_t size,size_t align,int socket_id) +{ +struct rte_memseg *cmemseg =rte_eal_get_iso_cmemseg (); +void *addr; + +if (cmemseg) + socket_id = cmemseg->socket_id; + + addr =rte_malloc_socket (NULL , size, align, socket_id); +return addr; +} +/* * Allocate memory on specified heap. */
lib/librte_eal/linuxapp/eal/eal.c +75 -0
99 lines not on this page · raw message
Signature · 1 line
2.14.3 (Apple Git-98)
Quoted 8 lines · Ajit Khaparde
From: Srinath Mannam <[email protected]>
Reserved physical memory is requested from kernel and it will be mapped to user space.
This memory will be mapped to IOVA using VFIO. And this memory will be provided to SPDK to allocate NVMe CQs.
Quoted 4 lines
Signed-off-by Srinath Mannam <[email protected]>Signed-off-by Scott Branden <[email protected]>Signed-off-by Ajit Khaparde <[email protected]>---
Hi Srinath,
I've seen this kind of approach implemented before to add additional memory types to DPDK (redefining "unused" socket id's to mean something else), and i don't like it.
What would be better is to design a new API to support different memory types. Some groundwork for this was already laid for this release (switching to memseg lists), but more changes will be needed down the line. My ideal approach would be to have pluggable memory allocators. I've outlined some of my thoughts on this before [1], you're welcome to join/continue that discussion, and make sure whatever comes out of it is going to be useful for all of us :) I was planning to (attempt to) restart that discussion, and this seems like as good an opportunity to do that as any other.
Now that the memory hotplug stuff is merged, i'll hopefully get more time prototyping.
So, as it is, it's a NACK from me, but let's work together on something better :)
[1] http://dpdk.org/ml/archives/dev/2018-February/090937.html
Signature · 2 lines
Thanks, Anatoly
Hi Anatoly,
Our requirement is, that separate memory segment (speed memory window) need to be allocated outside huge pages segment.
your thoughts discussed in the link (dynamic memory allocations in DPDK) are exactly matches with our requirement.
We tried to fit our requirement in the existing memory model with minimum changes, So we followed this approach.
Memory model in DPDK managed using socket ids. So I also attached new memory segment to un-used socket which allows to allocate memory using rte_malloc.
Please add me in your discussions. I am very much interested to join in your discussions and contribute in development.
Please point me the sources in DPDK related to this part of implementation.
Thank you.
Regards,
Srinath.
Quoted 42 lines · Anatoly
Quoted 9 lines · Ajit Khaparde
From: Srinath Mannam <[email protected]>
Reserved physical memory is requested from kernel and it will be mapped to user space.
This memory will be mapped to IOVA using VFIO. And this memory will be provided to SPDK to allocate NVMe CQs.Quoted 4 lines
Signed-off-by Srinath Mannam <[email protected]>Signed-off-by Scott Branden <[email protected]>Signed-off-by Ajit Khaparde <[email protected]>---
Hi Srinath,
I've seen this kind of approach implemented before to add additional memory types to DPDK (redefining "unused" socket id's to mean something else), and i don't like it.
What would be better is to design a new API to support different memory types. Some groundwork for this was already laid for this release (switching to memseg lists), but more changes will be needed down the line. My ideal approach would be to have pluggable memory allocators. I've outlined some of my thoughts on this before [1], you're welcome to join/continue that discussion, and make sure whatever comes out of it is going to be useful for all of us :) I was planning to (attempt to) restart that discussion, and this seems like as good an opportunity to do that as any other.
Now that the memory hotplug stuff is merged, i'll hopefully get more time prototyping.
So, as it is, it's a NACK from me, but let's work together on something better :)
[1] http://dpdk.org/ml/archives/dev/2018-February/090937.html
--
Thanks,
Anatoly
Hi Anatoly,
We'd appreciate your input so we can come to a solution of supporting the necessary memory allocations?
Quoted 76 lines · Srinath Mannam
Hi Anatoly,
Our requirement is, that separate memory segment (speed memory window) need to be allocated outside huge pages segment.
your thoughts discussed in the link (dynamic memory allocations in DPDK) are exactly matches with our requirement.
We tried to fit our requirement in the existing memory model with minimum changes, So we followed this approach.
Memory model in DPDK managed using socket ids. So I also attached new memory segment to un-used socket which allows to allocate memory usingrte_malloc.Please add me in your discussions. I am very much interested to join in your discussions and contribute in development.
Please point me the sources in DPDK related to this part of implementation.
Thank you.
Regards,
Srinath.
Quoted 16 lines · Anatoly
Quoted 9 lines · Ajit Khaparde
From: Srinath Mannam <[email protected]>
Reserved physical memory is requested from kernel and it will be mapped to user space.
This memory will be mapped to IOVA using VFIO. And this memory will be provided to SPDK to allocate NVMe CQs.Quoted 4 lines
Signed-off-by Srinath Mannam <[email protected]>Signed-off-by Scott Branden <[email protected]>Signed-off-by Ajit Khaparde <[email protected]>---
Quoted 3 lines
Hi Srinath,
I've seen this kind of approach implemented before to add additional
memory
Quoted 1 line
types to DPDK (redefining "unused" socket id's to mean something else),
and
Quoted 4 lines
i don't like it.
What would be better is to design a new API to support different memory types. Some groundwork for this was already laid for this release
(switching
Quoted 2 lines
to memseg lists), but more changes will be needed down the line. My ideal approach would be to have pluggable memory allocators. I've outlined
some of
Quoted 2 lines
my thoughts on this before [1], you're welcome to join/continue that discussion, and make sure whatever comes out of it is going to be useful
for
Quoted 14 lines
all of us :) I was planning to (attempt to) restart that discussion, and this seems like as good an opportunity to do that as any other.
Now that the memory hotplug stuff is merged, i'll hopefully get more time prototyping.
So, as it is, it's a NACK from me, but let's work together on something better :)
[1] http://dpdk.org/ml/archives/dev/2018-February/090937.html
--
Thanks,
Anatoly
Quoted 4 lines · Scott Branden
Hi Anatoly,
We'd appreciate your input so we can come to a solution of supporting the necessary memory allocations?
Hi Scott,
I'm currently starting to work on a prototype that will be at least RFC'd (if not v1'd) during 18.08 timeframe. Basically, the idea is to create/destroy named malloc heaps dynamically, and allow user to request memory from them. You may then mmap() whatever you want and create a malloc heap out of it.
Does that sound reasonable?
Signature · 2 lines
Thanks, Anatoly
Quoted 11 lines · Anatoly
Quoted 4 lines · Scott Branden
Hi Anatoly,
We'd appreciate your input so we can come to a solution of supporting the necessary memory allocations?
Hi Scott,
I'm currently starting to work on a prototype that will be at least RFC'd (if not v1'd) during 18.08 timeframe. Basically, the idea is to create/destroy named malloc heaps dynamically, and allow user to request memory from them. You may then
mmap()whatever you want and create a malloc heap out of it.Does that sound reasonable?
Hi Anatoly,
We have a solution right now that requires a kernel driver to allocate large contiguous memory and the DPDK changes in the patch. We would like to come to a common upstreamed solution as soon as possible. So please send out the patch as soon as you can and we can test/comment on it. I would hope this is a simple addition and shouldn't take long to come to an acceptable implementation. We need this change for DPDK to operate on our devices.
Thanks,
Scott
Hi Anatoly,
Quoted 12 lines · Anatoly
Quoted 4 lines · Scott Branden
Hi Anatoly,
We'd appreciate your input so we can come to a solution of supporting the necessary memory allocations?
Hi Scott,
I'm currently starting to work on a prototype that will be at least RFC'd (if not v1'd) during 18.08 timeframe. Basically, the idea is to create/destroy named malloc heaps dynamically, and allow user to request memory from them. You may then
mmap()whatever you want and create a malloc heap out of it.Does that sound reasonable?
Is the plan still to have a patch for 18.08?
Thanks,
Scott
Quoted 12 lines · Scott Branden
Hi Anatoly,
Quoted 8 lines · Anatoly
Quoted 4 lines · Scott Branden
Hi Anatoly,
We'd appreciate your input so we can come to a solution of supporting the necessary memory allocations?
Hi Scott,
Quoted 9 lines
Quoted 4 lines
I'm currently starting to work on a prototype that will be at least RFC'd (if not v1'd) during 18.08 timeframe. Basically, the idea is to create/destroy named malloc heaps dynamically, and allow user to request memory from them. You may then
mmap()whatever you want and create a malloc heap out of it.Does that sound reasonable?
Is the plan still to have a patch for 18.08?
Thanks,
Scott
Hi Scott,
The plan is still to submit an RFC during 18.08 timeframe, but since it will be an ABI break, it will only be integrated in the next (18.11) release.
Signature · 2 lines
Thanks, Anatoly
Quoted 17 lines · Anatoly
Quoted 16 lines · Scott Branden
Hi Anatoly,
Quoted 12 lines · Anatoly
Quoted 4 lines · Scott Branden
Hi Anatoly,
We'd appreciate your input so we can come to a solution of supporting the necessary memory allocations?
Hi Scott,
I'm currently starting to work on a prototype that will be at least RFC'd (if not v1'd) during 18.08 timeframe. Basically, the idea is to create/destroy named malloc heaps dynamically, and allow user to request memory from them. You may then
mmap()whatever you want and create a malloc heap out of it.Does that sound reasonable?
Quoted 9 lines
Quoted 5 lines
Is the plan still to have a patch for 18.08?
Thanks,
ScottHi Scott,
The plan is still to submit an RFC during 18.08 timeframe, but since it will be an ABI break, it will only be integrated in the next (18.11) release.
Hi Scott,
You're welcome to offer feedback on the proposal :)
http://patches.dpdk.org/project/dpdk/list/?series=453
Signature · 2 lines
Thanks, Anatoly
Hi Anatoly,
Thank you for your inputs.
We will port all your patches to our platform and update you.
Regards,
Srinath.
Quoted 47 lines · Anatoly
Quoted 28 lines · Anatoly
Quoted 26 lines · Scott Branden
Hi Anatoly,
Quoted 11 lines · Anatoly
Quoted 6 lines · Scott Branden
Hi Anatoly,
We'd appreciate your input so we can come to a solution of supporting the necessary memory allocations?
Hi Scott,
Quoted 8 lines
I'm currently starting to work on a prototype that will be at least RFC'd (if not v1'd) during 18.08 timeframe. Basically, the idea is to create/destroy named malloc heaps dynamically, and allow user to request memory from them. You may then
mmap()whatever you want and create a malloc heap out of it.Does that sound reasonable?
Is the plan still to have a patch for 18.08?
Quoted 9 lines
Quoted 3 lines
Thanks,
ScottHi Scott,
The plan is still to submit an RFC during 18.08 timeframe, but since it will be an ABI break, it will only be integrated in the next (18.11) release.
Hi Scott,
You're welcome to offer feedback on the proposal :)
http://patches.dpdk.org/project/dpdk/list/?series=453
--
Thanks,
Anatoly
Quoted 25 lines · Anatoly
Quoted 24 lines · Anatoly
Quoted 12 lines · Scott Branden
Hi Anatoly,
Quoted 8 lines · Anatoly
Quoted 4 lines · Scott Branden
Hi Anatoly,
We'd appreciate your input so we can come to a solution of supporting the necessary memory allocations?
Hi Scott,
Quoted 9 lines
Quoted 4 lines
I'm currently starting to work on a prototype that will be at least RFC'd (if not v1'd) during 18.08 timeframe. Basically, the idea is to create/destroy named malloc heaps dynamically, and allow user to request memory from them. You may then
mmap()whatever you want and create a malloc heap out of it.Does that sound reasonable?
Is the plan still to have a patch for 18.08?
Thanks,
ScottHi Scott,
Quoted 7 lines
Quoted 2 lines
The plan is still to submit an RFC during 18.08 timeframe, but since it will be an ABI break, it will only be integrated in the next (18.11) release.
Hi Scott,
You're welcome to offer feedback on the proposal :)
Thanks, Srinath is looking into it.
Scott