Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3758952ybh; Tue, 17 Mar 2020 06:09:26 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtpOo6dK0KMQJBGyOtbumssLs/oaWWoOAy37F2K+4x2buMXxZEadAiTsszbp2HLg89X6mQN X-Received: by 2002:a05:6830:2415:: with SMTP id j21mr1069750ots.93.1584450566794; Tue, 17 Mar 2020 06:09:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1584450566; cv=pass; d=google.com; s=arc-20160816; b=W07Mr/gxkuJL5x6wt9oPHVl0UPc//a4mewGQ0yYZJUpY2f0TYPFniigPVYZP3/UJC9 86PucsZNmLB4akJVfYYcPdJ+n1Eo0QVDuaFYnIg1Uqv0uOL2fnDrs/OR8kaFyrECYo/d 3QQJwESJ5ySzM1sFFk+16ttdfwGoV+E2+jM2woqUniWIE+/yaLI5j+GGQzaYRMj6K7/Z bk3BwcFefqdINjjkq0QJMk52MQ36zmA0uqaCwXW9N6UgLozxaGlftB9L/+Q/U1iD+kZa MUfJ6zhwfbbZe3zXbR1HH/2KRumvsMwpejo+UDiIBaJnQf/pnUH462jbSsx71gepstpZ 5sQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=9fyyMdo78pZQMkLuuxWh963x89cERymKsYzfa4q8JCg=; b=V6nUBi+znRQLq9hJ6Ai3TjisLwhQBTO6DrMBW3yy5KmIPFxZbeUMMJbNP66FlSzN5D 3IH7W/D7bopehldeuhkr2p6rcD3LoAw45whLU8RiKaUKAXWZJ2KQuT4PWKyhhOXwJRRG fqvkdL+FUs7DXs63TIQsPe+gR/qq4quF0t8SXhOSjzCZPBjNaHchiOomErRMTTJfV4Fq CnomL/rGRJDRdQPDqy/Zwe1e+avBG/LZv5bcyROv5kDjPgTTbh4EBfvdblrKghjWjVcK FvpQprpQksoSVWkdnI+9szKGquvA3X765Rhn4uQ/qhkD1j+fQhrKUYuNCJP5ft4cN8ym ZcyA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=pZC+CRZo; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f20si1661166oti.224.2020.03.17.06.08.51; Tue, 17 Mar 2020 06:09:26 -0700 (PDT) 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=@nxp.com header.s=selector2 header.b=pZC+CRZo; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726130AbgCQNIW (ORCPT + 99 others); Tue, 17 Mar 2020 09:08:22 -0400 Received: from mail-am6eur05on2042.outbound.protection.outlook.com ([40.107.22.42]:11818 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726084AbgCQNIW (ORCPT ); Tue, 17 Mar 2020 09:08:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D0OVn+TvF8Pnw2Yb5li+vCSzTGCcBqiSn2HmnNLw92SmTJaw3bvnJIMb9rTPGwO4p51XwiJ+YuhbTuBipvoRR/zOomMQuaAu6wsq4HtDtOnNALGOEL9eaF0YWZm2Gupi0OPq7ipb2+tKo8g2oT5ETWEykhvegWu4dPuRfCM3bpJhizjO1FTWXJJjTSbayIONwIpPFU0hmG9m4WVOpN7X14vd2vaaVOwRJr/tuIQN38uodLgyy43JWIBWNNRRDcD9vdLlERyG+YtuLZkgMmCb+7yaVFP8JnxDJcfs2CBU5BwUzC5pYkxKOR74rx9f+uc7o2liaoYXpqjjqdwb2LuT/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9fyyMdo78pZQMkLuuxWh963x89cERymKsYzfa4q8JCg=; b=cITtuvFkbtGSk6BvnMc2oVLWxIwT8R/cUT65d5Y/wezyERrnDKphhNWn9lGrRHcZ9EFHrsMte/2VHE+AXc6X/qVD0V1p5f1WlxnV2QzAk+hSTSdW+ilJpHHP5+tcdyYF6hhRpy3jwFrrffOBmOIhJD026Y5WZaMUPRf3BwzsN0Wk0tR5cNKy8zVAP9h9uTkDqKs9J4Snyn3TocwfUEmP6squ28fWWYI5kq6fh5llH2zLzehAHlXod5DSn0j0nX/Q/U91bi0cfFfmWV5K9iM/ZcuBrtT3Xv6SijmdCmJv/fCMNb7QgQKapVYGc96E1VrzVrtYNuWlx6/Vvs4RCo48OQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9fyyMdo78pZQMkLuuxWh963x89cERymKsYzfa4q8JCg=; b=pZC+CRZolMsaJFlF8iTJm5c/ukk39hzg/PzZAWr6lPZbdFABUqnhR7MQkHBJrWzndhShTjwZlc+Zgb1WHZ7xi6/afIG6hi8Kw1OoR172Was96+3uMd/ZMlWL4kShQXpjB5+jwplL9Tsz4VxDELTq3QEbTSM0094/Wg5HIX+V+LI= Received: from VI1PR0402MB3712.eurprd04.prod.outlook.com (52.134.14.25) by VI1PR0402MB3439.eurprd04.prod.outlook.com (52.134.2.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.15; Tue, 17 Mar 2020 13:08:18 +0000 Received: from VI1PR0402MB3712.eurprd04.prod.outlook.com ([fe80::8153:b06e:8386:a584]) by VI1PR0402MB3712.eurprd04.prod.outlook.com ([fe80::8153:b06e:8386:a584%6]) with mapi id 15.20.2814.021; Tue, 17 Mar 2020 13:08:18 +0000 From: Iuliana Prodan To: Herbert Xu CC: Baolin Wang , Ard Biesheuvel , Corentin Labbe , Horia Geanta , Maxime Coquelin , Alexandre Torgue , Maxime Ripard , Aymen Sghaier , "David S. Miller" , Silvano Di Ninno , Franck Lenormand , "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx Subject: Re: [PATCH v4 1/2] crypto: engine - support for parallel requests Thread-Topic: [PATCH v4 1/2] crypto: engine - support for parallel requests Thread-Index: AQHV9ZwplCPBsoqUKkWl+/E0XiXZQA== Date: Tue, 17 Mar 2020 13:08:18 +0000 Message-ID: References: <1583707893-23699-1-git-send-email-iuliana.prodan@nxp.com> <1583707893-23699-2-git-send-email-iuliana.prodan@nxp.com> <20200312032553.GB19920@gondor.apana.org.au> <20200317032924.GB18743@gondor.apana.org.au> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=iuliana.prodan@nxp.com; x-originating-ip: [92.121.36.197] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 9669300d-e2f4-48b0-d251-08d7ca7442d9 x-ms-traffictypediagnostic: VI1PR0402MB3439:|VI1PR0402MB3439: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-forefront-prvs: 0345CFD558 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(136003)(39860400002)(396003)(366004)(376002)(199004)(52536014)(66446008)(55016002)(26005)(9686003)(54906003)(316002)(7416002)(86362001)(478600001)(91956017)(71200400001)(66946007)(66556008)(64756008)(76116006)(4326008)(66476007)(7696005)(186003)(6506007)(53546011)(2906002)(5660300002)(81166006)(6916009)(81156014)(8936002)(44832011)(33656002)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0402MB3439;H:VI1PR0402MB3712.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: cLMF+9pD8q9CLlzbo8wMMbdRhvn7JebppWFstkrVjOJQEhSBvDX1M3pImw9WqRnxbsI4REnoKAprKXB5v32PrDe+E8u0vSQfqQcZqW6953s2RFEjsKOMBqaMRIniUDld4Mn1UyqYPkWCVtyv74Psdc3SVAb6SnabYhCTwrGmnY/X6dWrLKZA7OlNa7h9jjo7JECsMTpyPrvC3olApPAEEwXmr+OxJH6OpIW3NCnqnProdm3+ChQybclNhmc8uDp1iTmlsMitGDbdtonJCux3iX+MFMYPmr538BKVwMqYw+g88BC2v3K6k0O8qIEQSdTYHU/4cHv0dmeWDvweN2I5YnphI3YiTAxy4eEzkZ/XmG7x0OcgnRj+Y0MIgYuDJ0+8t4r+C3KRQXg+nBiuuvIWdeCQznNir88vSdQ8N/H1HOWOd1A9Fs78pJWPYJjDB2xT x-ms-exchange-antispam-messagedata: qfu6wLz3qDoUxPFfs9adF/ZEJGxxN2b22clYhXNrO1DdOYeDmydQ8t/8Lp0JYyfFNJMcG+R3e1/+G/JvMRWmof5ocfNCiuaETmmtmvpT13HBjHQuM1J5CTzPyr83vmybt59ltfpw06u1QY6lu59OEQ== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9669300d-e2f4-48b0-d251-08d7ca7442d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Mar 2020 13:08:18.1643 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4MMY4N29Isba6Hr5bz9FPTcE5oCA5tJGLMaGkXii47dKQFiSjVtSihiQfi3nLNX/N9+KcBWY3cYyp5uAZ0fCHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3439 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 3/17/2020 5:29 AM, Herbert Xu wrote:=0A= > On Thu, Mar 12, 2020 at 12:45:54PM +0000, Iuliana Prodan wrote:=0A= >>=0A= >> There are two aspects here:=0A= >> - if all requests go through crypto-engine, and, in this case, if there= =0A= >> is no space in hw queue, do_one_req returns 0, and actually there will= =0A= >> be no case of do_one_request() < 0;=0A= > =0A= > OK, that makes sense. However, this way of signaling for more=0A= > requests can be racy. Unless you can guarantee that the driver=0A= > is not taking any requests from another engine queue (or any=0A= > other source), just because it returned a positive value now does=0A= > not mean that it would be able to take a request the next time=0A= > you come around the loop.=0A= > =0A= =0A= This case can happen right now, also. I can't guarantee that all drivers = =0A= send all requests via crypto-engine.=0A= This is the second aspect from my other mail. There are cases, when we =0A= send requests (non crypto API) to hardware without passing to crypto-engine= .=0A= =0A= To solve this, I'm thinking of adding new patches that doesn't do =0A= request dequeue from crypto-engine queue, just peek, and dequeues the =0A= request after was successfully executed by hardware (if it has =0A= MAY_BACKLOG flag, otherwise will dequeue it). What do you think?=0A= =0A= Also, the above modification will imply changes in the drivers that use =0A= crypto-engine.=0A= =0A= Thanks,=0A= Iulia=0A= =0A= >> I've tried this, but it implies modifications in all drivers. For=0A= >> example, a driver, in case of error, it frees the resources of the=0A= >> request. So, will need to map again a request.=0A= > =0A= > I think what we are doing here is a major overhaul to the crypto=0A= > engine API so while it's always a good idea to minimise the impact,=0A= > we should not let the existing drivers constrain us too much.=0A= > =0A= > Thanks,=0A= > =0A= =0A=