From: "Tan, Jianfeng" <jianfeng.tan@intel.com>
To: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "Xie, Huawei" <huawei.xie@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2] virtio: fix segfault when transmit pkts
Date: Tue, 26 Apr 2016 03:47:41 +0000 [thread overview]
Message-ID: <ED26CBA2FAD1BF48A8719AEF02201E36032C4883@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20160426034309.GC7832@yliu-dev.sh.intel.com>
Hi Yuanhan,
> -----Original Message-----
> From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com]
> Sent: Tuesday, April 26, 2016 11:43 AM
> To: Tan, Jianfeng
> Cc: dev@dpdk.org; Xie, Huawei
> Subject: Re: [PATCH v2] virtio: fix segfault when transmit pkts
>
> On Mon, Apr 25, 2016 at 02:37:45AM +0000, Jianfeng Tan wrote:
> > Issue: when using virtio nic to transmit pkts, it causes segment fault.
> >
> > How to reproduce:
> > Basically, we need to construct a case with vm send packets to vhost-user,
> > and this issue does not happen when transmitting packets using indirect
> > desc. Besides, make sure all descriptors are exhausted before vhost
> > dequeues any packets.
> >
> > a. start testpmd with vhost.
> > $ testpmd -c 0x3 -n 4 --socket-mem 1024,0 --no-pci \
> > --vdev 'eth_vhost0,iface=/tmp/sock0,queues=1' -- -i --nb-cores=1
> >
> > b. start a qemu with a virtio nic connected with the vhost-user port, just
> > make sure mrg_rxbuf is enabled.
> >
> > c. enable testpmd on the host.
> > testpmd> set fwd io
> > testpmd> start (better without start vhost-user)
> >
> > d. start testpmd in VM.
> > $testpmd -c 0x3 -n 4 -m 1024 -- -i --disable-hw-vlan-filter --txqflags=0xf01
> > testpmd> set fwd txonly
> > testpmd> start
> >
> > How to fix: this bug is because inside virtqueue_enqueue_xmit(), the flag
> of
> ^^^^^^^
> > desc has been updated inside the do {} while (), not necessary to update
> after
> > the loop.
>
> That's not a right "because": you were stating a fact of the right way
> to do setup desc flags, but not the cause of this bug.
>
> > (And if we do that after the loop, if all descs could have run out,
> > idx is VQ_RING_DESC_CHAIN_END (32768), use this idx to reference the
> start_dp
> > array will lead to segment fault.)
>
> And that's the cause. So, you should state the cause first, then the fix
> (which we already have), but not in the verse order you just did.
>
> So, I'd like to reword the commit log a bit, to something like following.
> What do you think of it? If no objection, I could merge it soon. Thanks
> for the fix, BTW!
>
Your refinement sounds much better, thanks!
Jianfeng
next prev parent reply other threads:[~2016-04-26 3:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-21 12:36 [dpdk-dev] [PATCH] " Jianfeng Tan
2016-04-21 22:44 ` Yuanhan Liu
2016-04-22 14:23 ` Xie, Huawei
2016-04-25 1:58 ` Tan, Jianfeng
2016-04-25 2:37 ` [dpdk-dev] [PATCH v2] " Jianfeng Tan
2016-04-25 7:33 ` Xie, Huawei
2016-04-26 3:43 ` Yuanhan Liu
2016-04-26 3:47 ` Tan, Jianfeng [this message]
2016-04-26 8:43 ` Thomas Monjalon
2016-04-26 16:54 ` Yuanhan Liu
2016-04-26 4:48 ` [dpdk-dev] [PATCH] " Stephen Hemminger
2016-04-26 5:08 ` Tan, Jianfeng
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=ED26CBA2FAD1BF48A8719AEF02201E36032C4883@SHSMSX103.ccr.corp.intel.com \
--to=jianfeng.tan@intel.com \
--cc=dev@dpdk.org \
--cc=huawei.xie@intel.com \
--cc=yuanhan.liu@linux.intel.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).