Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp6738132pxu; Thu, 24 Dec 2020 10:55:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJy3gRfigKb1Gt65DZp9aHZIRZ2GIVyILyZe8+D4Fm4sdC0YjwNpZQ/MXJSJUdnIcnECVgbo X-Received: by 2002:aa7:cc15:: with SMTP id q21mr29888913edt.213.1608836106070; Thu, 24 Dec 2020 10:55:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608836106; cv=none; d=google.com; s=arc-20160816; b=kL657XslTLMYuhR2+asJ13MSVdwKDx2H5LsQcXdJfomx5baQk/LZ9Vv1OYU0RQBwVF 9PxnO67MFEOsV6Grgr/aNoQlpGULl5J+F24P99VT8pgmfZpsumVI+DZdmDYAsFqClhPB ohCewQLxXXxVuV2qYixecwHO/ubQ6IaL7pBfQec8WHXjpQco+4TYR3X8EO8UZ+PEu4q6 O6mLOVshAv2BOVA1sTNr9VwRFQ8RtTjJd5OAzK00n/GFzPNMGznZBnbNSlEECB+bDVqz k5y9LD5RJiHvh5mLFobP+TRoQaxiOUyb9D8LmMygvB7popB9fQ4DjyQqkUDdcx16e/ip nSLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=1Oa2VoO12t+3vhi1k9fcRsEF7afLB9+oEJKCROENiJk=; b=KXkt0DBfEDz53Jac7GeRu5vwSjjYT8wkb1TpnxIbZVdhCYtFvZSsqwfTiHE9lOv+aR oW7wvdkPX8SJUZGYhaQaTFuKdL1QH7wnjOaacUkUXyzcUIr502YOnU39UMwbtZYt54HK d2Y+/eKkzs9y/qrI0Le+U5Scx/+oxzgHm3zbOyh5Cw7z3ZtbT80V1t3uhTJYFl/qTRTM HLTIPrbYZ5zrAo2hWewPMVsAX6PayBG278SgQGwMBI3hlcnk96WhZsPEutlixJyIzdxH +xmNQX+7TpusDxkkh+EyMx4+7QmvTcqGx0eawpF4djy6YizpgHfiFX2VlDEFPOIO4Z58 c5hw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si17518284edp.516.2020.12.24.10.54.21; Thu, 24 Dec 2020 10:55:06 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728860AbgLXSxx (ORCPT + 99 others); Thu, 24 Dec 2020 13:53:53 -0500 Received: from vps-vb.mhejs.net ([37.28.154.113]:52356 "EHLO vps-vb.mhejs.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728578AbgLXSxw (ORCPT ); Thu, 24 Dec 2020 13:53:52 -0500 Received: from MUA by vps-vb.mhejs.net with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.93.0.4) (envelope-from ) id 1ksVjV-0003Ga-OE; Thu, 24 Dec 2020 19:53:05 +0100 Subject: Re: dm-crypt with no_read_workqueue and no_write_workqueue + btrfs scrub = BUG() To: Ignat Korchagin Cc: Alasdair G Kergon , Mike Snitzer , device-mapper development , dm-crypt@saout.de, linux-kernel , Eric Biggers , Damien Le Moal , Mikulas Patocka , kernel-team , Nobuto Murata , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, linux-crypto , Herbert Xu References: <16ffadab-42ba-f9c7-8203-87fda3dc9b44@maciej.szmigiero.name> <74c7129b-a437-ebc4-1466-7fb9f034e006@maciej.szmigiero.name> <20201223205642.GA19817@gondor.apana.org.au> From: "Maciej S. Szmigiero" Message-ID: Date: Thu, 24 Dec 2020 19:52:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24.12.2020 19:46, Ignat Korchagin wrote: > On Wed, Dec 23, 2020 at 8:57 PM Herbert Xu wrote: >> >> On Wed, Dec 23, 2020 at 04:37:34PM +0100, Maciej S. Szmigiero wrote: >>> >>> It looks like to me that the skcipher API might not be safe to >>> call from a softirq context, after all. >> >> skcipher is safe to use in a softirq. The problem is only in >> dm-crypt where it tries to allocate memory with GFP_NOIO. > > Hm.. After eliminating the GFP_NOIO (as well as some other sleeping > paths) from dm-crypt softirq code I still hit an occasional crash in > my extreme setup (QEMU with 1 CPU and cryptd_max_cpu_qlen set to 1) > (decoded with stacktrace_decode.sh): (..) > This happens when running dm-crypt with no_read_workqueues on top of > an emulated NVME in QEMU (NVME driver "completes" IO in IRQ context). > Somehow sending decryption requests to cryptd in some fashion in > softirq context corrupts the crypto queue it seems. You can try compiling your test kernel with KASAN, as it often immediately points out where the memory starts to get corrupted (if that's the bug). Enabling other "checking" kernel debug options might help debugging the root case of this, too. > Regards, > Ignat Thanks, Maciej