[v2] eal: warn on legacy memory allocation requirement

Message ID 20190722165505.14745-1-thomas@monjalon.net (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] eal: warn on legacy memory allocation requirement |

Checks

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

Commit Message

Thomas Monjalon July 22, 2019, 4:55 p.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>
---
v2:
	- user-oriented message
	- trigger warning on any legacy mem option
---
 lib/librte_eal/common/eal_common_options.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Thomas Monjalon July 22, 2019, 5:03 p.m. UTC | #1
22/07/2019 18:55, Thomas Monjalon:
> 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>
> ---
> v2:
> 	- user-oriented message
> 	- trigger warning on any legacy mem option
> ---
> --- a/lib/librte_eal/common/eal_common_options.c
> +++ b/lib/librte_eal/common/eal_common_options.c
> +	if (internal_cfg->legacy_mem && internal_cfg->memory == 0) {
> +		RTE_LOG(NOTICE, EAL, "Selected memory layout is static, "
> +			"allocation can be increased with the option -m\n");

Or better:

"Static memory layout is selected, "
"allocation can be increased with the option -m\n"
  
Anatoly Burakov July 23, 2019, 9:10 a.m. UTC | #2
On 22-Jul-19 6:03 PM, Thomas Monjalon wrote:
> 22/07/2019 18:55, Thomas Monjalon:
>> 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>
>> ---
>> v2:
>> 	- user-oriented message
>> 	- trigger warning on any legacy mem option
>> ---
>> --- a/lib/librte_eal/common/eal_common_options.c
>> +++ b/lib/librte_eal/common/eal_common_options.c
>> +	if (internal_cfg->legacy_mem && internal_cfg->memory == 0) {
>> +		RTE_LOG(NOTICE, EAL, "Selected memory layout is static, "
>> +			"allocation can be increased with the option -m\n");
> 
> Or better:
> 
> "Static memory layout is selected,"
> "allocation can be increased with the option -m\n"
> 


Allocation of what? :) Without context, the message makes little sense. 
How about:

"Selected memory layout is static, amount of reserved memory can be 
adjusted with the option -m or --socket-mem".

The slight issue there is, --socket-mem works with legacy mem, but not 
with no-huge. However, i think --socket-mem will produce its own error 
on attempt to use it with --no-huge, so i don't think it's a big deal.
  

Patch

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 24e36cf23..5e489041a 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -1592,6 +1592,10 @@  eal_check_common_options(struct internal_config *internal_cfg)
 				"with --"OPT_MATCH_ALLOCATIONS"\n");
 		return -1;
 	}
+	if (internal_cfg->legacy_mem && internal_cfg->memory == 0) {
+		RTE_LOG(NOTICE, EAL, "Selected memory layout is static, "
+			"allocation can be increased with the option -m\n");
+	}
 
 	return 0;
 }