Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Yang Shen <shenyang39@huawei.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: <herbert@gondor.apana.org.au>, <davem@davemloft.net>,
	<linux-kernel@vger.kernel.org>, <linux-crypto@vger.kernel.org>
Subject: Re: [RFC PATCH 2/6] crypto: benchmark - add a crypto benchmark tool
Date: Wed, 21 Sep 2022 16:20:01 +0800	[thread overview]
Message-ID: <69a629de-a2f8-202c-da31-a5f11c87427a@huawei.com> (raw)
In-Reply-To: <YylsNQb/EjUqkWEZ@kroah.com>



在 2022/9/20 15:31, Greg KH 写道:
> On Mon, Sep 19, 2022 at 08:05:33PM +0800, Yang Shen wrote:
>> Provide a crypto benchmark to help the developer quickly get the
>> performance of a algorithm registered in crypto.
>>
>> Due to the crypto algorithms have multifarious parameters, the tool
>> cannot support all test scenes. In order to provide users with simple
>> and easy-to-use tools and support as many test scenarios as possible,
>> benchmark refers to the crypto method to provide a unified struct
>> 'crypto_bm_ops'. And the algorithm registers its own callbacks to parse
>> the user's input. In crypto, a algorithm class has multiple algorithms,
>> but all of them uses the same API. So in the benchmark, a algorithm
>> class uses the same 'ops' and distinguish specific algorithm by name.
>>
>> First, consider the performance calculation model. Considering the
>> crypto subsystem model, a reasonable process code based on crypto api
>> should create a numa node based 'crypto_tfm' in advance and apply for
>> a certain amount of 'crypto_req' according to their own business.
>> In the real business processing stage, the thread send tasks based on
>> 'crypto_req' and wait for completion.
>>
>> Therefore, the benchmark will create 'crypto_tfm' and 'crypto_req' at
>> first, and then count all requests time to calculate performance.
>> So the result is the pure algorithm performance. When each algorithm
>> class implements its own 'ops', it needs to pay attention to the content
>> completed in the callback. Before the 'ops.perf', the tool had better
>> prepare the request data set. And in order to avoid the false high
>> performance of the algorithm caused by the false cache and TLB hit rate,
>> the size of data set should be larger than 'crypto_req' number.
>> The 'crypto_bm_ops' has following api:
>>   - 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 in
>>   crypto. 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 callbacks should create a 'reqnum'
>>   'crypto_req' group in struct 'crypto_bm_base'. And the also suggest
>>   prepare the request data in this function. In order to avoid the false
>>   high performance of the algorithm caused by the false cache and TLB hit
>>   rate, the size of data set should be larger than 'crypto_req' number.
>>   - 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'.
>>
>> Then consider the parameters that user can configure. Generally speaking,
>> the following parameters will affect the performance of the algorithm:
>> tfm number, request number, block size, numa node. And some parameters
>> will affect the stability of performance: testing time and requests sent
>> number. To sum up, the benchmark has following parameters:
>>   - algorithm
>>   The testing algorithm name. Showed in /proc/crypto.
>>   - algtype
>>   The testing algorithm class. Can get the algorithm class by echo 'algtype'
>>   to /sys/module/crypto_benchmark/parameters/help.
>>   - inputsize
>>   The testing length that can greatly impact performance. Such as data size
>>   for compress or key length for encryption.
>>   - loop
>>   The testing loop times. Avoid performance fluctuations caused by
>>   environment.
>>   - numamask
>>   The testing bind numamask. Used for allocate memory, create threads and
>>   create 'crypto_tfm'.
>>   - optype
>>   The testing algorithm operation type. Can get the algorithm available
>>   operation types by cat /sys/module/crypto_benchmark/parameters/help
>>   with specified 'algtype'.
>>   - reqnum
>>   The testing request number for per tfm. Used for test asynchrony api
>>   performance.
>>   - threadnum
>>   The testing thread number. To simplify model, create a 'crypto_tfm' per
>>   thread.
>>   - time
>>   The testing time. Used for stop the test thread.
>>   - run
>>   Start or stop the test.
>>
>> Users can configure parameters under
>> /sys/modules/crypto_benchmark/parameters/.
> Please don't use module parameters for stuff like this, use configfs
> which was designed for this type of interactions.
>
> thanks,
>
> greg k-h
Got it!

Thanks,

Yang


  reply	other threads:[~2022-09-21  8:20 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 [this message]
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 ` [RFC PATCH 5/6] crypto: benchmark - add API documentation Yang Shen
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=69a629de-a2f8-202c-da31-a5f11c87427a@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