DPDK usage discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Cc: wangyunjian <wangyunjian@huawei.com>,
	Ruifeng Wang <Ruifeng.Wang@arm.com>,
	"dev@dpdk.org" <dev@dpdk.org>, "users@dpdk.org" <users@dpdk.org>,
	"Burakov, Anatoly" <anatoly.burakov@intel.com>,
	"thomas@monjalon.net" <thomas@monjalon.net>,
	"sergio.gonzalez.monroy@intel.com"
	<sergio.gonzalez.monroy@intel.com>,
	Feifei Wang <Feifei.Wang2@arm.com>,
	Huangshaozhang <huangshaozhang@huawei.com>,
	dingxiaoxiong <dingxiaoxiong@huawei.com>, nd <nd@arm.com>
Subject: Re: [dpdk-dev][dpdk-users] A problem about  memory may not be all-zero allocated by rte_zmalloc_socket()
Date: Wed, 12 Apr 2023 10:35:28 -0700	[thread overview]
Message-ID: <20230412103528.189db6aa@hermes.local> (raw)
In-Reply-To: <DBAPR08MB58143D6544E3035F9FA8931E983C9@DBAPR08MB5814.eurprd08.prod.outlook.com>

On Wed, 23 Feb 2022 15:38:09 +0000
Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com> wrote:

> I have a question, does the dpdk code implement to ensure that the memory initialization is 0?
> [Ruifeng] Clearing of the memory should be done by the kernel. In section 3.1.4.6 of Programmer's Guide, it says: "
> Hugepages are cleared by the kernel when a file in hugetlbfs or its part is mapped for the first time system-wide to prevent data leaks from previous users of the same hugepage".
> http://doc.dpdk.org/guides/prog_guide/env_abstraction_layer.html#memory-mapping-discovery-and-memory-reservation
> [Yunjian] Thanks. However, hugepages are not cleared by the kernel(version 4.19.90) on the ARM platform.
> [Honnappa] I think that is besides the point we are discussing. rte_zmalloc_socket should be able to zero the memory every time it is called (not just the first time).
> 
> I see that rte_zmalloc_socket explicitly clears the memory using memset when the RTE_MALLOC_DEBUG is enabled. Have you tested with RTE_MALLOC_DEBUG enabled?
> 
> 
> Thanks,
> Yunjian

Normally.
  - hugepage memory is zero'd by kernel when mapped in.  DPDK assumes this because the overhead
    of zeroing large amounts of memory can impact application startup time.
    If kernel is not zeroing, then your kernel is buggy.
  - when memory is freed by rte_free() it is set to zero before returning to the pool.
  - when malloc gets memory it will be zero'd

RTE_MALLOC_DEBUG changes this so that:
   - when memory is freed it gets overwritten by a poison value
   - when malloc gets memory it will zero it.


      reply	other threads:[~2023-04-12 17:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-30  3:21 wangyunjian
2022-01-31  4:21 ` Honnappa Nagarahalli
2022-02-07  2:43   ` wangyunjian
2022-02-08  8:01   ` wangyunjian
2022-02-08 18:05     ` Honnappa Nagarahalli
2022-02-10 12:11       ` wangyunjian
2022-02-22  9:17         ` Ruifeng Wang
2022-02-23 11:22           ` wangyunjian
2022-02-23 15:38             ` Honnappa Nagarahalli
2023-04-12 17:35               ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230412103528.189db6aa@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=Feifei.Wang2@arm.com \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=Ruifeng.Wang@arm.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=dingxiaoxiong@huawei.com \
    --cc=huangshaozhang@huawei.com \
    --cc=nd@arm.com \
    --cc=sergio.gonzalez.monroy@intel.com \
    --cc=thomas@monjalon.net \
    --cc=users@dpdk.org \
    --cc=wangyunjian@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).