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 1CF0DA0564; Tue, 24 Mar 2020 07:19:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C04DD1C0AD; Tue, 24 Mar 2020 07:19:51 +0100 (CET) Received: from mail-il1-f194.google.com (mail-il1-f194.google.com [209.85.166.194]) by dpdk.org (Postfix) with ESMTP id 432831C0AB for ; Tue, 24 Mar 2020 07:19:50 +0100 (CET) Received: by mail-il1-f194.google.com with SMTP id l14so15696887ilj.8 for ; Mon, 23 Mar 2020 23:19:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sdm/XEwcGZ+0ei3EA3vwYzInbcjkPJ4oOU1gEAp/r9Q=; b=Rz5QMwvvYElp8XP/LJZx50gN2Zio2kMrqSw+aveiD27bSy8J8Lo2GRcGNKeG2hz/p+ cZnoXaY7fhZKLTBXXhmC+Cojre3K8m8G1BY6XT30GC+SG/CkNI+sdfSBy4rKzp8xgXFS 34jc8m6ck3wCm2MW2TeucaQ3S+zhppCEKnxA3/DQt3d3bUB2XgIKZjjbkmNoZTMl9zuG bUg2UCKV3z/xZx56xFg/vCbb6/i6S6NnA8zBJpDHkWG7q/nffGJSmDgHD5KQwQb7JRMI JNfsIMrrkZSZKxbuok6ZKYwtvv9EFhDOl4MONuYbUIQM1phvv2TwnaHS67OcU59UWIkp ID9Q== 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=sdm/XEwcGZ+0ei3EA3vwYzInbcjkPJ4oOU1gEAp/r9Q=; b=CJYKJLjqOlKsqWZoVavgoH9DK2yP9pAYmPOy9z/2xtM8xsqD9ChWD4TwVWcyAJPmpP TFg4ukPUpWBa3JlJ9ZEbrq9WkQ/TdBDalz2N8X0AiALnY93fxAHkSKW5U00CkUQOEcVc b1g4LSBnf7e2dcJF1nwaDgzHrqG7uvuq2kLzSDxkIuT0F/4mXgcwZEjKxD/08gU9Dccq 4NG3rgR1WpOlaqYUkVZlOEan1E2SinP49kK0IsE18HuYL40oEhyTlgI1NlVxZoKdULMQ CJ1467htIUhwoNpnoj2LpZzifIMaQdRSm1YOfVVV8Ujl/PfNMaE17J+COF8QX0gIx4EC ph/w== X-Gm-Message-State: ANhLgQ2gH0WHo2fa3MetDIgkygQBf7S+Ifoyk/7efckGxYSFwWTTL2Xq Yb71UIn8KBcYoV09ZVI/y4lrbvHD4ikX4dcVr+E= X-Google-Smtp-Source: ADFU+vuoyiW48d0HZ8hfNMN6PJOugn7xY8JjGkYnJ0cqulCgwARtipJf9b0ne/kyTgCrLecnPhoJK5xSrca/6KPvs8c= X-Received: by 2002:a92:cbc6:: with SMTP id s6mr382100ilq.271.1585030789349; Mon, 23 Mar 2020 23:19:49 -0700 (PDT) MIME-Version: 1.0 References: <20200220225207.30411-1-dwilder@us.ibm.com> <20200220225207.30411-2-dwilder@us.ibm.com> In-Reply-To: From: Jerin Jacob Date: Tue, 24 Mar 2020 11:49:33 +0530 Message-ID: To: dwilder Cc: Aaron Conole , Michael Santana , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , dpdk-dev , "Ruifeng Wang (Arm Technology China)" , David Marchand , David Christensen , David Wilder Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v3 1/3] eal/linux: select iova-mode va with no-huge option 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 Mon, Mar 23, 2020 at 11:11 PM dwilder wrote: > > Thanks you for your review Jerin. See my responses are inline. > > On 2020-03-20 06:24, Jerin Jacob wrote: > > On Fri, Feb 21, 2020 at 4:22 AM David Wilder > > wrote: > >> > >> If --no-huge is set and iova-mode has not been specified force VA > >> mode. > >> If --no-huge and --iova-mode=PA is requested error out as this is > >> an impossible configuration. > >> > >> Signed-off-by: David Wilder > >> --- > >> lib/librte_eal/linux/eal/eal.c | 14 ++++++++++++++ > >> 1 file changed, 14 insertions(+) > >> > >> diff --git a/lib/librte_eal/linux/eal/eal.c > >> b/lib/librte_eal/linux/eal/eal.c > >> index 9530ee55f..d3a0a1731 100644 > >> --- a/lib/librte_eal/linux/eal/eal.c > >> +++ b/lib/librte_eal/linux/eal/eal.c > >> @@ -1062,9 +1062,16 @@ rte_eal_init(int argc, char **argv) > >> > >> /* if no EAL option "--iova-mode=", use bus IOVA scheme > >> */ > >> if (internal_config.iova_mode == RTE_IOVA_DC) { > >> + > >> /* autodetect the IOVA mapping mode */ > >> enum rte_iova_mode iova_mode = > >> rte_bus_get_iommu_class(); > >> > >> + if (iova_mode == RTE_IOVA_PA && > >> !rte_eal_has_hugepages()) { > >> + iova_mode = RTE_IOVA_VA; > > > > > What if igb_uio or vfio_nommu has been loaded(i.e no iommu support > > enabled from the driver)? This would fail. > > Yes they would fail. If igb_uio or vfio_nommu (or any driver) cant be > forced to VA mode it cant be used with out hugepages. Drivers can be > available but not used therefor we print a warning message. I think, the warning will not be enough as the system will fail anyway. iova_mode == RTE_IOVA_PA && rte_eal_has_hugepages() == 0 && no_iommu == 1 case, we need to return error. iova_mode == RTE_IOVA_PA && rte_eal_has_hugepages() == 0 && no_iommu == 0 case warning is enough. > > > > >> + RTE_LOG(WARNING, EAL, "Some buses want 'PA' > >> but forcing 'VA' because --no-huge is requested.\n"); > >> + RTE_LOG(WARNING, EAL, "Not all buses may be > >> able to initialize.\n"); > >> + } > >> + > >> if (iova_mode == RTE_IOVA_DC) { > >> RTE_LOG(DEBUG, EAL, "Buses did not request a > >> specific IOVA mode.\n"); > >> > >> @@ -1111,6 +1118,13 @@ rte_eal_init(int argc, char **argv) > >> internal_config.iova_mode; > >> } > >> > >> + if (rte_eal_iova_mode() == RTE_IOVA_PA && > >> + rte_eal_has_hugepages() == 0) { > >> + rte_eal_init_alert("Cannot use IOVA as 'PA' with > >> --no-huge"); > > > > Top of the tree already detecting this case. am I missing anything? > > > > [master]dell[dpdk.org] $ sudo ./build/app/test/dpdk-test -c 0x3 > > --no-huge --iova-mode=pa > > EAL: Detected 56 lcore(s) > > EAL: Detected 2 NUMA nodes > > EAL: Static memory layout is selected, amount of reserved memory can > > be adjusted with -m or --socket-mem > > EAL: Multi-process socket /var/run/dpdk/rte/mp_socket > > EAL: FATAL: Cannot use IOVA as 'PA' since physical addresses are not > > available > > EAL: Cannot use IOVA as 'PA' since physical addresses are not available > > > > The check you reference is reporting that physical address are not > available, for example no permissions to read /proc/self/pagemap. In > this case, if --no-huge is set then PA mode is not allowed. There is no > guarantee that physical address are persistent with out using hugepages. Since this check is under the following, Yes, make sense for the check. The old command has explicit --iova-mode=pa. So it is in the different code paths. /* if no EAL option "--iova-mode=", use bus IOVA scheme */ if (internal_config.iova_mode == RTE_IOVA_DC) { > > > >> + rte_errno = EINVAL; > >> + return -1; > >> + } > >> + > >> if (rte_eal_iova_mode() == RTE_IOVA_PA && !phys_addrs) { > >> rte_eal_init_alert("Cannot use IOVA as 'PA' since > >> physical addresses are not available"); > >> rte_errno = EINVAL; > >> -- > >> 2.25.0 > >>