From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 62F36A00C3; Wed, 15 Dec 2021 13:06:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D499040688; Wed, 15 Dec 2021 13:06:29 +0100 (CET) Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) by mails.dpdk.org (Postfix) with ESMTP id A3FBA40041; Wed, 15 Dec 2021 13:06:28 +0100 (CET) Received: by mail-io1-f44.google.com with SMTP id e128so29703061iof.1; Wed, 15 Dec 2021 04:06:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aWwiK/qmPlAT7MhBq3o8Oe0Vz9sWYWpFwVr5dzUas1Y=; b=DOuhNFluob7OlKjXl+2GJDZIVfCMRUAHMVsbX55EebGJhly6kIkIcN1IV/IFg3lqkC 7reAqo5dk1S/1Oj7VzFCDWYV6okbDRR+IQOUljYZ+7WHNA+HrSNNjHeG0atOLljcRFI7 3PKryRyud33nxV96Ksy4s/Fuzy5rek+/TPm9m6IqR24krqW/PMY7GsbEHvCrFJrXV1Qp 6DGcZlRW5OiLozxrlAVLKCYuziluS87NMg9bZ/81ovdEetu4pZSnQ3GFz9wbmVBQAdXT T+P1b6dwUfjMv+Y9x2+jHmwFqb6YbQS6JPsJiXr0OxerRP0Z5rcV5in8DPzcw2mpdN/a WWfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aWwiK/qmPlAT7MhBq3o8Oe0Vz9sWYWpFwVr5dzUas1Y=; b=kGG+i6mBHEGshMpVM9aM4QgLS7yigNgq5xrAU+SHgTKwsjE6wRjTxWr3TA75k/DRJN A/YjbA0oaa46BanAztdg7BxOXtOzGAxTc6LMnoh+h0RfWzgedd4Qy4k0gFENstXPY50n Hx4dDAaK9Iu5DjkqMtogJkIpTgLDV9JL2DwGNnCpgOgG7GFl+BiYHt8v+/uhGikqly/Q c0owqpOc216Rg4zIpMkwKktM2o5KMHc0Fo1jSITlj2dE7iU2PziFPO1JtI79e13pZqF4 GL7+lM7Ru3LGG7OIJRm0XKNc51eccoNtoJtkUtF884gkChLowcLy2MtEiRxL7lhhuesJ HzXg== X-Gm-Message-State: AOAM530XCkPxhLHWAjek4ttTScxwyZCWwi0ZGyIowHGu5OSvihfrfMqs pU6RvUAMWsuVD/uix752jvY1YqJ1psYUjnzBHXM= X-Google-Smtp-Source: ABdhPJyPLfK02nLm/N2dO12OHEYqwToT0Fi36zpUnXM8ECy35fxzoIupfvwvwgZH8oQttY6xFEwh0PF1TLx0lEPGHQg= X-Received: by 2002:a05:6638:2728:: with SMTP id m40mr5324482jav.111.1639569987863; Wed, 15 Dec 2021 04:06:27 -0800 (PST) MIME-Version: 1.0 References: <20211214120817.1476-1-gaoxiangliu0@163.com> <20211214151850.1183-1-gaoxiangliu0@163.com> In-Reply-To: <20211214151850.1183-1-gaoxiangliu0@163.com> From: Jerin Jacob Date: Wed, 15 Dec 2021 17:36:01 +0530 Message-ID: Subject: Re: [PATCH v3] eal: allow to exclude memseg from core dump To: Gaoxiang Liu Cc: dpdk-dev , Anatoly Burakov , liugaoxiang@huawei.com, dpdk stable Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Dec 14, 2021 at 8:49 PM Gaoxiang Liu wrote: > > Some DPDK application is allocated storage partition of 8G(or smaller) > If coredump happens, the application doesn't work because of > insufficient storage space. > The patch provides a config that means whether the memseg memory > is allowed to exclude from core dump. > The DPDK application can choose to open it according to the actual > situation. > > Fixes: d72e4042c5eb ("mem: exclude unused memory from core dump") This is patch is a feature, not a fix. So you can remove this > Cc: stable@dpdk.org This is patch is a feature, not a fix. So you can remove this > > Signed-off-by: Gaoxiang Liu > > --- > v2: > * Fixed compile issues. > > v3: > * Fixed review issues. madvise is replaced by eal_mem_set_dump(), > * and The type of huge_dont_dump_flag has been changed to bool. > --- > doc/guides/linux_gsg/linux_eal_parameters.rst | 4 ++++ > lib/eal/common/eal_internal_cfg.h | 1 + > lib/eal/common/eal_options.h | 3 ++- > lib/eal/linux/eal.c | 4 ++++ > lib/eal/linux/eal_memalloc.c | 3 +++ > lib/eal/unix/eal_unix_memory.c | 7 +++++-- > 6 files changed, 19 insertions(+), 3 deletions(-) > > diff --git a/doc/guides/linux_gsg/linux_eal_parameters.rst b/doc/guides/linux_gsg/linux_eal_parameters.rst Since you are adding it in unix/eal_unix_memory.c it is applicable for freebsd too. Please update options and documentation for freebsd. > index 74df2611b5..b6805bc6df 100644 > --- a/doc/guides/linux_gsg/linux_eal_parameters.rst > +++ b/doc/guides/linux_gsg/linux_eal_parameters.rst > @@ -93,6 +93,10 @@ Memory-related options > > Free hugepages back to system exactly as they were originally allocated. > > +* ``--memseg-dont-dump`` > + > + Allow to exclude memseg from core dump. > + > Other options > ~~~~~~~~~~~~~ > > diff --git a/lib/eal/common/eal_internal_cfg.h b/lib/eal/common/eal_internal_cfg.h > index d6c0470eb8..a7c34b88db 100644 > --- a/lib/eal/common/eal_internal_cfg.h > +++ b/lib/eal/common/eal_internal_cfg.h > @@ -87,6 +87,7 @@ struct internal_config { > /**< user defined mbuf pool ops name */ > unsigned num_hugepage_sizes; /**< how many sizes on this system */ > struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES]; > + bool memseg_dont_dump_flag; > enum rte_iova_mode iova_mode ; /**< Set IOVA mode on this system */ > rte_cpuset_t ctrl_cpuset; /**< cpuset for ctrl threads */ > volatile unsigned int init_complete; > diff --git a/lib/eal/common/eal_options.h b/lib/eal/common/eal_options.h > index 8e4f7202a2..013aad4cfc 100644 > --- a/lib/eal/common/eal_options.h > +++ b/lib/eal/common/eal_options.h > @@ -87,7 +87,8 @@ enum { > OPT_NO_TELEMETRY_NUM, > #define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" > OPT_FORCE_MAX_SIMD_BITWIDTH_NUM, > - > +#define OPT_MEMSEG_DONT_DUMP "memseg-dont-dump" > + OPT_MEMSEG_DONT_DUMP_NUM, > OPT_LONG_MAX_NUM > }; > > diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c > index 60b4924838..8a47bf758a 100644 > --- a/lib/eal/linux/eal.c > +++ b/lib/eal/linux/eal.c > @@ -817,6 +817,10 @@ eal_parse_args(int argc, char **argv) > internal_conf->match_allocations = 1; > break; > > + case OPT_MEMSEG_DONT_DUMP_NUM: > + internal_conf->memseg_dont_dump_flag = 1; > + break; > + > default: > if (opt < OPT_LONG_MIN_NUM && isprint(opt)) { > RTE_LOG(ERR, EAL, "Option %c is not supported " > diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c > index 337f2bc739..8e41537355 100644 > --- a/lib/eal/linux/eal_memalloc.c > +++ b/lib/eal/linux/eal_memalloc.c > @@ -663,6 +663,9 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, > ms->iova = iova; > ms->socket_id = socket_id; > > + if (internal_conf->memseg_dont_dump_flag) > + eal_mem_set_dump(addr, alloc_sz, false); > + > return 0; > > mapped: > diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c > index 68ae93bd6e..44227aee95 100644 > --- a/lib/eal/unix/eal_unix_memory.c > +++ b/lib/eal/unix/eal_unix_memory.c > @@ -83,10 +83,13 @@ eal_mem_set_dump(void *virt, size_t size, bool dump) > int flags = dump ? EAL_DODUMP : EAL_DONTDUMP; > int ret = madvise(virt, size, flags); > if (ret) { > - RTE_LOG(DEBUG, EAL, "madvise(%p, %#zx, %d) failed: %s\n", > + RTE_LOG(INFO, EAL, "madvise(%p, %#zx, %d) failed: %s\n", > virt, size, flags, strerror(rte_errno)); probably ERR instead of INFO. > rte_errno = errno; > - } > + } else > + RTE_LOG(INFO, EAL, "madvise(%p, %#zx, %d) success: %s\n", > + virt, size, flags, __func__); This should be DEBUG. Not INFO. With above changes Reviewed-by: Jerin Jacob > + > return ret; > } > > -- > 2.32.0 > >