On Fri, Nov 24, 2023 at 11:29 AM Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> wrote:
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.

You are absolutely right Dmitry.
In fact I was only trying to rebase an old patch that we used to carry.
But the more I look at and think about it the less I like the approach.

A production setup has an admin that should do this consciously.
What we actually should change is not the behavior of EAL, but just the test automation to work on no-huge ppc64.
That is simpler and has much less impact and therefore probably is the right solution.

Consider this patch here withdrawn.
I'll submit the fix to the tests in a few seconds.
 
> +             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=<pa|va>", 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.



--
Christian Ehrhardt
Director of Engineering, Ubuntu Server
Canonical Ltd