From: Thomas Monjalon <thomas@monjalon.net>
To: Jianfeng Tan <jianfeng.tan@intel.com>
Cc: stable@dpdk.org, dev@dpdk.org, yuanhan.liu@linux.intel.com,
maxime.coquelin@redhat.com
Subject: Re: [dpdk-stable] [PATCH v2] eal: fix secondary process segfault on multipe virtio devices
Date: Wed, 05 Jul 2017 12:11:35 +0200 [thread overview]
Message-ID: <1821672.VUvoIibOHj@xps> (raw)
In-Reply-To: <1499063851-10209-1-git-send-email-jianfeng.tan@intel.com>
03/07/2017 08:37, Jianfeng Tan:
> Suppose we have 2 virtio devices for a VM, with only the first one,
> virtio0, binding to igb_uio. Start a primary DPDK process, driving
> only virtio0. Then start a secondary DPDK process, it encounters
> segfault at eth_virtio_dev_init() because hw is NULL, when trying
> to initialize the 2nd virtio devices.
> 1539 if (!hw->virtio_user_dev) {
>
> We could add a precheck to return error when hw is NULL. But the
> root cause is that virtio devices which are not driven by the primary
> process are not exluded by secondary eal probe function.
>
> To support legacy virtio devices bound to none kernel driver, we
> removed RTE_PCI_DRV_NEED_MAPPING in
> commit 962cf902e6eb ("pci: export device mapping functions").
> At the boot of primary process, ether dev is allocated in rte_eth_devices
> array, rte_eth_dev_data is also allocated in rte_eth_dev_data array; then
> probe function fails; and ether dev is released. However, the entry in
> rte_eth_dev_data array is not cleared. Then we start secondary process,
> and try to attach the virtio device that not used in primary process,
> the field, dev_private (or hw), in rte_eth_dev_data, is NULL.
>
> To fail the dev attach, we need to clear the field, name, when we
> release any ether devices in primary, so that below loop in
> rte_eth_dev_attach_secondary() will not find any matched names.
> for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
> if (strcmp(rte_eth_dev_data[i].name, name) == 0)
> break;
> }
>
> Fixes: 6d890f8ab512 ("Fixes: net/virtio: fix multiple process support")
> Cc: stable@dpdk.org
>
> Reported-by: Reshma Pattan <reshma.pattan@intel.com>
> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Reworded the comment and applied, thanks
prev parent reply other threads:[~2017-07-05 10:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-02 16:20 [PATCH] eal: fix secondary process segfault on multipe virtio devices Jianfeng Tan
2017-07-01 14:10 ` Thomas Monjalon
2017-07-03 8:38 ` Tan, Jianfeng
2017-07-03 6:37 ` [PATCH v2] " Jianfeng Tan
2017-07-05 10:11 ` Thomas Monjalon [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=1821672.VUvoIibOHj@xps \
--to=thomas@monjalon.net \
--cc=dev@dpdk.org \
--cc=jianfeng.tan@intel.com \
--cc=maxime.coquelin@redhat.com \
--cc=stable@dpdk.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.