Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2514817ybt; Tue, 16 Jun 2020 08:02:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztKN6Vh/a8Fob856+GimsA8KzWNkMHQ0XYT5MzvWM9TuAtwSP6CgQaei3hVOSjUg6lA15X X-Received: by 2002:a17:906:6b8a:: with SMTP id l10mr2991426ejr.465.1592319746849; Tue, 16 Jun 2020 08:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592319746; cv=none; d=google.com; s=arc-20160816; b=0ApMku0flflpQmF/E5VClnwIPFA9Hu5JsQuQAciH6TSLcLX5VKX8Fyc4UXgA0nzLRY IwUEXadCoMeiKuyGuEO3JbZHCo6RoNVDBhi6AAgFTXCaW9OfRfdO7V52OMpNPCSq4rbg ATyHcLVOwmYXjQRuuqf0h8AOpzvAI8dcWEaiSwJUFNRgbCjSArWOI4QHYYPCwDKB36I9 8g8TJTys4seSM+To/t47zUEV/nmeITS+oBNkuZCEMrIua9+yEMpqE3JzP7ugJL8xH+s5 TyZV7bufNpTa7U2VGsF92nPKo1qHMAz7sDdVgi00lHn1zc6AgjVh9usKdXai87D/gdfd 3wGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=8qmH81i5EvkQGNxIUerlyGiqGCwul1+ubQ1Y2Fp1www=; b=VW6pqBr1WUUAmOSelP8+XOutmGfT9Bk5hO0WTqAddjBc0HRob39/fqAz9q/TJ+SIik 1nVKUwsMDtVMrlPy3Tcj4VX6MAVlVbjD1/srz+HHShHPyGefIDvLPuI/lofkn2BmbFvB TCIdj1SpfDG71TPCoHVH7Hvgzjp917EOe3Wu0c+5Zf6fmXhbIAfSY+YTkkyqHAB2I56P FFjjCMmVgP5Yif8Kq3PbUIxfVStZANiTWOuqxofgHrU6deD0A9EPnpRCHv6o4jfgnj77 Qz87fq6dXJLFpbzPIiJzHA+1RSnfs2WvocTrIGa8vls48es7ovIOUv69Tv7H+0Qe5VIh aFsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=agWxHX6h; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u15si11024455edq.598.2020.06.16.08.01.54; Tue, 16 Jun 2020 08:02:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=agWxHX6h; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729389AbgFPPBW (ORCPT + 99 others); Tue, 16 Jun 2020 11:01:22 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:22024 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729378AbgFPPBV (ORCPT ); Tue, 16 Jun 2020 11:01:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592319680; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8qmH81i5EvkQGNxIUerlyGiqGCwul1+ubQ1Y2Fp1www=; b=agWxHX6hciyYaumvHgUxNahICp05CFOizuJOdPe7spTr2kNlgGMgUMuBlVNURrty6aCas3 fc74DUZBJuu91Ec5KCdajIQJVOOGvoeoB/OtQ/CUn/OW/APFH8CBtViBYzZCHVxvh/bd7G pL+xR+VnPXoim7OYNeMxNxpnj9kaayg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-410-JU5yxV5NN8ezmn8l1PxUIg-1; Tue, 16 Jun 2020 11:01:07 -0400 X-MC-Unique: JU5yxV5NN8ezmn8l1PxUIg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D00778CFF30; Tue, 16 Jun 2020 15:01:05 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EC5547FE95; Tue, 16 Jun 2020 15:01:01 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id 05GF11mo028805; Tue, 16 Jun 2020 11:01:01 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id 05GF10rb028801; Tue, 16 Jun 2020 11:01:01 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Tue, 16 Jun 2020 11:01:00 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Herbert Xu cc: "David S. Miller" , linux-crypto@vger.kernel.org, Mike Snitzer , Milan Broz , dm-devel@redhat.com, linux-kernel@vger.kernel.org Subject: Re: crypto API and GFP_ATOMIC In-Reply-To: <20200610121106.GA23137@gondor.apana.org.au> Message-ID: References: <20200610010450.GA6449@gondor.apana.org.au> <20200610121106.GA23137@gondor.apana.org.au> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, 10 Jun 2020, Herbert Xu wrote: > On Wed, Jun 10, 2020 at 08:02:23AM -0400, Mikulas Patocka wrote: > > > > Yes, fixing the drivers would be the best - but you can hardly find any > > person who has all the crypto hardware and who is willing to rewrite all > > the drivers for it. > > We don't have to rewrite them straight away. We could mark the > known broken ones (or the known working ones) and then dm-crypt > can allocate only those using the types/mask to crypto_alloc. > > Cheers, I triaged the drivers in drivers/crypto and unfortunatelly, most of them do memory allocation in the encryption routine. Some of the do GFP_KERNEL allocation even in the absence of CRYPTO_TFM_REQ_MAY_SLEEP. I'm sending the patches: The first patch adds a new flag CRYPTO_ALG_ALLOCATES_MEMORY. The second patch passes CRYPTO_ALG_ALLOCATES_MEMORY through the crypto API stack (please check it - I am not an expert in this area). The third patch sets CRYPTO_ALG_ALLOCATES_MEMORY on drivers that allocate memory in the encrypt/decrypt routine. The fourth patch fixes the drivers that use GFP_KERNEL in non-blocking context. Mikulas