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 8AC7C46428 for ; Wed, 19 Mar 2025 18:28:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E81B40609; Wed, 19 Mar 2025 18:28:34 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 7C4D5402C4 for ; Wed, 19 Mar 2025 18:28:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742405311; 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=J2Owe93JuoSF61/OcqgJ/gA2Eg6Cn6U93zhtgh8s/BU=; b=H0IBUayIOEtRKg79dGlGfPR2QhCERhpI1oyP974Zx5HRx0f8YbR3FsLQaWIXHSCCfyZ5tW vF3NxLPY9ghXpi57IhaOxu4oKAURHsUHJTiHXcUxircc1dCZao4mBm04ulXbjTC6YZw63l se6nPiVrEbu3hJopR+Ct3V7SYyRPsHY= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-672-KWgCdjhDPZaB7BvOisabaQ-1; Wed, 19 Mar 2025 13:28:29 -0400 X-MC-Unique: KWgCdjhDPZaB7BvOisabaQ-1 X-Mimecast-MFC-AGG-ID: KWgCdjhDPZaB7BvOisabaQ_1742405308 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-30bfaec88edso4883941fa.1 for ; Wed, 19 Mar 2025 10:28:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742405308; x=1743010108; 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=J2Owe93JuoSF61/OcqgJ/gA2Eg6Cn6U93zhtgh8s/BU=; b=XNJI+hhZHiuXPq1Mo54i8ZgJqnA2up/ALfcW0MVTFLq7NDI0sFbjb+ZfbyITKuEgmZ YMb+rGd58RhZBYO/1kXoZtvoSDLf9CsujtecB30V/pLFTMxz4BHTWL7LWWQpEXfmMtxa s6OPZ0fgEzMmpjmtPjbno4SI8mDwKda5ADYBypYcsJntvSNPZWtDWCkUet/RVl1jY0K4 TfCJjrEiLtDJ2+5ebZ8q1WHucB7TA8pLKsuExrcsgCRkei4U8rCquKcRFptZLdRq2fGL yYcUSdkBJFmjazPa1tI/b5ZwIhOnetT+jPNVFwTYx8NbFnxoLWW5+Cah56n+A+FFv7Gt 8eWg== X-Forwarded-Encrypted: i=1; AJvYcCWEKxFLumt41ipsuAful+HMqPikde2ybfIfqCXBI3EgsBmJxisCEgACCUskb9PQg2XZLZ0eF4U=@dpdk.org X-Gm-Message-State: AOJu0YwXStci2K+T5+XPoDsCcHxXr3jlPnIv0tPU+bC8V67UlsnFx8If CTx0ZsZ6F/bvyYaTKBXTW98pyzyPFchkcdexNWBOKHDzU7Gjg0dDwgR+beW8hEndGBp9JplUlTO Wc2kKzgvDgbNzlEvBFOyu+bHJBR+5OusrWrrj80M4OIKR2lfAIvBeS6LeelFS86OekXwnOTIZIH lrFzg5dL9QICaN5lVV4iI= X-Gm-Gg: ASbGncuYQglyjTdxSHAvZAM5KGqjBSC+fj+hOuGeCbZvC8drBmsiED8/9TPp4meKCfZ OeqDA+xZwnNbdGeFSJQ7yc1UksXBtEst5ukv0t8cgKbsBWXEhH0vwLxbjK33vWftacOIYEAlW5L A82xW7CC4YdBLCIbYI4zWRwCCsRFlSaw== X-Received: by 2002:a2e:a589:0:b0:308:e956:66e with SMTP id 38308e7fff4ca-30d72669124mr1738921fa.0.1742405307863; Wed, 19 Mar 2025 10:28:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvLSmVWC5ZxszMX4tYnoCvDBNncFWs9CMG+6RaszCVf/7qCM80vuhN/shRca0xX8lWXDAni6rSPC0ZPxMxJpQ= X-Received: by 2002:a2e:a589:0:b0:308:e956:66e with SMTP id 38308e7fff4ca-30d72669124mr1738841fa.0.1742405307444; Wed, 19 Mar 2025 10:28:27 -0700 (PDT) MIME-Version: 1.0 References: <20250305134720.907347-1-bruce.richardson@intel.com> <20250305162458.1059282-1-bruce.richardson@intel.com> In-Reply-To: From: David Marchand Date: Wed, 19 Mar 2025 18:28:16 +0100 X-Gm-Features: AQ5f1JodzDAyhrUj0fwa_McH93zCqvh2hr5TkADFGIeaS0atCHwnhADdC-og1BY Message-ID: Subject: Re: [PATCH v2] eal: fix undetected NUMA nodes To: Bruce Richardson Cc: dev@dpdk.org, Anatoly Burakov , stable@dpdk.org X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 4dy9xf243-fXAYKdhwwaxxLhYMJfTtS6Uvx8Yr0uPL0_1742405308 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Wed, Mar 19, 2025 at 5:55=E2=80=AFPM Bruce Richardson wrote: > > On Wed, Mar 19, 2025 at 05:31:45PM +0100, David Marchand wrote: > > On Wed, Mar 5, 2025 at 5:25=E2=80=AFPM Bruce Richardson > > wrote: > > > > > > In cases where the number of cores on a given socket is greater than > > > RTE_MAX_LCORES, then EAL will be unaware of all the sockets/numa node= s > > > on a system. Fix this limitation by having the EAL probe the NUMA nod= e > > > for cores it isn't going to use, and recording that for completeness. > > > > > > This is necessary as memory is tracked per node, and with the --lcore= s > > > parameters our app lcores may be on different sockets than the lcore = ids > > > may imply. For example, lcore 0 is on socket zero, but if app is run > > > with --lcores=3D0@64, then DPDK lcore 0 may be on socket one, so DPDK > > > needs to be aware of that socket. > > > > > > Fixes: 952b20777255 ("eal: provide API for querying valid socket ids"= ) > > > Cc: stable@dpdk.org > > > > > > Signed-off-by: Bruce Richardson > > > > On the principle, the fix lgtm. > > > > I have one comment. > > > > > > > > --- > > > v2: handle case where RTE_MAX_LCORE > CPU_SETSIZE (i.e. >1024) > > > --- > > > lib/eal/common/eal_common_lcore.c | 17 ++++++++++++----- > > > 1 file changed, 12 insertions(+), 5 deletions(-) > > > > > > diff --git a/lib/eal/common/eal_common_lcore.c b/lib/eal/common/eal_c= ommon_lcore.c > > > index 2ff9252c52..820a6534b1 100644 > > > --- a/lib/eal/common/eal_common_lcore.c > > > +++ b/lib/eal/common/eal_common_lcore.c > > > @@ -144,7 +144,11 @@ rte_eal_cpu_init(void) > > > unsigned lcore_id; > > > unsigned count =3D 0; > > > unsigned int socket_id, prev_socket_id; > > > - int lcore_to_socket_id[RTE_MAX_LCORE]; > > > +#if CPU_SETSIZE > RTE_MAX_LCORE > > > + int lcore_to_socket_id[CPU_SETSIZE] =3D {0}; > > > +#else > > > + int lcore_to_socket_id[RTE_MAX_LCORE] =3D {0}; > > > +#endif > > > > This initialisation was unneeded so far because, in the next loop (on > > each possible lcore), eal_cpu_socket_id() (returning 0 even for > > errors) was called regardless of eal_cpu_detected(). > > Moving this call after eal_cpu_detected() would be consistent with the > > rest of this patch. > > > > So keep the zero-init, and move the function call to set the initial valu= es > in the array then? I see no elegant way with current code. I would completely separate this socket discovery from the rest... Anyway, this is not the subject of this fix, so I'll withdraw this comment. > > > > > It is unrelated to this patch itself, but I also have some doubt about > > the socket_id value stored per lcore, as no check against > > RTE_MAX_NUMA_NODES is done afterwards. > > (it is probably never hit since the default value for RTE_MAX_NUMA_NODE= S is 32). > > > > Well, it's an open question whether RTE_MAX_NUMA_NODES is the max value f= or a > node id, or the maximum number of ids which can be handled. I imagine mos= t > of the code assumes both - that we have sequential numa nodes with value = < > MAX. Regardless of the meaning, we can end up in a situation where a lcore has a socket_id set in lcore_config[] / rte_lcore_XX API, that is outside the list of numa nodes stored in config->numa_nodes[] / rte_socket_XX API, which is used for memory init for example. --=20 David Marchand