From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 51D24A04C6;
	Fri, 15 Nov 2019 15:57:08 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id DCE83374;
	Fri, 15 Nov 2019 15:57:07 +0100 (CET)
Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com
 [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id 1BC7F1F5
 for <dev@dpdk.org>; Fri, 15 Nov 2019 15:57:06 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1573829825;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=6p9Q1LEb5iMAChLnHXbVKAwCVK4xQ4eG9xn7kkB8W94=;
 b=i3XK5WbuJP4kEMb5XBIeEBantvjlZSeHDZf8+hcDBIZmxz7gD2fXPtx8ngIB0oIip8FwhV
 TIYrwNMoMn8Ou7/06PbdaqIwDYoukOKg9LddRf5mJ6e7e9prtQhyI3sZGjCU9hBT4MI4zR
 b9rtomuiLbd6hlqtUWWDfj75D+G+v7w=
Received: from mail-vk1-f199.google.com (mail-vk1-f199.google.com
 [209.85.221.199]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-143-38cVZvGzPq6c5it47-l3HQ-1; Fri, 15 Nov 2019 09:57:04 -0500
Received: by mail-vk1-f199.google.com with SMTP id n6so4243261vke.22
 for <dev@dpdk.org>; Fri, 15 Nov 2019 06:57:04 -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=E4dhJ0HC06hXR5MrxnYWSLEqMyZi6RVfK0M7wil/3GQ=;
 b=AsYQzboxUgXjCfMRJDuZEyKeWfJwB93eNoMlpW7TBw4I4VPYiGL3uxKyC8INUZOvHt
 yV723X3bW6b05OM4Gvt/PlEVTyCJAO5Jk0xozekpLOvmg7BJTPirF1yzgtuc1BqAcW2v
 HMQmSU20YVO0F0URVq11Cppuoh++/d5kM2PucK8v5Wz4ZzdRMoz1JOCg7CCqlmXK1ZKc
 Vf/jGnIPuBKZAfOZZ4yeL5L9QZl11Nw2BiFBkqbpOmg+tu+TCOVwcsFKH25OIv7r6l1M
 uo7GVbgkK+zuL91XKqxfwRSXL6oDpWmB39K+XrFjtSLR/2Wb13++UEqlQfPRySBRBhdS
 CMaA==
X-Gm-Message-State: APjAAAW/q+U9NNUIO+QXx4zt0L6084saeXbAN9bq3nxadzj8/bkYnvl7
 vG0UfUrmsyq39CmsbmGxewjiKC+OtE+G+xKq63Ew+RhfHv0VwW+Gy04D3gy92OS8/FQtNlDqTHB
 7BXEzyFHYxeXCPmUYuuI=
X-Received: by 2002:a67:7d95:: with SMTP id y143mr9808746vsc.39.1573829823656; 
 Fri, 15 Nov 2019 06:57:03 -0800 (PST)
X-Google-Smtp-Source: APXvYqxEBixlKtIY1u01Rz6KGyRxu7FZO0zXjziKJ4PzghYjDhjyYvP8a7f3Pd2IJECdIYrmTu2Qoqirj9Lzg9RyqBs=
X-Received: by 2002:a67:7d95:: with SMTP id y143mr9808717vsc.39.1573829823247; 
 Fri, 15 Nov 2019 06:57:03 -0800 (PST)
MIME-Version: 1.0
References: <20191105110416.8955-1-vattunuru@marvell.com>
 <20191115111807.20935-1-vattunuru@marvell.com>
 <20191115111807.20935-3-vattunuru@marvell.com>
 <CAJFAV8y=euK9XzzqYZn1O-MVBgreFE4EL-WAWkHtJTq3mN4VXw@mail.gmail.com>
 <CALBAE1MM3Q6SgRxRJuCb8Jjzg-NcyMWmoBQcvjq+_Dtx1+gyXA@mail.gmail.com>
In-Reply-To: <CALBAE1MM3Q6SgRxRJuCb8Jjzg-NcyMWmoBQcvjq+_Dtx1+gyXA@mail.gmail.com>
From: David Marchand <david.marchand@redhat.com>
Date: Fri, 15 Nov 2019 15:56:51 +0100
Message-ID: <CAJFAV8yBPyYre-pU6+dKGDjCdKDwTKfTTtQJ=yaZtR3a3S0xeQ@mail.gmail.com>
To: Jerin Jacob <jerinjacobk@gmail.com>
Cc: Vamsi Attunuru <vattunuru@marvell.com>, "Yigit,
 Ferruh" <ferruh.yigit@intel.com>, dev <dev@dpdk.org>, 
 Thomas Monjalon <thomas@monjalon.net>,
 Jerin Jacob Kollanukkaran <jerinj@marvell.com>, 
 Kiran Kumar Kokkilagadda <kirankumark@marvell.com>,
 Olivier Matz <olivier.matz@6wind.com>, 
 "Burakov, Anatoly" <anatoly.burakov@intel.com>,
 Andrew Rybchenko <arybchenko@solarflare.com>, 
 Stephen Hemminger <stephen@networkplumber.org>
X-MC-Unique: 38cVZvGzPq6c5it47-l3HQ-1
X-Mimecast-Spam-Score: 0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Subject: Re: [dpdk-dev] [PATCH v13 2/2] kni: support IOVA mode
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Fri, Nov 15, 2019 at 2:40 PM Jerin Jacob <jerinjacobk@gmail.com> wrote:
> On Fri, Nov 15, 2019 at 6:29 PM David Marchand
> <david.marchand@redhat.com> wrote:
> > So far, KNI could not work with IOVA as VA.
> > Your patchset adds support for IOVA as VA if kernel is >=3D 4.6.
>
> We need achive the following.
>
> IOVA as PA  has performance implication on KNI case. So we need to
> make IOVA as PA when KNI module is loaded.

- The current behaviour is:
  * buses announce PA, nothing to do wrt KNI,
  * buses announce VA or DC (whatever the considerations on iommu), if
physical addresses are available, then PA is used and KNI works,

- Now, with this new feature (on kernels >=3D 4.6), we can have KNI work
with VA, the previous workaround can be skipped.
There is another consideration wrt performance, as a consequence, for
kernels 4.6, if physical addresses are available, we can select PA for
KNI.

_But_ I did not see people complaining about the current behavior.
I see no reason to change this if the VA support can't be used (kernels < 4=
.6).

So how about (I inverted the #if LINUX_VERSION_CODE >=3D
KERNEL_VERSION(4, 6, 0), it was causing me headaches):

diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.=
c
index 9e2d50cfb..33f3c674c 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -1073,6 +1073,11 @@ rte_eal_init(int argc, char **argv)
                                 */
                                iova_mode =3D RTE_IOVA_VA;
                                RTE_LOG(DEBUG, EAL, "Physical
addresses are unavailable, selecting IOVA as VA mode.\n");
+#if defined(RTE_LIBRTE_KNI) && LINUX_VERSION_CODE >=3D KERNEL_VERSION(4, 6=
, 0)
+                       } else if (rte_eal_check_module("rte_kni") =3D=3D 1=
) {
+                               iova_mode =3D RTE_IOVA_PA;
+                               RTE_LOG(DEBUG, EAL, "Forcing IOVA as
'PA' for better perfomance with KNI\n");
+#endif
                        } else if (is_iommu_enabled()) {
                                /* we have an IOMMU, pick IOVA as VA mode *=
/
                                iova_mode =3D RTE_IOVA_VA;
@@ -1085,7 +1090,7 @@ rte_eal_init(int argc, char **argv)
                                RTE_LOG(DEBUG, EAL, "IOMMU is not
available, selecting IOVA as PA mode.\n");
                        }
                }
-#ifdef RTE_LIBRTE_KNI
-               /* Workaround for KNI which requires physical address to wo=
rk */
+#if defined(RTE_LIBRTE_KNI) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0=
)
+               /* Workaround for KNI which requires physical address
to work with kernels < 4.6 */
                if (iova_mode =3D=3D RTE_IOVA_VA &&
                                rte_eal_check_module("rte_kni") =3D=3D 1) {


--=20
David Marchand