[dpdk-dev] [PATCH] virtio: fix allocating virtnet_rx not mem aligned

Yuanhan Liu yuanhan.liu at linux.intel.com
Mon Jun 13 12:26:35 CEST 2016


On Mon, Jun 13, 2016 at 10:06:22AM +0000, Tan, Jianfeng wrote:
> 
> 
> > -----Original Message-----
> > From: Yuanhan Liu [mailto:yuanhan.liu at linux.intel.com]
> > Sent: Monday, June 13, 2016 5:52 PM
> > To: Tan, Jianfeng
> > Cc: dev at dpdk.org; Xie, Huawei
> > Subject: Re: [dpdk-dev] [PATCH] virtio: fix allocating virtnet_rx not mem
> > aligned
> > 
> > On Mon, Jun 13, 2016 at 05:21:01PM +0800, Yuanhan Liu wrote:
> > > On Sun, Jun 12, 2016 at 02:29:42PM +0000, Jianfeng Tan wrote:
> > > > Compile DPDK with clang, below line in virtio_rxtx.c could be
> > > > optimized with four "VMOVAPS ymm, m256".
> > > >   memset(&rxvq->fake_mbuf, 0, sizeof(rxvq->fake_mbuf));
> > > >
> > > > This instruction requires memory address is 32-byte aligned.
> > > > Or, it leads to segfault.
> > >
> > > That looks like a dangerous optimization to me. If that's the case,
> > > doesn't it mean we have to make sure the address is always aligned
> > > properly while calling memset?
> > 
> > Above is just a side note. Anyway, I think making sure vq is cache
> > aligned is good here. So, I will apply it. BTW, do you mind if I
> > squash your 2 fixes into Huawei's Rx/Tx split commit? His commit is
> > not pushed to upstream yet, therefore I can still do rebase: I'm
> > thinking it's better to have one working commit other than one broken
> > commit followed with several fixing commits. And of course, I will
> > mention your contribution in the commit log.
> 
> Not a problem from my side. But Huawei seems to have concerns on this fix. You can do that for the other fix firstly.

What's the concern? Despite the clang issue (I still have no idea why
clang would go that aggressively), I think making vq cache aligned is
generically a good idea.

	--yliu


More information about the dev mailing list