[v2] eal: choose IOVA mode according to compilation flags

Message ID 20230606151511.978-1-viacheslavo@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] eal: choose IOVA mode according to compilation flags |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Slava Ovsiienko June 6, 2023, 3:15 p.m. UTC
  The DPDK can be compiled to be run in IOVA VA mode with
'enable_iova_as_pa=false' meson option. If there is no
explicit EAL --iova-mode parameter specified in the command
line the rte_eal_init() tried to deduce VA or PA mode without
taking into account the above mentioned compile time option,
resulting into initialization failure.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 lib/eal/linux/eal.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Bruce Richardson June 6, 2023, 3:23 p.m. UTC | #1
On Tue, Jun 06, 2023 at 06:15:11PM +0300, Viacheslav Ovsiienko wrote:
> The DPDK can be compiled to be run in IOVA VA mode with
> 'enable_iova_as_pa=false' meson option. If there is no
> explicit EAL --iova-mode parameter specified in the command
> line the rte_eal_init() tried to deduce VA or PA mode without
> taking into account the above mentioned compile time option,
> resulting into initialization failure.
> 
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> ---
>  lib/eal/linux/eal.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
> index ae323cd492..9856ec9d12 100644
> --- a/lib/eal/linux/eal.c
> +++ b/lib/eal/linux/eal.c
> @@ -1081,7 +1081,10 @@ rte_eal_init(int argc, char **argv)
>  		if (iova_mode == RTE_IOVA_DC) {
>  			RTE_LOG(DEBUG, EAL, "Buses did not request a specific IOVA mode.\n");
>  
> -			if (!phys_addrs) {
> +			if (!RTE_IOVA_IN_MBUF) {
> +				iova_mode = RTE_IOVA_VA;
> +				RTE_LOG(DEBUG, EAL, "IOVA as VA mode is forced by build option.\n");
> +			} else if (!phys_addrs) {
>  				/* if we have no access to physical addresses,
>  				 * pick IOVA as VA mode.
>  				 */

Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  
Thomas Monjalon June 7, 2023, 4:48 p.m. UTC | #2
06/06/2023 17:23, Bruce Richardson:
> On Tue, Jun 06, 2023 at 06:15:11PM +0300, Viacheslav Ovsiienko wrote:
> > The DPDK can be compiled to be run in IOVA VA mode with
> > 'enable_iova_as_pa=false' meson option. If there is no
> > explicit EAL --iova-mode parameter specified in the command
> > line the rte_eal_init() tried to deduce VA or PA mode without
> > taking into account the above mentioned compile time option,
> > resulting into initialization failure.

It looks like a bug fix to backport. Do you agree?
Could you add the fix tags?

> > 
> > Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

You forgot previous tag:
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>

> > ---
> >  lib/eal/linux/eal.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)

What about FreeBSD and Windows?
I suspect there is the same issue.

> > @@ -1081,7 +1081,10 @@ rte_eal_init(int argc, char **argv)
> >  		if (iova_mode == RTE_IOVA_DC) {
> >  			RTE_LOG(DEBUG, EAL, "Buses did not request a specific IOVA mode.\n");
> >  
> > -			if (!phys_addrs) {
> > +			if (!RTE_IOVA_IN_MBUF) {
> > +				iova_mode = RTE_IOVA_VA;
> > +				RTE_LOG(DEBUG, EAL, "IOVA as VA mode is forced by build option.\n");
> > +			} else if (!phys_addrs) {
> >  				/* if we have no access to physical addresses,
> >  				 * pick IOVA as VA mode.
> >  				 */
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  

Patch

diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index ae323cd492..9856ec9d12 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -1081,7 +1081,10 @@  rte_eal_init(int argc, char **argv)
 		if (iova_mode == RTE_IOVA_DC) {
 			RTE_LOG(DEBUG, EAL, "Buses did not request a specific IOVA mode.\n");
 
-			if (!phys_addrs) {
+			if (!RTE_IOVA_IN_MBUF) {
+				iova_mode = RTE_IOVA_VA;
+				RTE_LOG(DEBUG, EAL, "IOVA as VA mode is forced by build option.\n");
+			} else if (!phys_addrs) {
 				/* if we have no access to physical addresses,
 				 * pick IOVA as VA mode.
 				 */