Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3486491rwj; Mon, 19 Dec 2022 19:57:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf4gek9/QCnVXtrIWNijrXjrzQYF7bYBKfCUyhOIoLiwlomJyigDtFw8AvyqxtlX0pSSiavL X-Received: by 2002:a50:ec8d:0:b0:46c:a3c1:2057 with SMTP id e13-20020a50ec8d000000b0046ca3c12057mr36241997edr.29.1671508671183; Mon, 19 Dec 2022 19:57:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671508671; cv=none; d=google.com; s=arc-20160816; b=wvdWbj1AHrqmHdA8kwhoE3+QNF6ckzZLKgX727FhVQL9y1Gt7Z1+2S5tMMDh5UyBsE 9C/mcwNhxpnKyfiZBhMO+2bxaqkM5eJySIw+0CxFuY+Kgdj/BOMr1YlARvqlWLp2CyeQ JWSYwHGUbYkWCQbCC9j1AIiTgsKUXQMdDRSj7itNSCGzOuDfpTh6I28poutvRZmZww7j TfbZSkpyPBbL13k9xNAntMoCAU16KxrooLDBBVH+q/1YV/l5tSoEnIm1NzC6wK3KqFPr hH3ahpN53pAi9Sv9Z4M0iFF/X2Itunm0UXkzqyyVf6sHbhwQ7+Td4H3t7azqUuD3Ow1h KVSw== 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; bh=z/Rc3AkUDtfdpZUa+q7njUK/UQeFygFW16wejeubm60=; b=NPzOb9FhrK8ayjmaiP0LNu/+QGcl6bQwT7qI8O4pJzc6hY/TgWkJq16jCq7SZl1xyD YCk6oNPE7ZE70E6BIkozqR6zrn6hM9Lhn/1Yma5Jf+AQuQKVhvbR3hQ667ZBAt5FS/4t g3DiFvnZ9kBLpZroq/VT9ApwzyTN/rrfPY9n9YHULCnT55BKoCvkjcNXkhr1Gg2ibCc9 UvA3fJfuLOQoVsgc+dLqsMJ39kjgv9t9kDB+8/bAIOPNt9T+vSnfCmh9ohTD+zmD95QT Nn6rTv/pUQZJfNdYWWBFy0pHw41BHfXyfloRsRbuDphutGjePn+cKq7BjagLilPWoKt3 oDxA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb9-20020a0564020d0900b0046fd3acedacsi346675edb.566.2022.12.19.19.57.27; Mon, 19 Dec 2022 19:57:51 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229647AbiLTDyN (ORCPT + 99 others); Mon, 19 Dec 2022 22:54:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbiLTDyM (ORCPT ); Mon, 19 Dec 2022 22:54:12 -0500 Received: from formenos.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41C5812D1C; Mon, 19 Dec 2022 19:54:11 -0800 (PST) Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1p7The-008kFq-AP; Tue, 20 Dec 2022 11:54:07 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Tue, 20 Dec 2022 11:54:06 +0800 Date: Tue, 20 Dec 2022 11:54:06 +0800 From: Herbert Xu To: Robert Elliott Cc: davem@davemloft.net, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] crypto: skcipher - always yield at end of walk Message-ID: References: <20221219203733.3063192-1-elliott@hpe.com> <20221219203733.3063192-2-elliott@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221219203733.3063192-2-elliott@hpe.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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, Dec 19, 2022 at 02:37:31PM -0600, Robert Elliott wrote: > > diff --git a/crypto/skcipher.c b/crypto/skcipher.c > index 0ecab31cfe79..cdead632117a 100644 > --- a/crypto/skcipher.c > +++ b/crypto/skcipher.c > @@ -153,13 +153,20 @@ int skcipher_walk_done(struct skcipher_walk *walk, int err) > scatterwalk_done(&walk->in, 0, nbytes); > scatterwalk_done(&walk->out, 1, nbytes); > > - if (nbytes) { > - crypto_yield(walk->flags & SKCIPHER_WALK_SLEEP ? > - CRYPTO_TFM_REQ_MAY_SLEEP : 0); > + /* > + * Allow scheduler to use the CPU since it has been busy, > + * regardless of whether another loop pass is due > + */ > + crypto_yield(walk->flags & SKCIPHER_WALK_SLEEP ? > + CRYPTO_TFM_REQ_MAY_SLEEP : 0); > + > + if (nbytes) > return skcipher_walk_next(walk); > - } > > finish: > + crypto_yield(walk->flags & SKCIPHER_WALK_SLEEP ? > + CRYPTO_TFM_REQ_MAY_SLEEP : 0); > + You're calling crypto_yield twice if nbytes == 0. How about deleting the second crypto_yield call because the only case where it would matter is when n == 0. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt