Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp616388ybl; Tue, 28 Jan 2020 08:55:57 -0800 (PST) X-Google-Smtp-Source: APXvYqwbJQpPwA7L6wOp+RpFKIZaAVPl8Yc0y9AjCkV+Qf5qn6QWZ74A1e3koaDzQ/dqt0i1v5Gi X-Received: by 2002:a9d:7559:: with SMTP id b25mr1247153otl.189.1580230557759; Tue, 28 Jan 2020 08:55:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580230557; cv=none; d=google.com; s=arc-20160816; b=wyQWO6L0xtPre/paBbs7knX30v+7dpoGrf8mDM9o+zSb1jpQ2tiDppU905b5PB1+vg Oe2aJmQEdLe4Ug+UXANi/yr/4a5uVcYNO8CGdfMYntNqUAWiPuvGWZ/pf8uCOQFjR7dZ BUSbYlSoM+wu6JnYqcAjbMuec0pWfMIxxWULCIDJ5t9stq4CxWQ+qswnExnF2P2PX/Ul v7KRus53A1aD9bVRSwukiaLBLNKamG+3iaIyQi5JnhuUgSmOPXG8ZsiCb4vV9ZwQlsUw eNslDqqrOfcJoyGcCHEeQdCPstWi3gyPlJsqUJGN8vZcLaVdyJKC9xVwKRdzXKWdx9rX 2vkQ== 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=WCgG7MXtK+EadBs68VzLrnD51numFaQTp+Nf00N2Sac=; b=Ff0PiC9sBw8q41qxXGmoQEWn/6c30l4Y7HiIpkltgnvJ8ll1Ed5z7nnCy/X+cVuUSn EtMqcTdH7tX6Wjdg/CSZqjjJmoInEpHhSmMx8+/mtr6cK79ZhICgQVHL1c1m3C1sVUGb qPO13ln+IrPHCIar8EBiLTnjkXM8QcSCY1ZwRQ9pQl5JQzVjJUrzMx/gg6sWqrZpm8RY hQXYZJ/Yxbv8t1/80L5dKxK1jaRkZJ9OOf3jl+/EXWR2nOroyEekxZViXYktLLuWlzuM wvhOxhaBTFqv77UXUovuaY0jaScXfbamdbXYkmv5hbyUjcsKxoPrUj37GwmztabriB/T /BBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="RT/MqUsr"; 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 i9si9386731otp.139.2020.01.28.08.55.40; Tue, 28 Jan 2020 08:55:57 -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="RT/MqUsr"; 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 S1726481AbgA1Qzj (ORCPT + 99 others); Tue, 28 Jan 2020 11:55:39 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33200 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbgA1Qzj (ORCPT ); Tue, 28 Jan 2020 11:55:39 -0500 Received: by mail-wm1-f65.google.com with SMTP id m10so2213801wmc.0; Tue, 28 Jan 2020 08:55:38 -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=WCgG7MXtK+EadBs68VzLrnD51numFaQTp+Nf00N2Sac=; b=RT/MqUsrLMJMTlJLSdTpe5SrIjHzDcNYhB65LuMHGbpgW5xF3y/8DJJMuX45zauCMJ bM4sR7Worug+qMce3gtMcCYUWgxbClKOQNWiQPAQD8SgC1ivfBPxlAs2B++TNobJj0/m gI94unUUlyNwlsqDUGu6BNMo9IJKNtNnVzlqk/tSVzd51Z8Zy+8+tL0ogx4j62PoOAuB DJ25cWKO28c0OySBXqWSrlR/FqnbTh9ZLgGEsT5y4cZ3ovoBblD0M7+F47Sw9IjyL0FU o1vQr3BqT8TFEHapR1Qrsd4sU/TAI0wzV/dD5XbgUsxGoAwV94g2ovrA78elVdZmGQvZ rmVA== 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=WCgG7MXtK+EadBs68VzLrnD51numFaQTp+Nf00N2Sac=; b=Y5h0bX/I8EyeYRpOeLBlevGTAhtRGlUqCMUDxdi6lD0UgjvKalKCqQbw8DJdPebqTP T1sYuZEIg9qisYsDRgvncmI5nqK/Zh2Lz/N5qMqB51mjav8RGKguN+xFU132AdhOzC3h +6qL1fAz/hyFNkFVnUVM2AdUggKElDcJsCR2pmtuqqtP/9nbzU8VZh41ly2Wdia85dSe TtOaEcE/1rYnC8+0oCWtMfmsdPi2fF156TcL3GHPcJC3YgKSCa85rn2kdc4fnlUIxcbo LQH7O3MGJXEbYgf8uPtPLzjiFgJmyUOyeNyY+YpBAxHzzSOGOaQXEfEa7dYJSCUqoGbQ ewCA== X-Gm-Message-State: APjAAAUsrn/ptR8SF670icfTiVJDUIlSlwO7gHYrnuBVQ4HtRXR0SvpY PwvWsLzZKJX9c6Y/FKyO6wE= X-Received: by 2002:a05:600c:2c08:: with SMTP id q8mr6221103wmg.45.1580230537494; Tue, 28 Jan 2020 08:55:37 -0800 (PST) Received: from Red ([2a01:cb1d:3d5:a100:2e56:dcff:fed2:c6d6]) by smtp.googlemail.com with ESMTPSA id 16sm3745279wmi.0.2020.01.28.08.55.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jan 2020 08:55:36 -0800 (PST) Date: Tue, 28 Jan 2020 17:55:34 +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: <20200128165534.GA11610@Red> References: <20200122104528.30084-1-clabbe.montjoie@gmail.com> <20200122104528.30084-2-clabbe.montjoie@gmail.com> <20200128155800.GB17295@Red> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200128155800.GB17295@Red> 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 04:58:00PM +0100, Corentin Labbe wrote: > 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. > Sorry, I have misunderstood and wrongly answered. Right since some driver does not block on do_one_request(), crypto_pump_work() can be ran one after one and so launch two request. So this patch is bad. Regards