[dpdk-dev] [Question] How pmd virtio works without UIO?

Peter Xu peterx at redhat.com
Tue Dec 22 12:39:12 CET 2015


On Tue, Dec 22, 2015 at 10:47:21AM +0000, Xie, Huawei wrote:
> On 12/22/2015 5:57 PM, Peter Xu wrote:
> > On Tue, Dec 22, 2015 at 04:32:46PM +0800, Yuanhan Liu wrote:
> >> Actually, you are right. I mentioned in the last email that this is
> >> for configuration part. To answer your question in this email, you
> >> will not be able to go that further (say initiating virtio pmd) if
> >> you don't unbind the origin virtio-net driver, and bind it to igb_uio
> >> (or something similar).
> >>
> >> The start point is from rte_eal_pci_scan, where the sub-function
> >> pci_san_one just initates a DPDK bond driver.
> > I am not sure whether I do understand your meaning correctly
> > (regarding "you willl not be able to go that furture"): The problem
> > is that, we _can_ run testpmd without unbinding the ports and bind
> > to UIO or something. What we need to do is boot the guest, reserve
> > huge pages, and run testpmd (keeping its kernel driver as
> > "virtio-pci"). In pci_scan_one():
> >
> > 	if (!ret) {
> > 		if (!strcmp(driver, "vfio-pci"))
> > 			dev->kdrv = RTE_KDRV_VFIO;
> > 		else if (!strcmp(driver, "igb_uio"))
> > 			dev->kdrv = RTE_KDRV_IGB_UIO;
> > 		else if (!strcmp(driver, "uio_pci_generic"))
> > 			dev->kdrv = RTE_KDRV_UIO_GENERIC;
> > 		else
> > 			dev->kdrv = RTE_KDRV_UNKNOWN;
> > 	} else
> > 		dev->kdrv = RTE_KDRV_UNKNOWN;
> >
> > I think it should be going to RTE_KDRV_UNKNOWN
> > (driver=="virtio-pci") here. I tried to run IO and it could work,
> > but I am not sure whether it is safe, and how.
> 
> Good catch, peter.
> Actually recently customers complain that with this feature, DPDK always
> tries to take over this virtio-pci device, which is unwanted behavior.
> Using blacklist could workaround this issue.
> However, the real serious problem is that kernel driver is still
> managing this device.
> 
> Changchun, Thomas:
> I think we should fix this, but firstly i wonder why using port IO to
> get PCI resource is more secure.

I am not familiar with this, however, shouldn't port IO from
userspace the most dangerous way to access PCI resource?

> 
> >
> > Also, I am not sure whether I need to (at least) unbind the
> > virtio-pci driver, so that there should have no kernel driver
> > running for the virtio device before DPDK using it.
> If you unbind, you have no entry under /proc/ioports for virtio IO port.

I tried to unbind one of the virtio net device, I see the PCI entry
still there.

Before unbind:

[root at vm proc]# lspci -k -s 00:03.0
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
        Subsystem: Red Hat, Inc Device 0001
        Kernel driver in use: virtio-pci
[root at vm proc]# cat /proc/ioports | grep c060-c07f
  c060-c07f : 0000:00:03.0
    c060-c07f : virtio-pci

After unbind:

[root at vm proc]# lspci -k -s 00:03.0
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
        Subsystem: Red Hat, Inc Device 0001
[root at vm proc]# cat /proc/ioports | grep c060-c07f
  c060-c07f : 0000:00:03.0

So... does this means that it is an alternative to black list
solution?

Peter

> >
> > Thanks
> > Peter
> >
> >> 	--yliu
> 


More information about the dev mailing list