From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752849AbcF2IQU (ORCPT ); Wed, 29 Jun 2016 04:16:20 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:61052 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751047AbcF2IQP (ORCPT ); Wed, 29 Jun 2016 04:16:15 -0400 X-AuditID: cbfec7f4-f796c6d000001486-80-577383cc2584 Subject: Re: [PATCH v2] crypto: tcrypt - Fix memory leaks/crashes in multibuffer hash speed test To: Herbert Xu References: <1467098587-1038-1-git-send-email-k.kozlowski@samsung.com> <1467098587-1038-2-git-send-email-k.kozlowski@samsung.com> <20160628084138.GD15985@gondor.apana.org.au> <57723A08.1010704@samsung.com> <20160628095511.GA16644@gondor.apana.org.au> <20160628123352.GA17844@gondor.apana.org.au> Cc: "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Bartlomiej Zolnierkiewicz , Megha Dey , Fenghua Yu , Tim Chen From: Krzysztof Kozlowski Message-id: <577383CA.1040204@samsung.com> Date: Wed, 29 Jun 2016 10:16:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-version: 1.0 In-reply-to: <20160628123352.GA17844@gondor.apana.org.au> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRmVeSWpSXmKPExsVy+t/xq7pnmovDDfbPErfYOGM9q8Wc8y0s Fm3THC26X8lYvH5haHH/3k8mi8u75rBZnH/xh8Xi2qT5bA6cHltW3mTy2HZA1WPxnpdMHvNO Bnr0bVnF6PF5k1wAWxSXTUpqTmZZapG+XQJXxpnfrewFPRIVrx52MzUw3hDqYuTkkBAwkTi6 eQo7hC0mceHeerYuRi4OIYGljBJzPn1iBUkICTxjlPg3RQrEFhZIktj0YwYziC0ioCOx8uVi VoiGb0wS8yfNAetmFpjGJHF10kawbjYBY4nNy5ewgdi8AloSJ6a8ButmEVCVeLnvICOILSoQ ITFr+w8miBpBiR+T77F0MXJwcApYSky45QNiMgvoSdy/qAVSwSwgL7F5zVvmCYwCs5A0zEKo moWkagEj8ypG0dTS5ILipPRcQ73ixNzi0rx0veT83E2MkLD/soNx8TGrQ4wCHIxKPLwah4rC hVgTy4orcw8xSnAwK4nwLmwsDhfiTUmsrEotyo8vKs1JLT7EKM3BoiTOO3fX+xAhgfTEktTs 1NSC1CKYLBMHp1QDo9UTBvUtShtPhnBat4Vu8wkMOv5byXfOtbtXPk2Wqz7tdG15glkZx4P2 RT7iPNqFIp0nvjE9mP2Q7d0BSekt1W31xidcNUoPes7O2DfVOFqkL9f155dEnpscTN4czYYf 14mvSHspo7XC/FeZwYGwbYcf3tr8ZNe3S1/KDx0/u27vQYnEium93UosxRmJhlrMRcWJAEMX HzB3AgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/28/2016 02:33 PM, Herbert Xu wrote: > On Tue, Jun 28, 2016 at 12:15:43PM +0200, Krzysztof Kozlowski wrote: >> Oops: > > Thanks, there was a typo where it said k instead of j in the second > loop. > > ---8<--- > This patch resolves a number of issues with the mb speed test > function: > > * The tfm is never freed. > * Memory is allocated even when we're not using mb. > * When an error occurs we don't wait for completion for other requests. > * When an error occurs during allocation we may leak memory. > * The test function ignores plen but still runs for plen != blen. > * The backlog flag is incorrectly used (may crash). > > This patch tries to resolve all these issues as well as making > the code consistent with the existing hash speed testing function. > > Signed-off-by: Herbert Xu Seems to work fine except: 1. The updates are always 1. 2. For bigger blocks it reports always 1 or 3 cycles per byte: [root@odroidxu3 ~]# modprobe tcrypt mode=423 [ 70.129206] [ 70.129206] testing speed of multibuffer sha256 (sha256-neon) [ 70.135511] test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 4597 cycles/operation, 35 cycles/byte [ 70.145826] test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 5762 cycles/operation, 11 cycles/byte [ 70.156469] test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 10687 cycles/operation, 5 cycles/byte [ 70.167125] test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 31485 cycles/operation, 3 cycles/byte [ 70.177919] test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 59281 cycles/operation, 3 cycles/byte [ 70.189780] test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 118097 cycles/operation, 3 cycles/byte [ 70.204117] test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 232309 cycles/operation, 3 cycles/byte [root@odroidxu3 ~]# modprobe tcrypt mode=422 [ 71.988248] [ 71.988248] testing speed of multibuffer sha1 (sha1-neon) [ 71.994097] test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): 2506 cycles/operation, 19 cycles/byte [ 72.004547] test 2 ( 64 byte blocks, 64 bytes per update, 1 updates): 2299 cycles/operation, 4 cycles/byte [ 72.015152] test 5 ( 256 byte blocks, 256 bytes per update, 1 updates): 3535 cycles/operation, 1 cycles/byte [ 72.025807] test 8 ( 1024 byte blocks, 1024 bytes per update, 1 updates): 9403 cycles/operation, 1 cycles/byte [ 72.036401] test 12 ( 2048 byte blocks, 2048 bytes per update, 1 updates): 17142 cycles/operation, 1 cycles/byte [ 72.047058] test 16 ( 4096 byte blocks, 4096 bytes per update, 1 updates): 33109 cycles/operation, 1 cycles/byte [ 72.057821] test 21 ( 8192 byte blocks, 8192 bytes per update, 1 updates): 67750 cycles/operation, 1 cycles/byte modprobe: ERROR: could not insert 'tcrypt': Resource temporarily unavailable Is it expected? Best regards, Krzysztof