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 6F143A318B for ; Fri, 18 Oct 2019 10:34:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ECF531C11E; Fri, 18 Oct 2019 10:34:01 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id D1CFB1C035 for ; Fri, 18 Oct 2019 10:34:00 +0200 (CEST) Received: from mail-vk1-f200.google.com (mail-vk1-f200.google.com [209.85.221.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C2BF7BDAE for ; Fri, 18 Oct 2019 08:34:00 +0000 (UTC) Received: by mail-vk1-f200.google.com with SMTP id q187so2089950vkq.4 for ; Fri, 18 Oct 2019 01:34:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9ZXrYmDgTW4SH4BChmKtS8HFN7ZJLdl/2aYsL+MsV4Q=; b=F3X/oBvhhjM7cHwmETAnf3v476tL3FAYvYUZh5ZMd1bAbQC7m176U/Tj1ikwKYJp2p 337DQi6rZv9+T9nbi0ASemeqJFHsmxEUpWp5BPBcCOT42+67bIcdHwwPGgV+5/0nxkAD MjLPuERH4a1K/SVeJzjITUZPK+G1WpXTnCdDI8+PXDeAQ3ErkpPkjBZ4riHHNjTCKJUY SmuX2p3vUD6G//mhithScBs6fvwdzxXVpMiRd2yGRcXyTNLGxsPYaxN882AXcIDntKDZ 9zM6yp+6C/Fk2u1zTlXwQvhrAYcXRn9tfvrUd3kZtI/4d4Wn7Ou8EFxl6mVLpH7rJ2Ko alUA== X-Gm-Message-State: APjAAAVgMsjPoBVMjLXjTyZj6WI3tdJVsjglTHwIM8s/IObVG+jdfhqz a9QcqbOi96X3htI7a7jJWXvLRn7qgETwnr+svCTEA9Ao4/Yuj+tiBW2OrMXb/ePXaSGRfo0H2Cv CYoRhpGFlrnf0+5/7Wcc= X-Received: by 2002:a67:fa99:: with SMTP id f25mr2142579vsq.141.1571387639301; Fri, 18 Oct 2019 01:33:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqyn6rxEMf/Q+oE0i99fFUarvcLdkiTb/Oww4xpPe8PAH7LfCMGIGYNrCXjIuOhQL/jJ6853OLfRmvYvgF6LN7U= X-Received: by 2002:a67:fa99:: with SMTP id f25mr2142562vsq.141.1571387638936; Fri, 18 Oct 2019 01:33:58 -0700 (PDT) MIME-Version: 1.0 References: <1571313388-32142-1-git-send-email-david.marchand@redhat.com> <1571313388-32142-3-git-send-email-david.marchand@redhat.com> <20191018081611.GA19046@___> In-Reply-To: <20191018081611.GA19046@___> From: David Marchand Date: Fri, 18 Oct 2019 10:33:47 +0200 Message-ID: To: Tiwei Bie Cc: dev , Maxime Coquelin , Zhihong Wang Content-Type: text/plain; charset="UTF-8" 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: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. > > 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