[v2] mem: store memory mode flags in shared config

Message ID df103a747e256eabdbdc30b3eb8abdf468252d0e.1537457926.git.anatoly.burakov@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] mem: store memory mode flags in shared config |

Checks

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

Commit Message

Anatoly Burakov Sept. 20, 2018, 3:41 p.m. UTC
  Currently, command-line switches for legacy mem mode or single-file
segments mode are only stored in internal config. This leads to a
situation where these flags have to always match between primary
and secondary, which is bad for usability.

Fix this by storing these flags in the shared config as well, so
that secondary process can know if the primary was launched in
single-file segments or legacy mem mode.

This bumps the EAL ABI, however there's an EAL deprecation notice
already in place[1] for a different feature, so that's OK.

[1] http://patches.dpdk.org/patch/43502/

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---

Notes:
    v2:
    - Added documentation on ABI break

 doc/guides/rel_notes/rel_description.rst      |  5 +++++
 doc/guides/rel_notes/release_18_11.rst        |  6 +++++-
 .../common/include/rte_eal_memconfig.h        |  4 ++++
 lib/librte_eal/linuxapp/eal/Makefile          |  2 +-
 lib/librte_eal/linuxapp/eal/eal.c             | 20 +++++++++++++++++++
 lib/librte_eal/meson.build                    |  2 +-
 6 files changed, 36 insertions(+), 3 deletions(-)
  

Comments

Thomas Monjalon Oct. 3, 2018, 10:05 p.m. UTC | #1
20/09/2018 17:41, Anatoly Burakov:
> Currently, command-line switches for legacy mem mode or single-file
> segments mode are only stored in internal config. This leads to a
> situation where these flags have to always match between primary
> and secondary, which is bad for usability.
> 
> Fix this by storing these flags in the shared config as well, so
> that secondary process can know if the primary was launched in
> single-file segments or legacy mem mode.
> 
> This bumps the EAL ABI, however there's an EAL deprecation notice
> already in place[1] for a different feature, so that's OK.
> 
> [1] http://patches.dpdk.org/patch/43502/
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
> 
> Notes:
>     v2:
>     - Added documentation on ABI break
> 
>  doc/guides/rel_notes/rel_description.rst      |  5 +++++

Removed change in this file (dup of release note).

>  doc/guides/rel_notes/release_18_11.rst        |  6 +++++-
>  .../common/include/rte_eal_memconfig.h        |  4 ++++
>  lib/librte_eal/linuxapp/eal/Makefile          |  2 +-
>  lib/librte_eal/linuxapp/eal/eal.c             | 20 +++++++++++++++++++
>  lib/librte_eal/meson.build                    |  2 +-
>  6 files changed, 36 insertions(+), 3 deletions(-)

Applied (without extra note), thanks.
  
Anatoly Burakov Oct. 4, 2018, 9:17 a.m. UTC | #2
On 03-Oct-18 11:05 PM, Thomas Monjalon wrote:
> 20/09/2018 17:41, Anatoly Burakov:
>> Currently, command-line switches for legacy mem mode or single-file
>> segments mode are only stored in internal config. This leads to a
>> situation where these flags have to always match between primary
>> and secondary, which is bad for usability.
>>
>> Fix this by storing these flags in the shared config as well, so
>> that secondary process can know if the primary was launched in
>> single-file segments or legacy mem mode.
>>
>> This bumps the EAL ABI, however there's an EAL deprecation notice
>> already in place[1] for a different feature, so that's OK.
>>
>> [1] http://patches.dpdk.org/patch/43502/
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>> ---
>>
>> Notes:
>>      v2:
>>      - Added documentation on ABI break
>>
>>   doc/guides/rel_notes/rel_description.rst      |  5 +++++
> 
> Removed change in this file (dup of release note).
> 
>>   doc/guides/rel_notes/release_18_11.rst        |  6 +++++-
>>   .../common/include/rte_eal_memconfig.h        |  4 ++++
>>   lib/librte_eal/linuxapp/eal/Makefile          |  2 +-
>>   lib/librte_eal/linuxapp/eal/eal.c             | 20 +++++++++++++++++++
>>   lib/librte_eal/meson.build                    |  2 +-
>>   6 files changed, 36 insertions(+), 3 deletions(-)
> 
> Applied (without extra note), thanks.
> 

This will probably break external mem patches due to conflict in release 
notes. Should i respin?
  
Thomas Monjalon Oct. 4, 2018, 9:18 a.m. UTC | #3
04/10/2018 11:17, Burakov, Anatoly:
> On 03-Oct-18 11:05 PM, Thomas Monjalon wrote:
> > 20/09/2018 17:41, Anatoly Burakov:
> >> Currently, command-line switches for legacy mem mode or single-file
> >> segments mode are only stored in internal config. This leads to a
> >> situation where these flags have to always match between primary
> >> and secondary, which is bad for usability.
> >>
> >> Fix this by storing these flags in the shared config as well, so
> >> that secondary process can know if the primary was launched in
> >> single-file segments or legacy mem mode.
> >>
> >> This bumps the EAL ABI, however there's an EAL deprecation notice
> >> already in place[1] for a different feature, so that's OK.
> >>
> >> [1] http://patches.dpdk.org/patch/43502/
> >>
> >> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> >> ---
> >>
> >> Notes:
> >>      v2:
> >>      - Added documentation on ABI break
> >>
> >>   doc/guides/rel_notes/rel_description.rst      |  5 +++++
> > 
> > Removed change in this file (dup of release note).
> > 
> >>   doc/guides/rel_notes/release_18_11.rst        |  6 +++++-
> >>   .../common/include/rte_eal_memconfig.h        |  4 ++++
> >>   lib/librte_eal/linuxapp/eal/Makefile          |  2 +-
> >>   lib/librte_eal/linuxapp/eal/eal.c             | 20 +++++++++++++++++++
> >>   lib/librte_eal/meson.build                    |  2 +-
> >>   6 files changed, 36 insertions(+), 3 deletions(-)
> > 
> > Applied (without extra note), thanks.
> > 
> 
> This will probably break external mem patches due to conflict in release 
> notes. Should i respin?

No, conflicts in release notes are usual. I manage such conflict myself.
  
Ferruh Yigit Oct. 4, 2018, 10:46 a.m. UTC | #4
On 10/4/2018 10:18 AM, Thomas Monjalon wrote:
> 04/10/2018 11:17, Burakov, Anatoly:
>> On 03-Oct-18 11:05 PM, Thomas Monjalon wrote:
>>> 20/09/2018 17:41, Anatoly Burakov:
>>>> Currently, command-line switches for legacy mem mode or single-file
>>>> segments mode are only stored in internal config. This leads to a
>>>> situation where these flags have to always match between primary
>>>> and secondary, which is bad for usability.
>>>>
>>>> Fix this by storing these flags in the shared config as well, so
>>>> that secondary process can know if the primary was launched in
>>>> single-file segments or legacy mem mode.
>>>>
>>>> This bumps the EAL ABI, however there's an EAL deprecation notice
>>>> already in place[1] for a different feature, so that's OK.
>>>>
>>>> [1] http://patches.dpdk.org/patch/43502/
>>>>
>>>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>>>> ---
>>>>
>>>> Notes:
>>>>      v2:
>>>>      - Added documentation on ABI break
>>>>
>>>>   doc/guides/rel_notes/rel_description.rst      |  5 +++++
>>>
>>> Removed change in this file (dup of release note).
>>>
>>>>   doc/guides/rel_notes/release_18_11.rst        |  6 +++++-
>>>>   .../common/include/rte_eal_memconfig.h        |  4 ++++
>>>>   lib/librte_eal/linuxapp/eal/Makefile          |  2 +-
>>>>   lib/librte_eal/linuxapp/eal/eal.c             | 20 +++++++++++++++++++
>>>>   lib/librte_eal/meson.build                    |  2 +-
>>>>   6 files changed, 36 insertions(+), 3 deletions(-)
>>>
>>> Applied (without extra note), thanks.
>>>
>>
>> This will probably break external mem patches due to conflict in release 
>> notes. Should i respin?
> 
> No, conflicts in release notes are usual. I manage such conflict myself.

It is common to have conflict in release notes and as Thomas said we resolve it
manually but now this is causing problem in automated per patch tests because
patch can't be applied.

We should think about a way to prevent these conflicts.
  
Anatoly Burakov Oct. 5, 2018, 9:04 a.m. UTC | #5
On 04-Oct-18 11:46 AM, Ferruh Yigit wrote:
> On 10/4/2018 10:18 AM, Thomas Monjalon wrote:
>> 04/10/2018 11:17, Burakov, Anatoly:
>>> On 03-Oct-18 11:05 PM, Thomas Monjalon wrote:
>>>> 20/09/2018 17:41, Anatoly Burakov:
>>>>> Currently, command-line switches for legacy mem mode or single-file
>>>>> segments mode are only stored in internal config. This leads to a
>>>>> situation where these flags have to always match between primary
>>>>> and secondary, which is bad for usability.
>>>>>
>>>>> Fix this by storing these flags in the shared config as well, so
>>>>> that secondary process can know if the primary was launched in
>>>>> single-file segments or legacy mem mode.
>>>>>
>>>>> This bumps the EAL ABI, however there's an EAL deprecation notice
>>>>> already in place[1] for a different feature, so that's OK.
>>>>>
>>>>> [1] http://patches.dpdk.org/patch/43502/
>>>>>
>>>>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>>>>> ---
>>>>>
>>>>> Notes:
>>>>>       v2:
>>>>>       - Added documentation on ABI break
>>>>>
>>>>>    doc/guides/rel_notes/rel_description.rst      |  5 +++++
>>>>
>>>> Removed change in this file (dup of release note).
>>>>
>>>>>    doc/guides/rel_notes/release_18_11.rst        |  6 +++++-
>>>>>    .../common/include/rte_eal_memconfig.h        |  4 ++++
>>>>>    lib/librte_eal/linuxapp/eal/Makefile          |  2 +-
>>>>>    lib/librte_eal/linuxapp/eal/eal.c             | 20 +++++++++++++++++++
>>>>>    lib/librte_eal/meson.build                    |  2 +-
>>>>>    6 files changed, 36 insertions(+), 3 deletions(-)
>>>>
>>>> Applied (without extra note), thanks.
>>>>
>>>
>>> This will probably break external mem patches due to conflict in release
>>> notes. Should i respin?
>>
>> No, conflicts in release notes are usual. I manage such conflict myself.
> 
> It is common to have conflict in release notes and as Thomas said we resolve it
> manually but now this is causing problem in automated per patch tests because
> patch can't be applied.
> 
> We should think about a way to prevent these conflicts.
> 

How about just ignore them? 'git status' will show you which particular 
files cause conflicts. if it's anything in the doc/ directory, it's safe 
to 'git add' those files and proceed with rebase/apply, no?
  

Patch

diff --git a/doc/guides/rel_notes/rel_description.rst b/doc/guides/rel_notes/rel_description.rst
index 8f285566f..3fd289939 100644
--- a/doc/guides/rel_notes/rel_description.rst
+++ b/doc/guides/rel_notes/rel_description.rst
@@ -10,3 +10,8 @@  release version |release| and previous releases.
 It lists new features, fixed bugs, API and ABI changes and known issues.
 
 For instructions on compiling and running the release, see the :ref:`DPDK Getting Started Guide <linux_gsg>`.
+
+* eal: new ABI version for EAL library due to adding ``legacy_mem`` and
+       ``single_file_segments`` values to ``rte_config`` structure on account of
+       improving DPDK usability when using either ``--legacy-mem`` or
+       ``--single-file-segments`` flags.
diff --git a/doc/guides/rel_notes/release_18_11.rst b/doc/guides/rel_notes/release_18_11.rst
index 3ae6b3f58..34acf01d9 100644
--- a/doc/guides/rel_notes/release_18_11.rst
+++ b/doc/guides/rel_notes/release_18_11.rst
@@ -83,6 +83,10 @@  ABI Changes
    Also, make sure to start the actual text at the margin.
    =========================================================
 
+* eal: added ``legacy_mem`` and ``single_file_segments`` values to
+       ``rte_config`` structure on account of improving DPDK usability when
+       using either ``--legacy-mem`` or ``--single-file-segments`` flags.
+
 
 Removed Items
 -------------
@@ -129,7 +133,7 @@  The libraries prepended with a plus sign were incremented in this version.
      librte_compressdev.so.1
      librte_cryptodev.so.5
      librte_distributor.so.1
-     librte_eal.so.8
+   + librte_eal.so.9
      librte_ethdev.so.10
      librte_eventdev.so.4
      librte_flow_classify.so.1
diff --git a/lib/librte_eal/common/include/rte_eal_memconfig.h b/lib/librte_eal/common/include/rte_eal_memconfig.h
index aff0688dd..62a21c2dc 100644
--- a/lib/librte_eal/common/include/rte_eal_memconfig.h
+++ b/lib/librte_eal/common/include/rte_eal_memconfig.h
@@ -77,6 +77,10 @@  struct rte_mem_config {
 	 * exact same address the primary process maps it.
 	 */
 	uint64_t mem_cfg_addr;
+
+	/* legacy mem and single file segments options are shared */
+	uint32_t legacy_mem;
+	uint32_t single_file_segments;
 } __attribute__((__packed__));
 
 
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index fd92c75c2..5c16bc40f 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -10,7 +10,7 @@  ARCH_DIR ?= $(RTE_ARCH)
 EXPORT_MAP := ../../rte_eal_version.map
 VPATH += $(RTE_SDK)/lib/librte_eal/common/arch/$(ARCH_DIR)
 
-LIBABIVER := 8
+LIBABIVER := 9
 
 VPATH += $(RTE_SDK)/lib/librte_eal/common
 
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index e59ac6577..4a55d3b69 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -352,6 +352,24 @@  eal_proc_type_detect(void)
 	return ptype;
 }
 
+/* copies data from internal config to shared config */
+static void
+eal_update_mem_config(void)
+{
+	struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
+	mcfg->legacy_mem = internal_config.legacy_mem;
+	mcfg->single_file_segments = internal_config.single_file_segments;
+}
+
+/* copies data from shared config to internal config */
+static void
+eal_update_internal_config(void)
+{
+	struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
+	internal_config.legacy_mem = mcfg->legacy_mem;
+	internal_config.single_file_segments = mcfg->single_file_segments;
+}
+
 /* Sets up rte_config structure with the pointer to shared memory config.*/
 static void
 rte_config_init(void)
@@ -361,11 +379,13 @@  rte_config_init(void)
 	switch (rte_config.process_type){
 	case RTE_PROC_PRIMARY:
 		rte_eal_config_create();
+		eal_update_mem_config();
 		break;
 	case RTE_PROC_SECONDARY:
 		rte_eal_config_attach();
 		rte_eal_mcfg_wait_complete(rte_config.mem_config);
 		rte_eal_config_reattach();
+		eal_update_internal_config();
 		break;
 	case RTE_PROC_AUTO:
 	case RTE_PROC_INVALID:
diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index e1fde15d1..62ef985b9 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -21,7 +21,7 @@  else
 	error('unsupported system type "@0@"'.format(host_machine.system()))
 endif
 
-version = 8  # the version of the EAL API
+version = 9  # the version of the EAL API
 allow_experimental_apis = true
 deps += 'compat'
 deps += 'kvargs'