eal: warn on --no-huge allocation requirement

Message ID 20190718093432.14092-1-thomas@monjalon.net (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series eal: warn on --no-huge allocation requirement |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Thomas Monjalon July 18, 2019, 9:34 a.m. UTC
  When using --no-huge mode, dynamic allocation is not supported.
Because of this limitation, the option --legacy-mem is implied
and -m may be needed to specify the amount of memory to allocate.
Otherwise the default amount MEMSIZE_IF_NO_HUGE_PAGE will be allocated.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/librte_eal/common/eal_common_options.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Burakov, Anatoly July 18, 2019, 10:18 a.m. UTC | #1
On 18-Jul-19 10:34 AM, Thomas Monjalon wrote:
> When using --no-huge mode, dynamic allocation is not supported.
> Because of this limitation, the option --legacy-mem is implied
> and -m may be needed to specify the amount of memory to allocate.
> Otherwise the default amount MEMSIZE_IF_NO_HUGE_PAGE will be allocated.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>   lib/librte_eal/common/eal_common_options.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
> index 512d5088e..4a76929ea 100644
> --- a/lib/librte_eal/common/eal_common_options.c
> +++ b/lib/librte_eal/common/eal_common_options.c
> @@ -1551,6 +1551,10 @@ eal_check_common_options(struct internal_config *internal_cfg)
>   			"be specified at the same time\n");
>   		return -1;
>   	}
> +	if (internal_cfg->no_hugetlbfs && internal_cfg->memory == 0) {
> +		RTE_LOG(NOTICE, EAL, "Option --"OPT_NO_HUGE" uses legacy mode, "
> +			"option -m would override default memory allocation\n");

I think this is too technical and misleading. I don't think user cares 
about legacy vs dynamic mode here. I would rather print out something 
more informative, like, say, something along those lines:

"Option --no-huge was specified in command-line arguments. This mode 
uses static memory layout and will allocate %dMB of memory by default. 
Option '-m' can be used to increase allocated memory amount."

where %d is the amount of memory we're preallocating.

> +	}
>   	if (internal_cfg->no_hugetlbfs && internal_cfg->force_sockets == 1) {
>   		RTE_LOG(ERR, EAL, "Option --"OPT_SOCKET_MEM" cannot "
>   			"be specified together with --"OPT_NO_HUGE"\n");
>
  
Thomas Monjalon July 18, 2019, 10:29 a.m. UTC | #2
18/07/2019 12:18, Burakov, Anatoly:
> On 18-Jul-19 10:34 AM, Thomas Monjalon wrote:
> > When using --no-huge mode, dynamic allocation is not supported.
> > Because of this limitation, the option --legacy-mem is implied
> > and -m may be needed to specify the amount of memory to allocate.
> > Otherwise the default amount MEMSIZE_IF_NO_HUGE_PAGE will be allocated.
> > 
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> >   lib/librte_eal/common/eal_common_options.c | 4 ++++
> >   1 file changed, 4 insertions(+)
> > 
> > diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
> > index 512d5088e..4a76929ea 100644
> > --- a/lib/librte_eal/common/eal_common_options.c
> > +++ b/lib/librte_eal/common/eal_common_options.c
> > @@ -1551,6 +1551,10 @@ eal_check_common_options(struct internal_config *internal_cfg)
> >   			"be specified at the same time\n");
> >   		return -1;
> >   	}
> > +	if (internal_cfg->no_hugetlbfs && internal_cfg->memory == 0) {
> > +		RTE_LOG(NOTICE, EAL, "Option --"OPT_NO_HUGE" uses legacy mode, "
> > +			"option -m would override default memory allocation\n");
> 
> I think this is too technical and misleading. I don't think user cares 
> about legacy vs dynamic mode here. I would rather print out something 
> more informative, like, say, something along those lines:
> 
> "Option --no-huge was specified in command-line arguments. This mode 
> uses static memory layout and will allocate %dMB of memory by default. 
> Option '-m' can be used to increase allocated memory amount."
> 
> where %d is the amount of memory we're preallocating.

%d is defined in eal.c
It requires to move the value in a common .h

I may try something like you suggest in shorter.
A log is supposed to be short :)
  
Burakov, Anatoly July 18, 2019, 10:37 a.m. UTC | #3
On 18-Jul-19 11:29 AM, Thomas Monjalon wrote:
> 18/07/2019 12:18, Burakov, Anatoly:
>> On 18-Jul-19 10:34 AM, Thomas Monjalon wrote:
>>> When using --no-huge mode, dynamic allocation is not supported.
>>> Because of this limitation, the option --legacy-mem is implied
>>> and -m may be needed to specify the amount of memory to allocate.
>>> Otherwise the default amount MEMSIZE_IF_NO_HUGE_PAGE will be allocated.
>>>
>>> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>>> ---
>>>    lib/librte_eal/common/eal_common_options.c | 4 ++++
>>>    1 file changed, 4 insertions(+)
>>>
>>> diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
>>> index 512d5088e..4a76929ea 100644
>>> --- a/lib/librte_eal/common/eal_common_options.c
>>> +++ b/lib/librte_eal/common/eal_common_options.c
>>> @@ -1551,6 +1551,10 @@ eal_check_common_options(struct internal_config *internal_cfg)
>>>    			"be specified at the same time\n");
>>>    		return -1;
>>>    	}
>>> +	if (internal_cfg->no_hugetlbfs && internal_cfg->memory == 0) {
>>> +		RTE_LOG(NOTICE, EAL, "Option --"OPT_NO_HUGE" uses legacy mode, "
>>> +			"option -m would override default memory allocation\n");
>>
>> I think this is too technical and misleading. I don't think user cares
>> about legacy vs dynamic mode here. I would rather print out something
>> more informative, like, say, something along those lines:
>>
>> "Option --no-huge was specified in command-line arguments. This mode
>> uses static memory layout and will allocate %dMB of memory by default.
>> Option '-m' can be used to increase allocated memory amount."
>>
>> where %d is the amount of memory we're preallocating.
> 
> %d is defined in eal.c
> It requires to move the value in a common .h
> 
> I may try something like you suggest in shorter.
> A log is supposed to be short :)
> 

OK, maybe not print the value and make it shorter, but definitely don't 
confuse the user with talk about legacy modes :)
  

Patch

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 512d5088e..4a76929ea 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -1551,6 +1551,10 @@  eal_check_common_options(struct internal_config *internal_cfg)
 			"be specified at the same time\n");
 		return -1;
 	}
+	if (internal_cfg->no_hugetlbfs && internal_cfg->memory == 0) {
+		RTE_LOG(NOTICE, EAL, "Option --"OPT_NO_HUGE" uses legacy mode, "
+			"option -m would override default memory allocation\n");
+	}
 	if (internal_cfg->no_hugetlbfs && internal_cfg->force_sockets == 1) {
 		RTE_LOG(ERR, EAL, "Option --"OPT_SOCKET_MEM" cannot "
 			"be specified together with --"OPT_NO_HUGE"\n");