From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id A6C418036A for ; Mon, 31 Aug 2026 23:43:38 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 67VNgRcJ032044; Tue, 1 Sep 2026 02:42:28 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 67VNgRcJ032044 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="E/Y8QahP" Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 67VNgKVk032012 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 1 Sep 2026 02:42:20 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 67VNgKVk032012 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-472c330e555so1763577f8f.1 for ; Mon, 31 Aug 2026 16:42:20 -0700 (PDT) X-Gm-Message-State: AFuF++n3OsmtXPoq9HFvvfkfsI/wtQzg8d/Y3jawNQuxI+25J8rvz1N1 t65Fy3C/V9uFaPPJz80ZuHym50IEPQLG1Q2xXsQlgadmN51Z1mDj085EGn3Ct+OWe3WD2DQIX/Y 8yWAxQNJTcfOdXQhShYgZW13XUmL2Tv2J0LjvVx/t2UD8zHJCzOVtNw== X-Gm-Gg: AR+sD11wrhrUbBDIGgS0m49v/4J7zo4+i7gJAduifIGIPk0KG3STkIi/AJjSKGMg0XJ QXYnZLqFQ0o2caiR04P2UIyJdvz42NCRpI2ShD+ojNLEp/q8VYwiTaN1Z8nwCfyv2BIPq/rnup5 lxfv3YQsd42TlgqueKVbWIOkU9Z6DthQVXgPhF+MwBWRG9wv8yTrwpenJ13rE9H2AJxCpDX6CpP HfiD6a0BmZ3bW3xbHFg2Aw4jObegvIE+ohHa/GGuU6QYi9/88CSEy7MpsDxKGIxp+cheEuUz8K2 NH4Z2lFbjvXjDqtu+iWLaJYhvjyjRBXXNXVDpRCwbd9Oau+JdSo9A4fwa4/5tswhwkvS8x0Hhm6 6FYpQc7mIlhu0kiX5I/EHsC5ajQ== X-Received: by 2002:a05:600c:8411:b0:499:4892:d022 with SMTP id 5b1f17b1804b1-49b91c279e1mr530739245e9.8.1788219740607; Mon, 31 Aug 2026 16:42:20 -0700 (PDT) X-Received: by 2002:a05:600c:8411:b0:499:4892:d022 with SMTP id 5b1f17b1804b1-49b91c279e1mr530738745e9.8.1788219740234; Mon, 31 Aug 2026 16:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1788219740; cv=none; d=google.com; s=arc-20260327; b=eFJHfJyQtP/VubeL7SUjJ8DEiuZW3kXQKUgKzJAMPOf9WLV773GF/MuYk8jm8EYCuY dRZFgncLQLTanX2TbSl8PNllLbN6ydKl/dnAC18S3ejAJKCedEjO7+cvOQDqmcw2x6Ta N5gQyuV0xViQ4MParWzj5WKyEpNt6VkSFSlXcWXvOs2fvAxddZzf2tSCV+rqg1RfrnTe dlz67Wuqca7L+AXcjXdEDmKY4A88owi+MYaG6mDVqc1tl1eGW/N/iZscYmxBPlr62Vqe THEk2hL6JY54k7JWa2PosjEW7RRcebWAqf6cr3dqlV/9xeIpf79BJlzMLxk4jf28zd+A yCZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=U1vOJcFij3a15Tg3Y9DYfaMYIAWVUoZk2Q/DHj2f9Zs=; fh=WpT6aB7RBAGHZeWZzqAr71yzRFbPTYkPWKsRagLn48Q=; b=VEegAaBoby9OlAAkN/1va27r8q2fQvtoOXmUJQoy+2zBKq0b7x3bsJ0LzD5e3xCNEn 4gT6guoDmh2dzp5VURqGxlu/VOGyuCUf7dljZ9TzUi5lG8nzaKfUie32TbeN4/VTaSma 1SkmvPecuGYxXXtf75s2DdBwrZqDgFHWlMNatWMQzEXEghjF/m6avq3hu9vU5RIlvkp4 qay6fUa87PXb+rp/nCvzHcPpKuJkmeDNbCujjNXmgKiJlHrbBOk+7u20oA7V2SiOq32c 3IMeSzxB228bAQkciQ3AWxH7I5YYHKDPyWVrqT/2KB/QSG7B1qR8ac8Ydql3m2pGSbp6 yCWA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b="E/Y8QahP"; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id 5b1f17b1804b1-49cdda9f5d5si21104085e9.12.2026.08.31.16.42.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2026 16:42:20 -0700 (PDT) Received-SPF: pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b="E/Y8QahP"; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=U1vOJcFij3a15Tg3Y9DYfaMYIAWVUoZk2Q/DHj2f9Zs=; b=E/Y8QahPWZhL Re35dsHz0scqqcLKWe6qUz+oFyfSbhQeSl2wG9M8NzjqaUjpvkQp16uU4N5l0Ee7DAg71iR7sQAHR /ucVWgQmHjXBZzU87FjebXQT2bFdZX8d4D60zLqgFNpPYg7NSvm3tZ6Fxo3CPMOpb6CUBw9jk0B/c aGOLhPj7zVuJ+ADbvqpaFJKnKI8OkUFBt5hNgeXlSBVXqgM9+ZfI8GiWw04t5IbQON7geLJUqfba0 /ijenoKB1aJLpLkaTe56umh5rVOq9qLjN0QKktXiBGIdq+TlQQGz7U4+G6+IVB68Bg1dL9co2XqkQ vRnPvmcwqcZr2QbiYAD9uA==; Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=LekKit-T14) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1x1BbV-00Alra-0W; Tue, 01 Sep 2026 01:42:11 +0200 From: Eva Kurchatova To: khorenko@virtuozzo.com Date: Tue, 1 Sep 2026 02:41:50 +0300 Message-ID: <20260831234217.1649428-3-eva.kurchatova@virtuozzo.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260831234217.1649428-1-eva.kurchatova@virtuozzo.com> References: <20260831234217.1649428-1-eva.kurchatova@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH vz10 v2 3/5] selftests: bpf: size the map in test_lru_sanity3 to whole refills X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org The test fills a map of tgt_free * 2 elements and then reads back all but the last few, which fails on a machine with six cpus: test_lru_sanity3 (map_type:9 map_flags:0x0): test_lru_map.c:463: test_lru_sanity3: Assertion `!bpf_map_lookup_elem_with_ref_bit( lru_map_fd, key, value)' failed. The elements are handed out in refills of lru->target_free, which the kernel derives from the map size as clamp((size / nr_cpus) / 2, 1, LOCAL_FREE_TARGET), 21 for a 256 element map and six cpus. A refill the global free list cannot satisfy in full does not stop there, it calls __bpf_lru_list_shrink() for the remainder, and that evicts elements which are still live. 256 is not a multiple of 21, so filling the map ends on a partial refill that drops 17 of the elements the test goes on to reference, and the lookup fails on the first of them. Whether the size divides evenly depends on the cpu count alone, which is why this passes on two and on sixty four cpus and fails on six. batch_size is already __tgt_size(tgt_free), the refill size of a map of __map_size(batch_size) elements, so size the map that way and the fill consumes whole refills and evicts nothing. Start the keys of the last insert at map_size + 1, they were placed just past the old size. Fixes: 5e9388f7984a ("selftests/bpf: adapt one more case in test_lru_map to the new target_free") https://virtuozzo.atlassian.net/browse/VSTOR-139677 Feature: fix selftests Signed-off-by: Eva Kurchatova --- tools/testing/selftests/bpf/test_lru_map.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/test_lru_map.c b/tools/testing/selftests/bpf/test_lru_map.c index 0921939532c6..fc67a337d3c1 100644 --- a/tools/testing/selftests/bpf/test_lru_map.c +++ b/tools/testing/selftests/bpf/test_lru_map.c @@ -441,8 +441,18 @@ static void test_lru_sanity3(int map_type, int map_flags, unsigned int tgt_free) assert(sched_next_online(0, &next_cpu) != -1); batch_size = __tgt_size(tgt_free); + if (!batch_size) + batch_size = 1; + + /* The local free list is refilled lru->target_free elements at a + * time, and a refill the global free list cannot satisfy in full + * shrinks the LRU list, which evicts elements that are still live. + * Size the map so that target_free divides it, otherwise filling it + * ends on a partial refill and evicts the elements referenced below. + */ + map_size = __map_size(batch_size); + assert(__tgt_size(map_size) == batch_size); - map_size = tgt_free * 2; lru_map_fd = create_map(map_type, map_flags, map_size); assert(lru_map_fd != -1); @@ -466,7 +476,7 @@ static void test_lru_sanity3(int map_type, int map_flags, unsigned int tgt_free) } /* Insert new batch_size: replaces the non-referenced elements */ - key = 2 * tgt_free + 1; + key = 1 + map_size; end_key = key + batch_size; for (; key < end_key; key++) { assert(!bpf_map_update_elem(lru_map_fd, &key, value, -- 2.55.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel