async_tx/md: Remove async_tx framework
Subsystems (5)
cover async_tx/md: Remove async_tx framework
This RFC is collecting more feedbacks to device when is good time to remove whole async_tx framework and how to remove it safely. And is overall direction correction.
Little to no real hardware acceleration usage:
Most systems run RAID5/6 parity calculations on the CPU using optimized XOR/PQ implementations, while DMAEngine-backed async_tx acceleration is rarely present or exercised.
Added abstraction and maintenance cost:
async_tx introduces an extra layer between MD RAID and parity operations, making the code harder to understand, debug, and maintain.
Modern CPUs outperform DMA offload:
SIMD implementations (SSE/AVX/NEON and architecture-specific RAID routines) often provide better performance than DMA descriptor setup and completion handling overhead.
Obsolete hardware dependencies:
Many async_tx acceleration backends were designed for older DMA/XOR engines that are no longer common in contemporary systems.
Complex asynchronous execution model:
Dependency chains, callback handling, and DMA transaction management increase code complexity without corresponding performance benefits on typical deployments.Simplifies RAID code paths: Removing async_tx allows direct use of synchronous XOR/PQ helpers, reducing indirection in raid5.c source code [linux/drivers/md/raid5.c].
Reduces testing burden:
Eliminates rarely used code paths that are difficult to validate and more likely to accumulate latent bugs.
Aligns implementation with actual usage:
The vast majority of MD RAID deployments already rely on software parity generation rather than DMA offload.
Current dmaengine support xor is
Driver File Driver Name First Added Date
==========================================================================mv_xor.c Marvell XOR Engine (mv_xor) 2008-07-08ppc4xx/adma.c ppc440spe ADMA (PPC4xx) 2009-12-11fsl_raid.c Freescale RAID Engine (fsl_re) 2015-03-03xgene-dma.c APM X-Gene DMA 2015-03-18ioat/init.c Intel IOAT DMA (ioatdma) 2015-08-11mv_xor_v2.c Marvell XOR Engine v2 2016-06-16bcm-sba-raid.c BCM SBA RAID (Broadcom) 2017-05-15
fsl_raid is for power pc SoC, which already EOF.
Patches is build test only now.
To: Alasdair Kergon <[email protected]>
To: Mike Snitzer <[email protected]>
To: Mikulas Patocka <[email protected]>
To: Benjamin Marzinski <[email protected]>
To: Song Liu <[email protected]>
To: Yu Kuai <[email protected]>
To: Li Nan <[email protected]>
To: Xiao Ni <[email protected]>
To: Dan Williams <[email protected]>
To: Herbert Xu <[email protected]>
To: "David S. Miller" <[email protected]>
To: Jonathan Corbet <[email protected]>
To: Shuah Khan <[email protected]>
To: Randy Dunlap <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Anatolij Gustschin <[email protected]>
Cc: Saeed Bishara <[email protected]>
Cc: Rameshwar Prasad Sahu <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Anup Patel <[email protected]>
---
Frank Li (4):
md/dm-integrity: replace async_tx with synchronous xor for journal md/raid5-ppl: replace async_tx with synchronous xor md/raid5: replace async_tx with synchronous xor/pq operations
crypto: remove async_tx framework
Documentation/crypto/async-tx-api.rst | 270 --------------- Documentation/crypto/index.rst | 1 - crypto/Kconfig | 5 - crypto/Makefile | 4 - crypto/async_tx/Kconfig | 28 -- crypto/async_tx/Makefile | 7 - crypto/async_tx/async_memcpy.c | 97 ------ crypto/async_tx/async_pq.c | 464 -------------------------- crypto/async_tx/async_raid6_recov.c | 595 ---------------------------------- crypto/async_tx/async_tx.c | 299 ----------------- crypto/async_tx/async_xor.c | 380 ---------------------- crypto/async_tx/raid6test.c | 250 -------------- drivers/md/dm-integrity.c | 26 +- drivers/md/raid5-log.h | 4 +- drivers/md/raid5-ppl.c | 40 +-- drivers/md/raid5.c | 467 +++++++++++++------------- include/linux/async_tx.h | 187 ----------- 17 files changed, 281 insertions(+), 2843 deletions(-)
---
base-commit: 98a4f6276df67a1bb37b1be56a3ab4285155e3df
change-id: 20261015-asycn_tx_remove-381cd003d9f7
Best regards,
Signature · 1 line
Frank Li <[email protected]>
RFC PATCH 1/4 md/dm-integrity: replace async_tx with synchronous xor for journal
From: Frank Li <[email protected]>
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.
--- drivers/md/dm-integrity.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
drivers/md/dm-integrity.c +14 -12
@@ -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 seatomic_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)
Signature · 1 line
2.43.0
Re: [PATCH RFC 1/4] md/dm-integrity: replace async_tx with synchronous xor for journal
Quoted 8 lines · On Thu, 15 Oct 2026, [email protected] wrote:
From: Frank Li <[email protected]>
Remove the dependency on the
async_txframework from dm-integrity'sxor_journal()function. Theasync_xor()+async_tx_issue_pending_all()pattern is replaced with directkmap_local_page()+memcpy()+crypto_xor()+kunmap_local()per page, which is simpler and removes the need for #include <linux/async_tx.h>.
Quoted 6 lines
async_txadds 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 <[email protected]>
Quoted 78 lines
--- drivers/md/dm-integrity.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)drivers/md/dm-integrity.c +14
-12@@ -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 seatomic_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)Signature · 2 lines
-- 2.43.0
Re: [PATCH RFC 1/4] md/dm-integrity: replace async_tx with synchronous xor for journal
Quoted 4 lines · Mikulas Patocka
Quoted 4 lines
async_txadds 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.
This patch is to dm-integrity, which is doing an XOR, but not for a RAID parity computation. The above paragraph should be adjusted.
Quoted 3 lines
Quoted 3 lines
--- drivers/md/dm-integrity.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
Should also drop the 'select ASYNC_XOR' from CONFIG_DM_INTEGRITY.
Quoted 6 lines
drivers/md/dm-integrity.c static void xor_journal(struct dm_integrity_c *ic, bool encrypt, unsigned int se · line 939
Quoted 6 lines
drivers/md/dm-integrity.c +6
-0+ 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);
crypto_xor_cpy(), instead of memcpy() + crypto_xor().
Also, these pages come from dm_integrity_alloc_page_list() which allocates them in lowmem, and elsewhere in the file they are accessed using lowmem_page_address(). So the kmap_local is not necessary.
Also note that crypto_xor() and crypto_xor_cpy() just use scalar instructions. Probably fine (it's just an XOR after all), but it might be worthwhile to mention why xor_gen() isn't used instead. Is it because the pointers and lengths aren't aligned well enough for that? Or just because not enough data is being processed here to bother?
- Eric
Re: [PATCH RFC 1/4] md/dm-integrity: replace async_tx with synchronous xor for journal
Quoted 28 lines · Eric Biggers
Quoted 4 lines · Mikulas Patocka
Quoted 4 lines
async_txadds 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.This patch is to dm-integrity, which is doing an XOR, but not for a RAID parity computation. The above paragraph should be adjusted.
Quoted 3 lines
Quoted 3 lines
--- drivers/md/dm-integrity.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)Should also drop the 'select
ASYNC_XOR' fromCONFIG_DM_INTEGRITY.Quoted 6 lines
drivers/md/dm-integrity.c static void xor_journal(struct dm_integrity_c *ic, bool encrypt, unsigned int se · line 939
Quoted 6 lines
drivers/md/dm-integrity.c +6
-0+ 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);
crypto_xor_cpy(), instead ofmemcpy()+crypto_xor().Also, these pages come from
dm_integrity_alloc_page_list()which allocates them in lowmem, and elsewhere in the file they are accessed usinglowmem_page_address(). So thekmap_localis not necessary.
Quoted 5 lines
Also note that
crypto_xor()andcrypto_xor_cpy()just use scalar instructions. Probably fine (it's just an XOR after all), but it might be worthwhile to mention whyxor_gen()isn't used instead. Is it because the pointers and lengths aren't aligned well enough for that? Or just because not enough data is being processed here to bother?
There's also a stale comment:
/* mirror async_tx per-page completion accounting */
complete_journal_op(comp);- Eric
RFC PATCH 2/4 md/raid5-ppl: replace async_tx with synchronous xor
In reply to [email protected]From: Frank Li <[email protected]>
Remove the async_tx dependency from ops_run_partial_parity() and ppl_xor(). The function now returns void and operates synchronously:
- count==1: copy_page() replaces async_memcpy
- count>1: memcpy + xor_blocks() replaces async_xor
- ppl_xor(): xor_blocks() replaces async_xor + async_tx_quiesce
Drop #include <linux/async_tx.h> and add #include <linux/xor.h>.
--- drivers/md/raid5-ppl.c | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-)
drivers/md/raid5-ppl.c +16 -24
@@ -8,7 +8,7 @@#include <linux/blkdev.h> #include <linux/slab.h> #include <linux/crc32c.h> -#include <linux/async_tx.h> +#include <linux/raid/xor.h> #include <linux/raid/md_p.h> #include "md.h" #include "raid5.h"
@@ -154,14 +154,11 @@ struct ppl_io_unit {struct bio_vec biovec[PPL_IO_INLINE_BVECS ]; }; -struct dma_async_tx_descriptor * -ops_run_partial_parity (struct stripe_head *sh,struct raid5_percpu *percpu, -struct dma_async_tx_descriptor *tx) +void ops_run_partial_parity (struct stripe_head *sh,struct raid5_percpu *percpu) {int disks = sh->disks;struct page **srcs = percpu->scribble;int count =0 , pd_idx = sh->pd_idx, i; -struct async_submit_ctl submit;pr_debug ("%s: stripe %llu\n" , __func__, (unsigned long long )sh->sector);
@@ -186,20 +183,20 @@ ops_run_partial_parity(struct stripe_head *sh, struct raid5_percpu *percpu, srcs[count++] = dev->page; } }else { -return tx; +return ; } -init_async_submit (&submit,ASYNC_TX_FENCE |ASYNC_TX_XOR_ZERO_DST , tx, -NULL , sh, (void *) (srcs + sh->disks +2 )); - -if (count ==1 ) - tx =async_memcpy (sh->ppl_page, srcs[0 ],0 ,0 ,PAGE_SIZE , - &submit); -else - tx =async_xor (sh->ppl_page, srcs,0 , count,PAGE_SIZE , - &submit); +if (count ==1 ) { +copy_page (page_address (sh->ppl_page),page_address (srcs[0 ])); + }else { +void *dest =page_address (sh->ppl_page); +void **ptrs = (void **)srcs; +int j; -return tx; +for (j =0 ; j < count; j++) + ptrs[j] =page_address (srcs[j]); +xor_gen (dest, ptrs, count,PAGE_SIZE ); + } }static void *ppl_io_pool_alloc (gfp_t gfp_mask,void *pool_data)
@@ -706,15 +703,10 @@ void ppl_stripe_write_finished(struct stripe_head *sh)static void ppl_xor (int size,struct page *page1,struct page *page2) { -struct async_submit_ctl submit; -struct dma_async_tx_descriptor *tx; -struct page *xor_srcs[] = { page1, page2 }; - -init_async_submit (&submit,ASYNC_TX_ACK |ASYNC_TX_XOR_DROP_DST , -NULL ,NULL ,NULL ,NULL ); - tx =async_xor (page1, xor_srcs,0 ,2 , size, &submit); +void *dest =page_address (page1); +void *ptrs[2 ] = { dest,page_address (page2) }; -async_tx_quiesce (&tx); +xor_gen (dest, ptrs,2 , size); }/*
Signature · 1 line
2.43.0
Re: [PATCH RFC 2/4] md/raid5-ppl: replace async_tx with synchronous xor
Hi Frank,
I encountered a PPL recovery failure that appears relevant to this proposal, on a QNAP TS-410 (Marvell Kirkwood, ARMv5).
The system runs a custom Linux 6.1-based kernel with CONFIG_MV_XOR=y and CONFIG_ASYNC_TX_DMA=y, plus a local PCIe startup-reset patch. Storage is a four-member RAID5 with metadata 1.2, 512 KiB chunks and PPL enabled.
After a power outage, array startup hit:
kernel BUG at crypto/async_tx/async_tx.c:269!
PC: async_tx_quiesce
LR: ppl_xor [raid456]
The call trace included:
async_tx_quiesceppl_xorppl_recover_entryppl_init_lograid5_runmd_rundo_md_run
All four members had matching event counts and valid superblock checksums, with no members marked failed.
The apparent issue is that ppl_xor() submits with ASYNC_TX_ACK, then passes the returned descriptor to async_tx_quiesce(), which asserts that it is not already acknowledged.
Disabling both Marvell XOR engines through their device-tree status properties, while retaining the same kernel binary and modules, allowed the existing array to assemble and the filesystem to recover. No forced assembly, array recreation or PPL-policy change was used. File transfers are working again.
I have not tested this RFC or reproduced the crash on a current kernel. Source inspection found the same ACK/quiesce sequence in v6.1.190 and current mainline.
I’m sharing this because the ppl_xor() change below removes the exact ACK/quiesce sequence implicated in my crash. I haven’t tested your patch, but disabling hardware XOR allowed recovery to complete on the same kernel.
Thanks,
Alex
Quoted 97 lines · On 2026-10-15 12:22, [email protected] wrote:
From: Frank Li <[email protected]>
Remove the
async_txdependency fromops_run_partial_parity()andppl_xor(). The function now returns void and operates synchronously:- count==1:
copy_page()replacesasync_memcpy
- count>1: memcpy +xor_blocks()replacesasync_xor
-ppl_xor():xor_blocks()replacesasync_xor+async_tx_quiesceDrop #include <
linux/async_tx.h> and add #include <linux/xor.h>.Signed-off-by Frank Li <[email protected]>--- drivers/md/raid5-ppl.c | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-)drivers/md/raid5-ppl.c +16
-24@@ -8,7 +8,7 @@#include <linux/blkdev.h> #include <linux/slab.h> #include <linux/crc32c.h> -#include <linux/async_tx.h> +#include <linux/raid/xor.h> #include <linux/raid/md_p.h> #include "md.h" #include "raid5.h" @@ -154,14 +154,11 @@ struct ppl_io_unit {struct bio_vec biovec[PPL_IO_INLINE_BVECS ]; }; -struct dma_async_tx_descriptor * -ops_run_partial_parity (struct stripe_head *sh,struct raid5_percpu *percpu, -struct dma_async_tx_descriptor *tx) +void ops_run_partial_parity (struct stripe_head *sh,struct raid5_percpu *percpu) {int disks = sh->disks;struct page **srcs = percpu->scribble;int count =0 , pd_idx = sh->pd_idx, i; -struct async_submit_ctl submit;pr_debug ("%s: stripe %llu\n" , __func__, (unsigned long long )sh->sector);@@ -186,20 +183,20 @@ ops_run_partial_parity(struct stripe_head *sh, struct raid5_percpu *percpu, srcs[count++] = dev->page; } }else { -return tx; +return ; } -init_async_submit (&submit,ASYNC_TX_FENCE |ASYNC_TX_XOR_ZERO_DST , tx, -NULL , sh, (void *) (srcs + sh->disks +2 )); - -if (count ==1 ) - tx =async_memcpy (sh->ppl_page, srcs[0 ],0 ,0 ,PAGE_SIZE , - &submit); -else - tx =async_xor (sh->ppl_page, srcs,0 , count,PAGE_SIZE , - &submit); +if (count ==1 ) { +copy_page (page_address (sh->ppl_page),page_address (srcs[0 ])); + }else { +void *dest =page_address (sh->ppl_page); +void **ptrs = (void **)srcs; +int j; -return tx; +for (j =0 ; j < count; j++) + ptrs[j] =page_address (srcs[j]); +xor_gen (dest, ptrs, count,PAGE_SIZE ); + } }static void *ppl_io_pool_alloc (gfp_t gfp_mask,void *pool_data)@@ -706,15 +703,10 @@ void ppl_stripe_write_finished(struct stripe_head *sh)static void ppl_xor (int size,struct page *page1,struct page *page2) { -struct async_submit_ctl submit; -struct dma_async_tx_descriptor *tx; -struct page *xor_srcs[] = { page1, page2 }; - -init_async_submit (&submit,ASYNC_TX_ACK |ASYNC_TX_XOR_DROP_DST , -NULL ,NULL ,NULL ,NULL ); - tx =async_xor (page1, xor_srcs,0 ,2 , size, &submit); +void *dest =page_address (page1); +void *ptrs[2 ] = { dest,page_address (page2) }; -async_tx_quiesce (&tx); +xor_gen (dest, ptrs,2 , size); }/*
Re: [PATCH RFC 2/4] md/raid5-ppl: replace async_tx with synchronous xor
Quoted 34 lines · Alex Naylor
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Hi Frank,
I encountered a PPL recovery failure that appears relevant to this proposal, on a QNAP TS-410 (Marvell Kirkwood, ARMv5).
The system runs a custom Linux 6.1-based kernel with
CONFIG_MV_XOR=yandCONFIG_ASYNC_TX_DMA=y, plus a local PCIe startup-reset patch. Storage is a four-member RAID5 with metadata 1.2, 512 KiB chunks and PPL enabled.After a power outage, array startup hit:
kernel BUG at
crypto/async_tx/async_tx.c:269!
PC:async_tx_quiesce
LR:ppl_xor[raid456]The call trace included:
async_tx_quiesceppl_xorppl_recover_entryppl_init_lograid5_runmd_rundo_md_runAll four members had matching event counts and valid superblock checksums, with no members marked failed.
The apparent issue is that
ppl_xor()submits withASYNC_TX_ACK, then passes the returned descriptor toasync_tx_quiesce(), which asserts that it is not already acknowledged.
Quoted 5 lines
Disabling both Marvell XOR engines through their device-tree status properties, while retaining the same kernel binary and modules, allowed the existing array to assemble and the filesystem to recover. No forced assembly, array recreation or PPL-policy change was used. File transfers are working again.
Do you means mv_xor actually broken at kernel 6.1?
Frank
RFC PATCH 3/4 md/raid5: replace async_tx with synchronous xor/pq operations
In reply to [email protected]From: Frank Li <[email protected]>
Remove all async_tx usage from drivers/md/raid5.c. Replace each async operation with its synchronous equivalent:
- async_copy_data() -> sync_copy_data() using kmap_local_page/memcpy
- async_memcpy() -> memcpy() directly on page_address()
- async_xor_offs() ZERO_DST -> memset(dst,0) + xor_gen()
- async_xor_offs() DROP_DST -> xor_gen() (dest included in src ptrs)
- async_gen_syndrome() -> raid6_gen_syndrome()
- async_gen_syndrome() PQ_XOR_DST -> raid6_xor_syndrome()
- async_raid6_datap_recov() -> raid6_datap_recov()
- async_raid6_2data_recov() -> raid6_2data_recov()
- async_xor_val_offs() -> xor_gen() + memchr_inv()
- async_syndrome_val() -> xor_gen() + raid6_gen_syndrome() + memcmp()
- async_trigger_callback() -> direct callback invocation
- async_tx_quiesce() -> removed (synchronous, no-op needed)
- async_tx_issue_pending_all() -> removed (no-op)
Also remove the addr_conv_t region from the scribble buffer and the to_addr_conv() helper since DMA address conversion is no longer needed.
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.
Replace #include <linux/async_tx.h> with #include <linux/raid/xor.h>.
--- drivers/md/raid5-log.h | 4 +- drivers/md/raid5.c | 467 ++++++++++++++++++++++++++----------------------- 2 files changed, 251 insertions(+), 220 deletions(-)
drivers/md/raid5-log.h +1 -3
@@ -31,9 +31,7 @@ void r5c_update_on_rdev_error(struct mddev *mddev, struct md_rdev *rdev);bool r5c_big_stripe_cached (struct r5conf *conf,sector_t sect);int r5l_start (struct r5l_log *log); -struct dma_async_tx_descriptor * -ops_run_partial_parity (struct stripe_head *sh,struct raid5_percpu *percpu, -struct dma_async_tx_descriptor *tx); +void ops_run_partial_parity (struct stripe_head *sh,struct raid5_percpu *percpu);int ppl_init_log (struct r5conf *conf);void ppl_exit_log (struct r5conf *conf);int ppl_write_stripe (struct r5conf *conf,struct stripe_head *sh);
drivers/md/raid5.c +250 -217
829 lines not on this page · raw message
Signature · 1 line
2.43.0
RFC PATCH 4/4 crypto: remove async_tx framework
In reply to [email protected]From: Frank Li <[email protected]>
Remove the async_tx API and all associated files now that the last consumer (md/raid5) has been converted to synchronous operations:
--- Documentation/crypto/async-tx-api.rst | 270 --------------- Documentation/crypto/index.rst | 1 - crypto/Kconfig | 5 - crypto/Makefile | 4 - crypto/async_tx/Kconfig | 28 -- crypto/async_tx/Makefile | 7 - crypto/async_tx/async_memcpy.c | 97 ------ crypto/async_tx/async_pq.c | 464 -------------------------- crypto/async_tx/async_raid6_recov.c | 595 ---------------------------------- crypto/async_tx/async_tx.c | 299 ----------------- crypto/async_tx/async_xor.c | 380 ---------------------- crypto/async_tx/raid6test.c | 250 -------------- include/linux/async_tx.h | 187 ----------- 13 files changed, 2587 deletions(-)
Documentation/crypto/async-tx-api.rst deleted +0 -270
@@ -1,270 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0 - -===================================== -Asynchronous Transfers/Transforms API -===================================== - -.. Contents - - 1. INTRODUCTION - - 2 GENEALOGY - - 3 USAGE - 3.1 General format of the API - 3.2 Supported operations - 3.3 Descriptor management - 3.4 When does the operation execute? - 3.5 When does the operation complete? - 3.6 Constraints - 3.7 Example - - 4 DMAENGINE DRIVER DEVELOPER NOTES - 4.1 Conformance points - 4.2 "My application needs exclusive control of hardware channels" - - 5 SOURCE - -1. Introduction -=============== - -The async_tx API provides methods for describing a chain of asynchronous -bulk memory transfers/transforms with support for inter-transactional -dependencies. It is implemented as a dmaengine client that smooths over -the details of different hardware offload engine implementations. Code -that is written to the API can optimize for asynchronous operation and -the API will fit the chain of operations to the available offload -resources. - -2.Genealogy -=========== - -The API was initially designed to offload the memory copy and -xor-parity-calculations of the md-raid5 driver using the offload engines -present in the Intel(R) Xscale series of I/O processors. It also built -on the 'dmaengine' layer developed for offloading memory copies in the -network stack using Intel(R) I/OAT engines. The following design -features surfaced as a result: - -1. implicit synchronous path: users of the API do not need to know if - the platform they are running on has offload capabilities. The - operation will be offloaded when an engine is available and carried out - in software otherwise. -2. cross channel dependency chains: the API allows a chain of dependent - operations to be submitted, like xor->copy->xor in the raid5 case. The - API automatically handles cases where the transition from one operation - to another implies a hardware channel switch. -3. dmaengine extensions to support multiple clients and operation types - beyond 'memcpy' - -3. Usage -======== - -3.1 General format of the API ------------------------------ - -:: - - struct dma_async_tx_descriptor * - async_<operation>(<op specific parameters>, struct async_submit_ctl *submit) - -3.2 Supported operations ------------------------- - -======== ==================================================================== -memcpy memory copy between a source and a destination buffer -memset fill a destination buffer with a byte value -xor xor a series of source buffers and write the result to a - destination buffer -xor_val xor a series of source buffers and set a flag if the - result is zero. The implementation attempts to prevent - writes to memory -pq generate the p+q (raid6 syndrome) from a series of source buffers -pq_val validate that a p and or q buffer are in sync with a given series of - sources -datap (raid6_recov_datap) recover a raid6 data block and the p block - from the given sources -2data (raid6_recov_2data) recover 2 raid6 data blocks from the given - sources -======== ==================================================================== - -3.3 Descriptor management -------------------------- - -The return value is non-NULL and points to a 'descriptor' when the operation -has been queued to execute asynchronously. Descriptors are recycled -resources, under control of the offload engine driver, to be reused as -operations complete. When an application needs to submit a chain of -operations it must guarantee that the descriptor is not automatically recycled -before the dependency is submitted. This requires that all descriptors be -acknowledged by the application before the offload engine driver is allowed to -recycle (or free) the descriptor. A descriptor can be acked by one of the -following methods: - -1. setting the ASYNC_TX_ACK flag if no child operations are to be submitted -2. submitting an unacknowledged descriptor as a dependency to another - async_tx call will implicitly set the acknowledged state. -3. calling async_tx_ack() on the descriptor. - -3.4 When does the operation execute? ------------------------------------- - -Operations do not immediately issue after return from the -async_<operation> call. Offload engine drivers batch operations to -improve performance by reducing the number of mmio cycles needed to -manage the channel. Once a driver-specific threshold is met the driver -automatically issues pending operations. An application can force this -event by calling async_tx_issue_pending_all(). This operates on all -channels since the application has no knowledge of channel to operation -mapping. - -3.5 When does the operation complete? -------------------------------------- - -There are two methods for an application to learn about the completion -of an operation. - -1. Call dma_wait_for_async_tx(). This call causes the CPU to spin while - it polls for the completion of the operation. It handles dependency - chains and issuing pending operations. -2. Specify a completion callback. The callback routine runs in tasklet - context if the offload engine driver supports interrupts, or it is - called in application context if the operation is carried out - synchronously in software. The callback can be set in the call to - async_<operation>, or when the application needs to submit a chain of - unknown length it can use the async_trigger_callback() routine to set a - completion interrupt/callback at the end of the chain. - -3.6 Constraints ---------------- - -1. Calls to async_<operation> are not permitted in IRQ context. Other - contexts are permitted provided constraint #2 is not violated. -2. Completion callback routines cannot submit new operations. This - results in recursion in the synchronous case and spin_locks being - acquired twice in the asynchronous case. - -3.7 Example ------------ - -Perform a xor->copy->xor operation where each operation depends on the -result from the previous operation:: - - #include <linux/async_tx.h> - - static void callback(void *param) - { - complete(param); - } - - #define NDISKS 2 - - static void run_xor_copy_xor(struct page **xor_srcs, - struct page *xor_dest, - size_t xor_len, - struct page *copy_src, - struct page *copy_dest, - size_t copy_len) - { - struct dma_async_tx_descriptor *tx; - struct async_submit_ctl submit; - addr_conv_t addr_conv[NDISKS]; - struct completion cmp; - - init_async_submit(&submit, ASYNC_TX_XOR_DROP_DST, NULL, NULL, NULL, - addr_conv); - tx = async_xor(xor_dest, xor_srcs, 0, NDISKS, xor_len, &submit); - - submit.depend_tx = tx; - tx = async_memcpy(copy_dest, copy_src, 0, 0, copy_len, &submit); - - init_completion(&cmp); - init_async_submit(&submit, ASYNC_TX_XOR_DROP_DST | ASYNC_TX_ACK, tx, - callback, &cmp, addr_conv); - tx = async_xor(xor_dest, xor_srcs, 0, NDISKS, xor_len, &submit); - - async_tx_issue_pending_all(); - - wait_for_completion(&cmp); - } - -See include/linux/async_tx.h for more information on the flags. See the -ops_run_* and ops_complete_* routines in drivers/md/raid5.c for more -implementation examples. - -4. Driver Development Notes -=========================== - -4.1 Conformance points ----------------------- - -There are a few conformance points required in dmaengine drivers to -accommodate assumptions made by applications using the async_tx API: - -1. Completion callbacks are expected to happen in tasklet context -2. dma_async_tx_descriptor fields are never manipulated in IRQ context -3. Use async_tx_run_dependencies() in the descriptor clean up path to - handle submission of dependent operations - -4.2 "My application needs exclusive control of hardware channels" ------------------------------------------------------------------ - -Primarily this requirement arises from cases where a DMA engine driver -is being used to support device-to-memory operations. A channel that is -performing these operations cannot, for many platform specific reasons, -be shared. For these cases the dma_request_channel() interface is -provided. - -The interface is:: - - struct dma_chan *dma_request_channel(dma_cap_mask_t mask, - dma_filter_fn filter_fn, - void *filter_param); - -Where dma_filter_fn is defined as:: - - typedef bool (*dma_filter_fn)(struct dma_chan *chan, void *filter_param); - -When the optional 'filter_fn' parameter is set to NULL -dma_request_channel simply returns the first channel that satisfies the -capability mask. Otherwise, when the mask parameter is insufficient for -specifying the necessary channel, the filter_fn routine can be used to -disposition the available channels in the system. The filter_fn routine -is called once for each free channel in the system. Upon seeing a -suitable channel filter_fn returns DMA_ACK which flags that channel to -be the return value from dma_request_channel. A channel allocated via -this interface is exclusive to the caller, until dma_release_channel() -is called. - -The DMA_PRIVATE capability flag is used to tag dma devices that should -not be used by the general-purpose allocator. It can be set at -initialization time if it is known that a channel will always be -private. Alternatively, it is set when dma_request_channel() finds an -unused "public" channel. - -A couple caveats to note when implementing a driver and consumer: - -1. Once a channel has been privately allocated it will no longer be - considered by the general-purpose allocator even after a call to - dma_release_channel(). -2. Since capabilities are specified at the device level a dma_device - with multiple channels will either have all channels public, or all - channels private. - -5. Source ---------- - -include/linux/dmaengine.h: - core header file for DMA drivers and api users -drivers/dma/dmaengine.c: - offload engine channel management routines -drivers/dma/: - location for offload engine drivers -include/linux/async_tx.h: - core header file for the async_tx api -crypto/async_tx/async_tx.c: - async_tx interface to dmaengine and common code -crypto/async_tx/async_memcpy.c: - copy offload -crypto/async_tx/async_xor.c: - xor and xor zero sum offload
Documentation/crypto/index.rst +0 -1
@@ -18,7 +18,6 @@ for cryptographic use cases, as well as programming examples. api-intro architecture - async-tx-api asymmetric-keys devel-algos userspace-if
crypto/Kconfig +0 -5
@@ -3,11 +3,6 @@ # Generic algorithms support # -# -# async_tx api: hardware offloaded memory transfer/transform support -# -source "crypto/async_tx/Kconfig" - # # Cryptographic API Configuration #
crypto/Makefile +0 -4
@@ -188,10 +188,6 @@ ecrdsa_generic-y += ecrdsa_params.asn1.o ecrdsa_generic-y += ecrdsa_pub_key.asn1.o obj-$(CONFIG_CRYPTO_ECRDSA) += ecrdsa_generic.o -# -# generic algorithms and the async_tx api -# -obj-$(CONFIG_ASYNC_CORE) += async_tx/ obj-$(CONFIG_ASYMMETRIC_KEY_TYPE) += asymmetric_keys/ crypto_simd-y := simd.o obj-$(CONFIG_CRYPTO_SIMD) += crypto_simd.o
crypto/async_tx/Kconfig deleted +0 -28
@@ -1,28 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -config ASYNC_CORE - tristate - -config ASYNC_MEMCPY - tristate - select ASYNC_CORE - -config ASYNC_XOR - tristate - select ASYNC_CORE - select XOR_BLOCKS - -config ASYNC_PQ - tristate - select ASYNC_CORE - -config ASYNC_RAID6_RECOV - tristate - select ASYNC_CORE - select ASYNC_PQ - select ASYNC_XOR - -config ASYNC_TX_DISABLE_PQ_VAL_DMA - bool - -config ASYNC_TX_DISABLE_XOR_VAL_DMA - bool
crypto/async_tx/Makefile deleted +0 -7
@@ -1,7 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_ASYNC_CORE) += async_tx.o -obj-$(CONFIG_ASYNC_MEMCPY) += async_memcpy.o -obj-$(CONFIG_ASYNC_XOR) += async_xor.o -obj-$(CONFIG_ASYNC_PQ) += async_pq.o -obj-$(CONFIG_ASYNC_RAID6_RECOV) += async_raid6_recov.o -obj-$(CONFIG_ASYNC_RAID6_TEST) += raid6test.o
crypto/async_tx/async_memcpy.c deleted +0 -97
97 lines not on this page · raw message
crypto/async_tx/async_pq.c deleted +0 -464
464 lines not on this page · raw message
crypto/async_tx/async_raid6_recov.c deleted +0 -595
595 lines not on this page · raw message
crypto/async_tx/async_tx.c deleted +0 -299
299 lines not on this page · raw message
crypto/async_tx/async_xor.c deleted +0 -380
380 lines not on this page · raw message
crypto/async_tx/raid6test.c deleted +0 -250
250 lines not on this page · raw message
include/linux/async_tx.h deleted +0 -187
187 lines not on this page · raw message
Signature · 1 line
2.43.0
Quoted 36 lines · On Thu, Oct 15, 2026 at 03:22:24PM -0400, [email protected] wrote:
This RFC is collecting more feedbacks to device when is good time to remove whole
async_txframework and how to remove it safely. And is overall direction correction.Little to no real hardware acceleration usage:
Most systems run RAID5/6 parity calculations on the CPU using optimized XOR/PQ implementations, while DMAEngine-backedasync_txacceleration is rarely present or exercised.Added abstraction and maintenance cost:
async_txintroduces an extra layer between MD RAID and parity operations, making the code harder to understand, debug, and maintain.Modern CPUs outperform DMA offload:
SIMD implementations (SSE/AVX/NEON and architecture-specific RAID routines) often provide better performance than DMA descriptor setup and completion handling overhead.Obsolete hardware dependencies:
Manyasync_txacceleration backends were designed for older DMA/XOR engines that are no longer common in contemporary systems.Complex asynchronous execution model:
Dependency chains, callback handling, and DMA transaction management increase code complexity without corresponding performance benefits on typical deployments.Simplifies RAID code paths: Removingasync_txallows direct use of synchronous XOR/PQ helpers, reducing indirection inraid5.csource code [linux/drivers/md/raid5.c].Reduces testing burden:
Eliminates rarely used code paths that are difficult to validate and more likely to accumulate latent bugs.Aligns implementation with actual usage:
The vast majority of MD RAID deployments already rely on software parity generation rather than DMA offload.
[..]
Quoted 1 line
17 files changed, 281 insertions(+), 2843 deletions(-)
I haven't been paying much attention to the crypto/async_tx/ directory, but this makes sense to me. This mirrors similar trends that we've seen with the crypto and CRC algorithms. For these types of algorithms, just using the CPU is faster and much simpler than trying to offload the operation to some external hardware engine (which rarely even exist).
- Eric