From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B9406433B7; Fri, 24 Nov 2023 11:29:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A54E3402B3; Fri, 24 Nov 2023 11:29:45 +0100 (CET) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by mails.dpdk.org (Postfix) with ESMTP id 024A740283 for ; Fri, 24 Nov 2023 11:29:44 +0100 (CET) Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2c878e228b4so21835611fa.1 for ; Fri, 24 Nov 2023 02:29:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700821783; x=1701426583; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=PkIbqTmmSnUa1L+/Yrmxw6gA07D+VVudkzO3onvW100=; b=Us+ePsUT1Suwi3lmlc8LucKcdNWSpD5Ekuwh5wHs59WYdHIrLFgxyxRafe+C6Hs0B2 bt8mzdd2DNmdQLHV5srVshSx4MINeL1YSGfiyCzHiNA1DKljAun77tW3XhZb7zl+aM9o 4ubl2IggzM9xVUC5O/OF5SmEaJ0LDP8u6/6///njj6IAeOEIOdFDmDp64zvQ7Cg9fLaZ emIwrlR4IZ4kgNwwmN1UvEp0QESymMqERWS1jfo+pcuyd5ecg4w2AtKnzKXJUafndGsi rQBETbnQFc8gHOF8lsk+M7AnKjyiFptuAdVoYIph027QFJG6z1XAyeU/s3VaD1yCmnWz gEqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700821783; x=1701426583; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PkIbqTmmSnUa1L+/Yrmxw6gA07D+VVudkzO3onvW100=; b=p1P/bQ2xTBh62K0NUq36hrbSfnfrCaduN7UUEH8T+FInbkNqFVyWpvPzS60+r0mYuj O+bg9SyNqNf9wQL4aHKCiP6h6o1w3VidVAptKVnULvwX3s5NM14Mrvy51hkUb/vF31pw FJ4t9iBfs+JGJwITZx2H28zNVaIdojfpUkNETnd+rMFj4xn0rHPVuc+V+7oKuh7+eWRi KkGSMA5MeZE7MEsJoC3ZaCaNavn7kuK58Oke+dbe+ilT9D3eAYGYJx/kdtlZhPY6f3ts iXyuycilLkFBEr5Pppn5O4JnhAmwH+7NR8Lx9U2L4uGx3c2ehL0UJ+AQQf+kcctWILlq C/0w== X-Gm-Message-State: AOJu0Yw+021yGjiH/Sy//j2cuFzyg7Z/NWupffMxq+Innjy0VslxR5Q+ wb9d7CfF/E1mnCDjsM9wWak= X-Google-Smtp-Source: AGHT+IFnbkW9yLU5/ukS1yCXEoddQ2I2NuQFsqaz1RmZK/Wkt1BCpKAvK8OWff10H9V2XBYLEwc3hA== X-Received: by 2002:a2e:8196:0:b0:2bc:c004:cc22 with SMTP id e22-20020a2e8196000000b002bcc004cc22mr1501699ljg.33.1700821783096; Fri, 24 Nov 2023 02:29:43 -0800 (PST) Received: from sovereign (broadband-109-173-110-33.ip.moscow.rt.ru. [109.173.110.33]) by smtp.gmail.com with ESMTPSA id y15-20020a05651c154f00b002c876944825sm458211ljp.53.2023.11.24.02.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 02:29:42 -0800 (PST) Date: Fri, 24 Nov 2023 13:29:41 +0300 From: Dmitry Kozlyuk To: christian.ehrhardt@canonical.com Cc: dev , Luca Boccassi , David Wilder Subject: Re: [PATCH v2] eal/linux: force iova-mode va without pa available Message-ID: <20231124132941.4fe0f846@sovereign> In-Reply-To: <20231124100904.388453-1-christian.ehrhardt@canonical.com> References: <20231124100904.388453-1-christian.ehrhardt@canonical.com> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 2023-11-24 11:09 (UTC+0100), christian.ehrhardt@canonical.com: [...] > diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c > index 57da058cec..2f1fce3c54 100644 > --- a/lib/eal/linux/eal.c > +++ b/lib/eal/linux/eal.c > @@ -1067,6 +1067,16 @@ rte_eal_init(int argc, char **argv) > > phys_addrs = rte_eal_using_phys_addrs() != 0; > > + if (!phys_addrs) { > + /* if we have no access to physical addresses, pick IOVA as VA mode. */ > + if (internal_conf->iova_mode == RTE_IOVA_PA) > + RTE_LOG(WARNING, EAL, "WARNING: --iova-mode=pa, but Physical addresses are unavailable, selecting IOVA as VA mode.\n"); If an impossible combination of options is requested, initialization should fail instead. > + else > + RTE_LOG(DEBUG, EAL, "Physical addresses are unavailable, selecting IOVA as VA mode.\n"); > + internal_conf->iova_mode = RTE_IOVA_VA; > + rte_eal_get_configuration()->iova_mode = internal_conf->iova_mode; > + } > + > /* if no EAL option "--iova-mode=", use bus IOVA scheme */ > if (internal_conf->iova_mode == RTE_IOVA_DC) { > /* autodetect the IOVA mapping mode */ What do you think about keeping the existing code structure: if (--iova-mode not specified) { iova_mode = VA if !phys_addrs or !RTE_IOVA_IN_MBUF (with logs) if (iova_mode == DC) { // autodetect from bus requirements and IOMMU (with logs) } rte_eal_get_configuration()->iova_mode = iova_mode; } else { rte_eal_get_configuration()->iova_mode = internal_conf->iova_mode; } // verify rte_eal_get_configuration()->iova_mode Note: the logic should be consistent across OS when possible.