DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [Question] How pmd virtio works without UIO?
Date: Thu, 24 Dec 2015 09:56:52 -0800	[thread overview]
Message-ID: <20151224095652.5a2adfe6@xeon-e3> (raw)
In-Reply-To: <20151224033027.GY18863@yliu-dev.sh.intel.com>

On Thu, 24 Dec 2015 11:30:27 +0800
Yuanhan Liu <yuanhan.liu@linux.intel.com> wrote:

> On Wed, Dec 23, 2015 at 11:26:17PM +0100, Thomas Monjalon wrote:
> > 2015-12-23 10:09, Yuanhan Liu:
> > > On Wed, Dec 23, 2015 at 09:55:54AM +0800, Peter Xu wrote:
> > > > On Tue, Dec 22, 2015 at 04:38:30PM +0000, Xie, Huawei wrote:
> > > > > On 12/22/2015 7:39 PM, Peter Xu wrote:
> > > > > > I tried to unbind one of the virtio net device, I see the PCI entry
> > > > > > still there.
> > > > > >
> > > > > > Before unbind:
> > > > > >
> > > > > > [root@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@vm proc]# cat /proc/ioports | grep c060-c07f
> > > > > >   c060-c07f : 0000:00:03.0
> > > > > >     c060-c07f : virtio-pci
> > > > > >
> > > > > > After unbind:
> > > > > >
> > > > > > [root@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@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?
> > > > > Oh, we could firstly check if this port is manipulated by kernel driver
> > > > > in virtio_resource_init/eth_virtio_dev_init, as long as it is not too late.
> > > 
> > > Why can't we simply quit at pci_scan_one, once finding that it's not
> > > bond to uio (or similar stuff)? That would be generic enough, that we
> > > don't have to do similar checks for each new pmd driver.
> > > 
> > > Or, am I missing something?
> > 
> > UIO is not needed to make virtio works (without interrupt support).
> > Sometimes it may be required to avoid using kernel modules.
> 
> While dig the git history, I found the commit:
> 
>     commit da978dfdc43b59e290a46d7ece5fd19ce79a1162
>     Author: Ouyang Changchun <changchun.ouyang@intel.com>
>     Date:   Mon Feb 9 09:14:06 2015 +0800
>     
>         virtio: use port IO to get PCI resource
>     
>         Make virtio not require UIO for some security reasons, this is to match
>         6WIND's virtio-net-pmd.
>     
>         Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
>         Acked-by: Huawei Xie <huawei.xie@intel.com>
> 
> The commit log is not well written, giving no explanation about the
> "some security reasons".
> 
> Anyway, I see it now that it's kind of a design.
> 
> 
> Note that my first patch set about enabling virtio 1.0 [0] sets the
> RTE_PCI_DRV_NEED_MAPPING flag, which somehow implies that uio is a
> must, otherwise, eal init would fail at pci_map_device().
> 
> So that my pathset breaks the un-documented rule, and I need fix it.
> How about adding a wrapper, say rte_pci_map_device(), and exporting
> it, so that virtio pmd driver could map resources when necessary?
> 
> [0]: http://dpdk.org/dev/patchwork/bundle/yliu/virtio-1.0-pmd/
> 
> 
> > > > I guess there might be two problems? Which are:
> > > > 
> > > > 1. How user avoid DPDK taking over virtio devices that they do not
> > > >    want for IO (chooses which device to use)
> > > 
> > > Isn't that what's the 'binding/unbinding' for?
> > 
> > Binding is, sometimes, required.
> 
> We may need fix the doc then. As the doc says it's a must:
> 
>     3.6. Binding and Unbinding Network Ports to/from the Kernel Modules
> 
>     Instead, all ports that are to be used by an DPDK application
> ==> must be bound to the uio_pci_generic, igb_uio or vfio-pci
>     module before the application is run. Any network ports under
>     Linux* control will be ignored by the DPDK poll-mode drivers
>     and cannot be used by the application.
> 
> 
> 	--yliu
> 
> > But does it mean DPDK should use every available ports?
> > That's the default and may be configured with blacklist/whitelist.
> > 
> > > > 2. Driver conflict between virtio PMD in DPDK, and virtio-pci in
> > > >    kernel (happens on every virtio device that DPDK uses)
> > > 
> > > If you unbinded the kernel driver first, which is the suggested (or
> > > must?) way to use DPDK, that will not happen.


As far as I remember; there are some environments where DPDK but guests are not
allowed to load their own kernel modules. But since virtio only needs access to
I/O ports on x86, the driver can accomodate. I haven't run into these environments.

But the added code in virtio driver causes issues. Mostly because it causes
an unnecessary duplication of the initialization code, and is missing many of
the protections and interfaces that exist in the base code. For example,
there are lots of corner cases in interrupt support which are related to
this non-UIO mode of operation.

  reply	other threads:[~2015-12-24 17:56 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22  3:50 Peter Xu
2015-12-22  7:00 ` Yuanhan Liu
2015-12-22  8:23   ` Peter Xu
2015-12-22  8:32     ` Yuanhan Liu
2015-12-22  9:56       ` Peter Xu
2015-12-22 10:47         ` Xie, Huawei
2015-12-22 10:53           ` Xie, Huawei
2015-12-22 11:39           ` Peter Xu
2015-12-22 14:31             ` Xie, Huawei
2015-12-22 16:38             ` Xie, Huawei
2015-12-23  1:55               ` Peter Xu
2015-12-23  2:09                 ` Yuanhan Liu
2015-12-23  2:38                   ` Peter Xu
2015-12-23 22:26                   ` Thomas Monjalon
2015-12-24  3:30                     ` Yuanhan Liu
2015-12-24 17:56                       ` Stephen Hemminger [this message]
2015-12-23  2:01         ` Yuanhan Liu
2015-12-23  2:41           ` Peter Xu
2015-12-23  2:58             ` Yuanhan Liu
2015-12-23  5:13               ` Xie, Huawei
2015-12-23 22:20                 ` Thomas Monjalon
2015-12-24 18:38 ` [dpdk-dev] [PATCH 0/4] check if any kernel driver is manipulating the virtio device Huawei Xie
2015-12-24 18:38   ` [dpdk-dev] [PATCH 1/4] eal: make the comment more accurate Huawei Xie
2015-12-24 18:38   ` [dpdk-dev] [PATCH 2/4] eal: set kdrv to RTE_KDRV_NONE if kernel driver isn't manipulating the device Huawei Xie
2015-12-28 20:24     ` David Marchand
2015-12-24 18:38   ` [dpdk-dev] [PATCH 3/4] virtio: return 1 to tell the upper layer we don't take over this device Huawei Xie
2015-12-28  5:25     ` Yuanhan Liu
2015-12-28  5:38       ` Xie, Huawei
2015-12-24 18:38   ` [dpdk-dev] [PATCH 4/4] virtio: check if any kernel driver is manipulating the device Huawei Xie
2015-12-28  5:26     ` Yuanhan Liu
2015-12-28  5:29       ` Xie, Huawei
2016-01-04  9:02     ` Xie, Huawei
2016-01-04 17:29       ` Stephen Hemminger
2016-01-05 14:44       ` Panu Matilainen
2015-12-28  3:08   ` [dpdk-dev] [PATCH 0/4] check if any kernel driver is manipulating the virtio device Peter Xu
2016-01-03 17:56 ` [dpdk-dev] [PATCH v2 0/4] fix the issue that DPDK takes over virtio device blindly Huawei Xie
2016-01-03 17:56   ` [dpdk-dev] [PATCH v2 1/4] eal: make the comment more accurate Huawei Xie
2016-01-03 17:56   ` [dpdk-dev] [PATCH v2 2/4] eal: set kdrv to RTE_KDRV_NONE if kernel driver isn't manipulating the device Huawei Xie
2016-01-03 17:56   ` [dpdk-dev] [PATCH v2 3/4] virtio: return 1 to tell the upper layer we don't take over this device Huawei Xie
2016-01-03 17:56   ` [dpdk-dev] [PATCH v2 4/4] virtio: check if any kernel driver is manipulating the virtio device Huawei Xie
2016-01-04 17:24     ` Stephen Hemminger
2016-01-04 17:56       ` Xie, Huawei
2016-01-05  1:56         ` Yuanhan Liu
2016-01-07 13:17         ` Ferruh Yigit
2016-01-07 14:17     ` Panu Matilainen
2016-01-27 12:43       ` Thomas Monjalon
2016-01-04 17:25   ` [dpdk-dev] [PATCH v2 0/4] fix the issue that DPDK takes over virtio device blindly Stephen Hemminger
2016-01-12  3:02     ` Xie, Huawei
2016-01-12  4:23       ` Santosh Shukla
2016-01-12  5:16         ` Xie, Huawei
2016-01-13 12:17           ` Santosh Shukla
2016-01-27 15:21 ` [dpdk-dev] [PATCH v3 " Huawei Xie
2016-01-27 15:21   ` [dpdk-dev] [PATCH v3 1/4] eal: make the comment more accurate Huawei Xie
2016-01-27 15:21   ` [dpdk-dev] [PATCH v3 2/4] eal: set kdrv to RTE_KDRV_NONE if kernel driver isn't manipulating the device Huawei Xie
2016-01-27 15:21   ` [dpdk-dev] [PATCH v3 3/4] virtio: return 1 to tell the upper layer we don't take over this device Huawei Xie
2016-01-27 15:21   ` [dpdk-dev] [PATCH v3 4/4] virtio: check if kernel driver is manipulating the virtio device Huawei Xie
2016-01-28  9:55     ` Panu Matilainen
2016-01-29  7:40   ` [dpdk-dev] [PATCH v3 0/4] fix the issue that DPDK takes over virtio device blindly Yuanhan Liu
2016-02-24 12:43   ` Thomas Monjalon
2016-02-26  6:09     ` Xie, Huawei
2016-02-26  8:40       ` David Marchand
2016-02-26  9:00         ` Xie, Huawei
2016-02-26  1:53 ` [dpdk-dev] [PATCH v4 " Huawei Xie
2016-02-26  1:53   ` [dpdk-dev] [PATCH v4 1/4] eal: make the comment more accurate Huawei Xie
2016-02-29  8:48     ` David Marchand
2016-02-26  1:53   ` [dpdk-dev] [PATCH v4 2/4] eal: set kdrv to RTE_KDRV_NONE if kernel driver isn't managing the device Huawei Xie
2016-02-29  2:34     ` Xie, Huawei
2016-02-29  8:46     ` David Marchand
2016-02-29  9:00       ` Xie, Huawei
2016-02-29  9:05         ` David Marchand
2016-02-26  1:53   ` [dpdk-dev] [PATCH v4 3/4] eal: call pci_ioport_map when " Huawei Xie
2016-02-29  9:02     ` David Marchand
2016-02-26  1:53   ` [dpdk-dev] [PATCH v4 4/4] virtio: return 1 to tell the upper layer we don't take over this device Huawei Xie
2016-02-29 13:15     ` Santosh Shukla
2016-03-01  7:16     ` Thomas Monjalon
2016-03-01  7:53       ` Xie, Huawei
2016-03-01  8:20         ` Thomas Monjalon
2016-03-01  8:39           ` Xie, Huawei
2016-03-01  9:55             ` Thomas Monjalon
2016-03-01 10:08               ` Xie, Huawei
2016-03-08 17:00                 ` Xie, Huawei
2016-03-08 23:01                 ` Thomas Monjalon
2016-03-08 15:33 ` [dpdk-dev] [PATCH v5 0/6] fix the issue that DPDK takes over virtio device blindly Huawei Xie
2016-03-08 15:33   ` [dpdk-dev] [PATCH v5 1/6] eal: make the comment more accurate Huawei Xie
2016-03-08 15:33   ` [dpdk-dev] [PATCH v5 2/6] eal: RTE_KDRV_NONE means kernel driver isn't managing the device Huawei Xie
2016-03-08 15:33   ` [dpdk-dev] [PATCH v5 3/6] eal: use new RTE_ARCH_X86 for x86 arch Huawei Xie
2016-03-09 23:04     ` Thomas Monjalon
2016-03-08 15:33   ` [dpdk-dev] [PATCH v5 4/6] eal: simple code rework Huawei Xie
2016-03-08 15:33   ` [dpdk-dev] [PATCH v5 5/6] eal: map IO port when kernel driver isn't managing the device Huawei Xie
2016-03-08 15:33   ` [dpdk-dev] [PATCH v5 6/6] virtio: return 1 to tell the upper layer we don't take over this device Huawei Xie
2016-03-09 23:23     ` Thomas Monjalon
2016-03-09 23:35   ` [dpdk-dev] [PATCH v5 0/6] fix the issue that DPDK takes over virtio device blindly Thomas Monjalon

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=20151224095652.5a2adfe6@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=dev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).