From patchwork Thu Nov 30 10:09:27 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: 120092 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp468726qgn; Thu, 30 Nov 2017 02:09:50 -0800 (PST) X-Google-Smtp-Source: AGs4zMa/wIkgTmN2Od0wdGhUKlEIfxXwq1SNVhbqmE0E2zoJxNBmtCY7lpXJT5Zm912feRFOMYYA X-Received: by 10.98.24.207 with SMTP id 198mr6079330pfy.3.1512036590662; Thu, 30 Nov 2017 02:09:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512036590; cv=none; d=google.com; s=arc-20160816; b=jd/1KBzK1TDMs5g63vMo3VgoozGq9ByYCOViqK+yXx+YpbRWERQKedTQioxWmNJUTq IM2aWG7F3SGQ2V6Bi4N0ePtzfct/V+2lezz0UCFtAoVdfuCavaLd6hqQACLfp2D0UNX+ dI2YB+MQBvDvJ0kYZxakdoYCq0sy+M8XtkGpmNdBToQn3wBs8V8sEBxw+0zw/XfsT5/Q Eh8muIyEY0ZwYZ4kVGj7yRbN68aOKeMMStTPvdQkN4QLPVrNV0VEVfBHkFe1c9VlTRhI hdeGy8kKby50DuoY5Pf0VHusAnI/F2DTtl4IvAEzE2SOysT9L3I2QEIrAw1K7WXMqRQL lhGQ== 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=RlGtTCNlTpJU+7n/Pfj35pYvyEqy06lbHp8VUqjo00o=; b=jWxPRDITKnMnOS4+0ilpcwSiJzHAvMy3wxD68aY3eTPwF/sKqhoEmO9CxGJHGMNsPs +goxMviY67UCmgTnLAKjA4j+W9TRbd+y+R2prHF2UY1IZnVuaQhhkdzSaM1Ti384vfNE MBYijWTkrnTtQBz5HF78MGHYfHnliotnSEOq/U1YUrwzbejBiXFPNwipjD+oAFdlTTHD TZGepXYTHiX/B17CnChREEqWZbDomniyARyANx5tFW6xIzZnMm6rzRe72KgX/mR3lR/h Z1m/vlAXHRp+ZZOmWpa87KJFyi/k991KWnsi7FGTvWA4jsf80A+1AlG/n+jbeiWQen0a n8lA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 w125si2787713pgb.296.2017.11.30.02.09.50; Thu, 30 Nov 2017 02:09:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752250AbdK3KJs (ORCPT + 26 others); Thu, 30 Nov 2017 05:09:48 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50202 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752111AbdK3KJo (ORCPT ); Thu, 30 Nov 2017 05:09:44 -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 4C8071596; Thu, 30 Nov 2017 02:09:44 -0800 (PST) Received: from sugar.kfn.arm.com (unknown [10.45.48.154]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E530E3F246; Thu, 30 Nov 2017 02:09:42 -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 1/6] crypto: tcrypt: use multi buf for ahash mb test Date: Thu, 30 Nov 2017 10:09:27 +0000 Message-Id: <1512036574-26665-2-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512036574-26665-1-git-send-email-gilad@benyossef.com> References: <1512036574-26665-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 3ced1ba..d1fd033 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -383,7 +383,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; @@ -426,7 +426,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, @@ -437,9 +442,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; }