From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 1D93D106B for ; Thu, 26 Mar 2015 02:27:43 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 25 Mar 2015 18:27:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,468,1422950400"; d="scan'208";a="546437077" Received: from kmsmsx151.gar.corp.intel.com ([172.21.73.86]) by orsmga003.jf.intel.com with ESMTP; 25 Mar 2015 18:27:42 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by KMSMSX151.gar.corp.intel.com (172.21.73.86) with Microsoft SMTP Server (TLS) id 14.3.224.2; Thu, 26 Mar 2015 09:27:40 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.36]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.108]) with mapi id 14.03.0224.002; Thu, 26 Mar 2015 09:27:35 +0800 From: "Xie, Huawei" To: "Xie, Huawei" Thread-Topic: [dpdk-dev] [PATCH] virtio: Fix crash issue for secondary process Thread-Index: AdBldkq2A0UtQbqxTSuxek4H+BtiJg== Date: Thu, 26 Mar 2015 01:27:35 +0000 Message-ID: References: <1426729537-24892-1-git-send-email-changchun.ouyang@intel.com> <2258736.A24vDFQUbz@xps13> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] virtio: Fix crash issue for secondary process X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Mar 2015 01:27:44 -0000 On 3/23/2015 10:33 PM, Xie, Huawei wrote:=0A= > On 3/21/2015 5:59 AM, Thomas Monjalon wrote:=0A= >=0A= > 2015-03-19 09:45, Ouyang Changchun:=0A= >=0A= >=0A= > It definitely needs Rx function even in the case of secondary process, so= put=0A= > the assignment a bit earlier to make sure of it.=0A= >=0A= > Signed-off-by: Changchun Ouyang =0A= > ---=0A= > lib/librte_pmd_virtio/virtio_ethdev.c | 5 ++---=0A= > 1 file changed, 2 insertions(+), 3 deletions(-)=0A= >=0A= > diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virti= o/virtio_ethdev.c=0A= > index 603be2d..ad24cf2 100644=0A= > --- a/lib/librte_pmd_virtio/virtio_ethdev.c=0A= > +++ b/lib/librte_pmd_virtio/virtio_ethdev.c=0A= > @@ -1113,6 +1113,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)=0A= > RTE_BUILD_BUG_ON(RTE_PKTMBUF_HEADROOM < sizeof(struct virtio_net_= hdr));=0A= >=0A= > eth_dev->dev_ops =3D &virtio_eth_dev_ops;=0A= > + eth_dev->rx_pkt_burst =3D &virtio_recv_pkts;=0A= > eth_dev->tx_pkt_burst =3D &virtio_xmit_pkts;=0A= >=0A= > if (rte_eal_process_type() =3D=3D RTE_PROC_SECONDARY)=0A= > @@ -1148,10 +1149,8 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)= =0A= > if (vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) {=0A= > eth_dev->rx_pkt_burst =3D &virtio_recv_mergeable_pkts;=0A= >=0A= >=0A= >=0A= > Why the mergeable buffers case is not handled for secondary processes?=0A= >=0A= > Forgot to CC my comment to dpdk.org.=0A= > There are many parts of eth_dev for the secondary process still=0A= >=0A= > uninitialized, even like eth_dev->data->mac_addrs isn't allocated., also= =0A= >=0A= > like mergeable, feature, etc.=0A= >=0A= > Secondary process will not work unless they never touch those fields.=0A= >=0A= =0A= This comment is not right, but there is indeed a possible minor issue here.= =0A= eth_dev_data array is shared across multiple processes.=0A= The eth_dev_data is the same for the same eth device unless the port id=0A= allocated to it is the same, i.e, the devices are scanned in the same=0A= order in all processes.=0A= For instance, if we blacklist a device in one process, the port id will=0A= be then different.=0A= =0A= =0A= >=0A= > Prefer we have a clean fix. Customer could apply that one line of fix if= =0A= >=0A= > they need this urgently.=0A= >=0A= > I am wondering whether other PMDS have the same issue for the second proc= ess.=0A= >=0A= >=0A= >=0A= >=0A= >=0A= > hw->vtnet_hdr_size =3D sizeof(struct virtio_net_hdr_mrg_r= xbuf);=0A= > - } else {=0A= > - eth_dev->rx_pkt_burst =3D &virtio_recv_pkts;=0A= > + } else=0A= > hw->vtnet_hdr_size =3D sizeof(struct virtio_net_hdr);=0A= > - }=0A= >=0A= > /* Copy the permanent MAC address to: virtio_hw */=0A= > virtio_get_hwaddr(hw);=0A= >=0A= >=0A= >=0A= >=0A= >=0A= >=0A= >=0A= >=0A= >=0A= =0A=