From patchwork Sun Dec 17 08:29:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 122174 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1514613qgn; Sun, 17 Dec 2017 00:30:15 -0800 (PST) X-Google-Smtp-Source: ACJfBotPYkZfT7keT+/0WoIDam0OD2UHM+obBT5jl7ZaHBtWh1r3vUODq/2q+YlX4IOzI2vrTf8N X-Received: by 10.159.196.130 with SMTP id c2mr19056163plo.123.1513499415090; Sun, 17 Dec 2017 00:30:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513499415; cv=none; d=google.com; s=arc-20160816; b=PFAi2/eIsFazAgE7Z1eo1jC8+EnEgq6W0kS6LaQ5rHIgVZimWxoBkvfUXH6xha57YW qQ+Ylx0KER+IsAkRDGxihH8wTzcTL1zf8PlTEhGO8rlz5lvuS9YmCXu4dLy5LfqONTXB aP9n+uhYHCXuUf1DIMQR5btVtvcL0NjRr2y7ShS5sC0alJb1V3FXRdJI/66YrzEsiYiI X+KbFjSiBWVwrjlR0iuj2D4LUvELX8p5NKDICGH5x5fOq+mknKx7trTQrVD4rsSasIdS 0fkvdL/QCT1idR9D7TYmQibKuXSlgCxu2W5eSwV28HWc7sMnbAbjh5/cb1TMhpRdbFaE zHIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=fdofa9jNHUZDonqBeoFqTgPeaMX0UqIhrz+wF3jQCo8=; b=cUHrFfVHrinX9XgXDhpEnKrOyfEsPjuZZ6cQWeWghUk3noCFy6AcFH73gbSrAfPXHK X8nMmt38SSMZ3/+t1UtE08ahu6pGswMAP3lHPvk5vdHbs1oIOyN8IpxxWfh68kSZpzRI 6eKVfTCqpj0dYrZkJfNTpyqsK9gsDi9QSrtVbb/fqYJxq/JgiDLSzh4a6W7ieu8IdY4b JokSqWBLINYWGTPwYWDz1nxatXuS6mgzMhNugcFp9PhhjU9rpef3y093e+Ss2Eh+qs06 IcsbhV3XU7ye548BJnc5ED8jlY+tBvSPTR+slaBTNFjWnAG5fK6arcTFr3HkuKZgD1wQ lcYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w7si7550038plp.574.2017.12.17.00.30.14; Sun, 17 Dec 2017 00:30:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752395AbdLQIaM (ORCPT + 1 other); Sun, 17 Dec 2017 03:30:12 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:40906 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751883AbdLQIaF (ORCPT ); Sun, 17 Dec 2017 03:30:05 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 869E61596; Sun, 17 Dec 2017 00:30:04 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1B4743F24A; Sun, 17 Dec 2017 00:30:02 -0800 (PST) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: Ofir Drang , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/6] crypto: tcrypt: use multi buf for ahash mb test Date: Sun, 17 Dec 2017 08:29:00 +0000 Message-Id: <1513499346-9047-2-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513499346-9047-1-git-send-email-gilad@benyossef.com> References: <1513499346-9047-1-git-send-email-gilad@benyossef.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The multi buffer ahash speed test was allocating multiple buffers for use with the multiple outstanding requests it was starting but never actually using them (except to free them), instead using a different single statically allocated buffer for all requests. Fix this by actually using the allocated buffers for the test. It is noted that it may seem tempting to instead remove the allocation and free of the multiple buffers and leave things as they are since this is a hash test where the input is read only. However, after consideration I believe that multiple buffers better reflect real life scenario with regard to data cache and TLB behaviours etc. Signed-off-by: Gilad Ben-Yossef --- crypto/tcrypt.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 28b4882..a0c4e0d 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -385,7 +385,7 @@ static inline int do_one_ahash_op(struct ahash_request *req, int ret) } struct test_mb_ahash_data { - struct scatterlist sg[TVMEMSIZE]; + struct scatterlist sg[XBUFSIZE]; char result[64]; struct ahash_request *req; struct crypto_wait wait; @@ -428,7 +428,12 @@ static void test_mb_ahash_speed(const char *algo, unsigned int sec, ahash_request_set_callback(data[i].req, 0, crypto_req_done, &data[i].wait); - test_hash_sg_init(data[i].sg); + + sg_init_table(data[i].sg, XBUFSIZE); + for (j = 0; j < XBUFSIZE; j++) { + sg_set_buf(data[i].sg + j, data[i].xbuf[j], PAGE_SIZE); + memset(data[i].xbuf[j], 0xff, PAGE_SIZE); + } } pr_info("\ntesting speed of multibuffer %s (%s)\n", algo, @@ -439,9 +444,9 @@ static void test_mb_ahash_speed(const char *algo, unsigned int sec, if (speed[i].blen != speed[i].plen) continue; - if (speed[i].blen > TVMEMSIZE * PAGE_SIZE) { + if (speed[i].blen > XBUFSIZE * PAGE_SIZE) { pr_err("template (%u) too big for tvmem (%lu)\n", - speed[i].blen, TVMEMSIZE * PAGE_SIZE); + speed[i].blen, XBUFSIZE * PAGE_SIZE); goto out; }