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 7F12A45BDF; Sat, 26 Oct 2024 13:43:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 118724027A; Sat, 26 Oct 2024 13:43:14 +0200 (CEST) Received: from smtp-gw.pt.net (smtp-gw.pt.net [206.210.192.15]) by mails.dpdk.org (Postfix) with ESMTP id 5C7EE40265 for ; Sat, 26 Oct 2024 13:43:12 +0200 (CEST) X-ASG-Debug-ID: 1729942990-09411a490e3561a0001-TfluYd Received: from mail.pt.net (mail.pt.net [206.210.194.11]) by smtp-gw.pt.net with ESMTP id Opr54gD2Lm2bNWjq (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 26 Oct 2024 06:43:10 -0500 (CDT) X-Barracuda-Envelope-From: lew@perftech.com X-Barracuda-Effective-Source-IP: mail.pt.net[206.210.194.11] X-Barracuda-Apparent-Source-IP: 206.210.194.11 Received: from localhost (localhost [IPv6:::1]) by mail.pt.net (Postfix) with ESMTP id 8754B19A34D; Sat, 26 Oct 2024 06:43:10 -0500 (CDT) Received: from mail.pt.net ([IPv6:::1]) by localhost (mail.pt.net [IPv6:::1]) (amavis, port 10032) with ESMTP id ogbzYE1PKVEq; Sat, 26 Oct 2024 06:43:10 -0500 (CDT) Received: from localhost (localhost [IPv6:::1]) by mail.pt.net (Postfix) with ESMTP id 0B41619A34C; Sat, 26 Oct 2024 06:43:10 -0500 (CDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.pt.net 0B41619A34C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=perftech.com; s=B15A3A56-ABEA-11EE-9719-5F12F125680F; t=1729942990; bh=LnZ9FGR+OCs2OEL5sfN15TtvrzHBZyeAKKjWUh8BnvE=; h=Date:From:To:Message-ID:MIME-Version; b=QrJrAHQteUO6+YyXVx5hHi4ZN0OngMPzVLMxVmE74fg2FfYUlFrlgcSCcqxd1t6yv cOxWnBxM2j68SNaSLpRIIopNNnOZk/kFI6xM8SKgIzs9YfL+FjbIUZYS7JWWBS5Me7 Evf1U2wWduHq39pmQbOt2FxwBnw3cqTMB4WG/+KpfjjFr7FVWSblaNCflo8R2VELft h2/fT/choKpZx6aHw+CP35kiEyT+t9Ii2nU9QQNCQihvWn3YsNNbbtDjlX5qpeFhgR TQvT+QIi5TyDaqITdaFVo0n8/LqgwPjW6+jWu9jxYxxrbonTnEi17VAtZaTrFoMjTU tqBZCwadFfggg== X-Virus-Scanned: amavis at pt.net Received: from mail.pt.net ([IPv6:::1]) by localhost (mail.pt.net [IPv6:::1]) (amavis, port 10026) with ESMTP id 2XwhrBUa2c9H; Sat, 26 Oct 2024 06:43:09 -0500 (CDT) Received: from mail.pt.net (mail.pt.net [206.210.194.11]) by mail.pt.net (Postfix) with ESMTP id E7C7A19A34B; Sat, 26 Oct 2024 06:43:09 -0500 (CDT) Date: Sat, 26 Oct 2024 06:43:08 -0500 (CDT) From: Lewis Donzis To: Dmitry Kozlyuk Cc: dev , anatoly burakov Message-ID: <1865717992.9940628.1729942988633.JavaMail.zimbra@donzis.com> In-Reply-To: <20241025202615.2581513-2-dmitry.kozliuk@gmail.com> References: <20241023231859.1323727-1-kozlyuk@bifit.com> <20241025202615.2581513-1-dmitry.kozliuk@gmail.com> <20241025202615.2581513-2-dmitry.kozliuk@gmail.com> Subject: Re: [PATCH v2 1/2] contigmem: support including mapped buffers in core dump MIME-Version: 1.0 X-ASG-Orig-Subj: Re: [PATCH v2 1/2] contigmem: support including mapped buffers in core dump Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Originating-IP: [206.210.194.11] X-Mailer: Zimbra 8.8.15_GA_4652 (ZimbraWebClient - GC130 (Mac)/8.8.15_GA_4652) Thread-Topic: contigmem: support including mapped buffers in core dump Thread-Index: PERqOtUB2gReyOiV8E550/Y2dqtPlw== X-Barracuda-Connect: mail.pt.net[206.210.194.11] X-Barracuda-Start-Time: 1729942990 X-Barracuda-Encrypted: TLS_AES_256_GCM_SHA384 X-Barracuda-URL: https://smtp-gw.pt.net:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at pt.net X-Barracuda-Scan-Msg-Size: 5355 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.132327 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 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 Is the extra control necessary, i.e., why not just always do this and let the EAL option control whether the pages get dumped? ----- On Oct 25, 2024, at 3:26 PM, Dmitry Kozlyuk dmitry.kozliuk@gmail.com wrote: > It was impossible to include mapped contigmem buffers in core dump. > Add hw.contigmem.coredump_enable tunable to control the inclusion. > > Mappings backed by OBJ_FICTITIOUS are excluded from core dump. > While contigmem is a device and its OBJT_DEVICE mappings get this flag, > they are actually backed by memory. > Clear OBJ_FICTITIOUS mapping bit to include them in core dump. > Do this only if hw.contigmem.coredump_enable=1. > > Signed-off-by: Dmitry Kozlyuk > --- > doc/guides/freebsd_gsg/build_dpdk.rst | 27 ++++++++++++++++++++------- > kernel/freebsd/contigmem/contigmem.c | 8 ++++++++ > 2 files changed, 28 insertions(+), 7 deletions(-) > > diff --git a/doc/guides/freebsd_gsg/build_dpdk.rst > b/doc/guides/freebsd_gsg/build_dpdk.rst > index 86e8e5a805..387ec52820 100644 > --- a/doc/guides/freebsd_gsg/build_dpdk.rst > +++ b/doc/guides/freebsd_gsg/build_dpdk.rst > @@ -86,6 +86,22 @@ module loading using:: > kenv hw.contigmem.num_buffers=n > kenv hw.contigmem.buffer_size=m > > +Where n is the number of blocks and m is the size in bytes of each area of > +contiguous memory. A default of two buffers of size 1073741824 bytes (1 > Gigabyte) > +each is set during module load if they are not specified in the environment. > + > +Buffers are excluded from core dump by default. > +Mapped buffers can be included in core dump using the following tunable: > + > + hw.contigmem.coredump_enable=1 > + > +.. note:: > + > + Including contigmem buffers in core dump file increases its size, > + which may fill the storage or overload the transport. > + Buffers typically hold data processed by the application, > + like network packets, which may contain sensitive information. > + > The kernel environment variables can also be specified during boot by placing > the > following in ``/boot/loader.conf``: > > @@ -93,15 +109,12 @@ following in ``/boot/loader.conf``: > > hw.contigmem.num_buffers=n > hw.contigmem.buffer_size=m > + hw.contigmem.coredump_enable=1 > > The variables can be inspected using the following command:: > > sysctl -a hw.contigmem > > -Where n is the number of blocks and m is the size in bytes of each area of > -contiguous memory. A default of two buffers of size 1073741824 bytes (1 > Gigabyte) > -each is set during module load if they are not specified in the environment. > - > The module can then be loaded using kldload:: > > kldload contigmem > @@ -115,13 +128,13 @@ up time. This can be achieved by placing lines similar to > the following into > > hw.contigmem.num_buffers=1 > hw.contigmem.buffer_size=1073741824 > + hw.contigmem.coredump_enable=1 > contigmem_load="YES" > > .. note:: > > - The contigmem_load directive should be placed after any definitions of > - ``hw.contigmem.num_buffers`` and ``hw.contigmem.buffer_size`` if the > default values > - are not to be used. > + The ``contigmem_load`` directive should be placed after any definitions > + of ``hw.contigmem.*`` if the default values are not to be used. > > An error such as:: > > diff --git a/kernel/freebsd/contigmem/contigmem.c > b/kernel/freebsd/contigmem/contigmem.c > index 7dd87599d9..591e46dded 100644 > --- a/kernel/freebsd/contigmem/contigmem.c > +++ b/kernel/freebsd/contigmem/contigmem.c > @@ -51,6 +51,7 @@ static d_close_t contigmem_close; > > static int contigmem_num_buffers = RTE_CONTIGMEM_DEFAULT_NUM_BUFS; > static int64_t contigmem_buffer_size = RTE_CONTIGMEM_DEFAULT_BUF_SIZE; > +static bool contigmem_coredump_enable; > > static eventhandler_tag contigmem_eh_tag; > static struct contigmem_buffer contigmem_buffers[RTE_CONTIGMEM_MAX_NUM_BUFS]; > @@ -59,6 +60,7 @@ static int contigmem_refcnt; > > TUNABLE_INT("hw.contigmem.num_buffers", &contigmem_num_buffers); > TUNABLE_QUAD("hw.contigmem.buffer_size", &contigmem_buffer_size); > +TUNABLE_BOOL("hw.contigmem.coredump_enable", &contigmem_coredump_enable); > > static SYSCTL_NODE(_hw, OID_AUTO, contigmem, CTLFLAG_RD, 0, "contigmem"); > > @@ -68,6 +70,8 @@ SYSCTL_QUAD(_hw_contigmem, OID_AUTO, buffer_size, CTLFLAG_RD, > &contigmem_buffer_size, 0, "Size of each contiguous buffer"); > SYSCTL_INT(_hw_contigmem, OID_AUTO, num_references, CTLFLAG_RD, > &contigmem_refcnt, 0, "Number of references to contigmem"); > +SYSCTL_BOOL(_hw_contigmem, OID_AUTO, coredump_enable, CTLFLAG_RD, > + &contigmem_coredump_enable, 0, "Include mapped buffers in core dump"); > > static SYSCTL_NODE(_hw_contigmem, OID_AUTO, physaddr, CTLFLAG_RD, 0, > "physaddr"); > @@ -357,5 +361,9 @@ contigmem_mmap_single(struct cdev *cdev, vm_ooffset_t > *offset, vm_size_t size, > *obj = cdev_pager_allocate(vmh, OBJT_DEVICE, &contigmem_cdev_pager_ops, > size, nprot, *offset, curthread->td_ucred); > > + /* Mappings backed by OBJ_FICTITIOUS are excluded from core dump. */ > + if (contigmem_coredump_enable) > + (*obj)->flags &= ~OBJ_FICTITIOUS; > + > return 0; > } > -- > 2.38.4