Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp445576ybg; Wed, 10 Jun 2020 05:06:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCvOv/ib/Fyk2E9oEFQuxZbURjc24i6OZ77/TwTJRIEl+LtIymUTIiChZYcXzgz97xLuHZ X-Received: by 2002:a17:906:8492:: with SMTP id m18mr3005691ejx.168.1591790760984; Wed, 10 Jun 2020 05:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591790760; cv=none; d=google.com; s=arc-20160816; b=q/ZKXvfWQ1Tw8V+uPnIMDociSdMph5letTn6CqTGYWML6SEKmJSXm6Y7PjtnbGa/Se rIJ5i0q22//SGi0VPVOECMcXI7BQZfDcu+wMqRfC63kOgNuAscIOz9a5nlgTJllCctRs dixoPssch64pYYQxNR0OajbDzyeLzHjJ9vfW8oTX2QUl877txXjTGs1nGuGx/19v4qBy gjXQjkFXgT0do8zFiwCOX/ZOJtLEux5mELusLdnl4njURR9U73TxToWPqlbnumvbGEZX B6lEA6rCxCnx3AqG9ZCNFS1z7NuzjVZQ3Q+2v70BV0gn/PDE/xNQFi9S0pZq0g9FWdt2 cGbA== 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=TNsoGvRQNqCDBEQwQWNi/36A0peQaj7a5rcaN6nMm74=; b=uYyJm0d8CSdyD5MAzg41hVz8ZmvG77f1kLXr/INFSDPesWl0CBp3acYbUxpSyxZl4f 1J0TTBpBnpRsBKkvbtmAhVeJ5GCHm2CsfzGTCUNN3QYD5RAc7qv2jpBlG/onWBqikx9v 63uNhRolIUJEBDWlAv+PTAt3d+tnEUh+Xnm/Q8m08yh+QusVdngQ6lXYXJ6GJ7T0TlgK PTE1yNz+nzsv2DAoOwUtCmnMb14hqi5E+ZytNoRqg4VQ027F05j41MDHGTr5rvZf16Mu XfEs59S8MbyLb9a4cwGSpybHsNpXlxoZLAdHXpikREg4iC8/ZlUpzvueTDwkCRg2msRt 2xQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=O0qKoJFb; 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 s3si12006226ejq.532.2020.06.10.05.05.26; Wed, 10 Jun 2020 05:06:00 -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=O0qKoJFb; 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 S1728908AbgFJMC4 (ORCPT + 99 others); Wed, 10 Jun 2020 08:02:56 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:33769 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728753AbgFJMC4 (ORCPT ); Wed, 10 Jun 2020 08:02:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591790575; 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=TNsoGvRQNqCDBEQwQWNi/36A0peQaj7a5rcaN6nMm74=; b=O0qKoJFbCQHlE+jEGkzuweQIFACfqUkJnE/Kv6U0Th3mvK0fTus4FqsGJyeMMhyRbSRWFF K5WMU87Mm7XnUcxpPsAsR331XDPC4ailQQ6ESSNbaen77OBKi5q+R9Yav8KX4vG+w4+d/j eagnXIKb8FRw7XbdPho9vSGTol9/eAQ= 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-154-MecNFB9ROaaure0ci4G0eg-1; Wed, 10 Jun 2020 08:02:53 -0400 X-MC-Unique: MecNFB9ROaaure0ci4G0eg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F3826100A8EE; Wed, 10 Jun 2020 12:02:51 +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 C28088FF86; Wed, 10 Jun 2020 12:02:24 +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 05AC2Ono028363; Wed, 10 Jun 2020 08:02:24 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id 05AC2OLN028359; Wed, 10 Jun 2020 08:02:24 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Wed, 10 Jun 2020 08:02:23 -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: <20200610010450.GA6449@gondor.apana.org.au> Message-ID: References: <20200610010450.GA6449@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.13 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 Tue, Jun 09, 2020 at 01:11:05PM -0400, Mikulas Patocka wrote: > > > > Do you have another idea how to solve this problem? > > I think the better approach would be to modify the drivers to not > allocate any memory. In general, any memory needed by the driver > to fulfil a request *should* be allocated within the crypto request > object. That's why we have the reqsize field to indicate how much > memory could be needed per request. > > Thanks, 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. Another possibility - I was thinking about setting CRYPTO_TFM_REQ_MAY_SLEEP in dm-crypt and calling the crypto function under memalloc_noio_save. But there are some drivers that do GFP_ATOMIC allocation regardless of CRYPTO_TFM_REQ_MAY_SLEEP. Mikulas