Skip to contentSkip to conversation

eal: warn on --no-huge allocation requirement

PATCH In review Thomas Monjalon 2 participants 10 messages Jul 18, 2019 – Aug 5, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal: warn on --no-huge allocation requirement

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.

---
 lib/librte_eal/common/eal_common_options.c | 4 ++++
 1 file changed, 4 insertions(+)
lib/librte_eal/common/eal_common_options.c +4 -0
index 512d5088e..4a76929ea 100644
@@ -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");
Signature · 1 line
2.21.0
#1 lore raw
Quoted 15 lines · 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.

---
  lib/librte_eal/common/eal_common_options.c | 4 ++++
  1 file changed, 4 insertions(+)
lib/librte_eal/common/eal_common_options.c +0 -0
index 512d5088e..4a76929ea 100644

lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1556

Quoted 6 lines
lib/librte_eal/common/eal_common_options.c +3 -0
@@ -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.

Quoted 5 lines
lib/librte_eal/common/eal_common_options.c +1 -0
+	}
  	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");
Signature · 2 lines
Thanks,
Anatoly
#2 lore raw

18/07/2019 12:18, Burakov, Anatoly:

Quoted 27 lines · Thomas Monjalon
Quoted 15 lines

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.

---
  lib/librte_eal/common/eal_common_options.c | 4 ++++
  1 file changed, 4 insertions(+)
lib/librte_eal/common/eal_common_options.c +0 -0
index 512d5088e..4a76929ea 100644

lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1556

Quoted 6 lines
lib/librte_eal/common/eal_common_options.c +3 -0
@@ -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:

Quoted 5 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 :)

#3 lore raw
Quoted 32 lines · Thomas Monjalon

18/07/2019 12:18, Burakov, Anatoly:

Quoted 31 lines · Thomas Monjalon
Quoted 15 lines

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.

---
   lib/librte_eal/common/eal_common_options.c | 4 ++++
   1 file changed, 4 insertions(+)
lib/librte_eal/common/eal_common_options.c +0 -0
index 512d5088e..4a76929ea 100644

lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1556

Quoted 6 lines
lib/librte_eal/common/eal_common_options.c +3 -0
@@ -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."

Quoted 8 lines
Quoted 1 line

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 :)

Signature · 2 lines
Thanks,
Anatoly
#4 lore raw

PATCH v2 1/1 eal: warn on legacy memory allocation requirement

In reply to 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.

---
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(+)
lib/librte_eal/common/eal_common_options.c +4 -0
index 24e36cf23..5e489041a 100644
@@ -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;
 }
Signature · 1 line
2.21.0
#5 lore raw

Re: [dpdk-dev] [PATCH v2] eal: warn on legacy memory allocation requirement

22/07/2019 18:55, Thomas Monjalon:

Quoted 13 lines

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.

---
v2:
- user-oriented message
- trigger warning on any legacy mem option
---

lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1597

Quoted 3 lines
lib/librte_eal/common/eal_common_options.c +3 -0
+	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"

#6 lore raw

Re: [dpdk-dev] [PATCH v2] eal: warn on legacy memory allocation requirement

Quoted 20 lines · Thomas Monjalon

22/07/2019 18:55, Thomas Monjalon:

Quoted 13 lines

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.

---
v2:
- user-oriented message
- trigger warning on any legacy mem option
---

lib/librte_eal/common/eal_common_options.c eal_check_common_options(struct internal_config *internal_cfg) · line 1597

Quoted 3 lines
lib/librte_eal/common/eal_common_options.c +3 -0
+	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:

Quoted 3 lines

"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.

Signature · 2 lines
Thanks,
Anatoly
#7 lore raw

PATCH v3 1/1 eal: warn on legacy memory allocation requirement

In reply to 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.

The option --socket-mem can also be used with --legacy-mem when hugepages are supported.

---
v3:
- replace "allocation" with "amount of reserved memory"
- add --socket-mem
- more rewording
v2:
- user-oriented message
- trigger warning on any legacy mem option

---
 lib/librte_eal/common/eal_common_options.c | 5 +++++
 1 file changed, 5 insertions(+)
lib/librte_eal/common/eal_common_options.c +5 -0
index 512d5088e..ab0b6082b 100644
@@ -1589,6 +1589,11 @@ 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, "Static memory layout is selected, "
+			"amount of reserved memory can be adjusted with "
+			"-m or --"OPT_SOCKET_MEM"\n");
+	}
 
 	return 0;
 }
Signature · 1 line
2.21.0
Acked-by on v3 1/1
#8 lore raw

Re: [dpdk-dev] [PATCH v3] eal: warn on legacy memory allocation requirement

Quoted 9 lines · 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.

The option --socket-mem can also be used with --legacy-mem when hugepages are supported.

Quoted 9 lines

---
v3:
- replace "allocation" with "amount of reserved memory"
- add --socket-mem
- more rewording
v2:
- user-oriented message
- trigger warning on any legacy mem option
---

Signature · 2 lines
Thanks,
Anatoly
author Applied
#9 lore raw

Re: [dpdk-dev] [PATCH v3] eal: warn on legacy memory allocation requirement

31/07/2019 11:15, Burakov, Anatoly:

Quoted 6 lines · Thomas Monjalon
Quoted 5 lines

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.

Quoted 6 lines
Quoted 4 lines

The option --socket-mem can also be used with --legacy-mem when hugepages are supported.

Applied