From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 4258BFE5 for ; Fri, 6 May 2016 10:30:32 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP; 06 May 2016 01:30:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,586,1455004800"; d="scan'208";a="98284610" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga004.fm.intel.com with ESMTP; 06 May 2016 01:30:30 -0700 Received: from fmsmsx121.amr.corp.intel.com (10.18.125.36) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 6 May 2016 01:30:29 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx121.amr.corp.intel.com (10.18.125.36) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 6 May 2016 01:30:29 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.148]) by shsmsx102.ccr.corp.intel.com ([169.254.2.104]) with mapi id 14.03.0248.002; Fri, 6 May 2016 16:30:27 +0800 From: "Xie, Huawei" To: Vincent Li , "dev@dpdk.org" , Thomas Monjalon Thread-Topic: [dpdk-dev] virtio still blindly take over virtio device managed by kernel Thread-Index: AdGncYn1CJQd/2XmD02vO+Ng4mKrMg== Date: Fri, 6 May 2016 08:30:26 +0000 Message-ID: References: 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 Subject: Re: [dpdk-dev] virtio still blindly take over virtio device managed by kernel 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: Fri, 06 May 2016 08:30:32 -0000 On 5/5/2016 12:21 AM, Vincent Li wrote:=0A= > Hi,=0A= >=0A= > I am running the dpdk git repo which already had commit ac5e1d838dc=0A= > (virtio: skip error when probing kernel managed device), but in my=0A= > test, it seems still taking control of the kernel managed virtio=0A= > device and segmentation fault, here is the example:=0A= >=0A= > # ./tools/dpdk_nic_bind.py --status=0A= >=0A= > Network devices using DPDK-compatible driver=0A= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= > 0000:00:07.0 'Virtio network device' drv=3Digb_uio unused=3D=0A= > 0000:00:08.0 'Virtio network device' drv=3Digb_uio unused=3D=0A= >=0A= > Network devices using kernel driver=0A= > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= > 0000:00:03.0 'Virtio network device' if=3D drv=3Dvirtio-pci unused=3Digb_= uio=0A= >=0A= > #./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf -n 4 -- -i=0A= > EAL: Detected 4 lcore(s)=0A= > EAL: Probing VFIO support...=0A= > EAL: WARNING: cpu flags constant_tsc=3Dyes nonstop_tsc=3Dno -> using=0A= > unreliable clock cycles !=0A= > EAL: PCI device 0000:00:03.0 on NUMA socket -1=0A= > EAL: probe driver: 1af4:1000 rte_virtio_pmd=0A= > PMD: vtpci_init(): trying with legacy virtio pci.=0A= > Segmentation fault (core dumped)=0A= =0A= Hi Vincent:=0A= Could you try this?=0A= Weird. I had tested by binding the virtio nic with different kernel=0A= drivers including unbinding any drivers when submitting patches. But i=0A= find that it doesn't work even with that commit.=0A= So dev->devargs could be NULL.=0A= =0A= If it works for you, i will submit the fix.=0A= =0A= diff --git a/drivers/net/virtio/virtio_pci.c=0A= b/drivers/net/virtio/virtio_pci.c=0A= index 45edecc..8aeb44a 100644=0A= --- a/drivers/net/virtio/virtio_pci.c=0A= +++ b/drivers/net/virtio/virtio_pci.c=0A= @@ -650,7 +650,8 @@ vtpci_init(struct rte_pci_device *dev, struct=0A= virtio_hw *hw)=0A= PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");=0A= if (legacy_virtio_resource_init(dev, hw) < 0) {=0A= if (dev->kdrv =3D=3D RTE_KDRV_UNKNOWN &&=0A= - dev->devargs->type !=3D RTE_DEVTYPE_WHITELISTED_PCI) {= =0A= + (!dev->devargs ||=0A= + dev->devargs->type !=3D RTE_DEVTYPE_WHITELISTED_PCI)){= =0A= PMD_INIT_LOG(INFO,=0A= "skip kernel managed virtio device.");=0A= return 1;=0A= =0A= =0A= >=0A= > if I blacklist 0000:00:03.0 from testpmd, testpmd works:=0A= >=0A= > # ./x86_64-native-linuxapp-gcc/app/testpmd -c 0xf -n 4 -b 0000:00:03.0 -= - -i=0A= > EAL: Detected 4 lcore(s)=0A= > EAL: Probing VFIO support...=0A= > EAL: WARNING: cpu flags constant_tsc=3Dyes nonstop_tsc=3Dno -> using=0A= > unreliable clock cycles !=0A= > EAL: PCI device 0000:00:03.0 on NUMA socket -1=0A= > EAL: PCI device 0000:00:07.0 on NUMA socket -1=0A= > EAL: probe driver: 1af4:1000 rte_virtio_pmd=0A= > PMD: virtio_read_caps(): no modern virtio pci device found.=0A= > PMD: vtpci_init(): trying with legacy virtio pci.=0A= > EAL: PCI device 0000:00:08.0 on NUMA socket -1=0A= > EAL: probe driver: 1af4:1000 rte_virtio_pmd=0A= > PMD: virtio_read_caps(): no modern virtio pci device found.=0A= > PMD: vtpci_init(): trying with legacy virtio pci.=0A= > Interactive-mode selected=0A= > Configuring Port 0 (socket 0)=0A= > rte_eth_dev_config_restore: port 0: MAC address array not supported=0A= > Port 0: 52:54:00:EA:6E:3E=0A= > Configuring Port 1 (socket 0)=0A= > rte_eth_dev_config_restore: port 1: MAC address array not supported=0A= > Port 1: 52:54:00:24:06:DB=0A= > Checking link statuses...=0A= > Port 0 Link Up - speed 10000 Mbps - full-duplex=0A= > Port 1 Link Up - speed 10000 Mbps - full-duplex=0A= > Done=0A= > testpmd>=0A= >=0A= =0A=