Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2505971pxb; Mon, 18 Jan 2021 21:31:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+CgKOXF08UpzwIl0ic3k770NSIR/j38zJUNi9hj1tahoX9kT/uajBRAJtTOlYS4gCFZOm X-Received: by 2002:aa7:d649:: with SMTP id v9mr2008518edr.383.1611034264516; Mon, 18 Jan 2021 21:31:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611034264; cv=none; d=google.com; s=arc-20160816; b=kFcDyv4fJC94EJszfAIhi7w16Igw4quLdhte0ySIpV/ttV8006NsP6edlBGdg56V0E eMgiyaXqWyu1PiKZbIg/n1CsWJUfCtzLvbAbt5Qli8En/9TFX2g/BNWNi91J8ZIB1W0t re9SG//OP/qXuYaUR+q8gC+ZdsiUpLtNmR7LLjlQpSdIocIzSTC4yHpEGKJmDwQZzyLA 9njo99ca0O7MFo5VMaABrpAohaajIdpQGEc5t0Xsx2zKkj9qn1GDmVhFPNyyzHLawOjw UPQ1bvmy6mIefQ9p84iFQiI+UABO1OIPaLJUFEbDjocNv8eEwR2Me6Bb0vh/0AzT3Dnz JdnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=RNIIO1LfDdwmZD1fpi7N0jsea/5vNdEYtpT955Q+IpQ=; b=Nm2EFYjgowLYhHzqoriXfAXVevxqgnpIeUutz8XS52VcqUgavO/5eJ8K4Axq+bXRDl cLHCddNVul3BMrAhcsHStLhLcmpp9SIeXug92GUtnXcCjHmrtrmRaH31aMBIILwxX13y J3dr13TB1q/h+Q90RdqmsRXd0LhLCaZbiqxX3Z29YOzipmYXXnDJfhADDnso0Sbeq4FX a3SKaB2OMQf+iSnaLGMWe7W+BnupfoYY5rReZ2VBVNIp1yxlYNrcdSrUnuMrRLLy/R6Q wXT0Q+9GFaW8MrYIgLBfqcEznrokU1wravYtN7aR7znev2DDUmSSFQVMp7lZGDc/oXG/ LhTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b=drSj6qv3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r18si330140edt.510.2021.01.18.21.30.37; Mon, 18 Jan 2021 21:31:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@cloudflare.com header.s=google header.b=drSj6qv3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731544AbhARXG6 (ORCPT + 99 others); Mon, 18 Jan 2021 18:06:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732739AbhARXGw (ORCPT ); Mon, 18 Jan 2021 18:06:52 -0500 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EAEBC061574 for ; Mon, 18 Jan 2021 15:05:57 -0800 (PST) Received: by mail-io1-xd29.google.com with SMTP id h11so6952889ioh.11 for ; Mon, 18 Jan 2021 15:05:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RNIIO1LfDdwmZD1fpi7N0jsea/5vNdEYtpT955Q+IpQ=; b=drSj6qv33myxlpEiC4qESl9upkPKuqyqoxsYjouA8LnGBOHrGhGDU+yzUWoYIBQ/EW Vw+PqDmhRrmMKbKD3NJjC2s4mCufYAvRkg10iCDjyl3DO67xFh8I0MQmIKVwvUV0UtyY Zgmmhlmak5KGcPDpP2EdVG6kqOH3ZpvPKzfU8= 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=RNIIO1LfDdwmZD1fpi7N0jsea/5vNdEYtpT955Q+IpQ=; b=BqZEVxmSJeo0slvP46rdKfzK5P0Q7rP6WwMZ5xv+2iLxCEgZGTQDOSLJgQUwvSL26J U6a9ewQs8qerzi71H4C69CRpzm6k3oYKblDncVbZW9D6zIq/+omjkLpuiQX0WjEDIgN4 em1pXau4d4lpEYCNyq2J4ltROsDfzE0XTnfamBdtXVahR3PCkdr39p/SwrILefhK8aBy d6fcnxiW9EYBuW2dcyMA+rmiqoUExvCH9EGerGaQCmxh9bUVKixWhDGNcFypDiGBU+fE Nqlu9Il5Pw5spXNqntjJKIfaBJQhqXXLJzt2PQwUoi0+yplCV0q2arjHhiPdYxHkNenl PP0g== X-Gm-Message-State: AOAM530VYEW8umvZFBlkXZfcwdVRGdnkp/w7DLKm7tcn+6aNAdk/5u2l KIlC6KK6mOaClDd0YrO0++j0FKbAdTrc3zpswp27zA== X-Received: by 2002:a05:6e02:1be6:: with SMTP id y6mr1071625ilv.145.1611011156183; Mon, 18 Jan 2021 15:05:56 -0800 (PST) MIME-Version: 1.0 References: <20210118113352.764293297@linuxfoundation.org> <20210118113354.944646657@linuxfoundation.org> <20210118224431.GA26685@amd> In-Reply-To: <20210118224431.GA26685@amd> From: Ignat Korchagin Date: Mon, 18 Jan 2021 23:05:45 +0000 Message-ID: Subject: Re: [PATCH 5.10 045/152] dm crypt: use GFP_ATOMIC when allocating crypto requests from softirq To: Pavel Machek Cc: Greg Kroah-Hartman , linux-kernel , stable@vger.kernel.org, "Maciej S. Szmigiero" , Mikulas Patocka , Mike Snitzer Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 18, 2021 at 10:44 PM Pavel Machek wrote: > > > > Fix this by allocating crypto requests with GFP_ATOMIC mask in > > interrupt context. > ... > > This one is wrong. > > > > +++ b/drivers/md/dm-crypt.c > > @@ -1454,13 +1454,16 @@ static int crypt_convert_block_skcipher( > > - if (!ctx->r.req) > > - ctx->r.req = mempool_alloc(&cc->req_pool, GFP_NOIO); > > + if (!ctx->r.req) { > > + ctx->r.req = mempool_alloc(&cc->req_pool, in_interrupt() ? GFP_ATOMIC : GFP_NOIO); > > Good so far. Ugly but good. > > > -static void crypt_alloc_req_aead(struct crypt_config *cc, > > +static int crypt_alloc_req_aead(struct crypt_config *cc, > > struct convert_context *ctx) > > { > > - if (!ctx->r.req_aead) > > - ctx->r.req_aead = mempool_alloc(&cc->req_pool, GFP_NOIO); > > + if (!ctx->r.req) { > > + ctx->r.req = mempool_alloc(&cc->req_pool, in_interrupt() ? GFP_ATOMIC : GFP_NOIO); > > + if (!ctx->r.req) > > + return -ENOMEM; > > + } > > But this one can't be good. We are now allocating different field in > the structure! Good catch! Sorry for the copy-paste. It is actually not a big deal, because this is not a structure, but a union: as long as the mempool was initialized with the correct size, it should be no different. Nevertheless, I'll send the patch to fix the typo. Regards, Ignat > Pavel > > -- > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany >