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 E1AEF4318A; Tue, 17 Oct 2023 14:39:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C877240273; Tue, 17 Oct 2023 14:39:05 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by mails.dpdk.org (Postfix) with ESMTP id 75E4540270 for ; Tue, 17 Oct 2023 14:39:04 +0200 (CEST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 7B8D93200A4E; Tue, 17 Oct 2023 08:39:03 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 17 Oct 2023 08:39:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1697546343; x=1697632743; bh=4bl9w6Q+i3LYPlEjruCvZG9a8cTJ8EXFY8C CskZcnxY=; b=nIyldo0ENAHTTNAQGeuzmCtOhLsXhBDB1oraTWAIBMGAvxrPU4b uh2mdazeO8U7ierOaPAtxPkubg6gdx1R//8CRPlKrKOXT5jIgubsUAusnIu5O601 J6LmnF8pZWogRquOpHjxtHk0lKWaF2akYlFQUxH6cWYnhOYiDsWksBau+0BdJ1f1 KlbNQlT63AqDxBXqlatLSmEefIcycDG2LTp22hJr9NQGRbIOIzlfrTvnHjBIgpHU ZEfj0kR8/QVAJit4RHgg3nSwZSjgNqUnDQ0caJ8BYu+kIjR8EvtXt9GvVSvVd6tU Tr6/WsyEN8bo3vwrBngZCkCvMW1iuJXtifg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1697546343; x=1697632743; bh=4bl9w6Q+i3LYPlEjruCvZG9a8cTJ8EXFY8C CskZcnxY=; b=YSpfoWSqapk9oxgdjcmamuKrmD1hNAZfUki1v+Sh5Vlqj7oClEO mXzThEaZMl5XBe3XXIxbpE3+3SFL0WIyR/Ml9l5rd+ATzi2BIcebwLIr1CIAijbU NhpWXZ3KK5P15btNC3sHEo+Sg4Bz6zl9WY17jspDoAhC2Rg1znWluF/Drv4XGCEH MkiGlynpnADgeF/E0hXd3UzjZA89qvRXxVDDkYSwKoOTZGxU06ccblXHSK8oz/Gf jEe5DN+s4JVwel7h/FLqTKpu+E1+iLm72aJPvyHTfflNo2DbfbEzGd8noivJXkMY BMGfYnmuppBBS7TAx+yTazOKiX0/lP2sKjw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrjedvgdehfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkjghfggfgtgesthfure dttddtvdenucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgrshes mhhonhhjrghlohhnrdhnvghtqeenucggtffrrghtthgvrhhnpedtjeeiieefhedtfffgvd elteeufeefheeujefgueetfedttdeikefgkeduhedtgfenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghlohhnrd hnvght X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 17 Oct 2023 08:39:02 -0400 (EDT) From: Thomas Monjalon To: David Christensen Cc: dev@dpdk.org Subject: Re: [PATCH] eal/linux: verify mmu type for DPDK support (ppc64le) Date: Tue, 17 Oct 2023 14:39:01 +0200 Message-ID: <3356591.usfYGdeWWP@thomas> In-Reply-To: <20231010225100.335049-1-drc@linux.vnet.ibm.com> References: <20231010225100.335049-1-drc@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 11/10/2023 00:51, 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. > > Bugzilla ID: 1221 > Suggested-by: Thomas Monjalon > Signed-off-by: David Christensen > --- > --- a/lib/eal/linux/eal.c > +++ b/lib/eal/linux/eal.c > +/* > + * 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. > + */ > +static bool > +is_mmu_supported(void) > +{ > +#ifdef RTE_ARCH_PPC_64 > + static const char proc_cpuinfo[] = "/proc/cpuinfo"; > + static const char str_mmu[] = "MMU"; > + static const char str_radix[] = "Radix"; > + char buf[512]; > + char *ret = NULL; > + FILE *f = fopen(proc_cpuinfo, "r"); > + > + if (f == NULL) { > + RTE_LOG(ERR, EAL, "Cannot open %s\n", proc_cpuinfo); > + 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_eal_init_alert("DPDK on PPC64 requires radix-mmu."); > + return (ret != NULL); > +#else > + return true; > +#endif > +} I feel this function should not be implemented in the common EAL. What about adding a new function in lib/eal/ppc/ ? And add the "return true" for other architectures?