[v3] eal: fix prompt info when remap_segment failed

Message ID 20230704121751.92253-1-changfengnan@bytedance.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v3] eal: fix prompt info when remap_segment failed |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS

Commit Message

Fengnan Chang July 4, 2023, 12:17 p.m. UTC
  When there is not enough space to memsegs, we should prompt
which configuration should be modified instead of printing
some numbers.

Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
---
 lib/eal/common/eal_common_dynmem.c |  6 ++----
 lib/eal/freebsd/eal_memory.c       |  8 +++-----
 lib/eal/linux/eal_memory.c         | 11 ++++-------
 3 files changed, 9 insertions(+), 16 deletions(-)
  

Comments

Anatoly Burakov July 4, 2023, 12:43 p.m. UTC | #1
On 7/4/2023 1:17 PM, Fengnan Chang wrote:
> When there is not enough space to memsegs, we should prompt
> which configuration should be modified instead of printing
> some numbers.
> 
> Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
  
fengchengwen July 5, 2023, 1:33 a.m. UTC | #2
This is bugfix, suggest add Cc.

With above add, Acked-by: Chengwen Feng <fengchengwen@huawei.com>

On 2023/7/4 20:17, Fengnan Chang wrote:
> When there is not enough space to memsegs, we should prompt
> which configuration should be modified instead of printing
> some numbers.
> 
> Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
> ---
>  lib/eal/common/eal_common_dynmem.c |  6 ++----
>  lib/eal/freebsd/eal_memory.c       |  8 +++-----
>  lib/eal/linux/eal_memory.c         | 11 ++++-------
>  3 files changed, 9 insertions(+), 16 deletions(-)
> 

...
  
Thomas Monjalon July 6, 2023, 2:16 p.m. UTC | #3
05/07/2023 03:33, fengchengwen:
> This is bugfix, suggest add Cc.
> 
> With above add, Acked-by: Chengwen Feng <fengchengwen@huawei.com>
> 
> On 2023/7/4 20:17, Fengnan Chang wrote:
> > When there is not enough space to memsegs, we should prompt
> > which configuration should be modified instead of printing
> > some numbers.
> > 
> > Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>

Applied with
    Fixes: dd61b34d580b ("mem: error if requesting more segments than MAX_MEMSEG")
    Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")
    Cc: stable@dpdk.org
  

Patch

diff --git a/lib/eal/common/eal_common_dynmem.c b/lib/eal/common/eal_common_dynmem.c
index 52e52e5986..bdbbe233a0 100644
--- a/lib/eal/common/eal_common_dynmem.c
+++ b/lib/eal/common/eal_common_dynmem.c
@@ -120,8 +120,7 @@  eal_dynmem_memseg_lists_init(void)
 	max_seglists_per_type = RTE_MAX_MEMSEG_LISTS / n_memtypes;
 
 	if (max_seglists_per_type == 0) {
-		RTE_LOG(ERR, EAL, "Cannot accommodate all memory types, please increase %s\n",
-			RTE_STR(RTE_MAX_MEMSEG_LISTS));
+		RTE_LOG(ERR, EAL, "Cannot accommodate all memory types, please increase RTE_MAX_MEMSEG_LISTS\n");
 		goto out;
 	}
 
@@ -180,8 +179,7 @@  eal_dynmem_memseg_lists_init(void)
 		for (cur_seglist = 0; cur_seglist < n_seglists; cur_seglist++) {
 			if (msl_idx >= RTE_MAX_MEMSEG_LISTS) {
 				RTE_LOG(ERR, EAL,
-					"No more space in memseg lists, please increase %s\n",
-					RTE_STR(RTE_MAX_MEMSEG_LISTS));
+					"No more space in memseg lists, please increase RTE_MAX_MEMSEG_LISTS\n");
 				goto out;
 			}
 			msl = &mcfg->memsegs[msl_idx++];
diff --git a/lib/eal/freebsd/eal_memory.c b/lib/eal/freebsd/eal_memory.c
index 17ab10e0ca..5c6165c580 100644
--- a/lib/eal/freebsd/eal_memory.c
+++ b/lib/eal/freebsd/eal_memory.c
@@ -172,9 +172,8 @@  rte_eal_hugepage_init(void)
 				break;
 			}
 			if (msl_idx == RTE_MAX_MEMSEG_LISTS) {
-				RTE_LOG(ERR, EAL, "Could not find space for memseg. Please increase %s and/or %s in configuration.\n",
-					RTE_STR(RTE_MAX_MEMSEG_PER_TYPE),
-					RTE_STR(RTE_MAX_MEM_MB_PER_TYPE));
+				RTE_LOG(ERR, EAL, "Could not find space for memseg. Please increase RTE_MAX_MEMSEG_PER_LIST "
+					"RTE_MAX_MEMSEG_PER_TYPE and/or RTE_MAX_MEM_MB_PER_TYPE in configuration.\n");
 				return -1;
 			}
 			arr = &msl->memseg_arr;
@@ -404,8 +403,7 @@  memseg_primary_init(void)
 
 			if (msl_idx >= RTE_MAX_MEMSEG_LISTS) {
 				RTE_LOG(ERR, EAL,
-					"No more space in memseg lists, please increase %s\n",
-					RTE_STR(RTE_MAX_MEMSEG_LISTS));
+					"No more space in memseg lists, please increase RTE_MAX_MEMSEG_LISTS\n");
 				return -1;
 			}
 
diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c
index 0876974631..9b6f08fba8 100644
--- a/lib/eal/linux/eal_memory.c
+++ b/lib/eal/linux/eal_memory.c
@@ -716,9 +716,8 @@  remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
 		break;
 	}
 	if (msl_idx == RTE_MAX_MEMSEG_LISTS) {
-		RTE_LOG(ERR, EAL, "Could not find space for memseg. Please increase %s and/or %s in configuration.\n",
-				RTE_STR(RTE_MAX_MEMSEG_PER_TYPE),
-				RTE_STR(RTE_MAX_MEM_MB_PER_TYPE));
+		RTE_LOG(ERR, EAL, "Could not find space for memseg. Please increase RTE_MAX_MEMSEG_PER_LIST "
+			"RTE_MAX_MEMSEG_PER_TYPE and/or RTE_MAX_MEM_MB_PER_TYPE in configuration.\n");
 		return -1;
 	}
 
@@ -966,8 +965,7 @@  prealloc_segments(struct hugepage_file *hugepages, int n_pages)
 				break;
 			}
 			if (msl_idx == RTE_MAX_MEMSEG_LISTS) {
-				RTE_LOG(ERR, EAL, "Not enough space in memseg lists, please increase %s\n",
-					RTE_STR(RTE_MAX_MEMSEG_LISTS));
+				RTE_LOG(ERR, EAL, "Not enough space in memseg lists, please increase RTE_MAX_MEMSEG_LISTS\n");
 				return -1;
 			}
 
@@ -1833,8 +1831,7 @@  memseg_primary_init_32(void)
 
 				if (msl_idx >= RTE_MAX_MEMSEG_LISTS) {
 					RTE_LOG(ERR, EAL,
-						"No more space in memseg lists, please increase %s\n",
-						RTE_STR(RTE_MAX_MEMSEG_LISTS));
+						"No more space in memseg lists, please increase RTE_MAX_MEMSEG_LISTS\n");
 					return -1;
 				}