From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id 8E5861B5A3 for ; Fri, 23 Nov 2018 16:02:14 +0100 (CET) Received: by mail-pl1-f194.google.com with SMTP id x21-v6so10757585pln.9 for ; Fri, 23 Nov 2018 07:02:14 -0800 (PST) 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=NfcZJTEhN9xihgD/oDMSV7qqtawGQRJo+Fc1ID9Stms=; b=hXkzBL4HD6WHLpgS+GjoWQD3cLJ/Q0iULHFZR712Oujl1SHnUMbtGK/FwNPOSQRjEk 6Xx0Hze8qW3mC3R9tcQDVTY47tQoimPTNdU7FGXYk0Ip90dxxqXK18ZwTmnTse8kq6sv +Xk1WVE/Qi3Jwj6RcrFp8+DcCKL5O2dCA7mt0iqlt5WkNuNk1ocitcJoZD/euPijN4C7 qXywdMj49FnrHE+sc+YVr907fJvXir9uXIz6gDeB/RKtqjSN37ZH23da6y+/8gDEOZty dv1RS/VwyAU88uHOZ0oqGdKFrIhOtOavsiOxes4VuQPc8qh89yhUCao8nzA2SESAu362 2nEw== X-Gm-Message-State: AA+aEWbR+n3KL11FOoRYaoTCPvtSfv188M9JKUlFZAaSmyTuBXrrFSVS K1qcNUDJwVkSOo13ZoZxeXgDAwLDTULMOr+C7bBZtw== X-Google-Smtp-Source: AFSGD/UiWHZz5tlJgWymgRXlN4BihdiLFrg51D3xBwhIUihjKZtjz+elzTADZTOC/I5iLY9bK6C86HpOs204Yab9XZo= X-Received: by 2002:a17:902:780c:: with SMTP id p12mr15709211pll.197.1542985333905; Fri, 23 Nov 2018 07:02:13 -0800 (PST) MIME-Version: 1.0 References: <20181123141739.11214-1-i.maximets@samsung.com> <20181123143620.10480-1-i.maximets@samsung.com> In-Reply-To: <20181123143620.10480-1-i.maximets@samsung.com> From: David Marchand Date: Fri, 23 Nov 2018 16:02:01 +0100 Message-ID: To: i.maximets@samsung.com Cc: dev@dpdk.org, maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com, thomas@monjalon.net, ferruh.yigit@intel.com, ian.stokes@intel.com, Kevin Traynor Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v2] 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2018 15:02:15 -0000 On Fri, Nov 23, 2018 at 3:36 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 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 > Reviewed-by: David Marchand 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