From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <tiwei.bie@intel.com>
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id A5D3DF72;
 Mon,  8 May 2017 11:11:48 +0200 (CEST)
Received: from orsmga004.jf.intel.com ([10.7.209.38])
 by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 08 May 2017 02:11:47 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.38,308,1491289200"; d="scan'208";a="84838120"
Received: from debian.sh.intel.com (HELO debian) ([10.239.67.137])
 by orsmga004.jf.intel.com with ESMTP; 08 May 2017 02:11:46 -0700
Date: Mon, 8 May 2017 17:13:34 +0800
From: Tiwei Bie <tiwei.bie@intel.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org, stable@dpdk.org
Message-ID: <20170508091334.GB11935@debian>
References: <20170508080916.4317-1-tiwei.bie@intel.com>
 <20170508085357.GA47408@bricha3-MOBL3.ger.corp.intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <20170508085357.GA47408@bricha3-MOBL3.ger.corp.intel.com>
User-Agent: Mutt/1.7.2 (2016-11-26)
Subject: Re: [dpdk-dev] [PATCH] eal/bsd: don't zero the pages during mmap in
	contigmem
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 08 May 2017 09:11:49 -0000

On Mon, May 08, 2017 at 09:53:57AM +0100, Bruce Richardson wrote:
> On Mon, May 08, 2017 at 08:09:16AM +0000, Tiwei Bie wrote:
> > Don't zero the pages during mmap in contigmem. Instead, zero the
> > pages after mmap in primary process. Otherwise, the multi-process
> > support will be broken, as the pages will be zeroed when secondary
> > processes map the memory.
> > 
> > Fixes: 82f931805506 ("contigmem: zero all pages during mmap")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> > ---
> I agree there is a problem here, but I'm not sure about the solution to
> it. I still think that the kernel should zero the pages before they get
> given to userspace. Is there any way to keep that working e.g
> 
> * have them zeroed on mmap only when they are not already mmaped into
>   another process?
> * have them zeroed on init, and again on unmap by the last process to
>   have them mapped?
> 

I think it's the simplest way to fix it in userspace, so I just did it.
I'd like to fix it in kernel if you also prefer this.

Best regards,
Tiwei Bie