Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp741462lqd; Wed, 24 Apr 2024 16:00:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+VcSH1DY8IdJs9TuBTfChL8CtxqEjcJDu38mW5CC8aK/np155uPWCWsVaI4f7du4wmmn2N5ShenYg3i69H6TguTozPu3MlWoQ3P4PsA== X-Google-Smtp-Source: AGHT+IFA6WXLNF+iIpGf2NoN+LLdgRvyX5qzzax6i4h+jLyThZ5YybJhXvPaLiRaiq0lBf+/uzBm X-Received: by 2002:a17:906:3150:b0:a58:8602:ffa1 with SMTP id e16-20020a170906315000b00a588602ffa1mr1065016eje.19.1713999639503; Wed, 24 Apr 2024 16:00:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713999639; cv=pass; d=google.com; s=arc-20160816; b=l9EahwreSQxPekvwO+eOnG1uUXUuDCSPMiCnk7l0uJGz1qKksdfkguRxIOev6r3vk4 xIb8ktyjXjpeZ89iBheFNaVwewtfb1inoMu+xgaw8x1rOy1anSboU0OVzgz2767TFG/j 7dLQMdl85xPI9Y4Sd1F1m8RbTZxo2FBy51IxeiFijsBXMqnCOyCMn7r0LXeTt7KriN/0 1QO4SGOsWmyt8ZHP3w/Wq4h8Qu9Y7hmp7I8kWhuQbYj8si9ZWqYRDO+75OA+DRsLKcA0 AUTv7VVfyDIP4eeXBRZWALam9zucjYb4JQr1tfM+u0rXx2Jxgz7P0HeE+2brKJkqAIQa zdWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=3BMDKen4lDURPKayU5eYO0kmKgOVuk4M52gCuVuXlKI=; fh=zF0mnFNF65OG9v9U1qYqsxVSdPS1T0QLA3n7bTzI3/E=; b=vKafBY37kV+l+aYTedTLqKizVByC0vx+4CNxrVJovCF4uW/F32ovbS4U5O7jw6gKQJ xILxr6zMUZJb8Jgv4EsMQFzvUr3UmOQYHEMg4IUO5sXva/fTs5Qmop7DSVq2Wite75M5 9WULR0pcn/gzKC90IQ/cgPqGKr6nFGTTC/oJE0ubYc2W1XRF25MS/2z9Cc7CGqNSfLN8 +sDc9bhiZKxit/O4w+GOHhQg/kTqTtZqYNqwHJBVS7ayQdng2x8EalGoGEWsbTptMq5/ Wv981j5ijOnfiWhMNWt3QaV3dERAD5VyGyOB/DWYvotZwWSRHyh1ek3p2ptOsDez1C8a wdwg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=eDV+aDLu; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-crypto+bounces-3834-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3834-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v11-20020a170906180b00b00a46e28b5a79si8455153eje.818.2024.04.24.16.00.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:00:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-3834-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=eDV+aDLu; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-crypto+bounces-3834-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3834-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3F9351F25544 for ; Wed, 24 Apr 2024 23:00:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0568E16F0DD; Wed, 24 Apr 2024 23:00:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="eDV+aDLu" X-Original-To: linux-crypto@vger.kernel.org Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) (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 AC11E157465 for ; Wed, 24 Apr 2024 23:00:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713999619; cv=none; b=a8IK/HNg8W4K33fgsKiOWPLtjgSBycQOOS60PTPgC0DBHd8LuiwHhn3e5a0YvCEERM6erih0f3Nj/6i94ps3zQtrmCq3u6eOu09Dz5WT/e7F7QNMjddrzxVeV8Zr5nFBk9aVZRz6aqDn1lVDGHpuunXVeuCDeiQoTz6gjkES2pw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713999619; c=relaxed/simple; bh=OPwcFaLQ9T8uCG4Wo6nTpdLpWu2UtD2m1jc+3stupew=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=reqkLW3oV6hKWKBxHtoFo7bpjOxCZ/RBCoyi8nSHYkJF3subBlPEl5TaGJTeKLWm0urgpPzQgavO+sSbEPClRBGAv/9aC+VgPPifqDYWZK/of4Nc+ztZfcuA+t5dEssgj8KWYmtENJfCc4jDdTsz/kdv3BHiaEw78vFyu2VhP7M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=eDV+aDLu; arc=none smtp.client-ip=91.218.175.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1713999615; 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=3BMDKen4lDURPKayU5eYO0kmKgOVuk4M52gCuVuXlKI=; b=eDV+aDLuhu/FM3EG5Abpe4ZHT75SyrOUwXolWHIpOwxSuxWAgvRM4W7Rip7kDYGVwdST/T evUomv5riMmlvJ4ma7pYn+8xSFW58hqpLFsH3K6KpFrAUV0HQvdVFq5GUK6AY1F5odIFbD 3i2n48w6uNjvBcDbV7aotQtcvLD5la4= Date: Thu, 25 Apr 2024 00:00:11 +0100 Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH bpf-next v10 4/4] selftests: bpf: crypto: add benchmark for crypto functions To: Martin KaFai Lau , Vadim Fedorenko Cc: Jakub Kicinski , Andrii Nakryiko , Alexei Starovoitov , Mykola Lysenko , Herbert Xu , netdev@vger.kernel.org, linux-crypto@vger.kernel.org, bpf@vger.kernel.org References: <20240422225024.2847039-1-vadfed@meta.com> <20240422225024.2847039-5-vadfed@meta.com> <54ff0e5d-1089-4370-913a-d4fdf2fd8ad1@linux.dev> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Vadim Fedorenko In-Reply-To: <54ff0e5d-1089-4370-913a-d4fdf2fd8ad1@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 24/04/2024 23:43, Martin KaFai Lau wrote: > On 4/22/24 3:50 PM, Vadim Fedorenko wrote: >> diff --git a/tools/testing/selftests/bpf/benchs/bench_bpf_crypto.c >> b/tools/testing/selftests/bpf/benchs/bench_bpf_crypto.c >> new file mode 100644 >> index 000000000000..0b8c1f2fe7e6 >> --- /dev/null >> +++ b/tools/testing/selftests/bpf/benchs/bench_bpf_crypto.c >> @@ -0,0 +1,185 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */ >> + >> +#include >> +#include "bench.h" >> +#include "crypto_bench.skel.h" >> + >> +#define MAX_CIPHER_LEN 32 >> +static char *input; > > [ ... ] > >> +static void *crypto_producer(void *input) > > The bench result has all 0s in the output: > > $> ./bench -p 4 crypto-decrypt > Setting up benchmark 'crypto-decrypt'... > Benchmark 'crypto-decrypt' started. > Iter   0 (209.082us): hits    0.000M/s (  0.000M/prod), drops > 0.000M/s, total operations    0.000M/s > Iter   1 (154.618us): hits    0.000M/s (  0.000M/prod), drops > 0.000M/s, total operations    0.000M/s > Iter   2 (-36.658us): hits    0.000M/s (  0.000M/prod), drops > 0.000M/s, total operations    0.000M/s > > This "void *input" arg shadowed the global variable. > Got it. Will do re-spin then... >> +{ >> +    LIBBPF_OPTS(bpf_test_run_opts, opts, >> +        .repeat = 64, >> +        .data_in = input, >> +        .data_size_in = args.crypto_len, >> +    ); >> + >> +    while (true) >> +        (void)bpf_prog_test_run_opts(ctx.pfd, &opts); >> +    return NULL; >> +} >