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 CDE58A00C3 for ; Tue, 14 Dec 2021 13:09:18 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C5657410F3; Tue, 14 Dec 2021 13:09:18 +0100 (CET) Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) by mails.dpdk.org (Postfix) with ESMTP id 08438410F3; Tue, 14 Dec 2021 13:09:18 +0100 (CET) Received: by mail-io1-f54.google.com with SMTP id z18so23614208iof.5; Tue, 14 Dec 2021 04:09:17 -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=bbSrzC+6+Dr09S+pAtKWlq608Ws3Aj8CtLW0nDeEB+M=; b=DvGyKZvgoaqnb8wkvBMuoO6/TpWGIE9fl4Nu4BBDp18/VhCvBb5+EgUKcPKehcWehg dd20ZSD+QS4WwbYedr4jL36ALLaWYaq2OHUdjTXfCMpromyoO+UE3vrX0SHgp6ne9WTV h3IOuw8CF/obQ2md7hO/qEamynIWTqbXDPd85ODN/P7ihKgYd9hmtR4x8mxCQycofdYM +EWA0es30vI67gvgS4XyCWwzuoPxyx7lSQVPehxasNYTWqYs1KguRTNRuQEfepbzMciM jhnrmut9+3HA0vXIehC03Av3XlForceJTelmf5QakYLGrnoRcU1Os9H3rmUCbMVi819h JOdQ== 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=bbSrzC+6+Dr09S+pAtKWlq608Ws3Aj8CtLW0nDeEB+M=; b=XxGwD5u6FOrpQK0pwx4gYqHXM0XlKaqz5ETDN35zn9j9W+FzHvx4mvM1dAyICJIvn2 zI9NspTvxkE32v19l/JykfDfqV69vRxqNAyDTF+BQUNkwjB1fp35xhxo9m25vA/IRhd8 pNOPbTK/G+h7QYM/TrMG93ryp+Y6DRubfA3o0vEKIVveVbuYe8dPxpJ41zN39h/lCQ0b HBsZm9OEcxfXD11Vo4iSpOOYMXUhlic8xHItjo0eCi52cAhsPwD9JuyNCP5RLsc3B77f 9YRfGq9cGMY5eEDa4nTXhfQS9bycAQeOYVzAVc6oCE8N2Y7J/lbrh1TSVCvjeL7NfZHZ 6p9g== X-Gm-Message-State: AOAM533WlXCyqLU4bSuDYqHKs3c8HLuy6qBgYNOL+m3+a/jB2bfSFlCT SnuuPvqQPqRN1LIzAxumu+VWPxAJwrwkUWVYX/KAjzjwI8Q= X-Google-Smtp-Source: ABdhPJzkYvQWZAlvBi1pXI3mlWMU7vC+pr90neg+jm+zcVyREMo1xu2/daKglx0btoZSk0nW1pb5LospWD9y9dh8Ll8= X-Received: by 2002:a02:a116:: with SMTP id f22mr2569812jag.733.1639483757382; Tue, 14 Dec 2021 04:09:17 -0800 (PST) MIME-Version: 1.0 References: <20211214114151.1298-1-gaoxiangliu0@163.com> In-Reply-To: <20211214114151.1298-1-gaoxiangliu0@163.com> From: Jerin Jacob Date: Tue, 14 Dec 2021 17:38:51 +0530 Message-ID: Subject: Re: [PATCH] mem: exclude used memory from core dump by config To: Gaoxiang Liu Cc: dpdk-dev , Anatoly Burakov , liugaoxiang@huawei.com, dpdk stable Content-Type: text/plain; charset="UTF-8" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Tue, Dec 14, 2021 at 5:12 PM Gaoxiang Liu wrote: > > Some DPDK application is allolcateed storage partition of 8G(or smaller) allocated > If coredump happens, the application doesn't work because of > insufficient storage space. > The patch provides a config that means whether the huge used memory > needs to be not dumped in core dump. > The DPDK application can choose to open it according to the actual > situation. > > Fixes: d72e4042c5eb ("mem: exclude unused memory from core dump") > Cc: stable@dpdk.org Probably subject can be changed to: eal: allow to exclude memseg from core dump > > Signed-off-by: Gaoxiang Liu > --- > lib/eal/common/eal_internal_cfg.h | 1 + > lib/eal/common/eal_options.h | 3 ++- > lib/eal/linux/eal.c | 3 +++ > lib/eal/linux/eal_memalloc.c | 10 ++++++++++ freebsd support can be updated, Please update doc/guides/linux_gsg/linux_eal_parameters.rst and doc/guides/freebsd_gsg/freebsd_eal_parameters.rst. > 4 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/lib/eal/common/eal_internal_cfg.h b/lib/eal/common/eal_internal_cfg.h > index d6c0470eb8..f9cd300f86 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]; > + volatile unsigned huge_dont_dump_flag; Volatile may not be needed. it can be changed to bool as well. > 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..6b9a24f0f9 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_HUGE_DONT_DUMP "huge-dont-dump" > + OPT_HUGE_DONT_DUMP_NUM, > OPT_LONG_MAX_NUM > }; > > diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c > index 60b4924838..eeab5e4f3d 100644 > --- a/lib/eal/linux/eal.c > +++ b/lib/eal/linux/eal.c > @@ -816,6 +816,9 @@ eal_parse_args(int argc, char **argv) > case OPT_MATCH_ALLOCATIONS_NUM: > internal_conf->match_allocations = 1; > break; > + case OPT_HUGE_DONT_DUMP_NUM: > + internal_config->huge_dont_dump_flag = 1; > + break; > > default: > if (opt < OPT_LONG_MIN_NUM && isprint(opt)) { > diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c > index 337f2bc739..13ca1cf58c 100644 > --- a/lib/eal/linux/eal_memalloc.c > +++ b/lib/eal/linux/eal_memalloc.c > @@ -663,6 +663,16 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, > ms->iova = iova; > ms->socket_id = socket_id; > > + if (internal_config->huge_dont_dump_flag) { > + if (madvise(addr, alloc_sz, EAL_DONTDUMP)) { > + RTE_LOG(INFO, EAL, "madvise(%p, %#zx, %d) failed: %s\n", > + virt, size, flags, strerror(rte_errno)); > + } else { > + RTE_LOG(INFO, EAL, "%s(): madvise(MADV_DONTDUMP) memory success.(len=%zu)\n", > + __func__, alloc_sz); > + } I think, you can use eal_mem_set_dump() > + } > + > return 0; > > mapped: > -- > 2.32.0 > >