Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3529244rwb; Tue, 20 Sep 2022 00:33:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45iTKEO28dYLM68+LnI0wR7OKxt/Vk1NpiICERLrHjooHMF5kRv5PTnwpmHXEwZF1v0iKt X-Received: by 2002:a17:907:1b0e:b0:72f:9b43:b98c with SMTP id mp14-20020a1709071b0e00b0072f9b43b98cmr15858095ejc.710.1663659229176; Tue, 20 Sep 2022 00:33:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663659229; cv=none; d=google.com; s=arc-20160816; b=Pjkt6aj2snGt5lnfrbjAlE5EOEH+/uIwv7vs+B+D8iWOjo98KLDk6w5DYvI1jn4esc k9ycyc5ZD3CPHDwa6+lOGyAqcCnBrrun95g3NBgLMyQ4fxBIsqvLdMKB0i6fJ5WXtNmq ejZPYd/+AWmyalRKUesNNG4vIjimXVZMlmT/v5p3VjMOIEZre/8uEccP3Fr7tawkp50r dG8yDBMlRkL45SBrJEnuPaUE81GjIxVyw7VNmxMaglGNW/87RBUXcU7lHZEiDqopkzDH MpU8JAtG31LzBQdhubPCNZ/J54LrRmrQ3C1ftQITlmzoV6zO3ST2CK6x3E2rutG72Hbw TMhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lqNtwb4mc4cvsE3f//SW0HLCFj1RySRWTTbU7XmchYI=; b=JBCLLYqIgdY5tbodnWm3gAdljNnfq/lIxQ6mZasqOt3Gfolbf9FWFcevZRxtBtjonh z+VHmpTCtu1SJg1AN5NnR+Erkbn6H2/n2tnd5JNBuV5eoJsJHwzXv/6hVKfZAN/aKKdg +w/90oiHg4H/MetI9xnVoBeQaCfBp/D5laHFcr/RsTDdzC/qCFFJwbv+Mqvsn9UWwHjB Mec4FSPcT6K0zb+eTtIUniuUMYAnBd89i4Vbl7CIPy69kfMa8GJ/EYsDm0hZXm3zYOnd Jy3ih942iLUwjXB6TG3uw/5kWobqHpq80UH064ftUNlaHUOez+CTvhUPnjLInUdccxwR JI4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QuY1L0Pn; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k22-20020aa7c396000000b004542d6cbc47si763513edq.521.2022.09.20.00.33.21; Tue, 20 Sep 2022 00:33:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QuY1L0Pn; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229559AbiITHah (ORCPT + 99 others); Tue, 20 Sep 2022 03:30:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229557AbiITHag (ORCPT ); Tue, 20 Sep 2022 03:30:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C818A5EDD3; Tue, 20 Sep 2022 00:30:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EF4086202A; Tue, 20 Sep 2022 07:30:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE29EC433C1; Tue, 20 Sep 2022 07:30:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663659032; bh=kh4OSvjPZPtz1jxHi5/yOoKyEiwAorfd2yO5ngDd0lA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QuY1L0PnlU8afKCJz1EjxkqA9H3HSEcxyS0jTzaaDXUbAqU3n6b1EQBeqL+QkB5bP GRRF/ZxMN0L/moJPh/bb95T1C1916kyDSupGTYG7KRNtPNrRVIPlZjspEfQCpKLEns NE36SPEsbk1VBt3jrurvrFf8cljQfOpXvagb6M6s= Date: Tue, 20 Sep 2022 09:31:01 +0200 From: Greg KH To: Yang Shen 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 Message-ID: References: <20220919120537.39258-1-shenyang39@huawei.com> <20220919120537.39258-3-shenyang39@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220919120537.39258-3-shenyang39@huawei.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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