From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96590E77188 for ; Sat, 28 Dec 2024 11:52:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 221516B007B; Sat, 28 Dec 2024 06:52:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1AAC56B0082; Sat, 28 Dec 2024 06:52:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 04A7E6B0083; Sat, 28 Dec 2024 06:52:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D77406B007B for ; Sat, 28 Dec 2024 06:52:31 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5EB1A1C91B3 for ; Sat, 28 Dec 2024 11:52:31 +0000 (UTC) X-FDA: 82944204462.04.F4B72B6 Received: from abb.hmeau.com (abb.hmeau.com [144.6.53.87]) by imf12.hostedemail.com (Postfix) with ESMTP id CE1994000B for ; Sat, 28 Dec 2024 11:52:09 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=hmeau.com header.s=formenos header.b=CAt5V2NT; dmarc=pass (policy=quarantine) header.from=apana.org.au; spf=pass (imf12.hostedemail.com: domain of herbert@gondor.apana.org.au designates 144.6.53.87 as permitted sender) smtp.mailfrom=herbert@gondor.apana.org.au ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735386729; a=rsa-sha256; cv=none; b=EZPmwlfgn5IS7pKFc7n1WnHYW8QsaixYGO+DmaPDrsvJD18gbXGvTTj8OpXH8dkZ07a9/o HQQcAeE3RR2PEeGb5c6vjm0jny5CfXAS3Z9rNjl7p7+4SRYOZPkMaX4nO9fXy0s8fbsIYj fPDP66UQyJJG+nMaRICzS1o1Pu0zAfs= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=hmeau.com header.s=formenos header.b=CAt5V2NT; dmarc=pass (policy=quarantine) header.from=apana.org.au; spf=pass (imf12.hostedemail.com: domain of herbert@gondor.apana.org.au designates 144.6.53.87 as permitted sender) smtp.mailfrom=herbert@gondor.apana.org.au ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735386729; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:dkim-signature; bh=u1/oC8BCLPT6yMZPY3Inwd3Vjvgb95l3JqkPW1qz50w=; b=kunTibG+R27znwf1HSBlz8vGqJWxwFfZtO/ex/4T7LnAKggADEMVmRqf0+h4+Ggv7S0hsV mxkOA9l+NKSvuFHPO/M7GDF6qq1PaXCnNYtDozLDIPME+5+GW8Kq5M7FRsr3tM99x/Q60j AgtTA0BNyBNUkxzNzMADf0+bW6+hPgY= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hmeau.com; s=formenos; h=In-Reply-To:Content-Type:MIME-Version:Message-ID:Subject:Cc:To: From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=u1/oC8BCLPT6yMZPY3Inwd3Vjvgb95l3JqkPW1qz50w=; b=CAt5V2NTTc0kb0kGRdkIX/GZQQ bTTgHPH/NKLbxDLA1MWIRbDtr1+h1JQ3XTYWhrKwwElWtk9P9hcq4K3641+Y3JYO9EQk3QgAZyzVU 0PTMD9vVeb5gNmpADBEVs8wmeUO/fh2YOdh/v32sAb29LJYimtK7hz42n3OZAvGVJZqiCWjxkZCQp Cy0RlSprSqCndAlanQhh8J5a4oRrv46//YRY5TnrbR9SmMlbxXAo7jv4zmQn1b5ZMB4ad7oM9jvo8 qcbr5WJHkqH+rTXOqfGmDbIxTeDcl/ii9iAR09JP8nZY3HXepGGVAsVFC9nz/UmrgUW8zepJW0jQv sJsPL07Q==; Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.96 #2 (Debian)) id 1tRV9r-003ZHr-0b; Sat, 28 Dec 2024 19:52:25 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Sat, 28 Dec 2024 19:52:23 +0800 Date: Sat, 28 Dec 2024 19:52:23 +0800 From: Herbert Xu To: Kanchana P Sridhar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, hannes@cmpxchg.org, yosryahmed@google.com, nphamcs@gmail.com, chengming.zhou@linux.dev, usamaarif642@gmail.com, ryan.roberts@arm.com, 21cnbao@gmail.com, akpm@linux-foundation.org, linux-crypto@vger.kernel.org, davem@davemloft.net, clabbe@baylibre.com, ardb@kernel.org, ebiggers@google.com, surenb@google.com, kristen.c.accardi@intel.com, wajdi.k.feghali@intel.com, vinodh.gopal@intel.com, kanchana.p.sridhar@intel.com Subject: Re: [PATCH v1] crypto: iaa - Fix IAA disabling that occurs when sync_mode is set to 'async'. Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241221220707.7050-1-kanchana.p.sridhar@intel.com> X-Newsgroups: apana.lists.os.linux.cryptoapi,apana.lists.os.linux.kernel X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: CE1994000B X-Stat-Signature: xrnmxpfnnxccrdd1e9n76af7yr1shz6t X-HE-Tag: 1735386729-912112 X-HE-Meta: U2FsdGVkX19cuIeZzUR6lVp/jlwBhBKHVq/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yHKZF+W9eTdEscfKzbMqF/FLjl+oiar+7kKdleONF0cpMiWr96Mo3FVuST2pfVuDcC9U4RudoOlZZR2uegViy5kb0l6Qs0PJ0RyKK2UilAOmO6Os3UmLFD4ccKBn58HE/t2PL0JPgnxRieYLCI2rhtuzwy1cb4SYi4q+lEwd+EiTEwFRF5yw28DqFnynF9mCCedF1klx5gjoTB8ypMf/KOk3dImjZrtZ6co= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Kanchana P Sridhar wrote: > With the latest mm-unstable, setting the iaa_crypto sync_mode to 'async' > causes crypto testmgr.c test_acomp() failure and dmesg call traces, and > zswap being unable to use 'deflate-iaa' as a compressor: > > echo async > /sys/bus/dsa/drivers/crypto/sync_mode > > [ 255.271030] zswap: compressor deflate-iaa not available > [ 369.960673] INFO: task cryptomgr_test:4889 blocked for more than 122 seconds. > [ 369.970127] Not tainted 6.13.0-rc1-mm-unstable-12-16-2024+ #324 > [ 369.977411] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. > [ 369.986246] task:cryptomgr_test state:D stack:0 pid:4889 tgid:4889 ppid:2 flags:0x00004000 > [ 369.986253] Call Trace: > [ 369.986256] > [ 369.986260] __schedule+0x45c/0xfa0 > [ 369.986273] schedule+0x2e/0xb0 > [ 369.986277] schedule_timeout+0xe7/0x100 > [ 369.986284] ? __prepare_to_swait+0x4e/0x70 > [ 369.986290] wait_for_completion+0x8d/0x120 > [ 369.986293] test_acomp+0x284/0x670 > [ 369.986305] ? __pfx_cryptomgr_test+0x10/0x10 > [ 369.986312] alg_test_comp+0x263/0x440 > [ 369.986315] ? sched_balance_newidle+0x259/0x430 > [ 369.986320] ? __pfx_cryptomgr_test+0x10/0x10 > [ 369.986323] alg_test.part.27+0x103/0x410 > [ 369.986326] ? __schedule+0x464/0xfa0 > [ 369.986330] ? __pfx_cryptomgr_test+0x10/0x10 > [ 369.986333] cryptomgr_test+0x20/0x40 > [ 369.986336] kthread+0xda/0x110 > [ 369.986344] ? __pfx_kthread+0x10/0x10 > [ 369.986346] ret_from_fork+0x2d/0x40 > [ 369.986355] ? __pfx_kthread+0x10/0x10 > [ 369.986358] ret_from_fork_asm+0x1a/0x30 > [ 369.986365] > > This happens because the only async polling without interrupts that > iaa_crypto currently implements is with the 'sync' mode. With 'async', > iaa_crypto calls to compress/decompress submit the descriptor and return > -EINPROGRESS, without any mechanism in the driver to poll for > completions. Hence callers such as test_acomp() in crypto/testmgr.c or > zswap, that wrap the calls to crypto_acomp_compress() and > crypto_acomp_decompress() in synchronous wrappers, will block > indefinitely. Even before zswap can notice this problem, the crypto > testmgr.c's test_acomp() will fail and prevent registration of > "deflate-iaa" as a valid crypto acomp algorithm, thereby disallowing the > use of "deflate-iaa" as a zswap compress (zswap will fall-back to the > default compressor in this case). > > To fix this issue, this patch modifies the iaa_crypto sync_mode set > function to treat 'async' equivalent to 'sync', so that the correct and > only supported driver async polling without interrupts implementation is > enabled, and zswap can use 'deflate-iaa' as the compressor. > > Hence, with this patch, this is what will happen: > > echo async > /sys/bus/dsa/drivers/crypto/sync_mode > cat /sys/bus/dsa/drivers/crypto/sync_mode > sync > > There are no crypto/testmgr.c test_acomp() errors, no call traces and zswap > can use 'deflate-iaa' without any errors. The iaa_crypto documentation has > also been updated to mention this caveat with 'async' and what to expect > with this fix. > > True iaa_crypto async polling without interrupts is enabled in patch > "crypto: iaa - Implement batch_compress(), batch_decompress() API in > iaa_crypto." [1] which is under review as part of the "zswap IAA compress > batching" patch-series [2]. Until this is merged, we would appreciate it if > this current patch can be considered for a hotfix. > > [1]: https://patchwork.kernel.org/project/linux-mm/patch/20241221063119.29140-5-kanchana.p.sridhar@intel.com/ > [2]: https://patchwork.kernel.org/project/linux-mm/list/?series=920084 > > Fixes: 09646c98d ("crypto: iaa - Add irq support for the crypto async interface") > Signed-off-by: Kanchana P Sridhar > --- > Documentation/driver-api/crypto/iaa/iaa-crypto.rst | 9 ++++++++- > drivers/crypto/intel/iaa/iaa_crypto_main.c | 2 +- > 2 files changed, 9 insertions(+), 2 deletions(-) Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt