From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 81274A31F3 for ; Fri, 18 Oct 2019 12:08:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 49ADC1C230; Fri, 18 Oct 2019 12:08:22 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 80F1C1C212 for ; Fri, 18 Oct 2019 12:08:21 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Oct 2019 03:08:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,311,1566889200"; d="scan'208";a="221694791" Received: from dpdk-virtio-tbie-2.sh.intel.com (HELO ___) ([10.67.104.74]) by fmsmga004.fm.intel.com with ESMTP; 18 Oct 2019 03:08:19 -0700 Date: Fri, 18 Oct 2019 18:05:14 +0800 From: Tiwei Bie To: David Marchand Cc: dev , Maxime Coquelin , Zhihong Wang Message-ID: <20191018100514.GA6862@___> References: <1571313388-32142-1-git-send-email-david.marchand@redhat.com> <1571313388-32142-3-git-send-email-david.marchand@redhat.com> <20191018081611.GA19046@___> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH 2/2] net/virtio: do not require IO permissions 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, Oct 18, 2019 at 10:33:47AM +0200, David Marchand wrote: > On Fri, Oct 18, 2019 at 10:19 AM Tiwei Bie wrote: > > On Thu, Oct 17, 2019 at 01:56:28PM +0200, David Marchand wrote: > > > On x86, iopl permissions are only needed when the virtio devices are > > > bound to a uio kernel module. > > > > > > When running a dpdk application as non root, the virtio driver was > > > refusing to register because of this check while it could work when > > > binding the device to vfio (requires to have a vIOMMU configured). > > > > > > We still need to call rte_eal_iopl_init() in the constructor so that > > > the interrupt thread would inherit this permission in the case it could > > > be used with UIO later. > > > Log a warning message for the user to understand what is wrong. > > > > > > Signed-off-by: David Marchand > > > --- > > > drivers/net/virtio/virtio_ethdev.c | 8 ++------ > > > 1 file changed, 2 insertions(+), 6 deletions(-) > > > > > > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > > > index 7261109..3506ca0 100644 > > > --- a/drivers/net/virtio/virtio_ethdev.c > > > +++ b/drivers/net/virtio/virtio_ethdev.c > > > @@ -1995,11 +1995,6 @@ exit: > > > static int eth_virtio_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, > > > struct rte_pci_device *pci_dev) > > > { > > > - if (rte_eal_iopl_init() != 0) { > > > - PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD"); > > > - return 1; > > > - } > > > - > > > /* virtio pmd skips probe if device needs to work in vdpa mode */ > > > if (vdpa_mode_selected(pci_dev->device.devargs)) > > > return 1; > > > @@ -2031,7 +2026,8 @@ static struct rte_pci_driver rte_virtio_pmd = { > > > > > > RTE_INIT(rte_virtio_pmd_init) > > > { > > > - rte_eal_iopl_init(); > > > + if (rte_eal_iopl_init() != 0) > > > + PMD_INIT_LOG(WARNING, "IOPL call failed - virtio devices won't be functional if bound to UIO drivers"); > > > > Basically this will undo what below commit did, i.e. > > annoying log will show again. > > > > https://github.com/DPDK/dpdk/commit/705dced4a72a1053368c84c4b68f04f028a78b30 > > Yes.. true. > I wanted to keep a trace for debug, so maybe lower this to debug > level, or just drop this message. > > > > > > Maybe it's better to print this error when we really > > need the port IO (legacy device): > > virtio calls rte_pci_ioport_map, so I suppose we can change the log > level to ERR in the first patch of this series: > http://patchwork.dpdk.org/patch/61370/ > > And I suppose I could add some context in this log, like the device name. Sounds like a good idea to me. Thanks, Tiwei > > > > > https://github.com/DPDK/dpdk/blob/31b798a6f08e9b333b94b8bb26910209aa810b73/drivers/net/virtio/virtio_pci.c#L679-L680 > > https://github.com/DPDK/dpdk/blob/31b798a6f08e9b333b94b8bb26910209aa810b73/drivers/net/virtio/virtio_ethdev.c#L1834-L1835 > > > -- > David Marchand