From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id A2FDA2B96; Wed, 5 Jul 2017 12:11:36 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 45B42206FF; Wed, 5 Jul 2017 06:11:36 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 05 Jul 2017 06:11:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=ZB8qD3EE/5tMqvK DNB9kYoPDh0VmLRP74TUoH38LTOI=; b=hlB/gBB0ymeHQ0fGQf0oNQroI8SiFvj /txoNtNmY90G7Q2ZOC4ofcdIswyAKz288E7Xr/3x8v3AAVgOMdwoX+iXi6xdiRxH thCbDzaRv3GDVbuVXYgmwKGoxkX096TOqYUXb4bJB7Mr/6hIjtT+rbiRbi5rrfKo fImrKIMY9GMM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=ZB8qD3EE/5tMqvKDNB9kYoPDh0VmLRP74TUoH38LTOI=; b=n4lAVCOi apeyHhABPdrfvoFU2eW3qvz8vakChd8bK1TUyjoyW20Lfu6RdHf2efScRkqcl82W 61k3rfbymHybmGystZPvoxSY2kxEPtewkrpr1WgPdZjdb9/g8ZjoaD4FfsyeHSnu INzEx296tFpHKN2XFcaA7fyZ5Ae8ur8eyQpjOdTN7aqlaWGAGs9nZLAZ7G/E74ck cITvcISRhV1fk0fto/9GDgI6BBZ4asdxMbC2eUXza6+YfXiKylPZcdn84LX+s4GY 4ZFP0/55t8xAzurjXIs7VrsYasrEbTEjGsBYz2llRG3RDNGpj2VKg4lVoQeka45+ 2olLQwjm1fyBuw== X-ME-Sender: X-Sasl-enc: IFqaz1Gdfw8dXUgUnl6HwBVK3+jM/+k+XVQ3rfc4iLKI 1499249495 Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id EC0A97E6B1; Wed, 5 Jul 2017 06:11:35 -0400 (EDT) From: Thomas Monjalon To: Jianfeng Tan Cc: stable@dpdk.org, dev@dpdk.org, yuanhan.liu@linux.intel.com, maxime.coquelin@redhat.com Date: Wed, 05 Jul 2017 12:11:35 +0200 Message-ID: <1821672.VUvoIibOHj@xps> In-Reply-To: <1499063851-10209-1-git-send-email-jianfeng.tan@intel.com> References: <1496420451-104928-1-git-send-email-jianfeng.tan@intel.com> <1499063851-10209-1-git-send-email-jianfeng.tan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v2] eal: fix secondary process segfault on multipe virtio devices X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jul 2017 10:11:37 -0000 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 > Signed-off-by: Jianfeng Tan Reworded the comment and applied, thanks