<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Nov 29, 2023 at 10:51 PM David Christensen <<a href="mailto:drc@linux.vnet.ibm.com">drc@linux.vnet.ibm.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 11/24/23 2:09 AM, <a href="mailto:christian.ehrhardt@canonical.com" target="_blank">christian.ehrhardt@canonical.com</a> wrote:<br>
> From: David Wilder <<a href="mailto:dwilder@us.ibm.com" target="_blank">dwilder@us.ibm.com</a>><br>
> <br>
> When using --no-huge option physical address are not guaranteed<br>
> to be persistent.<br>
> <br>
> This change effectively makes "--no-huge" the same as<br>
> "--no-huge --iova-mode=va".<br>
> <br>
> When --no-huge is used (or any other condition making physical<br>
> addresses unavailable) setting --iova-mode=pa will have no effect.<br>
> <br>
> Signed-off-by: Christian Ehrhardt <<a href="mailto:christian.ehrhardt@canonical.com" target="_blank">christian.ehrhardt@canonical.com</a>><br>
> ---<br>
>   doc/guides/prog_guide/env_abstraction_layer.rst |  9 ++++++---<br>
>   lib/eal/linux/eal.c                             | 16 ++++++++++------<br>
>   2 files changed, 16 insertions(+), 9 deletions(-)<br>
> <br>
> diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst<br>
> index 6debf54efb..20c7355e0f 100644<br>
> --- a/doc/guides/prog_guide/env_abstraction_layer.rst<br>
> +++ b/doc/guides/prog_guide/env_abstraction_layer.rst<br>
> @@ -559,9 +559,12 @@ IOVA Mode is selected by considering what the current usable Devices on the<br>
>   system require and/or support.<br>
> <br>
>   On FreeBSD, RTE_IOVA_PA is always the default. On Linux, the IOVA mode is<br>
> -detected based on a 2-step heuristic detailed below.<br>
> +detected based on a heuristic detailed below.<br>
> <br>
> -For the first step, EAL asks each bus its requirement in terms of IOVA mode<br>
> +For the first step, if no Physical Addresses are available RTE_IOVA_VA is<br>
> +selected.<br>
> +<br>
> +Then EAL asks each bus its requirement in terms of IOVA mode<br>
>   and decides on a preferred IOVA mode.<br>
> <br>
>   - if all buses report RTE_IOVA_PA, then the preferred IOVA mode is RTE_IOVA_PA,<br>
> @@ -575,7 +578,7 @@ and decides on a preferred IOVA mode.<br>
>   If the buses have expressed no preference on which IOVA mode to pick, then a<br>
>   default is selected using the following logic:<br>
> <br>
> -- if physical addresses are not available, RTE_IOVA_VA mode is used<br>
> +- if enable_iova_as_pa was not set at build RTE_IOVA_VA mode is used<br>
>   - if /sys/kernel/iommu_groups is not empty, RTE_IOVA_VA mode is used<br>
>   - otherwise, RTE_IOVA_PA mode is used<br>
> <br>
> diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c<br>
> index 57da058cec..2f1fce3c54 100644<br>
> --- a/lib/eal/linux/eal.c<br>
> +++ b/lib/eal/linux/eal.c<br>
> @@ -1067,6 +1067,16 @@ rte_eal_init(int argc, char **argv)<br>
> <br>
>       phys_addrs = rte_eal_using_phys_addrs() != 0;<br>
> <br>
> +     if (!phys_addrs) {<br>
> +             /* if we have no access to physical addresses, pick IOVA as VA mode. */<br>
> +             if (internal_conf->iova_mode == RTE_IOVA_PA)<br>
> +                     RTE_LOG(WARNING, EAL, "WARNING: --iova-mode=pa, but Physical addresses are unavailable, selecting IOVA as VA mode.\n");<br>
> +             else<br>
> +                     RTE_LOG(DEBUG, EAL, "Physical addresses are unavailable, selecting IOVA as VA mode.\n");<br>
> +             internal_conf->iova_mode = RTE_IOVA_VA;<br>
> +             rte_eal_get_configuration()->iova_mode = internal_conf->iova_mode;<br>
> +     }<br>
> +<br>
>       /* if no EAL option "--iova-mode=<pa|va>", use bus IOVA scheme */<br>
>       if (internal_conf->iova_mode == RTE_IOVA_DC) {<br>
>               /* autodetect the IOVA mapping mode */<br>
> @@ -1078,12 +1088,6 @@ rte_eal_init(int argc, char **argv)<br>
>                       if (!RTE_IOVA_IN_MBUF) {<br>
>                               iova_mode = RTE_IOVA_VA;<br>
>                               RTE_LOG(DEBUG, EAL, "IOVA as VA mode is forced by build option.\n");<br>
> -                     } else if (!phys_addrs) {<br>
> -                             /* if we have no access to physical addresses,<br>
> -                              * pick IOVA as VA mode.<br>
> -                              */<br>
> -                             iova_mode = RTE_IOVA_VA;<br>
> -                             RTE_LOG(DEBUG, EAL, "Physical addresses are unavailable, selecting IOVA as VA mode.\n");<br>
>                       } else if (is_iommu_enabled()) {<br>
>                               /* we have an IOMMU, pick IOVA as VA mode */<br>
>                               iova_mode = RTE_IOVA_VA;<br>
<br>
What tests are you running that generate an error without explicitly <br>
selecting the iova-mode?  When I run the fast-tests I see the system <br>
correctly selecting VA without any additional command-line parameters <br>
when running 23.11:<br>
<br></blockquote><div><br></div><div>Hi, we run the tests as they are defined in debian/ubuntu autopkgtest, here a full log:</div><div><br></div><div> <a href="https://autopkgtest.ubuntu.com/results/autopkgtest-noble-paelzer-dpdk-23.11-test-builds/noble/ppc64el/d/dpdk/20231123_134814_ed029@/log.gz">https://autopkgtest.ubuntu.com/results/autopkgtest-noble-paelzer-dpdk-23.11-test-builds/noble/ppc64el/d/dpdk/20231123_134814_ed029@/log.gz</a></div><div><br></div><div>Fasttests, just like yours, fail for us.</div><div>But this is a virtual test env that might not be as powerful as yours.</div><div><br></div><div>But as I've said, consider this one withdrawn and the one just fixing the test config preferred.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
21:47:05 DPDK_TEST=acl_autotest MALLOC_PERTURB_=201 <br>
/home/drc/src/dpdk/build/app/dpdk-test --no-huge -m 2048<br>
----------------------------------- output <br>
-----------------------------------<br>
stdout:<br>
RTE>>acl_autotest<br>
acl context <acl_ctx>@0x179cbd300<br>
   socket_id=-1<br>
   alg=5<br>
   first_load_sz=0<br>
   max_rules=196608<br>
   rule_size=128<br>
   num_rules=0<br>
   num_categories=0<br>
   num_tries=0<br>
acl context <acl_ctx>@0x179cbd300<br>
   socket_id=-1<br>
   alg=5<br>
   first_load_sz=0<br>
   max_rules=196608<br>
   rule_size=128<br>
   num_rules=0<br>
   num_categories=0<br>
   num_tries=0<br>
running test_convert_rules(acl_ipv4vlan_tuple)<br>
running test_convert_rules(acl_ipv4vlan_tuple, <br>
RTE_ACL_FIELD_TYPE_BITMASK type for IPv4)<br>
running test_convert_rules(acl_ipv4vlan_tuple, RTE_ACL_FIELD_TYPE_RANGE <br>
type for IPv4)<br>
running test_convert_rules(acl_ipv4vlan_tuple: swap VLAN and PORTs order)<br>
running test_convert_rules(acl_ipv4vlan_tuple: swap SRC and DST IPv4 order)<br>
test_u32_range#1704 starting range test from 0 to 264192<br>
Test OK<br>
RTE>><br>
stderr:<br>
EAL: Detected CPU lcores: 128<br>
EAL: Detected NUMA nodes: 2<br>
EAL: Detected static linkage of DPDK<br>
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket<br>
EAL: Selected IOVA mode 'VA'<br>
<br>
Dave<br>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">Christian Ehrhardt<br><span style="color:rgb(34,34,34)">Director of Engineering</span>, Ubuntu Server<br>Canonical Ltd</div></div></div>