From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2B37845523; Fri, 28 Jun 2024 14:10:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1D1F0410EE; Fri, 28 Jun 2024 14:10:51 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 3642D410D0 for ; Fri, 28 Jun 2024 14:10:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719576633; 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=E7nIRJhxNw69j+Tr0NloGxgiGEqlpO9Aj+xn02/SPoc=; b=ZEobdrdn5Nc890zeF/AvS3WEYOj8bNN2+n0ByrbKi3sUoUPABkC8yxGDrM0afaSmNp7SHS elunkIpKe1lw4XgfMKxTXID1WKOVymic/Q9n0dKneOBZUM4XcDdvbNhnNYNuTx7RNl40Rb b03b7qSsjBKgFuJ6L6a28fhxeDvoVLc= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-433-LOkQjSwvOue_bpJVLUea8Q-1; Fri, 28 Jun 2024 08:10:32 -0400 X-MC-Unique: LOkQjSwvOue_bpJVLUea8Q-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2ee4e9b77c1so3891451fa.1 for ; Fri, 28 Jun 2024 05:10:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719576631; x=1720181431; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E7nIRJhxNw69j+Tr0NloGxgiGEqlpO9Aj+xn02/SPoc=; b=BMyee1Uckhip3BTniJO0Lb1bR8SpTSJiwB2XtBG3jHOvmOpyQ+pEt8+Q1kcJS0QF90 i0srceOjdabTUcmvBHoMqNS7UCkWLcqlFy5JZ7ZXczEUITZVxvMeY8icRvplxM7LU2sw PB6fouu/2WrC/9ZLQsEW+aYC2d0DdTXZz087mguV5BWewN0pjz0fZCcdV3BsSB4xY/fI evXksLRetXDjWoFSz9/aAPKxQkSm+iI+TPX1dc7EhWuuKYPWlDr7PmTp0C+ijI9JRGWI uhNcVYoSrfdPd7IEyEc9Y3D+euZwReXXNEE1Uc0Zy42i2fzfS5+RDCThMB41M/6xJyRL QKng== X-Forwarded-Encrypted: i=1; AJvYcCX9c/dP/DOZCPBEykHmXDQdHZic2mJXNU+lOxe/E4wdLKXIPezPNlt3ZYM30oUYMTzXO+vTUFMcI0uFdH4= X-Gm-Message-State: AOJu0YyOi3nUJ4EuViAF5MBovIfyhlWJIxVk4eCf5doKv+CjCQWNCBgD H+DFnpAWZtlIiEHyJHYC5uwDPjX9zqZnBAhr3ScDASRb2Cb4RNcxYMw7fOxzZQz5/Nc2rU39kjH 3CSodQ2U+XngeePqF0uNEuZ9HAWNBHPxF6wmSpYl0vU85vC3w3HFS6+R9tkuHTMyXRe9iNeRcCi nc18gkxjmy86RBQXc= X-Received: by 2002:a05:651c:150c:b0:2ec:3e02:9736 with SMTP id 38308e7fff4ca-2ee53c28b8dmr5861511fa.4.1719576630986; Fri, 28 Jun 2024 05:10:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG89BUoideKbVNy96E5xN+CDvIg1i3z2v2qr3rRxhWLloy0/ies4ZdHEo8GSi9afuU2ubj1viW4JqGOKaqpvYc= X-Received: by 2002:a05:651c:150c:b0:2ec:3e02:9736 with SMTP id 38308e7fff4ca-2ee53c28b8dmr5861421fa.4.1719576630573; Fri, 28 Jun 2024 05:10:30 -0700 (PDT) MIME-Version: 1.0 References: <20231130191844.612699-1-drc@linux.vnet.ibm.com> <20240530164448.148044-1-drc@linux.ibm.com> In-Reply-To: <20240530164448.148044-1-drc@linux.ibm.com> From: David Marchand Date: Fri, 28 Jun 2024 14:10:19 +0200 Message-ID: Subject: Re: [PATCH v5] eal: verify mmu type for DPDK support (ppc64le) To: David Christensen Cc: thomas@monjalon.net, Ruifeng Wang , Tyler Retzlaff , Bruce Richardson , Min Zhou , David Christensen , Stanislaw Kardach , Konstantin Ananyev , dev@dpdk.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, May 30, 2024 at 6:45=E2=80=AFPM David Christensen wrote: > > From: David Christensen > > 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 > Signed-off-by: David Christensen Sorry, this patch fell through the cracks.. Could you please check that author =3D=3D sob ? WARNING:FROM_SIGN_OFF_MISMATCH: From:/Signed-off-by: email address mismatch: 'From: David Christensen ' !=3D 'Signed-off-by: David Christensen ' [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 =3D ENOTSUP; > + return -1; > + } > + > if (!rte_atomic_compare_exchange_strong_explicit(&run_once, &has_= run, 1, > rte_memory_order_relaxed, rte_mem= ory_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 =3D ENOTSUP; > + return -1; > + } > + > if (!rte_atomic_compare_exchange_strong_explicit(&run_once, &has_= run, 1, > rte_memory_order_relaxed, rte_mem= ory_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[] =3D "/proc/cpuinfo"; > + static const char str_mmu[] =3D "MMU"; > + static const char str_radix[] =3D "Radix"; > + static const char err_msg[] =3D "DPDK on PPC64 requires radix-mmu= "; > + char buf[512]; > + char *ret =3D NULL; > + FILE *f =3D fopen(proc_cpuinfo, "r"); > + > + if (f =3D=3D 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) !=3D NULL) { > + ret =3D strstr(buf, str_mmu); > + if (ret =3D=3D NULL) > + continue; > + ret +=3D sizeof(str_mmu) - 1; > + ret =3D strchr(ret, ':'); > + if (ret =3D=3D NULL) > + continue; > + ret =3D strstr(ret, str_radix); > + break; > + } > + fclose(f); > + > + if (ret =3D=3D 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 !=3D 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. --=20 David Marchand