From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <olivier.matz@6wind.com>
Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67])
 by dpdk.org (Postfix) with ESMTP id 0865514E8
 for <dev@dpdk.org>; Fri, 25 May 2018 17:17:53 +0200 (CEST)
Received: from rsa59-2-82-233-193-189.fbx.proxad.net ([82.233.193.189]
 helo=droids-corp.org)
 by mail.droids-corp.org with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.89) (envelope-from <olivier.matz@6wind.com>)
 id 1fMETp-0001Rg-0y; Fri, 25 May 2018 17:18:11 +0200
Received: by droids-corp.org (sSMTP sendmail emulation);
 Fri, 25 May 2018 17:17:48 +0200
Date: Fri, 25 May 2018 17:17:48 +0200
From: Olivier Matz <olivier.matz@6wind.com>
To: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Cc: dev@dpdk.org, "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
 "Richardson, Bruce" <bruce.richardson@intel.com>
Message-ID: <20180525151748.z6vbvbbbbs3gzcv3@neon>
References: <20170630142609.6180-1-olivier.matz@6wind.com>
 <20180403132644.23729-1-olivier.matz@6wind.com>
 <460fd61f-4346-752b-02c9-5ac952ea5215@intel.com>
 <f9f02987-9fc5-c3ef-3a1d-c3229a408cd4@intel.com>
 <5b5b3620-7674-86bb-125f-78e4796d2dea@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <5b5b3620-7674-86bb-125f-78e4796d2dea@intel.com>
User-Agent: NeoMutt/20170113 (1.7.2)
Subject: Re: [dpdk-dev] [PATCH] ring: relax alignment constraint on ring
 structure
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://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: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 25 May 2018 15:17:54 -0000

On Fri, May 25, 2018 at 03:57:07PM +0100, Burakov, Anatoly wrote:
> On 25-May-18 1:18 PM, Burakov, Anatoly wrote:
> > On 25-May-18 11:59 AM, Burakov, Anatoly wrote:
> > > On 03-Apr-18 2:26 PM, Olivier Matz wrote:
> > > > The initial objective of
> > > > commit d9f0d3a1ffd4 ("ring: remove split cacheline build setting")
> > > > was to add an empty cache line betwee, the producer and consumer
> > > > data (on platform with cache line size = 64B), preventing from
> > > > having them on adjacent cache lines.
> > > > 
> > > > Following discussion on the mailing list, it appears that this
> > > > also imposes an alignment constraint that is not required.
> > > > 
> > > > This patch removes the extra alignment constraint and adds the
> > > > empty cache lines using padding fields in the structure. The
> > > > size of rte_ring structure and the offset of the fields remain
> > > > the same on platforms with cache line size = 64B:
> > > > 
> > > >    rte_ring = 384
> > > >    rte_ring.name = 0
> > > >    rte_ring.flags = 32
> > > >    rte_ring.memzone = 40
> > > >    rte_ring.size = 48
> > > >    rte_ring.mask = 52
> > > >    rte_ring.prod = 128
> > > >    rte_ring.cons = 256
> > > > 
> > > > But it has an impact on platform where cache line size is 128B:
> > > > 
> > > >    rte_ring = 384        -> 768
> > > >    rte_ring.name = 0
> > > >    rte_ring.flags = 32
> > > >    rte_ring.memzone = 40
> > > >    rte_ring.size = 48
> > > >    rte_ring.mask = 52
> > > >    rte_ring.prod = 128   -> 256
> > > >    rte_ring.cons = 256   -> 512
> > > > 
> > > > Link: http://dpdk.org/dev/patchwork/patch/25039/
> > > > Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> > > > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> > > > ---
> > > 
> > > This patch causes eal_flags_autotest to hang on FreeBSD. Root cause
> > > at this time is unknown, but this is a weird one - the test seems to
> > > hang while doing read() in bsd/eal_thread.c:59. Reverting this patch
> > > on top of rc5 results in eal_flags_autotest passing.
> > > 
> > 
> > Further investigation shows that for some reason, if Enter is pressed
> > while the test is seemingly "hung", it continues and passes. Or rather,
> > it hangs on one test, and if Enter is pressed, it finishes that test and
> > hangs on another, after which pressing Enter again will result in test
> > succeeding. Weird...
> > 
> 
> This patch is OK, the problem is in the test :) With this patch, it
> apparently blew up in just the right way, but really, the EAL flags autotest
> is wrong on FreeBSD because it launches primary processes with '--no-shconf'
> option, which corrupt main process's memory. For some reason this only began
> manifesting with this patch.

Thanks for the analysis, I was also a bit puzzled by the impact...

Olivier