[dpdk-dev] [PATCH v2] net/virtio: avoid annoying IOPL call related errors
David Marchand
david.marchand at redhat.com
Fri Nov 23 16:02:01 CET 2018
On Fri, Nov 23, 2018 at 3:36 PM Ilya Maximets <i.maximets at samsung.com>
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 beaks most of the OVS unit
> tests if it built with DPDK support.
>
breaks
>
> 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.
>
Yes, that's the important part to avoid issues with the interrupt thread
which is spawned later and inherits the capa from the thread running
rte_eal_init, iirc.
> Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
>
Reviewed-by: David Marchand <david.marchand at redhat.com>
I wonder if we could move the "new" iopl check even later when probing a
device since it only makes sense in legacy mode when using uio.
But this patch keeps previous behaviour.
diff --git a/lib/librte_eal/bsdapp/eal/eal.c
> b/lib/librte_eal/bsdapp/eal/eal.c
> index 508cbc46f..b8152a75c 100644
> --- a/lib/librte_eal/bsdapp/eal/eal.c
> +++ b/lib/librte_eal/bsdapp/eal/eal.c
> @@ -556,9 +556,11 @@ int rte_eal_has_hugepages(void)
> int
> rte_eal_iopl_init(void)
> {
> - static int fd;
> + static int fd = -1;
> +
> + if (fd < 0)
> + fd = open("/dev/io", O_RDWR);
>
> - fd = open("/dev/io", O_RDWR);
> if (fd < 0)
> return -1;
> /* keep fd open for iopl */
>
Good catch.
Should be a separate fix.
--
David Marchand
More information about the dev
mailing list