From: Yang Shen <shenyang39@huawei.com>
To: <herbert@gondor.apana.org.au>, <davem@davemloft.net>
Cc: <linux-kernel@vger.kernel.org>, <linux-crypto@vger.kernel.org>,
<gregkh@linuxfoundation.org>
Subject: [RFC PATCH 5/6] crypto: benchmark - add API documentation
Date: Mon, 19 Sep 2022 20:05:36 +0800 [thread overview]
Message-ID: <20220919120537.39258-6-shenyang39@huawei.com> (raw)
In-Reply-To: <20220919120537.39258-1-shenyang39@huawei.com>
Provide a crypto benchmark to help the developer quickly get the
performance of a crypto-registed algorithm.
To simulate more scenes, the tool has following parameters under
'/sys/modules/crypto_benchmark/parameters/' to configure: algorithm,
algtype, inputsize, loop, numamask, optype, reqnum, threadnum
and time.
To shield the differences between different algorithms, the tool has
following interface to do a crypto request: init, uninit, create_tfm,
release_tfm, create_req, release_req, perf and help.
Signed-off-by: Yang Shen <shenyang39@huawei.com>
---
Documentation/crypto/benchmark.rst | 104 +++++++++++++++++++++++++++++
1 file changed, 104 insertions(+)
create mode 100644 Documentation/crypto/benchmark.rst
diff --git a/Documentation/crypto/benchmark.rst b/Documentation/crypto/benchmark.rst
new file mode 100644
index 000000000000..e9b13e81bce3
--- /dev/null
+++ b/Documentation/crypto/benchmark.rst
@@ -0,0 +1,104 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+Crypto Benchmark
+================
+
+Overview
+--------
+The crypto benchmark is a crypto algorithm performance tool.
+
+Designed Scheme
+---------------
+
+1. Parameters
+
+The crypto benchmark is used for test the algorithm registered in crypto
+subsystem. Users can use module parameters to simulate different scenarios.
+Both considering the test scenarios and the use complexity, the benchmark
+tool has following module parameters:
+
+- algorithm
+The 'algorithm' is used to create a 'crypto_tfm'. The right algorithm name
+can be found in /proc/crypto.
+
+- algtype
+The 'algtype' is used to find the operations of algorithm. Can get the
+algorithm class by echo 'algtype' to
+/sys/module/crypto_benchmark/parameters/help.
+
+- inputsize
+The 'inputsize' is used as testing inputsize, outputsize will be set
+according to algorithm.
+
+- loop
+The 'loop' is used as times to try to send request for one 'crypto_req'.
+Avoid performance fluctuations caused by environment.
+For synchronization mode, the loop times is equal to send times.
+But for asynchronization, the send times is often less than loop times.
+
+- numamask
+The 'numamask' is used as testing binding numa nodes. The input will be
+analyzed as a bitmap.
+
+- optype
+The 'optype' is used for choose algorithm operation function. Can get the
+algorithm available operation types by cat
+/sys/module/crypto_benchmark/parameters/help with specified 'algtype'.
+For example, choose the compress and decompress when test crypto comp.
+
+- reqnum
+The 'reqnum' is used as requests number of a crypto tfm. For asynchronization,
+one thread may used plural 'crypto_req' to improve performance. One request
+a thread is a synchronous model
+
+- threadnum
+The 'threadnum' is used for creating testing threads. To simplify model,
+create a 'crypto_tfm' per thread. Notice that all threads will be divided
+equally to the specified NUMA node, and threads that cannot be divided
+equally will be created on the last node.
+
+- time
+The 'time' is used for testing. Used for stop the test thread. If the time
+is not enough, the thread will send another group loop times requests.
+
+- run
+The 'run' is used to trigger the test. Echo 0 for stop all test threads,
+and others for starting test.
+
+- help
+The 'help' is used to guide users to use the test interface. Echo a module
+parameter name to 'help' can get the detailed information. Cat the 'help'
+can get some private information according to 'algtype'.
+
+2. Register
+
+There are too many differences between crypto algorithms. Therefore, the
+crypto benchmark only completes the general work. All the different parts
+are put into the callback of the algorithm to complete. The usual crypto
+task can be divided into three parts: alloc tfm, alloc request, and send
+request.
+
+A new algorithm class want to register to crypto benchmark should realize
+following callbacks:
+
+- init & uninit
+The initialize related functions. Algorithm can do some private setting.
+
+- create_tfm & release_tfm
+The crypto_tfm related functions. Algorithm has different tfm name.
+But they both has a member named tfm, so use tfm to stand for algorithm
+handle. The benchmark has provides the tfm array.
+
+- create_req & release_req
+The crypto_req related functions. The registrant should create a 'reqnum'
+'crypto_req' group in struct 'crypto_bm_base'. And the also suggest
+prepare the request data in this function. To simulate real cache and TLB
+hit rate, using a big data groups is a good plan.
+
+- perf
+The request sending functions. The registrant should use parameter 'loop'
+to send requests repeatly. And update the count in struct
+'crypto_bm_thread_data'.
+
+- help
+The algorithm private parameters meaning functions.
--
2.24.0
next prev parent reply other threads:[~2022-09-19 12:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-19 12:05 [RFC PATCH 0/6] crypto: benchmark - add the crypto benchmark Yang Shen
2022-09-19 12:05 ` [RFC PATCH 1/6] moduleparams: Add hexulong type parameter Yang Shen
2022-09-19 12:05 ` [RFC PATCH 2/6] crypto: benchmark - add a crypto benchmark tool Yang Shen
2022-09-20 7:31 ` Greg KH
2022-09-21 8:20 ` Yang Shen
2022-09-19 12:05 ` [RFC PATCH 3/6] crytpo: benchmark - support compression/decompresssion Yang Shen
2022-09-19 12:05 ` [RFC PATCH 4/6] crypto: benchmark - add help information Yang Shen
2022-09-19 12:05 ` Yang Shen [this message]
2022-09-19 12:05 ` [RFC PATCH 6/6] MAINTAINERS: add crypto benchmark MAINTAINER Yang Shen
2022-09-20 8:28 ` [RFC PATCH 0/6] crypto: benchmark - add the crypto benchmark Herbert Xu
2022-09-21 8:19 ` Yang Shen
2022-09-30 4:51 ` Herbert Xu
2022-10-14 1:43 ` Yang Shen
2022-10-14 8:25 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220919120537.39258-6-shenyang39@huawei.com \
--to=shenyang39@huawei.com \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox