Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp334791ybl; Wed, 29 Jan 2020 01:12:15 -0800 (PST) X-Google-Smtp-Source: APXvYqyMS1muqpvJ6J48nFynFuG02lSro1NUOGttJPhFWaIFGhWbAJ5Hlu4Djd8i2a3/ash1LdAC X-Received: by 2002:aca:dc45:: with SMTP id t66mr5937293oig.39.1580289135535; Wed, 29 Jan 2020 01:12:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580289135; cv=none; d=google.com; s=arc-20160816; b=DiJ5bid5s0+HiC83vAoT6aEnUBpDC1kvWlWFqsIUbLJiitP8MelM7XFowcE6d2eyhm ZhUNqZKs012ssNsqnzG194PTJfcb8owoIh6nK3p4BtAv0IiL8o2AthMIn+eHeFrrj3+g Qz+Pz+kW4UTbtqzC1087C6t6wz1Jp4aza4u1tev/2u56mzLcLMB527ZPKaDrjnKeHbDJ mVoaC5qsab61uZBgkMcr2GwSBmPiCEIfqOY489uudzPgkHneM5fTvEETZuc0Sqb87hm3 lWvLL7Vwm2sTJfnyOcLdmR/yGPekVrTGuDY98yFEWddq4cnfZlDLxf63fU906afpWIVP Q0hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=m8DeBR3ywE5BStJvUpTceu94rxUL71zPmj3cpgCJEJA=; b=WjkfOJnCkJB0K54ru2rxL+WPIyYJ2zbfYpwhSA7v93GrC5lfpLyN+WXJbZDQ787vN/ SsJcxwjwhoBSGfaXF8DCk2DI1NHxbf7h2dbEBkA0U5ESXAXspY/3YuQIx/bIMTNC6hw5 PuANaGSmbyBd7Qknap1bywsCHeVdwq1YfDX1p3RkK3iSfCnLUCV/Pqd8/aulp2RRONv9 HTzn7G9Pn7xWTCP0o3HWQFqEIkS5U18coMhhF+R7npCwg2fVMDBO4Eu3wtQgsNrzeu7u YK2qpL/BlXcsVTcmANVYBuBo8QyldaDG/nvi8s9C/nsu0TkiNgKoyMB7KvVCzZHuXCFQ 8/qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@benyossef-com.20150623.gappssmtp.com header.s=20150623 header.b=a++gLIAF; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11si767413oim.223.2020.01.29.01.11.55; Wed, 29 Jan 2020 01:12:15 -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=@benyossef-com.20150623.gappssmtp.com header.s=20150623 header.b=a++gLIAF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726096AbgA2JLy (ORCPT + 99 others); Wed, 29 Jan 2020 04:11:54 -0500 Received: from mail-ua1-f67.google.com ([209.85.222.67]:33733 "EHLO mail-ua1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725989AbgA2JLy (ORCPT ); Wed, 29 Jan 2020 04:11:54 -0500 Received: by mail-ua1-f67.google.com with SMTP id a12so5926366uan.0 for ; Wed, 29 Jan 2020 01:11:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benyossef-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=m8DeBR3ywE5BStJvUpTceu94rxUL71zPmj3cpgCJEJA=; b=a++gLIAF1FEOcrFCMq4xVdmkxU5ir6QrUsrbRHj/nnEOI3+Cpf2VX/n/8phxwaHxS4 GxmHeMr5ec8gdSyXHDKDnIsvhfKdX3oVZLwmw35xOalmu5AKz17wW1i0ZAuZ7MoT/Wm1 h6+RXq3l2NLi0hbKqoLO55daQGozT6siSDgq1RDFho78WXGvrQeL4Hvd13Rg9ifqRC0z H84mccExPAxGhSvaS8JdDjpByKyTR32oLC4bMDBWgL1hseHslLjKj8Dip2T/Q3WeAnuc XBc6/rV4YRNH6VhT46wv2rJA6MioHze0Vfu3KCtXRWk+tew6JRBfvLGSabtvFlhbOd6K ZlLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=m8DeBR3ywE5BStJvUpTceu94rxUL71zPmj3cpgCJEJA=; b=Oty1UgtXPrRxfN05DQw5hg44PUPB5KixPrneZgLSQeuO8qxW28qMPuRO8Y3zixQ8vn ohozub1QfrC4EbkG3XWeH6VbG9fh8/aZw2dkuL90XVkhGrg5pWNxf7nnET4mOJG/w8Yl DKA5NiaAob/pfRfLnqpcu/KxgM2VhUV1RWgn/avZxSRiOHwxlfvqRM1YFa+v1vwgsUjB W8KHrJ2sQUZj0DFRB2uyEbDY7IC99v2bI0WVzVlcwANlxzrG8A7PkkIgMi1iNKXv5LG4 bhcFW/QCDJMubz6KRFIAYrBTzeBf4MnC8Sq/VHHSHOT/O3lRKVLkMKOeAYMcS9t15hvx t4wQ== X-Gm-Message-State: APjAAAXjhZfRtVl8aXKrBI8pJ1cSg9B6QoPiE9yXgQnAlF4So1T4h/g5 JJXRN+6VGPj1QBQI4W8pDl56ToxjsP7s460f2cLu2w== X-Received: by 2002:a9f:226d:: with SMTP id 100mr15413840uad.107.1580289113246; Wed, 29 Jan 2020 01:11:53 -0800 (PST) MIME-Version: 1.0 References: <20200128190913.23086-1-geert+renesas@glider.be> In-Reply-To: <20200128190913.23086-1-geert+renesas@glider.be> From: Gilad Ben-Yossef Date: Wed, 29 Jan 2020 11:11:42 +0200 Message-ID: Subject: Re: [PATCH] [RFC] crypto: ccree - fix retry handling in cc_send_sync_request() To: Geert Uytterhoeven Cc: Herbert Xu , "David S . Miller" , Linux Crypto Mailing List , Linux-Renesas , Linux kernel mailing list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 9:09 PM Geert Uytterhoeven wrote: > > If cc_queues_status() indicates that the queue is full, > cc_send_sync_request() should loop and retry. > > However, cc_queues_status() returns either 0 (for success), or -ENOSPC > (for queue full), while cc_send_sync_request() checks for real errors by > comparing with -EAGAIN. Hence -ENOSPC is always considered a real > error, and the code never retries the operation. > > Fix this by just removing the check, as cc_queues_status() never returns > any other error value than -ENOSPC. Thank you for spotting this! The error is simply checking for the wrong error value. We should be checking for -ENOSPC! What this does aims to do is wait for the hardware queue to free up if we were asked to queue a synchronous request and there was no room in the hardware queue. The cc_queue_status() function used to return -EAGAIN in this scenario and this was missed in the change. I'm curious as to how you found this - did you run into some problem and traced it to this? This can lead to a setkey() failing in very high load situations but I expect this occurrence to be very rare indeed since cc_queue_status() already loops several times waiting for the room to be freeed. Gilad --=20 Gilad Ben-Yossef Chief Coffee Drinker values of =CE=B2 will give rise to dom!