mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Frank.Li@oss.nxp.com
Cc: Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>,
	 Benjamin Marzinski <bmarzins@redhat.com>,
	Song Liu <song@kernel.org>,  Yu Kuai <yukuai@fygo.io>,
	Li Nan <magiclinan@didiglobal.com>,  Xiao Ni <xiao@kernel.org>,
	Dan Williams <djbw@kernel.org>,
	 Herbert Xu <herbert@gondor.apana.org.au>,
	 "David S. Miller" <davem@davemloft.net>,
	Jonathan Corbet <corbet@lwn.net>,
	 Shuah Khan <skhan@linuxfoundation.org>,
	 Randy Dunlap <rdunlap@infradead.org>,
	dm-devel@lists.linux.dev,  linux-kernel@vger.kernel.org,
	linux-raid@vger.kernel.org,  linux-crypto@vger.kernel.org,
	linux-doc@vger.kernel.org,  Anatolij Gustschin <agust@denx.de>,
	Saeed Bishara <saeed@marvell.com>,
	 Rameshwar Prasad Sahu <rsahu@apm.com>,
	 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	 Anup Patel <anup.patel@broadcom.com>,
	Frank Li <Frank.Li@nxp.com>
Subject: Re: [PATCH RFC 1/4] md/dm-integrity: replace async_tx with synchronous xor for journal
Date: Thu, 22 Oct 2026 15:24:18 +0200 (CEST)	[thread overview]
Message-ID: <fb9c7c5c-e377-7926-c8f1-a7f9e93c2d46@redhat.com> (raw)
In-Reply-To: <20261015-asycn_tx_remove-v1-1-056a7085e0a1@nxp.com>



On Thu, 15 Oct 2026, Frank.Li@oss.nxp.com wrote:

> From: Frank Li <Frank.Li@nxp.com>
> 
> Remove the dependency on the async_tx framework from dm-integrity's
> xor_journal() function.  The async_xor() + async_tx_issue_pending_all()
> pattern is replaced with direct kmap_local_page() + memcpy() +
> crypto_xor() + kunmap_local() per page, which is simpler and removes
> the need for #include <linux/async_tx.h>.
> 
> async_tx adds significant complexity and maintenance overhead while
> providing little practical benefit on modern systems, where RAID parity
> computation is typically performed more efficiently by CPU-based XOR/PQ
> implementations than by DMA engine offload.
> 
> Signed-off-by: Frank Li <Frank.Li@nxp.com>

Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>

> ---
>  drivers/md/dm-integrity.c | 26 ++++++++++++++------------
>  1 file changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
> index 802b377613b06..6bd0623b6402a 100644
> --- a/drivers/md/dm-integrity.c
> +++ b/drivers/md/dm-integrity.c
> @@ -23,7 +23,6 @@
>  #include <crypto/hash.h>
>  #include <crypto/skcipher.h>
>  #include <crypto/utils.h>
> -#include <linux/async_tx.h>
>  #include <linux/dm-bufio.h>
>  
>  #include "dm-audit.h"
> @@ -896,7 +895,6 @@ static void complete_journal_op(void *context)
>  static void xor_journal(struct dm_integrity_c *ic, bool encrypt, unsigned int section,
>  			unsigned int n_sections, struct journal_completion *comp)
>  {
> -	struct async_submit_ctl submit;
>  	size_t n_bytes = (size_t)(n_sections * ic->journal_section_sectors) << SECTOR_SHIFT;
>  	unsigned int pl_index, pl_offset, section_index;
>  	struct page_list *source_pl, *target_pl;
> @@ -913,14 +911,11 @@ static void xor_journal(struct dm_integrity_c *ic, bool encrypt, unsigned int se
>  
>  	atomic_add(roundup(pl_offset + n_bytes, PAGE_SIZE) >> PAGE_SHIFT, &comp->in_flight);
>  
> -	init_async_submit(&submit, ASYNC_TX_XOR_ZERO_DST, NULL, complete_journal_op, comp, NULL);
> -
>  	section_index = pl_index;
>  
>  	do {
>  		size_t this_step;
> -		struct page *src_pages[2];
> -		struct page *dst_page;
> +		void *src0, *src1, *dst;
>  
>  		while (unlikely(pl_index == section_index)) {
>  			unsigned int dummy;
> @@ -935,11 +930,20 @@ static void xor_journal(struct dm_integrity_c *ic, bool encrypt, unsigned int se
>  		}
>  
>  		this_step = min(n_bytes, (size_t)PAGE_SIZE - pl_offset);
> -		dst_page = target_pl[pl_index].page;
> -		src_pages[0] = source_pl[pl_index].page;
> -		src_pages[1] = ic->journal_xor[pl_index].page;
>  
> -		async_xor(dst_page, src_pages, pl_offset, 2, this_step, &submit);
> +		src0 = kmap_local_page(source_pl[pl_index].page);
> +		src1 = kmap_local_page(ic->journal_xor[pl_index].page);
> +		dst  = kmap_local_page(target_pl[pl_index].page);
> +
> +		memcpy(dst + pl_offset, src0 + pl_offset, this_step);
> +		crypto_xor(dst + pl_offset, src1 + pl_offset, this_step);
> +
> +		kunmap_local(dst);
> +		kunmap_local(src1);
> +		kunmap_local(src0);
> +
> +		/* mirror async_tx per-page completion accounting */
> +		complete_journal_op(comp);
>  
>  		pl_index++;
>  		pl_offset = 0;
> @@ -947,8 +951,6 @@ static void xor_journal(struct dm_integrity_c *ic, bool encrypt, unsigned int se
>  	} while (n_bytes);
>  
>  	BUG_ON(n_sections);
> -
> -	async_tx_issue_pending_all();
>  }
>  
>  static void complete_journal_encrypt(void *data, int err)
> 
> -- 
> 2.43.0
> 


  reply	other threads:[~2026-10-22 13:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 19:22 [PATCH RFC 0/4] async_tx/md: Remove async_tx framework Frank.Li
2026-10-15 19:22 ` [PATCH RFC 1/4] md/dm-integrity: replace async_tx with synchronous xor for journal Frank.Li
2026-10-22 13:24   ` Mikulas Patocka [this message]
2026-10-15 19:22 ` [PATCH RFC 2/4] md/raid5-ppl: replace async_tx with synchronous xor Frank.Li
2026-10-15 19:22 ` [PATCH RFC 3/4] md/raid5: replace async_tx with synchronous xor/pq operations Frank.Li
2026-10-15 19:22 ` [PATCH RFC 4/4] crypto: remove async_tx framework Frank.Li
2026-10-15 19:51 ` [PATCH RFC 0/4] async_tx/md: Remove " Eric Biggers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fb9c7c5c-e377-7926-c8f1-a7f9e93c2d46@redhat.com \
    --to=mpatocka@redhat.com \
    --cc=Frank.Li@nxp.com \
    --cc=Frank.Li@oss.nxp.com \
    --cc=agk@redhat.com \
    --cc=agust@denx.de \
    --cc=anup.patel@broadcom.com \
    --cc=bmarzins@redhat.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=djbw@kernel.org \
    --cc=dm-devel@lists.linux.dev \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=magiclinan@didiglobal.com \
    --cc=rdunlap@infradead.org \
    --cc=rsahu@apm.com \
    --cc=saeed@marvell.com \
    --cc=skhan@linuxfoundation.org \
    --cc=snitzer@kernel.org \
    --cc=song@kernel.org \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=xiao@kernel.org \
    --cc=yukuai@fygo.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®