DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: David Christensen <drc@linux.ibm.com>
Cc: thomas@monjalon.net, Ruifeng Wang <ruifeng.wang@arm.com>,
	 Tyler Retzlaff <roretzla@linux.microsoft.com>,
	 Bruce Richardson <bruce.richardson@intel.com>,
	Min Zhou <zhoumin@loongson.cn>,
	 David Christensen <drc@linux.vnet.ibm.com>,
	Stanislaw Kardach <stanislaw.kardach@gmail.com>,
	 Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
	dev@dpdk.org
Subject: Re: [PATCH v5] eal: verify mmu type for DPDK support (ppc64le)
Date: Fri, 28 Jun 2024 14:10:19 +0200	[thread overview]
Message-ID: <CAJFAV8ypaWUQauf6iLR6ePYMrrOK8gFteYOUpgNsyF+NSt9g5Q@mail.gmail.com> (raw)
In-Reply-To: <20240530164448.148044-1-drc@linux.ibm.com>

On Thu, May 30, 2024 at 6:45 PM David Christensen <drc@linux.ibm.com> wrote:
>
> From: David Christensen <drc@linux.vnet.ibm.com>
>
> IBM POWER systems support more than one type of memory management unit
> (MMU).  The Power ISA 3.0 specification, which applies to P9 and later
> CPUs, defined a new Radix MMU which, among other things, allows an
> anonymous memory page mapping to be converted into a hugepage mapping
> at a specific address. This is a required feature in DPDK so we need
> to test the MMU type when POWER systems are used and provide a more
> useful error message for the user when running on an unsupported
> system such as P8/P9 on PowerVM.
>
> All architectures other than ppc64le unconditionally report that the
> MMU is supported.  When running with ppc64le on Linux, the MMU is
> tested and the actual result is returned, while running with ppc64le
> on FreeBSD unconditionally reports that the MMU is supported to avoid
> unnecessary breakage until an actual test can be implemented for that
> environment (i.e. keeps existing behavior without the patch).
>
> Bugzilla ID: 1221
>
> Suggested-by: Thomas Monjalon <thomas@monjalon.net>
> Signed-off-by: David Christensen <drc@linux.ibm.com>

Sorry, this patch fell through the cracks..

Could you please check that author == sob ?

WARNING:FROM_SIGN_OFF_MISMATCH: From:/Signed-off-by: email address
mismatch: 'From: David Christensen <drc@linux.vnet.ibm.com>' !=
'Signed-off-by: David Christensen <drc@linux.ibm.com>'

[snip]

> diff --git a/lib/eal/arm/rte_mmu.c b/lib/eal/arm/rte_mmu.c
> new file mode 100644
> index 0000000000..3d40bfde38
> --- /dev/null
> +++ b/lib/eal/arm/rte_mmu.c
> @@ -0,0 +1,11 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (C) IBM Corporation 2023

2024* (and idem in other new files in this patch)

[snip]

> diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
> index bab77118e9..1229230063 100644
> --- a/lib/eal/freebsd/eal.c
> +++ b/lib/eal/freebsd/eal.c
> @@ -597,6 +597,13 @@ rte_eal_init(int argc, char **argv)
>                 return -1;
>         }
>
> +       /* verify if DPDK supported on architecture MMU */
> +       if (!eal_mmu_supported()) {
> +               rte_eal_init_alert("unsupported MMU type.");
> +               rte_errno = ENOTSUP;
> +               return -1;
> +       }
> +
>         if (!rte_atomic_compare_exchange_strong_explicit(&run_once, &has_run, 1,
>                                         rte_memory_order_relaxed, rte_memory_order_relaxed)) {
>                 rte_eal_init_alert("already called initialization.");
> diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
> index fd422f1f62..d742cc98e2 100644
> --- a/lib/eal/linux/eal.c
> +++ b/lib/eal/linux/eal.c
> @@ -983,6 +983,13 @@ rte_eal_init(int argc, char **argv)
>                 return -1;
>         }
>
> +       /* verify if DPDK supported on architecture MMU */
> +       if (!eal_mmu_supported()) {
> +               rte_eal_init_alert("unsupported MMU type.");
> +               rte_errno = ENOTSUP;
> +               return -1;
> +       }
> +
>         if (!rte_atomic_compare_exchange_strong_explicit(&run_once, &has_run, 1,
>                                         rte_memory_order_relaxed, rte_memory_order_relaxed)) {
>                 rte_eal_init_alert("already called initialization.");

We are missing an update of windows/eal.c.

[snip]

> diff --git a/lib/eal/ppc/rte_mmu.c b/lib/eal/ppc/rte_mmu.c
> new file mode 100644
> index 0000000000..72d28c5985
> --- /dev/null
> +++ b/lib/eal/ppc/rte_mmu.c
> @@ -0,0 +1,67 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright (C) IBM Corporation 2023
> + */
> +
> +#include "stdio.h"
> +#include "string.h"
> +#include "rte_log.h"
> +#include "eal_private.h"
> +
> +bool
> +eal_mmu_supported(void)
> +{
> +#ifdef RTE_EXEC_ENV_LINUX
> +       static const char proc_cpuinfo[] = "/proc/cpuinfo";
> +       static const char str_mmu[] = "MMU";
> +       static const char str_radix[] = "Radix";
> +       static const char err_msg[] = "DPDK on PPC64 requires radix-mmu";
> +       char buf[512];
> +       char *ret = NULL;
> +       FILE *f = fopen(proc_cpuinfo, "r");
> +
> +       if (f == NULL) {
> +               RTE_LOG_LINE(ERR, EAL, "Cannot open %s", proc_cpuinfo);

EAL_LOG().

> +               return false;
> +       }
> +
> +       /*
> +        * Example "MMU" in /proc/cpuinfo:
> +        * ...
> +        * model        : 8335-GTW
> +        * machine      : PowerNV 8335-GTW
> +        * firmware     : OPAL
> +        * MMU          : Radix
> +        * ... or ...
> +        * model        : IBM,9009-22A
> +        * machine      : CHRP IBM,9009-22A
> +        * MMU          : Hash
> +        */
> +       while (fgets(buf, sizeof(buf), f) != NULL) {
> +               ret = strstr(buf, str_mmu);
> +               if (ret == NULL)
> +                       continue;
> +               ret += sizeof(str_mmu) - 1;
> +               ret = strchr(ret, ':');
> +               if (ret == NULL)
> +                       continue;
> +               ret = strstr(ret, str_radix);
> +               break;
> +       }
> +       fclose(f);
> +
> +       if (ret == NULL)
> +               RTE_LOG_LINE(ERR, EAL, "%s", err_msg);

err_msg is a fixed string (and only used once).

EAL_LOG(ERR, DPDK on PPC64 requires radix-mmu");

> +
> +       return (ret != NULL);
> +#elif RTE_EXEC_ENV_FREEBSD
> +       /*
> +        * Method to detect MMU type in FreeBSD not known
> +        * by this author.  Return true for now to emulate
> +        * previous behavior and avoid unnecessary failures.
> +        */
> +       return true;
> +#else
> +       /* Force false for other execution environments */
> +       return false;
> +#endif
> +}

The rest lgtm, can you send a n+1 for -rc2?

Thanks.

-- 
David Marchand


  reply	other threads:[~2024-06-28 12:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-10 22:51 [PATCH] eal/linux: " David Christensen
2023-10-17 12:39 ` Thomas Monjalon
2023-10-23 21:59   ` David Christensen
2023-11-06 13:54     ` Thomas Monjalon
2023-10-23 23:19 ` [PATCH v2] eal/linux: " David Christensen
2023-10-24  2:02   ` David Christensen
2023-10-24 17:43   ` [PATCH v3] " David Christensen
2023-11-06 13:55     ` Thomas Monjalon
2023-11-30 19:18     ` [PATCH v4] eal: " David Christensen
2024-05-30 16:44       ` [PATCH v5] " David Christensen
2024-06-28 12:10         ` David Marchand [this message]
     [not found]       ` <20240529183222.105731-1-drc@linux.vnet.ibm.com>
2024-06-27 21:11         ` David Christensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJFAV8ypaWUQauf6iLR6ePYMrrOK8gFteYOUpgNsyF+NSt9g5Q@mail.gmail.com \
    --to=david.marchand@redhat.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=drc@linux.ibm.com \
    --cc=drc@linux.vnet.ibm.com \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=roretzla@linux.microsoft.com \
    --cc=ruifeng.wang@arm.com \
    --cc=stanislaw.kardach@gmail.com \
    --cc=thomas@monjalon.net \
    --cc=zhoumin@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).