Hi Jerin,<br>I will fix the issues.<br><br>Thanks.<br>Gaoxiang.<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<br><br><br><div class="ntes-mailmaster-quote" style="padding-top: 1px; padding-bottom: 1px">
<div style=" margin-top: 2em; margin-bottom: 1em; font-size: 14px; line-height: 1.25; color: #78787a; ">---- 回复的原邮件 ----</div>
<div style=" margin-bottom: 1em; font-size: 12px; line-height: 1.25; color: #232324; padding: 0.5em 0.25em; border-radius: 0.67em; background-color: #f0f0f0; ">
<table width="100%" cellpadding="0" cellspacing="9" border="0">
<tr>
<td valign="top" style=" width: 4.25em; font-size: 12px; line-height: 1.25; color: #78787a; ">
发件人
</td>
<td valign="top" style=" font-size: 12px; line-height: 1.25; color: #232324; word-break: break-all; ">
<a class="mail-from" style="text-decoration:none;color:#0886e8;" href="mailto:jerinjacobk@gmail.com">Jerin Jacob<jerinjacobk@gmail.com></a>
</td>
</tr>
<tr>
<td valign="top" style=" width: 4.25em; font-size: 12px; line-height: 1.25; color: #78787a; ">
日期
</td>
<td class="mail-date" valign="top" style=" font-size: 12px; line-height: 1.25; color: #232324; word-break: break-all; ">
2021年12月14日 20:08
</td>
</tr>
<tr style="">
<td valign="top" style=" width: 4.25em; font-size: 12px; line-height: 1.25; color: #78787a; ">
收件人
</td>
<td valign="top" style=" font-size: 12px; line-height: 1.25; color: #232324; word-break: break-all; ">
<a class="mail-to" style="text-decoration:none;color:#0886e8;" href="mailto:gaoxiangliu0@163.com">Gaoxiang Liu<gaoxiangliu0@163.com></a>
</td>
</tr>
<tr style="">
<td valign="top" style=" width: 4.25em; font-size: 12px; line-height: 1.25; color: #78787a; ">
抄送至
</td>
<td valign="top" style=" font-size: 12px; line-height: 1.25; color: #232324; word-break: break-all; ">
<a class="mail-cc" style="text-decoration:none;color:#0886e8;" href="mailto:dev@dpdk.org">dpdk-dev<dev@dpdk.org></a>、<a class="mail-cc" style="text-decoration:none;color:#0886e8;" href="mailto:anatoly.burakov@intel.com">Anatoly Burakov<anatoly.burakov@intel.com></a>、<a class="mail-cc" style="text-decoration:none;color:#0886e8;" href="mailto:liugaoxiang@huawei.com">liugaoxiang@huawei.com<liugaoxiang@huawei.com></a>、<a class="mail-cc" style="text-decoration:none;color:#0886e8;" href="mailto:stable@dpdk.org">dpdk stable<stable@dpdk.org></a>
</td>
</tr>
<tr>
<td valign="top" style=" width: 4.25em; font-size: 12px; line-height: 1.25; color: #78787a; ">
主题
</td>
<td class="mail-subject" valign="top" style=" font-size: 12px; line-height: 1.25; color: #232324; word-break: break-all; ">
Re: [PATCH] mem: exclude used memory from core dump by config
</td>
</tr>
</table>
</div>
<div>On Tue, Dec 14, 2021 at 5:12 PM Gaoxiang Liu <gaoxiangliu0@163.com> wrote:
<br>>
<br>> Some DPDK application is allolcateed storage partition of 8G(or smaller)
<br>
<br>allocated
<br>
<br>> If coredump happens, the application doesn't work because of
<br>> insufficient storage space.
<br>> The patch provides a config that means whether the huge used memory
<br>> needs to be not dumped in core dump.
<br>> The DPDK application can choose to open it according to the actual
<br>> situation.
<br>>
<br>> Fixes: d72e4042c5eb ("mem: exclude unused memory from core dump")
<br>> Cc: stable@dpdk.org
<br>
<br>Probably subject can be changed to: eal: allow to exclude memseg from core dump
<br>
<br>>
<br>> Signed-off-by: Gaoxiang Liu <liugaoxiang@huawei.com>
<br>> ---
<br>> lib/eal/common/eal_internal_cfg.h | 1 +
<br>> lib/eal/common/eal_options.h | 3 ++-
<br>> lib/eal/linux/eal.c | 3 +++
<br>> lib/eal/linux/eal_memalloc.c | 10 ++++++++++
<br>
<br>freebsd support can be updated,
<br>Please update doc/guides/linux_gsg/linux_eal_parameters.rst and
<br>doc/guides/freebsd_gsg/freebsd_eal_parameters.rst.
<br>
<br>
<br>> 4 files changed, 16 insertions(+), 1 deletion(-)
<br>>
<br>> diff --git a/lib/eal/common/eal_internal_cfg.h b/lib/eal/common/eal_internal_cfg.h
<br>> index d6c0470eb8..f9cd300f86 100644
<br>> --- a/lib/eal/common/eal_internal_cfg.h
<br>> +++ b/lib/eal/common/eal_internal_cfg.h
<br>> @@ -87,6 +87,7 @@ struct internal_config {
<br>> /**< user defined mbuf pool ops name */
<br>> unsigned num_hugepage_sizes; /**< how many sizes on this system */
<br>> struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES];
<br>> + volatile unsigned huge_dont_dump_flag;
<br>
<br>Volatile may not be needed. it can be changed to bool as well.
<br>
<br>
<br>> enum rte_iova_mode iova_mode ; /**< Set IOVA mode on this system */
<br>> rte_cpuset_t ctrl_cpuset; /**< cpuset for ctrl threads */
<br>> volatile unsigned int init_complete;
<br>> diff --git a/lib/eal/common/eal_options.h b/lib/eal/common/eal_options.h
<br>> index 8e4f7202a2..6b9a24f0f9 100644
<br>> --- a/lib/eal/common/eal_options.h
<br>> +++ b/lib/eal/common/eal_options.h
<br>> @@ -87,7 +87,8 @@ enum {
<br>> OPT_NO_TELEMETRY_NUM,
<br>> #define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth"
<br>> OPT_FORCE_MAX_SIMD_BITWIDTH_NUM,
<br>> -
<br>> +#define OPT_HUGE_DONT_DUMP "huge-dont-dump"
<br>> + OPT_HUGE_DONT_DUMP_NUM,
<br>> OPT_LONG_MAX_NUM
<br>> };
<br>>
<br>> diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
<br>> index 60b4924838..eeab5e4f3d 100644
<br>> --- a/lib/eal/linux/eal.c
<br>> +++ b/lib/eal/linux/eal.c
<br>> @@ -816,6 +816,9 @@ eal_parse_args(int argc, char **argv)
<br>> case OPT_MATCH_ALLOCATIONS_NUM:
<br>> internal_conf->match_allocations = 1;
<br>> break;
<br>> + case OPT_HUGE_DONT_DUMP_NUM:
<br>> + internal_config->huge_dont_dump_flag = 1;
<br>> + break;
<br>>
<br>> default:
<br>> if (opt < OPT_LONG_MIN_NUM && isprint(opt)) {
<br>> diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
<br>> index 337f2bc739..13ca1cf58c 100644
<br>> --- a/lib/eal/linux/eal_memalloc.c
<br>> +++ b/lib/eal/linux/eal_memalloc.c
<br>> @@ -663,6 +663,16 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
<br>> ms->iova = iova;
<br>> ms->socket_id = socket_id;
<br>>
<br>> + if (internal_config->huge_dont_dump_flag) {
<br>> + if (madvise(addr, alloc_sz, EAL_DONTDUMP)) {
<br>> + RTE_LOG(INFO, EAL, "madvise(%p, %#zx, %d) failed: %s\n",
<br>> + virt, size, flags, strerror(rte_errno));
<br>> + } else {
<br>> + RTE_LOG(INFO, EAL, "%s(): madvise(MADV_DONTDUMP) memory success.(len=%zu)\n",
<br>> + __func__, alloc_sz);
<br>> + }
<br>
<br>I think, you can use eal_mem_set_dump()
<br>
<br>> + }
<br>> +
<br>> return 0;
<br>>
<br>> mapped:
<br>> --
<br>> 2.32.0
<br>>
<br>>
<br></div>
</div>
</body>
</html>