From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <maxime.coquelin@redhat.com>
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by dpdk.org (Postfix) with ESMTP id D487A4F9B
 for <dev@dpdk.org>; Fri, 23 Nov 2018 18:34:30 +0100 (CET)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
 [10.5.11.13])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.redhat.com (Postfix) with ESMTPS id 22845C049580;
 Fri, 23 Nov 2018 17:34:30 +0000 (UTC)
Received: from [10.36.112.54] (ovpn-112-54.ams2.redhat.com [10.36.112.54])
 by smtp.corp.redhat.com (Postfix) with ESMTPS id 37A2A17A91;
 Fri, 23 Nov 2018 17:34:23 +0000 (UTC)
To: Ilya Maximets <i.maximets@samsung.com>, dev@dpdk.org,
 David Marchand <david.marchand@redhat.com>
Cc: Tiwei Bie <tiwei.bie@intel.com>, Zhihong Wang <zhihong.wang@intel.com>,
 Thomas Monjalon <thomas@monjalon.net>, Ferruh Yigit
 <ferruh.yigit@intel.com>, Ian Stokes <ian.stokes@intel.com>,
 Kevin Traynor <ktraynor@redhat.com>,
 Bruce Richardson <bruce.richardson@intel.com>
References: <20181123143620.10480-1-i.maximets@samsung.com>
 <20181123153920.12398-1-i.maximets@samsung.com>
 <CGME20181123153951eucas1p1218331b7e51db8eae3073fa6a14f3bcd@eucas1p1.samsung.com>
 <20181123153920.12398-3-i.maximets@samsung.com>
From: Maxime Coquelin <maxime.coquelin@redhat.com>
Message-ID: <b345eb50-b94a-7255-a0f5-87f723f65185@redhat.com>
Date: Fri, 23 Nov 2018 18:34:22 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.2.1
MIME-Version: 1.0
In-Reply-To: <20181123153920.12398-3-i.maximets@samsung.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.5.110.31]); Fri, 23 Nov 2018 17:34:30 +0000 (UTC)
Subject: Re: [dpdk-dev] [PATCH v3 2/2] net/virtio: avoid annoying IOPL call
 related errors
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 23 Nov 2018 17:34:31 -0000



On 11/23/18 4:39 PM, Ilya Maximets wrote:
> In case of running with not enough capabilities, i.e. running as
> non-root user any application linked with DPDK prints the message
> about IOPL call failure even if it was just called like
> './testpmd --help'. For example, this breaks most of the OVS unit
> tests if it built with DPDK support.
> 
> Let's register the virtio driver unconditionally and print error
> message while probing the device. Silent iopl() call left in the
> constructor to have privileges as early as possible as it was before.
> 
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>
> ---
>   drivers/net/virtio/virtio_ethdev.c | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index e1fe36a23..2ba66d291 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -1760,6 +1760,11 @@ vdpa_mode_selected(struct rte_devargs *devargs)
>   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;
> @@ -1785,11 +1790,7 @@ static struct rte_pci_driver rte_virtio_pmd = {
>   
>   RTE_INIT(rte_virtio_pmd_init)
>   {
> -	if (rte_eal_iopl_init() != 0) {
> -		PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD");
> -		return;
> -	}
> -
> +	rte_eal_iopl_init();
>   	rte_pci_register(&rte_virtio_pmd);
>   }
>   
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime