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=-9.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 2D9D3C4332E for ; Tue, 22 Dec 2020 13:32:38 +0000 (UTC) Received: from mail.server123.net (mail.server123.net [78.46.64.186]) (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 AB98A23105 for ; Tue, 22 Dec 2020 13:32:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB98A23105 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-crypt-bounces@saout.de X-Virus-Scanned: amavisd-new at saout.de Authentication-Results: mail.server123.net (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::32b; helo=mail-wm1-x32b.google.com; envelope-from=gmazyland@gmail.com; receiver= Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.server123.net (Postfix) with ESMTPS for ; Tue, 22 Dec 2020 14:31:47 +0100 (CET) Received: by mail-wm1-x32b.google.com with SMTP id 3so2187605wmg.4 for ; Tue, 22 Dec 2020 05:31:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=cb+JfYPl0RvgoYk7l9k6yf9a2Z2DqF5zOju84n1TdkA=; b=U4mzzGGmjYulqn6SVu7c+BYyjB2HmxQqVlLrTGq9nk79j5tpBWHM0HAki2/l/JQHmg Wvk7hjwBvnYHvx3h1GCpr6w4q4XL8ecvrTvdI6Se/UtBIymk3eSyoZ4XyqHgYlLfc7KF 78+697QyC3/b/h9LUng4mXh1qUjL2r9G8hYaT6ddE0wtna2fFKGtvnFMy6HRU7K7b15h Si5e7nyivFWT9P9wSYpLq3rT+VvXCwt6nNT2zUgukvHRTz2u+DqOJTKu6rGkW/imAGeH bYUGYbWfX97/XwfWLA3ldDD7CJaIS97IpZTLDY08QfhbiMLEq8SUrQgYL/tP+sBsoinO cznQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=cb+JfYPl0RvgoYk7l9k6yf9a2Z2DqF5zOju84n1TdkA=; b=IyTXRqTOsXWqGFi4tn5PuYdxk24KnxGsu5gGtKLJjOFtqUiKmKb8vPtQJ24MKrTTZK Lisn2/ZxMkaLA4DjuTMzWQ/k63FJ2oYgRIsz9nDIhhXI8PSzCHDC8zl34/TuGsGRrVVE 7dG4xM9Vb0zFGZZUoCZUxX3X/lPnZLy1kCiWhJb6B+654tKB3P4N8+IawUSCXJXydXCA A8fJDVcxdtahUQ7/2fQi/2CJapiyCJX13ivi0xKGf0lm3I9pnoFRmsHzZN3H+VvGh+ts 1m5xwrxBpkKt37PNS5MIqWoDTIZq7VIpILatwJQEP/EyxnYpujFN9Iwqk/xq59HP6Ga3 zokQ== X-Gm-Message-State: AOAM530ACF6BYnAtw3Vpz4kp+N9co9UyF7g4laUcb7yNB2qWPoG744aE PgR4D4FSTLYKVZOo4VnbJs2XaK4ni5I= X-Google-Smtp-Source: ABdhPJyd82h1zJ3HzQaDtYFlMROZvc/Us59SBf4MnU0FWxrva3EnDChHx71h2nUNHdDkzt/kBUaXcg== X-Received: by 2002:a1c:b7d4:: with SMTP id h203mr22149786wmf.59.1608643906692; Tue, 22 Dec 2020 05:31:46 -0800 (PST) Received: from [192.168.2.27] (39.35.broadband4.iol.cz. [85.71.35.39]) by smtp.gmail.com with ESMTPSA id j15sm32079353wrr.85.2020.12.22.05.31.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Dec 2020 05:31:46 -0800 (PST) To: Germano Massullo , dm-crypt@saout.de References: From: Milan Broz Message-ID: <24d2c850-3c7f-8e38-d5f3-daaafd692c42@gmail.com> Date: Tue, 22 Dec 2020 14:31:45 +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-Language: en-US Subject: Re: [dm-crypt] LUKS2 SSD swap and system freeze X-BeenThere: dm-crypt@saout.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Errors-To: dm-crypt-bounces@saout.de Sender: "dm-crypt" On 15/12/2020 11:42, Germano Massullo wrote: > Good day. I am investigating about a weird behavior of my system that > leads to frequent freezes. > The main components of my system are: Fedora 33 (kernel > 5.9.13-200.fc33.x86_64), cryptsetup 2.3.4, an AMD Ryzen 5 3600, 16 GB > RAM 3200 MHz, a Samsung 860 PRO used for 32 GB swap and LVM Cache, that > is encrypted with following criteria: > = > # cryptsetup status ssd_cache > /dev/mapper/ssd_cache is active and is in use. > =A0 type:=A0=A0=A0 LUKS2 > =A0 cipher:=A0 aes-xts-plain64 > =A0 keysize: 512 bits > =A0 key location: keyring > =A0 device:=A0 /dev/sdc > =A0 sector size:=A0 512 > =A0 offset:=A0 32768 sectors > =A0 size:=A0=A0=A0 500085424 sectors > =A0 mode:=A0=A0=A0 read/write > =A0 flags:=A0=A0 discards > = > During write bursts of swap (for example when booting some virtual > machines), the system completely freezes, I cannot even move the mouse > pointer. The system may remain in stuck state even for 10 minutes. When > the (host) system turns back to normal, I can see for example in virtual > machines, the following error in console > =3D=3D=3D=3D=3D=3D=3D=3D > Message from syslogd@localhost at Dec 15 01:14:32 ... > =A0kernel:watchdog: BUG: soft lockup - CPU#0 stuck for 124s! > [0x564a0d4baad0-:1924] > =3D=3D=3D=3D=3D=3D=3D=3D > = > To check if the complete stuck of the system was caused by encryption, I > tried to disable SSD swap, and create a unencrypted swap on a regular > HDD, and then when I had write bursts, the system slowed, but it did not > freeze. > How could I proceed in my investigation to find out if it is a matter of > system configuration, a bug, etc.? First, this is kernel issue, not a cryptsetup userspace issue (cryptsetup only configures kernel dm-crypt). With some encryption drivers that allocates memory during encryption there was a possible deadlock if swap is encrypted and system is out of mem= ory. There should be a workaround in latest stable kernel that does not allow to use such crypto drivers in dm-crypt. For dm-crypt it is commit https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/d= rivers/md/dm-crypt.c?id=3Dcd74693870fb748d812867ba49af733d689a3604 (but it requires also patches for crypto subsystem for setting this flag in= drivers.) The long-term solution is to fix crypto drivers... Anyway, please try the latest stable kernel (ideally 5.10.x) - if you still see the problem, please report it to dm-devel@redhat.com mailing list. (There is another patch that limits IOs in flight in dm-crypt, but this was not yet merged upstream - that could help too). Thanks, Milan _______________________________________________ dm-crypt mailing list dm-crypt@saout.de https://www.saout.de/mailman/listinfo/dm-crypt