From nobody Thu Sep 24 14:25:58 2026 Received: from mail-pj2-f13.google.com (mail-pj2-f13.google.com [74.125.227.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76902DF59 for ; Wed, 23 Sep 2026 00:08:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790122108; cv=none; b=YK5ym3qdkMtm6aPSE+8vlzbRJNDRbt7cyzLfFccNqmUcErbFANfw88kW2viAChbKDCHZtX7tfZaC4IL/xGPTGv+6nWu/8Kww3Qnprzs/nJ7TqOk/86cYR3j+Klr4HZmkv9hyNWQ+m8Rz0O58JUXQQ2keQ0rX92qDDqPMpahomm4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790122108; c=relaxed/simple; bh=fsWaJap2Z4snPeSf3DEBaGqtx3ZtQ4arg0Z0hs6TbO8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jZmb3tP4vtfXH0zvciEAKBQt/n9vtuJyDmazx1PAVs+MNdL8OAaHeJUuYWGrT26rr9BbX8Wof5Q8Kcbl6zTaI5k1lDqUqDebgvLWagm3Ltf+JMQrm1UddrgQKPWM7/QcQhyl42aaksPlOm53+saPg3SFWFLDQ+JzM6QDP3VpzWs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cq2yw6Nt; arc=none smtp.client-ip=74.125.227.141 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cq2yw6Nt" Received: by mail-pj2-f13.google.com with SMTP id d9443c01a7336-2d9004a1ac0so1568125ad.3 for ; Tue, 22 Sep 2026 17:08:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790122107; x=1790726907; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=LKmQCvI2wiAQJXN+O58M5/YjmdCMCrm9Tdz8ibDBbpU=; b=cq2yw6NtCjOj5tsW3Fow42xuVBtmfqLBQd+bB7gR7tl5wIUu1xfQNzdLixk0ytZiCf p+ai/8XVv9RwHk4DvpPoFiY9r0mT1cOXs760+Oywj/Nqn0mPuWG7jf1zJBMxicilaHX7 kJXC+0JULD8btF76QXkcc9PhsguLyguPLFBCT6pu9Qn8+0LIzXuUWNHxCb3AdNB3nW1/ StB0/hJM+nXtKrOTE09Gj3CiZdGCWSnvM9Wu4Iyswjw82gjweRM1e/IBiucWHqOQf4QT y3YErqU3T/ToEs8fYLLjj5SQisLyJKhADr9kfMwDCrV9uMPgYvDxJkAjR7L0DWqkrHMh E3ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790122107; x=1790726907; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=LKmQCvI2wiAQJXN+O58M5/YjmdCMCrm9Tdz8ibDBbpU=; b=St04HW9v7ZLVV71hgt6T7IgcOpUBcLzrXHLIbNdSjVKNmwlodHKDMP3fe0+mg2Q3sU 4fGjM0xZUXvogyTKtpqoOqTn/DwaeugI4IMvgrZ+nhVgwjhHhiMtwAoKce+luZu/hXWD +EE0YWRlPlMqqO7eDM9WV4iUT6f1GZZa+tmiJsjGypaT7cbaVv8gupM5jH67l47P5TG2 6trxOeJ6iuOo3mAcrN4dsJJpa90soHnR8Q374z2wd0uPQdzsdoYTRCcrPW3Xd1YVVfnm qFZh710wrOZ57GxZ4kF47J0t/HdL1czVDo2vWo9YuulOJSHgGGUnqbzqdGCiQW1xA4xh sRnA== X-Forwarded-Encrypted: i=1; AKwUvBy62Vq3N5r+p9EeI86Oa7rRHj/05VQYwMh0MQEZjzXIBQ1itnZepdPHRYFFcbimlVnhE1GgaiUUjwNBlYA=@vger.kernel.org X-Gm-Message-State: AFuF++kPNLvQLMi0dHONYmhnI+7SMItyzWAGEj8zGsLA/1p3o0rEGXa/ eBJNwECT4CjEyaQ3ZRork+UN+EcRT6tzN0ZxZwcoiLiHwSSx39mLH58= X-Gm-Gg: AYBFou0kDIeDgtI86piYhy/UOIYE3OhmSmCah6z0cRJFFnhKqXEFryEG4qJyy4nJhrU UUv5PbdRTP2A+bW+/UdWASsiktqg6Yjy06iNuIddgEiLuDAG8tnjV6obBvnRtImu0xuor9BBaL9 JrgXV0eSeyVDTzsiU+XqNyYjpNdx+3VfI03Yw57e767Ko+0mj2Frl3KAO33OYhkbjMQfN9C7PwU CYn8wrp8d6EAWEJpIs+SI6np5TcUqe1o5MfDuix/VWZwqjyo9M+Mk8APAt9/qlqBtKZ1BWGjG+U Py+hekz3HbqTNNEDqXYztTOK8Xu09PRlyYQMQ7pXLcMhFgd/2Qsw5vFeRi8B7vpS5/ajEd7cSu3 HyjCa9KG5gU8G6e8lVcbL8bTBzrcAWuPicGjhucUlmr99etx7PdXnGUw8WVPjNyxpMdcac5Ve2N SveosRpqNoidp8zRspu0pL1OKnKqt+ur+DD4gica7+5l3EZDy12SG/aQfbLLSYI/R6TQOASvhbt IZCcdGeFI87WocYJzdzdqpoveU= X-Received: by 2002:a17:902:e741:b0:2dd:c053:e0fa with SMTP id d9443c01a7336-2df69e017bdmr8199925ad.41.1790122106661; Tue, 22 Sep 2026 17:08:26 -0700 (PDT) Received: from ydg-Zenbook-14-UM3406GA ([2001:2d8:7f00:8c85:2466:805a:e198:cde8]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2df6a5c3a3dsm2021425ad.43.2026.09.22.17.08.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 17:08:25 -0700 (PDT) From: Donggeun Yoo To: bpf@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, ihor.solodrai@linux.dev, leon.hwang@linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, donggeunyoo.kernel@gmail.com Subject: [PATCH bpf v2 1/2] bpf: Zero-fill other CPUs when BPF_F_CPU creates a per-cpu hash element Date: Wed, 23 Sep 2026 09:08:00 +0900 Message-ID: <20260923000801.1764758-2-donggeunyoo.kernel@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260923000801.1764758-1-donggeunyoo.kernel@gmail.com> References: <20260923000801.1764758-1-donggeunyoo.kernel@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" pcpu_init_value() initializes the per-cpu area of a newly created [lru_]percpu_hash element. The area is recycled, so when the value comes from a BPF program (onallcpus =3D=3D false) it writes the running CPU's slot and zeroes the rest. bpf_percpu_hash_update() passes onallcpus =3D=3D true, which delegates to pcpu_copy_value(). Since BPF_F_CPU was added that writes only the CPU named in map_flags when the flag is set, so on the create path the other slots keep the recycled element's values: update(k1, 0xdeadc0de, BPF_F_ALL_CPUS) every CPU holds 0xdeadc0de delete(k1) element back on the freelist update(k2, 0xc0ffee, BPF_F_CPU | 0) creates, writes CPU 0 only lookup(k2) CPU 0 0xc0ffee, rest 0xdeadc0de Zero-fill the other CPUs on that arm too. Fixes: c6936161fd55 ("bpf: Add BPF_F_CPU and BPF_F_ALL_CPUS flags support f= or percpu_hash and lru_percpu_hash maps") Signed-off-by: Donggeun Yoo --- The merged arm no longer calls bpf_obj_cancel_fields() on the named CPU. That call is inert here: it acts only on BPF_TIMER, BPF_WORKQUEUE and BPF_TASK_WORK, which map_check_btf() rejects for [lru_]percpu_hash. v2: name the BPF_F_CPU entry condition in the block comment. kernel/bpf/hashtab.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index 4f495dcbf670c..f7a9c432d9b76 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -1054,14 +1054,16 @@ static void pcpu_init_value(struct bpf_htab *htab, = void __percpu *pptr, /* When not setting the initial value on all cpus, zero-fill element * values for other cpus. Otherwise, bpf program has no way to ensure * known initial values for cpus other than current one - * (onallcpus=3Dfalse always when coming from bpf prog). + * (onallcpus=3Dfalse always when coming from bpf prog, + * map_flags & BPF_F_CPU when coming from syscall but setting + * only one cpu). */ - if (!onallcpus) { - int current_cpu =3D raw_smp_processor_id(); + if (!onallcpus || (map_flags & BPF_F_CPU)) { + int init_cpu =3D onallcpus ? map_flags >> 32 : raw_smp_processor_id(); int cpu; =20 for_each_possible_cpu(cpu) { - if (cpu =3D=3D current_cpu) + if (cpu =3D=3D init_cpu) copy_map_value(&htab->map, per_cpu_ptr(pptr, cpu), value); else /* Since elem is preallocated, we cannot touch special fields */ zero_map_value(&htab->map, per_cpu_ptr(pptr, cpu)); --=20 2.53.0 From nobody Thu Sep 24 14:25:58 2026 Received: from mail-pj2-f43.google.com (mail-pj2-f43.google.com [74.125.227.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3493218CC13 for ; Wed, 23 Sep 2026 00:08:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790122115; cv=none; b=NU+lcifBYr8zKidFPQMUnp4qUuxJkoR7/dza1gtUOPCA8C7fV3vCYdbqmAmFCerHyP+NbKpfIw1OdKcpQUCjC2iHMK9F+vpEphG4LY1XZretNQGasWXfazvGqEccuPOzLgmTwxIWZeH++afmTR5ytEZc6c5IFAqRG0rtb1k961k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790122115; c=relaxed/simple; bh=FXOqWk6+ZyNZc5l454FhAHeymScBoMRKHlFW2SXO0lM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eqWqxi9k7lsk+ZKavC+aoqANCwuxB5tTrfpCKCdGYS7AZMg7tWLhqWS7sk5eoH9Il9DjgBPeQ/Zv3FTb1tDYeW7QJsKaJT0kGxvD2QLHTTkPVKtGEwGT8ehLmCv7ZYn2Ty9n405owDhmEmokkFu8sdHM5FtDOPAGelfH/njUm38= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dRpn16fm; arc=none smtp.client-ip=74.125.227.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dRpn16fm" Received: by mail-pj2-f43.google.com with SMTP id d9443c01a7336-2d91ede8035so3155595ad.3 for ; Tue, 22 Sep 2026 17:08:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790122112; x=1790726912; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=jXRneLdpupGQ5UzSvLNCbz2mrO1OCHoDsNMUHQpwnQo=; b=dRpn16fmMpDckJeus7/oLEVwBHFjjTw+OfRGdIJkQSyZIhleUSrAPIZNF/7yNMgjbV 7jTBInoF/CM6tJrOSJlB2zMcX3N0H3/yYlztuStnMWgRMUQwsI66tomy3KEac4mP0JwJ 62R4EaqMrj3Vz8B66FlkgOjEmOaEwy1LQ3vH0CJJiNv1v6iAM9oSKoDwyAgUBVUUuF06 1yw8M7xIETs2lHj68wQUFhtPaZWFwdVSJ6yscWNqIR9euLOoDfe3VGuOYRLcZxiciw26 QWVDriEjtDqsi+uVsOAwUpowiI5ASaYNq1BEfpmBRrjvPV7/L5m6crTRKYEkftPq9AC7 ReFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790122112; x=1790726912; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=jXRneLdpupGQ5UzSvLNCbz2mrO1OCHoDsNMUHQpwnQo=; b=Ee30oPznKyQz7F0GuQxN66rV/6ZjDbKg1gIcyB01JC96coOFXbRlrloQKg6mrXN8T/ xGvkJMcEMEeYo3c597SkuQNrmAe5Q+5UXeWS5nkXJOE+DFuTcXdcYDZtTLH921jk9plk 2YjZrl7TO5wNofyzaSug/kIJB140wEPQd6YUWqDkRiNzgsW9dykz4DFfN9aBOe1WcJcS bn4jja8FYmEi70vcL3j0tVgkWfcU5Go6Lfq5Mr35u4pZfM187TsG9G+Z1sBwoCouHLP1 imzSUQn8ClxB4xxkVvFoijVR/UtIpXaJ+R7cW/4Pf5k1znn1lkmrrpfjZJD/sLfTSJDY S6yA== X-Forwarded-Encrypted: i=1; AKwUvBzJTnFdzRa3Xam6+r2K5YtVEhlfl3GwDqR2gUSCRegImF1JF0NAy60Eq22fmooWESbuQFn79i3rDagghpI=@vger.kernel.org X-Gm-Message-State: AFuF++lsWioch4PJt4+gi2CajbB0lSPsmO/7cCju97tZuw6PKIjrIDe3 iikYOw2QRz3kgLTqCDHvY5KT/rABWiXm34kW1AiSqY1RFnUdHvPFFeE= X-Gm-Gg: AYBFou2HH9aPe6e26xHpIWm0hH53X8rMn22504leLV4cAEdi1D5jIoQR4DJt+2F1355 PhfeWa1c5oMRTE4OYSymewbUbPhRFsWq2B1kyh3FJAcN550xk1EGe909bugiP58uK4FE/gEuhDb 4Dp4nlcyLm71c/BGe9gup1ync4/gBbS3zktdhamtK+Salb04h/11odWUrhIBU+yrJy/1kpdZyu+ iMbAvlOnLhgcqbFIBpUWanWBg46rIvKe/F5B642p7ZJ5IQDfBdwf+GTcFXOUFewLE31qwkXHwM7 9dAFGEoE1k1p0sTgt0TEelVAKRQTeDiOnztQr1VlpOTgshbX4NffSac+nSLO4Px5kfXCl0NzomO CBIQe9P/RC24DChziyzsTmDmokjEwFq+uia/SxPcbwNvplvNDtsPSc4bAxj6iOTBoXpDQm9TkJ3 qol5Eo5Qx3q3xVPsL9YBde8FrCHRPOUgYTrK5vlK11gAMtk+GNaj8EpsMRpSbnH0p1XSeD+iIJm uHw521zTpen9JuQDo7JzuQaTonlB8E5XMsq6+8LeECbfBLY X-Received: by 2002:a17:902:d484:b0:2cc:6018:f030 with SMTP id d9443c01a7336-2df69d517bdmr9833245ad.14.1790122112335; Tue, 22 Sep 2026 17:08:32 -0700 (PDT) Received: from ydg-Zenbook-14-UM3406GA ([2001:2d8:7f00:8c85:2466:805a:e198:cde8]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2df6a5c3a3dsm2021425ad.43.2026.09.22.17.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 17:08:31 -0700 (PDT) From: Donggeun Yoo To: bpf@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, ihor.solodrai@linux.dev, leon.hwang@linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, donggeunyoo.kernel@gmail.com Subject: [PATCH bpf v2 2/2] selftests/bpf: Test per-cpu initialization of a BPF_F_CPU created element Date: Wed, 23 Sep 2026 09:08:01 +0900 Message-ID: <20260923000801.1764758-3-donggeunyoo.kernel@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260923000801.1764758-1-donggeunyoo.kernel@gmail.com> References: <20260923000801.1764758-1-donggeunyoo.kernel@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The existing cpu_flag subtests always prime a key with BPF_F_ALL_CPUS before any BPF_F_CPU write, so the create path is never covered. Add a subtest that creates the element with BPF_F_CPU on a map with max_entries 1, so the key can only reuse the element the previous key released, and check that the CPUs the update did not name read back zero. Run it for PERCPU_HASH preallocated and BPF_F_NO_PREALLOC, whose per-cpu areas come from different allocators, and for LRU_PERCPU_HASH. Signed-off-by: Donggeun Yoo --- v2: skip on a uniprocessor machine instead of failing; the block comment uses the general kernel style. .../selftests/bpf/prog_tests/percpu_alloc.c | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/percpu_alloc.c b/tools/= testing/selftests/bpf/prog_tests/percpu_alloc.c index a72ae0b29f6e9..f853f97bb882d 100644 --- a/tools/testing/selftests/bpf/prog_tests/percpu_alloc.c +++ b/tools/testing/selftests/bpf/prog_tests/percpu_alloc.c @@ -350,6 +350,80 @@ static void test_lru_percpu_hash_cpu_flag(void) test_percpu_map_cpu_flag(BPF_MAP_TYPE_LRU_PERCPU_HASH); } =20 +/* + * A BPF_F_CPU update that creates an element must zero the value on the o= ther + * cpus, rather than leave them holding whatever the recycled element last + * contained. max_entries is 1 so the second key can only reuse the element + * the first one released. + */ +static void test_percpu_map_cpu_flag_create(enum bpf_map_type map_type, __= u32 map_flags) +{ + LIBBPF_OPTS(bpf_map_create_opts, opts, .map_flags =3D map_flags); + const u32 stale =3D 0xDEADC0DE, fresh =3D 0xC0FFEE; + int nr_cpus, cpu, map_fd, err, key; + u32 value; + u64 flags; + + nr_cpus =3D libbpf_num_possible_cpus(); + if (!ASSERT_GT(nr_cpus, 0, "libbpf_num_possible_cpus")) + return; + + if (nr_cpus < 2) { + test__skip(); + return; + } + + map_fd =3D bpf_map_create(map_type, "cpu_flag_create", sizeof(key), sizeo= f(value), 1, &opts); + if (!ASSERT_GE(map_fd, 0, "bpf_map_create")) + return; + + key =3D 1; + value =3D stale; + err =3D bpf_map_update_elem(map_fd, &key, &value, BPF_F_ALL_CPUS); + if (!ASSERT_OK(err, "bpf_map_update_elem all_cpus")) + goto out; + + err =3D bpf_map_delete_elem(map_fd, &key); + if (!ASSERT_OK(err, "bpf_map_delete_elem")) + goto out; + + key =3D 2; + value =3D fresh; + flags =3D BPF_F_CPU; + err =3D bpf_map_update_elem(map_fd, &key, &value, flags); + if (!ASSERT_OK(err, "bpf_map_update_elem specified cpu")) + goto out; + + for (cpu =3D 0; cpu < nr_cpus; cpu++) { + value =3D 0; + flags =3D (u64)cpu << 32 | BPF_F_CPU; + err =3D bpf_map_lookup_elem_flags(map_fd, &key, &value, flags); + if (!ASSERT_OK(err, "bpf_map_lookup_elem_flags specified cpu")) + goto out; + if (!ASSERT_EQ(value, cpu ? 0 : fresh, "value on specified cpu")) + goto out; + } + +out: + close(map_fd); +} + +static void test_percpu_hash_cpu_flag_create(void) +{ + test_percpu_map_cpu_flag_create(BPF_MAP_TYPE_PERCPU_HASH, 0); +} + +static void test_percpu_hash_cpu_flag_create_malloc(void) +{ + test_percpu_map_cpu_flag_create(BPF_MAP_TYPE_PERCPU_HASH, BPF_F_NO_PREALL= OC); +} + +static void test_lru_percpu_hash_cpu_flag_create(void) +{ + /* lru without prealloc is -ENOTSUPP, so there is no malloc variant */ + test_percpu_map_cpu_flag_create(BPF_MAP_TYPE_LRU_PERCPU_HASH, 0); +} + static void test_percpu_cgroup_storage_cpu_flag(void) { struct percpu_alloc_array *skel =3D NULL; @@ -454,6 +528,12 @@ void test_percpu_alloc(void) test_percpu_hash_cpu_flag(); if (test__start_subtest("cpu_flag_lru_percpu_hash")) test_lru_percpu_hash_cpu_flag(); + if (test__start_subtest("cpu_flag_create_percpu_hash")) + test_percpu_hash_cpu_flag_create(); + if (test__start_subtest("cpu_flag_create_percpu_hash_malloc")) + test_percpu_hash_cpu_flag_create_malloc(); + if (test__start_subtest("cpu_flag_create_lru_percpu_hash")) + test_lru_percpu_hash_cpu_flag_create(); if (test__start_subtest("cpu_flag_percpu_cgroup_storage")) test_percpu_cgroup_storage_cpu_flag(); if (test__start_subtest("cpu_flag_array")) --=20 2.53.0