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 B884780681 for ; Fri, 25 Sep 2026 15:30:54 +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 68PFTfaE026711; Fri, 25 Sep 2026 18:29:42 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 68PFTfaE026711 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="nPJcxV3E" Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 68PFTYWE026698 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Fri, 25 Sep 2026 18:29:34 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 68PFTYWE026698 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-49e6ba4abdfso12378105e9.1 for ; Fri, 25 Sep 2026 08:29:34 -0700 (PDT) X-Gm-Message-State: AFuF++lD5HMoOL2AsZp46BCgsXyRVKldlR04/+dyYkTmcIbKLbx17+JI 4I7Tn73FN5fiSAuSyvotzUQLM38+9AwX6orAxbtLoPCxaA3t6eoilvlZUpcCXayApo1luUH9sZx GpJJIPr6y5u0Fk8umSQSKfuNyL4Efhsl69ZpelfaAMHY6YR8dIHTvcw== X-Gm-Gg: AYBFou16MRAJwZyZRlU5O3EdJ7vX22lbh780W9lMFqJSi8/D3WlUiQAon0hQ9NyoH8i E39uqcnUS+c4HSVDrMJpssOIkXzfTITi9f2NanO2tIvGDko30omAWShi0+Oj3vwa1EEZMOHOmNT 7uS5OGixluywzPEzTR7mL+KqaCwBU3Fypxsf1P51l9Ig8PBaed5DHzT6S+6dZlrzOcEpts5LYdS PJUKeZG+DFvdxheC8ConGXtQSUDv+t7SyVg+11bdnht2WeayWu+M2Ne3izQeTWlLqo7lbrUurZf UfYSKf7x55mTMbzuxOJh5ch0XBRnXvLMX4GXdmJICOiMafEX24bNDwjCpDFuSe87gLerzS6StnF OCISjfG9Q2lsbN9SFDbdyvBR95Q== X-Received: by 2002:a05:6000:4a01:b0:488:7d0b:e34f with SMTP id ffacd0b85a97d-4887d0be424mr5335654f8f.52.1790350174000; Fri, 25 Sep 2026 08:29:34 -0700 (PDT) X-Received: by 2002:a05:6000:4a01:b0:488:7d0b:e34f with SMTP id ffacd0b85a97d-4887d0be424mr5335626f8f.52.1790350173465; Fri, 25 Sep 2026 08:29:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1790350173; cv=none; d=google.com; s=arc-20260327; b=NBF5GxxPlemi0HymfvLIXYvucdTQ8k7yD8DxTCaLdbjnbM7xcS+18S6DJsbrFc+sBJ eWOYNb3k64idqZi/YpSlssRa0e71woRWqe7xyLq3sq/Bgcuk1NCr0p3aar0JfzXNMBbI C8WIRjW2J7xq1FnOHQtw2R7QAiYTzKjagtFlHtLV6RL3j65Xg/Yw9Oy8dRwbwWeiUiE7 jRcSSEmUqbClFDYGr5R50K4GkeHpdCV45qRWmRjrHuBZsL9SxnUgTn00oXGHa+M6RWdB YB4JE5HqgAiEsFSvtlKP1uUTsTNGIGYXFTRXW53LQBg4p6yti3BteyCLB7leCxZXGHSJ uWSA== 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=jF9fiziIdDKfTbn4k8eF62qGXRhCf5GwWvhBsUfSioM=; fh=WpT6aB7RBAGHZeWZzqAr71yzRFbPTYkPWKsRagLn48Q=; b=l2lH8PvHJahIEMlhTlOmVU4t0kl8FDpPgL6Cqwa2xx355EQCoygxLQ6AZi3X7nDmwN cjRl6TSNoZySy3KSGZqUNnr0nyXaeXcuygB9WLSoZVYf02jqhZED5Ysg/hK5h7l5JFa7 0InEzcjAeALtkjCHeQ3Q8/m8YJWp0SUg5zSPmkiueMbX+YmLSRgeY9Kd0QKtn6DCqVn9 WMkXROHkqsUQnz50e2qvE+t570EHJ4FtHG1PbrhBpeXLOtS7p/ymD7w8vnccwUf+ms5y ZpYpzJOUUACUWDt3gzYfupLiIej44qSrTZVUZkCbhHNwjZASl4r6FeMa8VkDu2UCri5s 8W1A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=nPJcxV3E; 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 ffacd0b85a97d-4887a64370fsi5785180f8f.147.2026.09.25.08.29.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Sep 2026 08:29:33 -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=nPJcxV3E; 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=jF9fiziIdDKfTbn4k8eF62qGXRhCf5GwWvhBsUfSioM=; b=nPJcxV3E5Kl+ smmgPjrLUpBV/nDF98mKxEg4xhHpCy/nINXKyZL90GxMbO7cyxgSjM+vjAETgJrUg8dJZPjU7Xcjm jPw8g87MfIPWfKz2sTO8mY+mgL1zBOak9PwlxOAG9BIW5BYnnInyhP/lM7pl6EDMX1s3DGAb6Eyee TTqwyPK3TXtknUOhvFmjQz5CyMPTyPD9/UDUUG6d0zQjvw8ye3oXr0m1+YQhXvbAtcbdbRh5h+1be qghaTAMvabErMnIROz7DbVSVcbgMG3P7Q0W/RJBFOOwPPe4kUcQPiSbh1j6+WTmHoWNPJwt/j+TEz 7/Ym4p45tBJQpwg1mI6LoQ==; 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 1xA7oi-00AeXH-34; Fri, 25 Sep 2026 17:29:29 +0200 From: Eva Kurchatova To: khorenko@virtuozzo.com Date: Fri, 25 Sep 2026 18:27:55 +0300 Message-ID: <20260925152929.3669459-2-eva.kurchatova@virtuozzo.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260925152929.3669459-1-eva.kurchatova@virtuozzo.com> References: <20260925152929.3669459-1-eva.kurchatova@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v3 1/1] 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 test_lru_sanity3 fills a map of tgt_free * 2 elements, and then reads back all but the last few. Whether that passes depends on the cpu count alone; on a machine with six it does not: 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 kernel hands elements out in refills of lru->target_free, which is clamp((size / nr_cpus) / 2, 1, LOCAL_FREE_TARGET), that is 128 / nr_cpus rounded down. A refill the global free list cannot satisfy in full calls __bpf_lru_list_shrink() for the remainder, and that evicts live elements. Filling the map therefore evicts nothing only when computed 128 / nr_cpus is a power of two. Any other nr_cpus variation fails. batch_size is already __tgt_size(tgt_free), the refill size of a map is __map_size(batch_size) elements, so size the map that way and the fill consumes whole refills. Start the keys of the last insert at map_size + 1, just past the new size. Above 128 cpus __tgt_size(tgt_free) is 0 and there is no size to build on. Skip the test there. 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 | 11 +++++++++-- 1 file changed, 9 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..84e9a930471a 100644 --- a/tools/testing/selftests/bpf/test_lru_map.c +++ b/tools/testing/selftests/bpf/test_lru_map.c @@ -441,8 +441,15 @@ 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) { + /* More cpus than this tgt_free gives a refill for */ + printf("Skip\n"); + return; + } + + /* A partial refill shrinks the LRU and evicts live elements */ + map_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 +473,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