From patchwork Wed Jul 24 21:22:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 11057629 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C2F2013A4 for ; Wed, 24 Jul 2019 21:22:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B086B28911 for ; Wed, 24 Jul 2019 21:22:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A403428918; Wed, 24 Jul 2019 21:22:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0C1E28911 for ; Wed, 24 Jul 2019 21:22:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728407AbfGXVWM (ORCPT ); Wed, 24 Jul 2019 17:22:12 -0400 Received: from lithops.sigma-star.at ([195.201.40.130]:51458 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727195AbfGXVWL (ORCPT ); Wed, 24 Jul 2019 17:22:11 -0400 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 13DD06089339; Wed, 24 Jul 2019 23:22:09 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id rU2TxR2z4FAv; Wed, 24 Jul 2019 23:22:08 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id C11CA6089354; Wed, 24 Jul 2019 23:22:08 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 4gLqFIRnLWU7; Wed, 24 Jul 2019 23:22:08 +0200 (CEST) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id 9A8E06089339; Wed, 24 Jul 2019 23:22:08 +0200 (CEST) Date: Wed, 24 Jul 2019 23:22:08 +0200 (CEST) From: Richard Weinberger To: linux-crypto@vger.kernel.org, linux-kernel Cc: horia.geanta@nxp.com, aymen.sghaier@nxp.com, david Message-ID: <839258138.49105.1564003328543.JavaMail.zimbra@nod.at> Subject: Backlog support for CAAM? MIME-Version: 1.0 X-Originating-IP: [195.201.40.130] X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF60 (Linux)/8.8.12_GA_3809) Thread-Index: BRBzCkuiRpn89WxIsrxtpCssT2oQQg== Thread-Topic: Backlog support for CAAM? Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi! Recently I had the pleasure to debug a lockup on a imx6 based platform. It turned out that the lockup was caused by the CAAM driver because it just returns -EBUSY upon a full job ring. Then I found commits: 0618764cb25f ("dm crypt: fix deadlock when async crypto algorithm returns -EBUSY") c0403ec0bb5a ("Revert "dm crypt: fix deadlock when async crypto algorithm returns -EBUSY"") Is there a reason why the driver has still no proper backlog support? If it is just a matter of -ENOPATCH, I have some cycles left an can help. But before working on this topic I'd like to figure what the current state or plans are. :-) So far I work around the issue with disgusting hacks like this one: Thanks, //richard --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -339,6 +339,7 @@ int caam_jr_enqueue(struct device *dev, u32 *desc, return -EIO; } +again: spin_lock_bh(&jrp->inplock); head = jrp->head; @@ -347,8 +348,8 @@ int caam_jr_enqueue(struct device *dev, u32 *desc, if (!rd_reg32(&jrp->rregs->inpring_avail) || CIRC_SPACE(head, tail, JOBR_DEPTH) <= 0) { spin_unlock_bh(&jrp->inplock); - dma_unmap_single(dev, desc_dma, desc_size, DMA_TO_DEVICE); - return -EBUSY; + msleep(100); + goto again; } head_entry = &jrp->entinfo[head];