From patchwork Sat Jan 25 15:24:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saket Kumar Bhaskar X-Patchwork-Id: 13950402 X-Patchwork-Delegate: bpf@iogearbox.net Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4899928399; Sat, 25 Jan 2025 15:25:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737818758; cv=none; b=H5gUbbPlsF/1m4D7NrT+bHF7q0W/Ffwh9Y7hyN5S6wn9XmgtysLnysAmb22aUnvgQHWj09JOy0qZ++0dr8Hij2ea+iFkTMU7Q66rN0QwFf8sXvtvRGwzxK0zebPUW4s45eQleNBzUaOVjLuQQtaiYK0vsXqyvDdOaTJ9t4FKZWM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737818758; c=relaxed/simple; bh=j4Go8/i2CqR47Ci3x3eSHwaVAi3HBFYj3yAvFS/hses=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XNWtISFaSycYHyTFRXSP9DXzNO/e5Tf+Cqz8T4Q+kSounm2e2Sf5RxRuMYhEdeKzes2833PKoWuIQ6anVefZDk7rEcuCy0vWCssiJDgzxz4QeF1pTrW6mx6oOCExc9aWOvwJZmwHMriGuf6/BMWz6JfNs3vyinEUOXPj4DsRsFU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=l2cmfGcA; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="l2cmfGcA" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50P7XJvi012028; Sat, 25 Jan 2025 15:25:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=11PDa0k0R1RTLaCjo +/PWjMeUbaQVkOOqact7XO7iUs=; b=l2cmfGcA5SKeZ0/OFgyibsoSkCwh+GuL4 SGn3XnAqOroSZ83EfmtTKUhlFcbaNSRvF5bMnOuH8Q9cXZBRJHCoyYGmbkGbJuMx ZkJg9IN3eDx6gkUMe+L3Tt+HykTU6cMvA/eRzMBDjn6LXIF54f+GXjGS6If9jl3d i+N7/g3Ye6m+mMSzQq/FwSMGV/sW3G3EtVdTND6m0aDhBJafbOIDNI6/WNoDXOuh sR0sq6VdI9k8Bj5NUFKCpW0bzruFWP7vZSAuum0ppPG1zt1HbOLciGHTR4TMG8YB lGNJZRcI6sR2/e/kFJu/r0kcq9Zge0wpuAlU+LVnec16jFUD8lIbQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 44cunn960t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 25 Jan 2025 15:25:20 +0000 (GMT) Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 50PFPKQH025680; Sat, 25 Jan 2025 15:25:20 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 44cunn960m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 25 Jan 2025 15:25:20 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 50PAF19Q004570; Sat, 25 Jan 2025 15:25:19 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 44cx1g8un6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 25 Jan 2025 15:25:19 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 50PFPHYW60948990 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 25 Jan 2025 15:25:17 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 41AE12007D; Sat, 25 Jan 2025 15:25:17 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5E16C2007F; Sat, 25 Jan 2025 15:25:05 +0000 (GMT) Received: from li-621bac4c-27c7-11b2-a85c-c2bf7c4b3c07.ibm.com.com (unknown [9.43.43.213]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Sat, 25 Jan 2025 15:25:04 +0000 (GMT) From: Saket Kumar Bhaskar To: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: ast@kernel.org, hbathini@linux.ibm.com, andrii@kernel.org, daniel@iogearbox.net, davem@davemloft.net, kuba@kernel.org, hawk@kernel.org, martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org, mykolal@fb.com, shuah@kernel.org Subject: [PATCH 2/2] selftests/bpf: Select NUMA node of current CPU to create map Date: Sat, 25 Jan 2025 20:54:33 +0530 Message-ID: X-Mailer: git-send-email 2.43.5 In-Reply-To: <70fb07e980196ced9fc3e5e4dbeededce2e36fdc.1737816475.git.skb99@linux.ibm.com> References: <70fb07e980196ced9fc3e5e4dbeededce2e36fdc.1737816475.git.skb99@linux.ibm.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: tNHmhVy880gXblGTNasSvgYk4bgf6rkH X-Proofpoint-GUID: lkqylRq2SQ8HTppkdxUwfV1sl4tUa3V9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-25_06,2025-01-23_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 spamscore=0 clxscore=1015 mlxscore=0 impostorscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501250109 X-Patchwork-Delegate: bpf@iogearbox.net On powerpc, a CPU does not necessarily originate from NUMA node 0. This contrasts with architectures like x86, where CPU 0 is not hot-pluggable, making NUMA node 0 a consistently valid node. This discrepancy can lead to failures when creating a map on NUMA node 0, which is initialized by default, if no CPUs are allocated from NUMA node 0. This patch fixes the issue by setting NUMA node for map creation to NUMA node of the current CPU. Fixes: 96eabe7a40aa ("bpf: Allow selecting numa node during map creation") Signed-off-by: Saket Kumar Bhaskar --- tools/testing/selftests/bpf/Makefile | 2 +- tools/testing/selftests/bpf/prog_tests/bloom_filter_map.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 0a016cd71..c7a996f53 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -47,7 +47,7 @@ CFLAGS += -g $(OPT_FLAGS) -rdynamic \ -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR) \ -I$(TOOLSINCDIR) -I$(TOOLSARCHINCDIR) -I$(APIDIR) -I$(OUTPUT) LDFLAGS += $(SAN_LDFLAGS) -LDLIBS += $(LIBELF_LIBS) -lz -lrt -lpthread +LDLIBS += $(LIBELF_LIBS) -lz -lrt -lpthread -lnuma PCAP_CFLAGS := $(shell $(PKG_CONFIG) --cflags libpcap 2>/dev/null && echo "-DTRAFFIC_MONITOR=1") PCAP_LIBS := $(shell $(PKG_CONFIG) --libs libpcap 2>/dev/null) diff --git a/tools/testing/selftests/bpf/prog_tests/bloom_filter_map.c b/tools/testing/selftests/bpf/prog_tests/bloom_filter_map.c index cc184e442..d241d22b8 100644 --- a/tools/testing/selftests/bpf/prog_tests/bloom_filter_map.c +++ b/tools/testing/selftests/bpf/prog_tests/bloom_filter_map.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "bloom_filter_map.skel.h" static void test_fail_cases(void) @@ -69,6 +70,7 @@ static void test_success_cases(void) /* Create a map */ opts.map_flags = BPF_F_ZERO_SEED | BPF_F_NUMA_NODE; + opts.numa_node = numa_node_of_cpu(sched_getcpu()); // Get the NUMA node of the current CPU fd = bpf_map_create(BPF_MAP_TYPE_BLOOM_FILTER, NULL, 0, sizeof(value), 100, &opts); if (!ASSERT_GE(fd, 0, "bpf_map_create bloom filter success case")) return;