From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54697C5DF62 for ; Wed, 6 Nov 2019 07:33:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1C074217F4 for ; Wed, 6 Nov 2019 07:33:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="O/2tQme9"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=benyossef-com.20150623.gappssmtp.com header.i=@benyossef-com.20150623.gappssmtp.com header.b="tXq9+cEd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1C074217F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=benyossef.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BCtvLK8qHjUCKelUeKb90Cub0DV1dG6v+Qlo94VvH4s=; b=O/2tQme9bKVBhg DYnEnWr1CWHYy6/vft7X3yQkcrpcT139jsYhvyB7ZrhLSSx8x1sGjOiVuLeVzrEBEwGrBLqSeVVVC SgS7nwQTORK8cXXBokNPbOcDj4pqv032Cdvy/7a5DIU1GMAexMsx4jeYX5Cz4JFqGRCNrE2vCULnp 6oR4lZrPwoMSUoKp/wWxvcbDWzYcXI/CWjxhWTTBSmL73kKHLP4Fc35vSdbrH4Q4YgaOnOgXdwk4s keHWU13JpXHestAT164t4Dhf6LwcVfM5oIGpIJXbU3qPo+RuH9bwW0dSgomu+kgFlsgL3+qX0czpD C9X70PyXfUTr2YTozy5w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSFou-0001uD-Bt; Wed, 06 Nov 2019 07:33:36 +0000 Received: from mail-vk1-xa43.google.com ([2607:f8b0:4864:20::a43]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSFoq-0001th-IJ for linux-arm-kernel@lists.infradead.org; Wed, 06 Nov 2019 07:33:33 +0000 Received: by mail-vk1-xa43.google.com with SMTP id u79so5381037vke.4 for ; Tue, 05 Nov 2019 23:33:32 -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; bh=fbVrCNlPLaDTmcKHIN3LtBZK21JIiPNghUTOX5jQAi0=; b=tXq9+cEdTgcUL/rTgW92c4PNWlxnqdy9ufzkcqPbyt0BmkFpZwtDr2SKTAZ2B2adPA F+XDqVbx7RMa+5XEnQg/NkxPXT5p1qsf2Il96TWl2Xo9SSM9hUuVYMdG4OSux/yBuUE8 /lt+ifyc1imI3ov8PQ2W9bkBv+/tM6c/VcGIy/P/kI10Cz+YzkEMxuP+yQO8wBG0+vvv 4n+EMc34+wsK62rjmo/p32ZrKZm00eMyRRnbQWc2dTB1jGdGHtZvt3NtPvauqSi+hfbZ LBqtHWQ+Da8ZxU44fzKnYQQKozNVLB2Tu1/P25qp5db4qn1FRQ9kkdL7iUFiBnTCljtW Vuzw== 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; bh=fbVrCNlPLaDTmcKHIN3LtBZK21JIiPNghUTOX5jQAi0=; b=SOFWU5mTdbZEMC7l45UuPIcrOfQqbNjGwcYfq8e43Oas1LHkeBJMMOSDuOWfkd3LOs c2OUsgNZ1nUpJsp4dvWKzrVGJ7ojMGhzwPdXw6CzBp3a+q93Hwrgnf7U8OelqR2rLVMR /p65lQexeteFFfJpLq+2ooKIbPBMzVx7hkgUSLxde3vnAlXjeCE1HlSYlC1UbZ7QIlRq dcewlBAFmBU6v83wDVGf87+7ZxoIsPBxVhzsFekWuzcXceOAj3CIygwZGHrY4SjTsjBK CX35h+pMzpRRmyIHjrpBowlq+Hka9C2Omag9uT2lTa+IUmZMBSJWq70O1zt/cpeKBrxn VmPg== X-Gm-Message-State: APjAAAWOi1z6FEvp1/z8XTh1t3IwPdq1hIUhBe/4vUDJBbOzSCf+K+3m wjlfImP+wtkD5CFboAf76yzXh9M8cXC4hwM/Xizv9g== X-Google-Smtp-Source: APXvYqw32qEeWfeBSD+BM8iRa57I4atoH5ZwU4QbRCyWX48m3mTUA1rFPOiMiu2Vt5iwu172Y/DEdSEJXJ81xV0PdLY= X-Received: by 2002:ac5:c756:: with SMTP id b22mr628305vkn.2.1573025611342; Tue, 05 Nov 2019 23:33:31 -0800 (PST) MIME-Version: 1.0 References: <20191017122549.4634-1-t-kristo@ti.com> <20191017122549.4634-10-t-kristo@ti.com> <076f0bc6-ad04-9543-db02-d7c7060db036@ti.com> In-Reply-To: <076f0bc6-ad04-9543-db02-d7c7060db036@ti.com> From: Gilad Ben-Yossef Date: Wed, 6 Nov 2019 09:33:20 +0200 Message-ID: Subject: Re: [PATCH 09/10] crypto: add timeout to crypto_wait_req To: Tero Kristo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191105_233332_627570_1CC1B513 X-CRM114-Status: GOOD ( 20.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Herbert Xu , Ard Biesheuvel , Eric Biggers , Linux Crypto Mailing List , linux-omap@vger.kernel.org, David Miller , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Nov 6, 2019 at 9:25 AM Tero Kristo wrote: > > On 06/11/2019 08:39, Gilad Ben-Yossef wrote: > > Hi, > > > > > > On Thu, Oct 17, 2019 at 3:26 PM Tero Kristo wrote: > >> > >> Currently crypto_wait_req waits indefinitely for an async crypto request > >> to complete. This is bad as it can cause for example the crypto test > >> manager to hang without any notification as to why it has happened. > >> Instead of waiting indefinitely, add a 1 second timeout to the call, > >> and provide a warning print if a timeout happens. > > > > While the incentive is clear and positive, this suggested solution > > creates problems of its own. > > In many (most?) cases where we are waiting here, we are waiting for a > > DMA operation to finish from hardware. > > Exiting while this pending DMA operation is not finished, even with a > > proper error return value, is dangerous because > > unless the calling code takes great care to not release the memory the > > DMA is being done from/to, this can have disastrous effects. > > > > As Eric has already mentioned, one second might seem like a long time, > > but we don't really know if it is enough. > > > > How about adding a second API (ig. crypto_wait_req_timeout) which > > supports a calee specified timeout where > > the calle knows how to correctly deal with timeout and port the > > relevant call sites to use this? > > Yeah, that would work for me. I guess we could just swap the testmgr to > use this timeout API, as it is quite clear it should timeout rather than > wait indefinitely, and afaics, the data buffers it uses are limited > size. It doesn't really matter for it whether the timeout is 1 second or > 10 seconds, as long as it eventually times out. As long as you avoid releasing the memory used on timeout, that should work well, I think. Gilad _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel