Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp561786ybl; Tue, 28 Jan 2020 07:58:18 -0800 (PST) X-Google-Smtp-Source: APXvYqwHnVJfrHwdpmRo2CgOfTo8sAIPacogFQZAokCTTeVGCdtsnQlsWXD/8GbSCohJqJ6wLT2A X-Received: by 2002:aca:c7cb:: with SMTP id x194mr3334887oif.157.1580227098049; Tue, 28 Jan 2020 07:58:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580227098; cv=none; d=google.com; s=arc-20160816; b=Z0+CzSFEJ1SLI64NJBrCyj1SKCS7oVN+RsvaLjxlciEcbb44VPH3Yo4DniJcBEsUqE 77ahhdU2/zA4sWv+QsAqJt0JLhxf7VJa4fXWy/Ru6UGv0CMIwq15nkHXJaN/pOADFfHy AZt79vlfcWsqo0GfWsncNisk9rLZyvxjoNYm8wFqBDdYX2MzGTZJIod9eaco2gf9a02J d/UGthrJeJQFFkMqwwNHg8Tb5yn//SfjU12a8v+mQc+KF/+bDNrxWpiDcixr3e/S8ajW 2UBpfDIrXo84rTQzY7zOVd33oUFItXsYohCiqAK3WCZMhSR0fZ6I5bw504b5AA1AXqai zu9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=FWPp9fyEDHyhawe1t49VObba7gl1SqL8FrQT/ryGVAI=; b=ZiMJmXjir4TuAnn9b2POspCV4ruA4zjHvTO3WJqSjFdiiL77TLeS14IITPKR0lIFNh 1+hXSdjnoA9nhPYrMbpteLT2SwQ0RkA92SAU42NuObOiN8FZGysSZjrgp3O3RMveDzOd Imm/0hb7U0LRQyG2++yIR2LMO9L6c1IK6GUOzm6l6QrbBl0hncdCv8slU22QOdE0YRuC dBLirmt5WuEL6jWQiZvZ99yZKyn+N/hw7jUaHStNr7Otl+wu1/K43HL9XALRAHm8+MJM +9+X8BgEvfCiYg682p7iVwnXBAFUyV18nAR3JWx9ew9uF8Lb6WY0KY+nmiUp6N2J/dQ8 OZZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="q/wO+PfO"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si8963626oth.267.2020.01.28.07.58.06; Tue, 28 Jan 2020 07:58:18 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="q/wO+PfO"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725974AbgA1P6F (ORCPT + 99 others); Tue, 28 Jan 2020 10:58:05 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:41178 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725959AbgA1P6F (ORCPT ); Tue, 28 Jan 2020 10:58:05 -0500 Received: by mail-wr1-f66.google.com with SMTP id c9so16614300wrw.8; Tue, 28 Jan 2020 07:58:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=FWPp9fyEDHyhawe1t49VObba7gl1SqL8FrQT/ryGVAI=; b=q/wO+PfO+FJAbmdRbe5TTat4LCNumuP61pWivJVRm4UlO1Pt0jyE78fSz472H6vaIp vZpw3Jd0LJoMKK725DxMrorGozM8U96NJjgdnd0eUGu3ljsSvzkYdA3Cn/+MqU3/sAm2 NhPmiQ9I95+MPKFKtvtUTAoJBDSb5R8vgatIF/i/GVHV1+31qX8jfvOEWGcwX3tkqQxt LihRqy6Pa5vsqcpLbvDpfbjloAxEPKem41hE3tGf3+zb8NghFfBRz0+s2EHga/CfqVDO E1QishhiZp9Cn34ts67GZES4qZ4ncyIIEspmxfvb34wyMvXAYn8hsghiUL8NHQ6Y5BDj X4Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=FWPp9fyEDHyhawe1t49VObba7gl1SqL8FrQT/ryGVAI=; b=KQXMswxfyCSJJ7ZgyJsPdLVyOECOt+0XzGIr2R0Lu/BfIH9wnI3saNqBLEPWHIp01p JrhuHBT9av7n+SH+/KcjM+OJDupjew2+H8pLnAi6j35E9QOlFH4umDEfBWbC07ULvkSz AHDu96QZbRl6GYgW+BySL88g9M3J/OiIZqhDaiqs3shT9hqQ4ObGTAp9pvRgdxYKTP+Q Ob0iFDr2CAmVWIV2LemsS/4lzU5gNxninXwyieWbf4VdDMgR7hxkh2fAkUimT8fF6tk8 uC8pxqYF3b8iI2wbaAouduQRBVlZ2MAeaGi7lfxKB1979pLq8Jf39AR7kAZSwlbs6i/g aKMQ== X-Gm-Message-State: APjAAAW3Kzt/Q54g+tgaj+F8b2BuDFqYbnC5d/7glzmIGg0YpIIh3Uac qbLymmAvZTkqddH3w5P0vjU= X-Received: by 2002:a5d:6151:: with SMTP id y17mr28941387wrt.110.1580227083068; Tue, 28 Jan 2020 07:58:03 -0800 (PST) Received: from Red ([2a01:cb1d:3d5:a100:2e56:dcff:fed2:c6d6]) by smtp.googlemail.com with ESMTPSA id i8sm26328713wro.47.2020.01.28.07.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jan 2020 07:58:02 -0800 (PST) Date: Tue, 28 Jan 2020 16:58:00 +0100 From: Corentin Labbe To: Horia Geanta Cc: "davem@davemloft.net" , "herbert@gondor.apana.org.au" , "mripard@kernel.org" , "wens@csie.org" , Iuliana Prodan , "linux-sunxi@googlegroups.com" , "linux-crypto@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 1/9] crypto: engine: workqueue can only be processed one by one Message-ID: <20200128155800.GB17295@Red> References: <20200122104528.30084-1-clabbe.montjoie@gmail.com> <20200122104528.30084-2-clabbe.montjoie@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, Jan 28, 2020 at 03:50:14PM +0000, Horia Geanta wrote: > On 1/22/2020 12:46 PM, Corentin Labbe wrote: > > Some bykeshedding are unnecessary since a workqueue can only be executed > > one by one. > > This behaviour is documented in: > > - kernel/kthread.c: comment of kthread_worker_fn() > > - Documentation/core-api/workqueue.rst: the functions associated with the work items one after the other > [...] > > @@ -73,16 +73,6 @@ static void crypto_pump_requests(struct crypto_engine *engine, > > > > spin_lock_irqsave(&engine->queue_lock, flags); > > > > - /* Make sure we are not already running a request */ > > - if (engine->cur_req) > > - goto out; > > - > This check is here for a good reason, namely because crypto engine > cannot currently handle multiple crypto requests being in "flight" > in parallel. > > More exactly, if this check is removed the following sequence could occur: > crypto_pump_work() -> crypto_pump_requests() -> .do_one_request(areq1) > crypto_pump_work() -> crypto_pump_requests() -> .do_one_request(areq2) > crypto_finalize_request(areq1) > crypto_finalize_request(areq2) > As explained in the commitlog, crypto_pump_work() cannot be ran twice. Regards