From nobody Fri Oct 23 03:31:41 2026 Received: from DU2PR03CU002.outbound.protection.outlook.com (mail-northeuropeazon11011031.outbound.protection.outlook.com [52.101.65.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A05CD54EEA7; Thu, 15 Oct 2026 19:23:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.31 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792092182; cv=fail; b=l0V1IeY1fdYUVL9h9stUJS4qQrk3OICUma5f9o+PwG1znVNCs/r2od1g0kvIMYDg28yV3gJ+YXKxbntRbtDcxaXRi9IAdj8XJ7J4sNAU1XsSjw/9MqYmdm6XvCklGmYL7KKCQ6TLMCHoC6LSEh/oE811d67fMv0xJtDxZrb+XPo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792092182; c=relaxed/simple; bh=xo+yXU/MZ4gVguJrUjSOsJktVYSUgnYdbhlXfw7Zg3I=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=u09uOGz7WHzWSZrSVfDmi3eGNaQzh4cNd3vJMK8Ah5AcP/73bz5gYtzWAqcSfpmRJJfQi2JyIQOG6jSJZInvkQ42vlF/gH/CF9VOCKgPy3m6yM1Dy0MY6Nh1avCbgkQ9nu+kgEytfHJrE7ymQTmmXfn9fQXdMkh19iUY+cDQ1u8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=JcOesouw; arc=fail smtp.client-ip=52.101.65.31 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="JcOesouw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XQjzPereJPo1M7rahUK/ljEIbaLukdQBNasWYlc6CgSmjNws7hbs/aRGoR3J2nO73XWV1uf5vNdF53zkoipCUcCvsX597aDtPzayse3DMXsDzuz4pmLjCT/+7PpsdJ7h6a7jjRue9D74dhkXmzcQnNZodflblQSIyaaLJVIu5uu08unyQC6dai/ECDTrFPIHEXB+BtyHkeXlDE8am9NljBjkD4chPLaHpqByuGvAUye5ZpTgNZ/vgB7o2mfQ1RtmTcwnrPvq+rHl7NRzRmIn14C2W8PHyju+wYIqVB0OIOGqTE2Aq0OPbEGWdKohY1NoYQk+fdmW2ugpKiHTyuMGYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wBuCEGDrADUZj+PTA6oRH2iLGuSXTpAGZSnySlCXPDA=; b=utXUJw7F3jZJRez9ZgPTTrKIT45QSUu5cXgdjiLvkEkTEo7edgz8OVx5aPryIefh5hQEHt56Zt9Z/CowjqXuVQG+pHNAbdYkS+9GnoZo6LD98ClYGYGP+kbzEZKWR9Ps6R1n+Tjroz8btybUeA3n9iFLodLCQ0CsosILBerb2pIOULIzs8skcO0F/hURXbHsJ3m0fbE96w8fBoVHyXRHxdQmTodx0ox4WN+D7fiFP9whq99cuhOZY+NU0bezL2N5CvlFtNru5wvbpfNvmDDMSjwvs0WJNT1i3eWLaqOjEySuhHyJf2LmMRkXk9QB8Js0HGrBpSXBM1XRC9pOteIzPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wBuCEGDrADUZj+PTA6oRH2iLGuSXTpAGZSnySlCXPDA=; b=JcOesouwH15Z6C7sPTuQRKkvje6PplZwLwZZdNY5aUn/WwDbCqsj+Xy9Bgm7Ao/i7tR7AfboSsZb/xIrCUsTPXqGK/WPx5YIhGH3bAHZOaA4dI/T9+6FHotXAIDDEuz4UXA0xKQaGpxebqwxnJdWtq37zAfRLQpCpN4Xsahr5kzQLNOyMsG0ZVo//WQrm6e0Xlefse5R8czeOZnH2ggdKbBVfj9dxKbDg6hYQLjL41wasR2dUiEu54mNeoxHvB/xLszshyhaqbRj1UPZcA0g1lEaSlrh/yo1dg0UGMkwuAe/cGhzjo5bq+oCqlP1+47mJWU3ikElDyEqJd+EZQyYog== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from GV2PR04MB11799.eurprd04.prod.outlook.com (2603:10a6:150:2cf::9) by MIWPR04MB358405.eurprd04.prod.outlook.com (2603:10a6:290:ab::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.522.14; Thu, 15 Oct 2026 19:22:58 +0000 Received: from GV2PR04MB11799.eurprd04.prod.outlook.com ([fe80::2146:83a2:5329:b7c]) by GV2PR04MB11799.eurprd04.prod.outlook.com ([fe80::2146:83a2:5329:b7c%7]) with mapi id 15.21.0522.012; Thu, 15 Oct 2026 19:22:58 +0000 From: Frank.Li@oss.nxp.com Date: Thu, 15 Oct 2026 15:22:25 -0400 Subject: [PATCH RFC 1/4] md/dm-integrity: replace async_tx with synchronous xor for journal Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-asycn_tx_remove-v1-1-056a7085e0a1@nxp.com> References: <20261015-asycn_tx_remove-v1-0-056a7085e0a1@nxp.com> In-Reply-To: <20261015-asycn_tx_remove-v1-0-056a7085e0a1@nxp.com> To: Alasdair Kergon , Mike Snitzer , Mikulas Patocka , Benjamin Marzinski , Song Liu , Yu Kuai , Li Nan , Xiao Ni , Dan Williams , Herbert Xu , "David S. Miller" , Jonathan Corbet , Shuah Khan , Randy Dunlap Cc: 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 , Saeed Bishara , Rameshwar Prasad Sahu , Thomas Petazzoni , Anup Patel , Frank Li X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792092167; l=3225; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=NY3esA7XZDEYOgEWni8OOg5IrMcJg8vFNPTSvJltSBQ=; b=RXSmVSSuRfqxSqfmxpF123Z6vWkNtOjwWTQqge7bD0urOM5Ydl9U8F4M6Cnkoig4feIfkADhe RNy81kOv2/iDn1t4aZOepSJEtlBJONQTOP1bEk/Upp4HisJ3bAKdjk0 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: PH8PR02CA0013.namprd02.prod.outlook.com (2603:10b6:510:2d0::14) To GV2PR04MB11799.eurprd04.prod.outlook.com (2603:10a6:150:2cf::9) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV2PR04MB11799:EE_|MIWPR04MB358405:EE_ X-MS-Office365-Filtering-Correlation-Id: a06fd20a-8340-4cba-41da-08df2af1b84e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|19092799006|1800799024|23010399003|366016|18002099003|22082099003|10067099003|921020|11063799006|261009223027099003|56012099006; X-Microsoft-Antispam-Message-Info: odtEsB9i/d/DjyMd9lZjmjnjfHW2h8yRj/vXe5aif5k/JVtebQDXRFwYwVT0mJ5ddEm2596zZC3IE1NiuNiyiOjLlmsID3jVhgzcNNDGYQNjc6A1rsW/QLqPGOgMX2PjCA/UYHv19NrDlfsczC2SfSMpGrD3lUeLXiAj3mon40MAkIkq9OcC6wVAOjevfuPZtLooQ/M+p/3/rkMD9RFZAewWKxhNJN0Ijd/ZZI2vbCnBB0k6wVOz57XEYaAFbqWEu6WLRGfc5I/GALTQLA10zYe8rJULxK44Dxg4NLVgYxwrJMZF6rOJblZgnqAY+xUf6B6MZgt3u4YhMHy9YwAcBlvF5+iMTsnu8pVQVlIzHTRGftvaVdTNr8dkDtci61xxmQZMQ6MpxWp20cbJqSLrsWSt1feOnxfuN3ZamEcZKyAVK8kBFWmFaqaQXBq6L4KDEM/KDLlD/F8caQ7gjVeXNzf8dRX7O9WcmIVRw5IelBTO2Rkzuhe70Jp18xyUAiQW1TY1KC0sJX3Ha4Zxg6G4JC1YRuX3cOAN5le5efXzTu8YKKKaysjVJPkCU0nvkICwVnSJiGcz8A/XZMbEbJg23Kvnlb92DgC995thKtbmkbzHMG5UzPWkTTcCbXKX3NG14Gk69QtKaq9luvfoTxX+WnHhSKaxzC7daJ0Oo4wQhMXk05jdmIRtFIa1qUK0iYOIrZfuLfwX9JitYSaY7VnQJA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV2PR04MB11799.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(19092799006)(1800799024)(23010399003)(366016)(18002099003)(22082099003)(10067099003)(921020)(11063799006)(261009223027099003)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WTJsald3RGd0U2VnMXhVWW43eEEwc21IL0tDeWs2V2JtOVU4WDh0b0Exdmkz?= =?utf-8?B?YkNyelhPMllPK1Nwd2YyTytUNWo4aW1aS1gxSmdEYkViUW1SaWo1S3JkT2NN?= =?utf-8?B?ejlVUWkrNTBLdHNvdGpPQWd0M0FPM3Y0NHVQNU5PdCtUam1aWU4vaE1yT0VK?= =?utf-8?B?UXhEeHE4S24rcEYwTVp1blMzeHZHb3VpZFp6aDJKT1NqSGRFS0V4MFNoeS9w?= =?utf-8?B?TlhJQjdWekpET3h0d0VabFc0SjEvNWpGRGY4dXlLTXg0aTRCeHJFWWRwckhz?= =?utf-8?B?ZnYxWXB3bDVaaElCcUREZllsOWZNU3FESlJvVFpXRWliMkFqRXZMWU1FeDVu?= =?utf-8?B?UXJ4RGNlQlNDQ2hMaXM0Tkx1N0JWSEEybGF4MU1KMW82S29TenYvR2hjR3ZV?= =?utf-8?B?cjlUS0owRjlyRmRCVldmdUZMOGpHeHE2aDBTRkt3MHJybTRzR1IwdDNZRnd0?= =?utf-8?B?U1dTa0o4Z3JjMmYzNmpFWW10T3BkSHlNL005c01mS3VmeHBjdmFKTS8wcHVv?= =?utf-8?B?UDZjdGdqZDl1Z2V5bEVHR050UGRIQTAraUFLWFg5cjVtT0dYaDRlYWtFSGYv?= =?utf-8?B?OWRONUJWbGRxWnVHMng3am96ZWgrKzRZZ00wNXVjZHd4dktNNGF3SmRQS2JD?= =?utf-8?B?cWNCZG9PSmplOHF3bER4Y2RLdmlrZndWemkxQmxQRU9yZHVhVm5VY0dQWnQw?= =?utf-8?B?VW0vbzBqb0szQjFHVzR4OXhpc0JkN1VqNHlEWFNLYTEzUTg1MFY4UGY4ODdh?= =?utf-8?B?YWtmSXZvQmRkSTdQdzc0bnJpWlF2OHczNWR5aVBSWUdoYmFoZkwyeFdwdzRQ?= =?utf-8?B?aDJaRG0vQm14dXVRUllhY1BPSkNWeUtGOW03OUFGdmVuS0ZNMlF0SUd4d3VJ?= =?utf-8?B?aWFlUW1sZlJ0V2plc1E3aUtPRkU5M1B3K0lqNWNSaHREVnZyTEYrME42QVNs?= =?utf-8?B?YUFuYTM3eWowWDcrblFqaHRBS0MzNHNxa1Q5emg2Mk00cmZkRjAwblAzWFpm?= =?utf-8?B?ZlM0bmRST2VGQnQ1cU1HSHVTZlBwdUk1VWNOaCtHc2FoTE1EYTJGZS9BQ1Rm?= =?utf-8?B?MThwdGJzRG1YZC9QdDBWRnRTL2dnUjFWUTBJYjBNbjFHVkhCYWNTRFZQZ1Av?= =?utf-8?B?bXVtQmNFVXh3Rm82RmZHKzV3blo0R2ZDWXg3N0QyVEpNbmxwa0hLdmxrS2RY?= =?utf-8?B?Tnh1Q1BWMGV3ZmFVZUQ4SnVZRTRoWXRFckNmRGJZOFo0aktsN3ZsWnAwL1p4?= =?utf-8?B?T1AxZTA4L2l0aXE2dXBCNjk4c0FhS1haU0pxUWIxa0JRUE1uNEVheFhZNkwr?= =?utf-8?B?enV2eWxGOFpNa20vSk5VMDJDY2twbU5icnlZcmRQRzR5RlJCNFJxa0NBSktu?= =?utf-8?B?N3N3SFNwWGF6NWZvQnR5cUVIQS8wRm4rTW9hYW04czltZE5wM29rVXhKSnNF?= =?utf-8?B?bmNnOHhYUkhRRkdXQlc3VTNhK05DWi9nejZFZnZOZmJFaUZNOFo4ZlZWdTJ0?= =?utf-8?B?NC9qSkpvbTh0U0txN3dIL3hPbEN5dmZnK3A4MFZvcWpFNjE3VFNRTU1jeXlE?= =?utf-8?B?NjQ1U3B1SCtYb0lXRXQ1dWIzSmFjcFo1eDg3OENGREVKSEZpb1IrWHF4MkhB?= =?utf-8?B?NXkxSmlXa2x4b1lQdno5dWN5OXZmRVJtbVI3S2ZidzBTZHJ4N0V3WEZLUHZT?= =?utf-8?B?bk1JUGlkdUFlYTBQUEZCbFNIM0IwWXNJMjNubms1NmZTL3M1cDdSNlNiYzU1?= =?utf-8?B?Yk9nQWI0RTlVTVp0Ry9zZit3WkIwR1RVRWs0YnRMMGZneUhRaUh3NmRLSkQ0?= =?utf-8?B?eTByR0l0em90YkhHRFJndG5Md2FJWHdLODRGaUMveVhqZVJrL0VFYTArcW54?= =?utf-8?B?WVdONUdNMW1aeUZoNDlQQTJPbjl4eEh1c29kN04zTkk5c3RZcmhvdytkTGRC?= =?utf-8?B?VWlreUFpZkIzaTQvZHNuOFpUa29NRVRPaS94eVpTRzc5UFdTUXdEWVNTV2Iz?= =?utf-8?B?ZFRTNCs4SXFzZVZIS3U4clNhZFV6UmxGNkFDNzkwVVdqalV0VFp0allyclVO?= =?utf-8?B?NzMzRnJWcS96VDFTKzlZTGt2UzZUTVhJUTBVWWd2WEtKajJMTnAxYm4rMm9H?= =?utf-8?B?bWFJTGVZWTZxZmt0THJtT3I1ZFdTVjhJRkJMVWNBenE1UEhzOUNVTmRwZzcy?= =?utf-8?B?RzkwU2dPNDFVcEtsanlXQ00rY2YxR1FweWhCWHJDUWpUTHA5MkNKeGxsMGFJ?= =?utf-8?B?TGhkbG1KTE5KSWRDQWxoRFpQRzQwS3pWQXQ3WWNtQ3pzbVp2d2ZkUThlemtV?= =?utf-8?B?MDdibHpNRGI3RXR0a1NFZ0JrY0FLQVdYSU5IZjZaZkMzeTExWkxBYWFvYnJU?= =?utf-8?Q?RD8RpzoBb0sItsy03/uJsw1BF2Xyz6aOjJaWo?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a06fd20a-8340-4cba-41da-08df2af1b84e X-MS-Exchange-CrossTenant-AuthSource: GV2PR04MB11799.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2026 19:22:58.0606 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: x7CmmH8UJsaJ0JmM2j6fwp+8smtF3RKUr+OcPR0KMn+SPdJQmRa1tshwV7e4CtoNACDbrh5b3YApExfm+wxQrT4O6fpN169Ctm2G9Wzg3rQB90StYEvnEX7xCdhO69dr X-MS-Exchange-Transport-CrossTenantHeadersStamped: MIWPR04MB358405 From: Frank Li 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 . 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 Reviewed-by: Mikulas Patocka --- 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 #include #include -#include #include =20 #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 =3D (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, bo= ol encrypt, unsigned int se =20 atomic_add(roundup(pl_offset + n_bytes, PAGE_SIZE) >> PAGE_SHIFT, &comp->= in_flight); =20 - init_async_submit(&submit, ASYNC_TX_XOR_ZERO_DST, NULL, complete_journal_= op, comp, NULL); - section_index =3D pl_index; =20 do { size_t this_step; - struct page *src_pages[2]; - struct page *dst_page; + void *src0, *src1, *dst; =20 while (unlikely(pl_index =3D=3D section_index)) { unsigned int dummy; @@ -935,11 +930,20 @@ static void xor_journal(struct dm_integrity_c *ic, bo= ol encrypt, unsigned int se } =20 this_step =3D min(n_bytes, (size_t)PAGE_SIZE - pl_offset); - dst_page =3D target_pl[pl_index].page; - src_pages[0] =3D source_pl[pl_index].page; - src_pages[1] =3D ic->journal_xor[pl_index].page; =20 - async_xor(dst_page, src_pages, pl_offset, 2, this_step, &submit); + src0 =3D kmap_local_page(source_pl[pl_index].page); + src1 =3D kmap_local_page(ic->journal_xor[pl_index].page); + dst =3D 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); =20 pl_index++; pl_offset =3D 0; @@ -947,8 +951,6 @@ static void xor_journal(struct dm_integrity_c *ic, bool= encrypt, unsigned int se } while (n_bytes); =20 BUG_ON(n_sections); - - async_tx_issue_pending_all(); } =20 static void complete_journal_encrypt(void *data, int err) --=20 2.43.0 From nobody Fri Oct 23 03:31:41 2026 Received: from GVXPR05CU001.outbound.protection.outlook.com (mail-swedencentralazon11013004.outbound.protection.outlook.com [52.101.83.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0FBC9542EC5; Thu, 15 Oct 2026 19:23:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.83.4 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792092187; cv=fail; b=AvNtP4wG7L3g0+E3SCoiGy6NF5WyKRseV+GY0gm6GKyCHodtj546kCKmTwVufIYiRKQYyWkT+FmR2HyGjK2xhDyewidXka0Z/8m+qXiSEaIVbH4tYac3/sRpkJnCfNI2OTKezAAZN2ZLUFzNznCys0kPN5j9IMYMtKAoN5DYHVU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792092187; c=relaxed/simple; bh=QTlwEA1sDf7KELWQjIhg3yDBEKLK+YNJrSV6DHMYm0A=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=RRW1pipFqi+gpkYKdSwn3OoQV9PQunGpjU3in9+HTDpi+ZpqX5aNvG2Y9kIxflXoJOMMLZoCGyi2tkGKo4NiVYO+dJTlc/DAAoLC9VOvYRv+62lH8G8BPGwgbrdBRo2Bnm1aR/QtQUp7gDSqT8TzaaXZxCtsUDWaBe5i6s9Xtlg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=K2waKi2m; arc=fail smtp.client-ip=52.101.83.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="K2waKi2m" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PJqo/UVuPM619pHFfkD6AkGZ+I4mq5VvfM6gGrJ6ymLHhSE+SKYFlo0W9GvX5xHfgK1u8AuzUKkp5YNaBpi0EQo0jnY0siQw9JIvud/gEaN6ieT5OupE963chAONLYGKtm1EOqnp+tcr/NPEVeLbCMtQQG06MW7dqYVilApnz5AV1sYmT0P6BdVEreiYmSQDaCJ2yHoWMQpqwv3TdD2tSQyze+/ZYBVvL8wxmaE/EcZROVwM46cJ+udnirLx+kagUJRf0xHvEWCR4+gB2HKFFHaNVLClJTMofYj839Yx9iQNl0ZSmMqKgBuRUOgXDwnDKGLpxvDB0U1nmNWP9bKOEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cGDR7/9+fYtlXxP+mlcHdyuFn+h7DBVkQRROeFfbxtc=; b=THeTaByjHKfP0BtJHvTsT0XVSSw+fGckMfWxVNWEfOuhEJ83Im3Mmi9kzyClwiQa+75LlA6JopMVSXf2FpJ2mgBYdU2n7vss6Gjv/KrXrXOqnv4yMRSzJ+yK9rRqpzCA7WtyOk62R/Y56ULXFVIZAlrXvxXTIhujDKAdHK/6YILUmKHQEsbIID62+ByGyr1JKaz2FUz9SHl8HRP+clcdlRrvY4+P3IWPEjEo5eTBYw40oQGjjCpNkvUbi3X2ftExNfnHH69mrY/QG0CQ1+uLjybu6tESL2jnrqUvc9nlDHykyJwG3rdfJKCpyVRLpweeB6PYmg+73TholFkgHepd4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cGDR7/9+fYtlXxP+mlcHdyuFn+h7DBVkQRROeFfbxtc=; b=K2waKi2mxtI6ug5vx10PjG5Be6IyxnKGA6n5ZOj5aJitE9yxK268QFaMGRSW5+A4PX42KzaDccn+mng+e0bm5D5EdLrCqAHXK+Gy6Po7Nef6g6vS/8s+TOd4g2k/UVrQ7Dj6Le7UB/CNobJDakU0qdPG0PrUPWvvElGE+S4tSJPUQbcqFv4dtgIOvEXHNNEzaFTzPBi5bHpnEcxW2hhB3FB2GBOZvWDULjZ60LEO93mNBVqOGtPsldIWHxOQsBdy50IHa7WOZ2ZoWzlSWJs/TmUK6oiQtd43BG3PeMOr6aV2ikXrWeSpB+ExvLJh2begi7RtIlHZEFOeOEZ73uyneg== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from GV2PR04MB11799.eurprd04.prod.outlook.com (2603:10a6:150:2cf::9) by MIWPR04MB358405.eurprd04.prod.outlook.com (2603:10a6:290:ab::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.522.14; Thu, 15 Oct 2026 19:23:02 +0000 Received: from GV2PR04MB11799.eurprd04.prod.outlook.com ([fe80::2146:83a2:5329:b7c]) by GV2PR04MB11799.eurprd04.prod.outlook.com ([fe80::2146:83a2:5329:b7c%7]) with mapi id 15.21.0522.012; Thu, 15 Oct 2026 19:23:02 +0000 From: Frank.Li@oss.nxp.com Date: Thu, 15 Oct 2026 15:22:26 -0400 Subject: [PATCH RFC 2/4] md/raid5-ppl: replace async_tx with synchronous xor Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-asycn_tx_remove-v1-2-056a7085e0a1@nxp.com> References: <20261015-asycn_tx_remove-v1-0-056a7085e0a1@nxp.com> In-Reply-To: <20261015-asycn_tx_remove-v1-0-056a7085e0a1@nxp.com> To: Alasdair Kergon , Mike Snitzer , Mikulas Patocka , Benjamin Marzinski , Song Liu , Yu Kuai , Li Nan , Xiao Ni , Dan Williams , Herbert Xu , "David S. Miller" , Jonathan Corbet , Shuah Khan , Randy Dunlap Cc: 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 , Saeed Bishara , Rameshwar Prasad Sahu , Thomas Petazzoni , Anup Patel , Frank Li X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792092167; l=3024; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=W7my1YlNaXtibhFai49iTowIOuh2zbKGxjHkHr2snGI=; b=352slSGw88aA+vdjeIU0E8cBX8GqXOxydXmuchlumm/mdDump2bQNjEZdbLizIQrn5sG46Txx XqliAZHehl8AOOpddH/TAQgx3muaUQurdgFzJdfmh1RETZ07oQpEQNJ X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: PH8PR02CA0013.namprd02.prod.outlook.com (2603:10b6:510:2d0::14) To GV2PR04MB11799.eurprd04.prod.outlook.com (2603:10a6:150:2cf::9) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV2PR04MB11799:EE_|MIWPR04MB358405:EE_ X-MS-Office365-Filtering-Correlation-Id: 55055ef8-3219-441d-0682-08df2af1bad7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|19092799006|1800799024|23010399003|366016|18002099003|22082099003|10067099003|921020|11063799006|261009223027099003|56012099006; X-Microsoft-Antispam-Message-Info: lCFU3bhgA9Yx+LT6CsI1t5x/r4l62VbpW1GKECPasqJ1JKik+uaBCmWszqTJnGCFFhZVofmZiOMqovvfYQu2ZOMKbtduCSc/QVIPh6O7F9Vj4v/sLUkyp8UVSrtPiq7CWs3CJveN/n7FUhKQ+H00aQfg0ECL4p4cdOezD45L8V4jtNQF7LZUdtB9fbN243aqE499kOR8WuJgKtx5phsD0z+x6/gD92JQqyo71nIRPcnCyhKG4HP8yR444ES96yItcskuhKSlJmlNDhJXIADYaajSs9aeRMi+/t9KUdw2SBaDxVfDsAYre9++lqwc409y9u3mXcuwSBuCLfZTOGBYgS3zfmrAW8Xa6Tk7hnWh4BEhvOUGDh4Ri0VCoHOZHVwUrf/mBoFtyLY3IJsyUyiWpnAx7vuUJU13nZH5YM35kXiYrGCWQTjVp1rFXb6KhIuyL2M80P1RrEGagODxmRrehHS/2hwhjZYfQBCD+Vxx0WeSN67lHxOS8kqnx1OAFcg0fZgHoXIcFrqyaN4PlCKiWDh8DDvNBPofyr3u+/Tr4dSwYhjqzFBsxKo0oUuDcXfuq+KACP/zJ+ytBY01/N5amqnLpdeFjlNiRJiwP7AEM++3by8NJR5rOWXEea4rdY3z1jCGvmjOMoL0TsNFP5DL6gdRSNoQueCWdyEEqbCMOZ+zDqGLFdTCZbOUbpG1RiHIwMgmFhmhNKPWuk1Dd/2C9g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV2PR04MB11799.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(19092799006)(1800799024)(23010399003)(366016)(18002099003)(22082099003)(10067099003)(921020)(11063799006)(261009223027099003)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VjVKRkVpRDRBQ2tZUE1KUlVSR3RlWHlnR0llYXZIak5aSXROazZJaFVUWlFu?= =?utf-8?B?YzUxTzhkTGQxTkJnUlA1UUFJTkRUdzlqUFprUTZCbEdmazBBcWdGeFhpc25v?= =?utf-8?B?OXZGSGtQMys2d2dmTDBrZUExTzlLYUZnYndlK3l4bUxsdXhLUEVaRXZicnl4?= =?utf-8?B?NDVzZHNyeisxemVkZUF3VkVoaHplTUVDblZVN0M2aitFd1ZzUXVhWmdiYjhF?= =?utf-8?B?ZWk4Z0JKb3NJVDRZSXpibFIxTytMazBDR0gxeUlzd0dqVzJ2aU0zNzYxQjcv?= =?utf-8?B?Q2d6MSs2dXprZVA3VE5UM2Q0RkE2dTJrcHJ3ZTRmTndhdGlEOFRzYkdkc29L?= =?utf-8?B?VnhMRkNIUm5aYVMrODlyTzdlaGkzM1FySmlodXFJYWYxcW81WlFQUmJ2NkZl?= =?utf-8?B?SE1QSTA5LzVrWkQ5NjJ3aktoU3Q4QnE4SmFiYnBsMmZsZ29pVXJZMDJ3eVJX?= =?utf-8?B?Z0NKNTVHQ0ZnUkJUSHo1M0hscXc0SnF1VmU2YVlEd1NadW9GeXNxVUoyNWpr?= =?utf-8?B?Rnc5NXBrL1FyTDJ3WE1Va2ZMbVhENW5HSGFYUkN1b1FUd29rVS8xN2ZHQmFa?= =?utf-8?B?a3FPS0I1ZVh5SzVzbS8wU1kvSVJibFBram5mK0xHSHRXVVBWeDdkdTg4WTg0?= =?utf-8?B?V1Z3dnd4K3puKzlRV0JIZHNWbVNuS3V3MnljNFE2SEtmZmNRKzdWamt0cElm?= =?utf-8?B?c2tJcEQ3NUFnalo0T0w1bVpFcW1WcjhTNjlmMit4Z2FpeWJSZlhROW55bC9J?= =?utf-8?B?MmdwKzF2cHB1OWJrNE1oTlFLbXcvalFJMlltRm0rdmJsa0wrZmVKbWV5QytH?= =?utf-8?B?cWxQdjhwY1hNMDNwMERtNWZneWhwRUlVMEo1T1RSMjgyOWN3ZTk0UFY0NU52?= =?utf-8?B?TzlpbEF3TVhyQnI3cElScDd3UWhMempRK0hHYlUzbXlTUFU5alpwU2JSWW5o?= =?utf-8?B?ZlNOTEYreFhQaWFiYjZSZmFMTDU1MUNKK2ViajlMbWFSeXNodk9INTZSSUdm?= =?utf-8?B?ZVBlUzlPSGovRyt4aHJFamM0Vm9oaExwSEtKckZoSkt5aDgwbzZxdGJ6WmRI?= =?utf-8?B?YWgzdWJKeUFXSXBWVnVPWEoxaThJVG5zam84dm5xbFFXUFBjVnh3YXhBSkcz?= =?utf-8?B?S1ZtYkcvYm83UldpNVIvVVo4TFBLMG15ZkNyWjJCZzFHbGdHYWF2bDlTeCtN?= =?utf-8?B?QWNBVlBXZ3BMdkVZOXFhb2xZdktMYXhyODBDTU1TVUdxQURscUxnMUZDVW8r?= =?utf-8?B?TS9EdU40Tnk0ZU1rNXBHZVlhMDNmdm9DNlhQU1Z4bWxxN1RtTGgrUmpReUE1?= =?utf-8?B?Y0RjRDZ1Q1V2ZG5GNXFjRzRTL1Zua05MTmh4Z2U3ckt3aFc1UU11a3BISW5Y?= =?utf-8?B?ckdNVVhZWEtDMXpQQ0VQV1FVZ21TaXRWNGFpbDRKTVpxVDRGeWtSTUR6ZlFJ?= =?utf-8?B?ckp3ZzNWR0YyQWc2cFo2UGJrdTRHZUtQUDJCMEkrazh4UjYvM1VZTGNJQi9a?= =?utf-8?B?bVNQVmhrMDAwdjBYUnBkN2tPT0o3U3pMaHVSY0xOMzRYRXJodW5CVXlQNk9k?= =?utf-8?B?SExDZlBnLzV5YTdSdUlLeVE1dGxnRHhIbEMzYUVXWTZEbEpMbXpSS1BadDJV?= =?utf-8?B?ekl0VThjeWY5cWVvT1d0TkVjb1lZUjZyeFZ3cy84eHpsMmMvdkFES2lyWTh5?= =?utf-8?B?Y1gwb2hrNnFTdEVDU09xN2MrZDZDeldzK2htZjZKZ09SZ0xnZnBSTUFoZXdI?= =?utf-8?B?VGRxTG4ra0doNXZ4d0RlNWgxVStIREtYQUJwN0cwcWNiSDdvZjNnZ3B3MStN?= =?utf-8?B?ZUVQbWFLTnBFaTdvR3NJemtKbmZBNEp5WG1YM0V5R0d0RU5zUkFqTFlWd1VN?= =?utf-8?B?aktzM3ZaYTZ3Z1BvTVlmYmMvL2lYU0JyQnJTN000RExGcEdNSVduRlNWV0dG?= =?utf-8?B?YlVQWEREZDVtZXdXbCsxM2hOeU5qcUdIekxSOUFBbU1HQWNFTFA3cC92bVJw?= =?utf-8?B?cVVBT2U3VTlwNGdRa1ZxdklGc0U3am1ERXJhNjYwdlVHTjRxTmM3RUJMeG9E?= =?utf-8?B?T080blMzUDRDN0FzSjIxQkN3dWdCV1A0elZnRlpqRDgyRWYwb2FXcWR2cHFN?= =?utf-8?B?WEhWMkY0YlFnTDZGNWtyTnE2Q0tLejJNa2lhc1FWVDcweUxlNEF6ekZLVkh3?= =?utf-8?B?QTNvWlJjOHRBSXQzeFpNdTZHRWdjSFhNU0lxQWVyTktESlZHN3lFNXpTY29l?= =?utf-8?B?NjA1WHI0cytQemk0YUxGWW90U0dRTWRYemJxTlQ2WVVPeEdSQTYrS3QzRThX?= =?utf-8?B?Zmo2QThaNS9LblZxMlFITHViZUoxVkhUZFFQa0x6U3U4b0JsaXJ5UEJDaTA4?= =?utf-8?Q?xcFLIo/y+rN6YBSp7zEhPdsW4LpzCmOFYef73?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55055ef8-3219-441d-0682-08df2af1bad7 X-MS-Exchange-CrossTenant-AuthSource: GV2PR04MB11799.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2026 19:23:02.1476 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hUFy0iTE66J0D7fiQJ+GqvPRgpGCoRu2SWrxTXdVLE5w1FzKLPQerhEl5uWkaqiE3oT1d22LRArTmJ8xTH10qWzhMbkUv7u/EFtp6aCW5g3KmpxP8fb+vQwsnoP3bjBx X-MS-Exchange-Transport-CrossTenantHeadersStamped: MIWPR04MB358405 From: Frank Li Remove the async_tx dependency from ops_run_partial_parity() and ppl_xor(). The function now returns void and operates synchronously: - count=3D=3D1: 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 and add #include . Signed-off-by: Frank Li --- drivers/md/raid5-ppl.c | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c index 7f8a9d3fd578d..bd844b4e8b372 100644 --- a/drivers/md/raid5-ppl.c +++ b/drivers/md/raid5-ppl.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include "md.h" #include "raid5.h" @@ -154,14 +154,11 @@ struct ppl_io_unit { struct bio_vec biovec[PPL_IO_INLINE_BVECS]; }; =20 -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 *p= ercpu) { int disks =3D sh->disks; struct page **srcs =3D percpu->scribble; int count =3D 0, pd_idx =3D sh->pd_idx, i; - struct async_submit_ctl submit; =20 pr_debug("%s: stripe %llu\n", __func__, (unsigned long long)sh->sector); =20 @@ -186,20 +183,20 @@ ops_run_partial_parity(struct stripe_head *sh, struct= raid5_percpu *percpu, srcs[count++] =3D dev->page; } } else { - return tx; + return; } =20 - init_async_submit(&submit, ASYNC_TX_FENCE|ASYNC_TX_XOR_ZERO_DST, tx, - NULL, sh, (void *) (srcs + sh->disks + 2)); - - if (count =3D=3D 1) - tx =3D async_memcpy(sh->ppl_page, srcs[0], 0, 0, PAGE_SIZE, - &submit); - else - tx =3D async_xor(sh->ppl_page, srcs, 0, count, PAGE_SIZE, - &submit); + if (count =3D=3D 1) { + copy_page(page_address(sh->ppl_page), page_address(srcs[0])); + } else { + void *dest =3D page_address(sh->ppl_page); + void **ptrs =3D (void **)srcs; + int j; =20 - return tx; + for (j =3D 0; j < count; j++) + ptrs[j] =3D page_address(srcs[j]); + xor_gen(dest, ptrs, count, PAGE_SIZE); + } } =20 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) =20 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[] =3D { page1, page2 }; - - init_async_submit(&submit, ASYNC_TX_ACK|ASYNC_TX_XOR_DROP_DST, - NULL, NULL, NULL, NULL); - tx =3D async_xor(page1, xor_srcs, 0, 2, size, &submit); + void *dest =3D page_address(page1); + void *ptrs[2] =3D { dest, page_address(page2) }; =20 - async_tx_quiesce(&tx); + xor_gen(dest, ptrs, 2, size); } =20 /* --=20 2.43.0 From nobody Fri Oct 23 03:31:41 2026 Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010024.outbound.protection.outlook.com [52.101.69.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 776D55616CF; Thu, 15 Oct 2026 19:23:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.24 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792092195; cv=fail; b=B1XefjEV9PKwzw+mUirWMYZCbnMacgOIMl4GPahRjFozfpnTOq0KMa+rYYj6K9KYOM9jrDZFkKpSUhWbGBNbV+1n3EwjP7dOcb3jEVq0IHH79QoQRKNKSCBNAL3HfoHI2DHeU56Ur7l5QrgHdDKVklrliNJH66bCC2f4R4j2nw0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792092195; c=relaxed/simple; bh=hz0ZP6bofOK+iTst0k2E2CwWKaGhTh5Xr8h+r4GDADE=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=aIARxoimLq6J0ZxQh1X8DkLTHDa4qjfUCtopIaJjw7jtH67/iswxNXWL2DS+S4sFmUTJ5Sk9zUOz5Vmjss81nx8Sn0u/sfTr/96RVAOMXYzJwEQYAIBu9VLcydU9ulQ+mKiO0bUZfe1sW8M1h7714HaMHfYQ1rgBjtOb/2KJLLU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=uz3omGZD; arc=fail smtp.client-ip=52.101.69.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="uz3omGZD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=X3RIs5kHrTFTTr/IZUsY9Zr2ftlFKSLgv0o1u99BhOOwTwyujkywulhSDzASrSTNrWYlGKl3ntgsDoFH0iW2V8OxUKsvTK10v6EV2/L32KahNcGZFiZOefqEzadk7FHrm0LO36KP0tAuVGeYBXo6QUXM8N0B3lypnipFLYEAnJje/1uGT5gRVS9cEynC21IdLKfGMQwG9OlUlzLE4pBik0h4JWr+BWfWl71XiAZ7wg/Nu0qybXnHd9VP8edX7UhuGGvXhYvvinJhhE+pwutOJL3Ep5l29kiUhDDItAKLHJTHv4xh3azG/KRPLcE3/Fot/OI7bnOp0kGvnz+y+BgYTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JDnlCzKBCk7g9Bdio+Li1q3osbS9MmPbV97SeJPxX9Y=; b=mL8VNjpcYYze0nu3E3lRfRwG6qRzrGHs1umgQqp27YiagLUqxXst1YeiF6CsbDaJKcrnSyWBBM6HF0fs1T+FWkaS+4h2+vXxV14jceX7a9HIcOZDImJtw1nZji9MqVB+6HjUbJjTKCgzcuboC27MYV1SIWnTsDNlHOscHWNh9fxdWvnGOPWBzJjVSDPseZhCRP3vBTlIjMetuNIUReaNAtDlf5m3ld76+xq1DqDYT+CHhg9045bipBQgRGMj0XArj+1xHV+sexWE/h0+Dw3mmZIUx2ubg3ot+54g7O/2t1Ghpj8gD6rrLJLQ7IXVKtIphm80Yl/dSS2KEL5v2ao6vQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JDnlCzKBCk7g9Bdio+Li1q3osbS9MmPbV97SeJPxX9Y=; b=uz3omGZDzhLq6aW59lEzW+wpyN36fl8h1YZkZrMAWFZzPxDhv+e6ExHl0A5BlXDPqUg3cAtiP4H2rFJVxw5EmbMK4Hf3wNuCLeY4HKgJYgqdpRPr0aHyi20bhBL2pxu8ubf47hfkffn5HvRG+hvKJxoLRokwXD2Joohu7oZjWsHQYmTanUPSQAn2Z5bmFXF5p/QPOsbYUICL4NeB1EvWn6gMsY1+BENFrfsW9h0u7ye6LcxZDO4TjpJCk6D5si9rThp1mizKFTaA951eohUgusEMo5ye5dOC7Aj8kr/5+zNnfXqn3CU3myr403hsqWOkcDUaOBYT19NkRNu8DxOXwQ== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from GV2PR04MB11799.eurprd04.prod.outlook.com (2603:10a6:150:2cf::9) by MIWPR04MB358405.eurprd04.prod.outlook.com (2603:10a6:290:ab::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.522.14; Thu, 15 Oct 2026 19:23:08 +0000 Received: from GV2PR04MB11799.eurprd04.prod.outlook.com ([fe80::2146:83a2:5329:b7c]) by GV2PR04MB11799.eurprd04.prod.outlook.com ([fe80::2146:83a2:5329:b7c%7]) with mapi id 15.21.0522.012; Thu, 15 Oct 2026 19:23:08 +0000 From: Frank.Li@oss.nxp.com Date: Thu, 15 Oct 2026 15:22:27 -0400 Subject: [PATCH RFC 3/4] md/raid5: replace async_tx with synchronous xor/pq operations Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-asycn_tx_remove-v1-3-056a7085e0a1@nxp.com> References: <20261015-asycn_tx_remove-v1-0-056a7085e0a1@nxp.com> In-Reply-To: <20261015-asycn_tx_remove-v1-0-056a7085e0a1@nxp.com> To: Alasdair Kergon , Mike Snitzer , Mikulas Patocka , Benjamin Marzinski , Song Liu , Yu Kuai , Li Nan , Xiao Ni , Dan Williams , Herbert Xu , "David S. Miller" , Jonathan Corbet , Shuah Khan , Randy Dunlap Cc: 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 , Saeed Bishara , Rameshwar Prasad Sahu , Thomas Petazzoni , Anup Patel , Frank Li X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792092167; l=32431; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=b4XhVlEH+imRIJgU0u9khMc4yfRtfaHpzFEsq8xIJJU=; b=qtQcIJ0soLqAOiFJKAJPQvvP34WEI0Hd9Y1+Xi6CH+vV4xzTS9rkzG+iHtIZ7owZr2kV00PcV laXnBJPNqOEAHN2b8ql/+UDQ7P4nmA/CYY8GD7rsyXtRf8S40CudBYH X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0036.namprd05.prod.outlook.com (2603:10b6:a03:33f::11) To GV2PR04MB11799.eurprd04.prod.outlook.com (2603:10a6:150:2cf::9) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV2PR04MB11799:EE_|MIWPR04MB358405:EE_ X-MS-Office365-Filtering-Correlation-Id: d2819a72-d0fe-48c7-bdf9-08df2af1be9b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|19092799006|1800799024|23010399003|366016|6133799003|18002099003|22082099003|10067099003|921020|11063799006|260925021311599003|260925021911599003|260925022911599003|261009223027099003|56012099006; X-Microsoft-Antispam-Message-Info: 3lQv7cTrppg8iVudd071gH5T0TbxZgwIIR5hi8f2IwFeLZ7ZjP7NGn1EPY1wYQly73nOop9XtRfXf/p+gkdBIf5nSkVnrN2vOGTDXGGJ7QM89fzviauTls7IXFcU78l0XSD5pcr9kk9qilQQsibMLIjE61HfMNyvZvbujnjMnJFlBTq+ZkjwM93qnG1uprYYKLSGP/TVSAFDqoLzzphugExXU/Y+vz/00a0DPtOUOMLBbvSWXzEzVWj8c9gyg3+Fibybj+zUf8T4qcAiRX4rWpAb4gMNCd+CpdXNpUcl9zx0GzYaGFc5GsoVwJY8gosGV4JxdRNd3nIsbJ5tzPXCb2/D6FKQQmCkRbTuoD1weS0VYDhwmfKKKxX+Gu5Ybd8XWhKR2dRpPZbSPUYi3ree1RfOq3M5CzRlgyFhqvmufrKLqxmN6ipUhUcqRTTttRTg34CFxmj38VQeI5EZBBNY8Bt9EFEkdnmmM33zvf6ytxBZiHBz2NP6fVqtFFXlXJTS943nZpy9OoyWtytJDEd7y4l7DpB49vSydyBnPiIfb7a9cWYOwghZQsVqMoM68nmFWfq1VdTH8JNcbhgcXe/aK2bKKEs1d+byWjKZ4GqRZXk3ceRvIsXCEDxjrb9v8GsDTn2CBvQ16zqHEmhEiW4YFW74NurPC3F6Qa94WvbcTtqz2rtulBYoQ1+60GbyUqSd9M4SiT6JH04hXTxFmdKvMw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV2PR04MB11799.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(19092799006)(1800799024)(23010399003)(366016)(6133799003)(18002099003)(22082099003)(10067099003)(921020)(11063799006)(260925021311599003)(260925021911599003)(260925022911599003)(261009223027099003)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dU1KdFJQNERFUllGNUFSOVFuT0tZaEc1MW1RRitpOXg0dTI5ditGYmhvdHhH?= =?utf-8?B?NDkrVVNHZFFFNUR4U0Z5OUJtZWVvdFlIM2NwZWVMRnVqdFI2aXB2bTFjYWFi?= =?utf-8?B?MHM2VXhmMXV0YUc2WHI5dmhxSG9ucTZJaEg0emRDM3dzMzZiNU1EV2toZkxY?= =?utf-8?B?OTVyZ2xaenNXbDllMlNVTStOOUJzMjNDNFhwZi90KzEwSTRMajJYRHVZb2I0?= =?utf-8?B?aXowZC8rbUJCUENDTDVrRjA2cW5jVmtOSmYvZjhhbmhpeXF3b3NMdHJHczhh?= =?utf-8?B?aEtIQzhHU0lLTGtVd0FFZW9TUDBETmVLRWN3cnE4NlYrMFU0K0NLT29DVUI3?= =?utf-8?B?Mm5EdS9zS0M2YzVaL2xvcWJqZko1YktrVW9JZmhkSkVwYWhPNS9NWm8vaUVn?= =?utf-8?B?aVdDSSszT2NiWXljS0VFNjlyelRaQk5NVTZXdXBhNk9mU1U1b1dYd0w4cU0y?= =?utf-8?B?dEdPOGVuWWMxc2NpMkppRFJsdkVwWklscFoyU25aOFBaY3g3eWtnOFR2M296?= =?utf-8?B?YVpHamVhM09YWDhjT2g1ODVlMzhVR0Rta0FrZUhoYkR4a1IwYzMranBBazla?= =?utf-8?B?R3RtVzBic2VlZTRsNXhBMTdyYkh2ejhEdmcwbEsrZHVYeHBKQlR3RWlNeHpS?= =?utf-8?B?SVV4SCs4WnZZR0ZURmthalhwbk1Yb1Y1RUFMNkU3Zk1Jd2RzbStVVHlCYWh0?= =?utf-8?B?cm01V3VIdUhFakR2REY1ZWdCenpIN2RuQkVnY3JWM0sxaTJzM1V3cHplSTZ6?= =?utf-8?B?UkdQblpCMGNOV3A5RzBQdWM2eTVXb0haeXFWVVp3eGN5VUtjdXRsdlROeDV2?= =?utf-8?B?MThxMTZ3T2ZpamM0blo0QVplcFFaUmJ0QnVDVVJTcFdwRGRVZ1VaMWZIVHdR?= =?utf-8?B?Mnd3WkRsZEE4ZmFjU1M1dnBFS2dCVXBYSzQyS2tKZlBGV0J0S2pRQ0Y4Ymo5?= =?utf-8?B?aENDellsNXNIc2ViVzQ3QjBWUkhvYkdYaTBmVStTbnMvanZKOUptOWcwYk00?= =?utf-8?B?L3NQa0NXVkZXaTIyVGx5T0d3MEEwU2tVOEFhRC8wVVdPVXVEZDAwNUlTT2lY?= =?utf-8?B?MlhtMlZKd1k1alNLNkdpdXFwL2IwUytJSHhPaDcxZ3pBS09TeUpEOVBIM25D?= =?utf-8?B?UldldXp4TkN5WU9jNWlzRk1HUVdoQ0ZNQlRVK0UrTkd5Vk53ZWFiV0xuU0Uv?= =?utf-8?B?RXZLckVydFQ1ZTA1QllpTEJKODFMNXVKYitzZHhIWXl5QzFZcWVITWhnRTVr?= =?utf-8?B?dkZoWVBqcU9vSlRSWElhaHRvZWxUTC9vcjk0OWtXOXFoVXRrZWUxcjNYZjNw?= =?utf-8?B?aDRwdmJoZStQL25MNitZTThGSWpoUGpBWnpZUHBlWGVyOHpxUGVQUmRnLzUz?= =?utf-8?B?d0t1OEp0U3BhNnVVMUdON2FON3FLVlBJRmhFYjZKMmV0cmpycEZyMDFvNVI4?= =?utf-8?B?UzRLTWhVWlNFRGFGYjd2K3RtTmhZZE5hNnNjSlFiZWFiT0ZqcWttQktWTzBi?= =?utf-8?B?QTRtcEd0NC9Kb1h0Y0VrUlh0aGk2M2xSUW5Sa0lTTFNSNzBCRXloY2thdk5H?= =?utf-8?B?WUZkTWlZS1ZNLzl4aUI5bnNUQzEzVnU2WHo1WXFQcVgwTEZwdGZSTTNlaVBH?= =?utf-8?B?TDJMbDl2WDhaMUdHSHhOWHVNWmNkVElwMEsrdlNkSUhrbVRQWTBjYm12bmlu?= =?utf-8?B?aW9SN1hJRWZJMHgvUzd5RS91dGpScithY1RhSWxHZHBIWFJiSzh5ejRCVDN2?= =?utf-8?B?T21HVWNUaUMyam54TzlreTlrTUVSK3UvaXk3Z3lSdTVnMnBZWmVPQWZ5dmxt?= =?utf-8?B?dUhhd0hZeUJOaFQyT05tZkhxN3IvZWpod2RvU0JJK05qOEdtN1ZLSlJsd2VT?= =?utf-8?B?UStwUVVkZityY1IyM3Rzc2V0TGJsdWFEQlFRWVVOYXNBV3o1N01MejJpMlJW?= =?utf-8?B?U3NiSkJHRzNndGwxcmswT0ltQUJWRlpWQTRXbkZjVWc0VjFNSVgzMGd2MjE1?= =?utf-8?B?aVdVc1NZclRHSkNFMzBYVDNLQlB6Nm5jMTh0enR0Y25EVjB6TTBCMUdzcE5O?= =?utf-8?B?NXUzaUk1VkdBUlJZZG9LN3AraXVMNnljOFRQS09LL1hhL2s2SEJ6ODhja1ZC?= =?utf-8?B?SURQN1BVNEpmRDVTMjVaWDNZWllJdENhbVdDUzI0MWRwZTYvYzVyMXloNzFX?= =?utf-8?B?WGZjSk1vMVhBdS91Z0ppQ2NDNUJKK2tpMHd2d01PbjJJNjBtc3pmMlRLTGgr?= =?utf-8?B?VkErRGVGVHI1SU55QkpjKzJEdnNURmFyNTlJRFM0WHkydlJrNjlQUHBCTlJ6?= =?utf-8?B?Nk1MZ21ZeWl4cWdkY1lteVY0dktRY2tTdWhkQWZObTMydkM2M08rNmpMRkdX?= =?utf-8?Q?KHBRxYvN3ZtqlADJcMWGadpTqu5Fh7gpHyUoB?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2819a72-d0fe-48c7-bdf9-08df2af1be9b X-MS-Exchange-CrossTenant-AuthSource: GV2PR04MB11799.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2026 19:23:08.6754 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NKIA/K5vcyqx7KXXmDVNxdOn+Dnn3fiBTwWOleXgF9wCLLpaNlXHxHzlJyMmdOGZPM7i33NB1rDIGj2BRTv1iUhWpVOamZzT7QlIbexgvCXa3KhJk7IWBJF/E+a75zi4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MIWPR04MB358405 From: Frank Li 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 with #include . --- drivers/md/raid5-log.h | 4 +- drivers/md/raid5.c | 467 ++++++++++++++++++++++++++-------------------= ---- 2 files changed, 251 insertions(+), 220 deletions(-) diff --git a/drivers/md/raid5-log.h b/drivers/md/raid5-log.h index c8332502669e5..52408067a40cb 100644 --- a/drivers/md/raid5-log.h +++ b/drivers/md/raid5-log.h @@ -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); =20 -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 *p= ercpu); 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); diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index b91545ce090de..b1121e6f4bfbe 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -1373,17 +1373,14 @@ static void ops_run_io(struct stripe_head *sh, stru= ct stripe_head_state *s) defer_issue_bios(conf, head_sh->sector, &pending_bios); } =20 -static struct dma_async_tx_descriptor * -async_copy_data(int frombio, struct bio *bio, struct page **page, - unsigned int poff, sector_t sector, struct dma_async_tx_descriptor *tx, - struct stripe_head *sh, int no_skipcopy) +static void sync_copy_data(int frombio, struct bio *bio, struct page **pag= e, + unsigned int poff, sector_t sector, struct stripe_head *sh, + int no_skipcopy) { struct bio_vec bvl; struct bvec_iter iter; struct page *bio_page; int page_offset; - struct async_submit_ctl submit; - enum async_tx_flags flags =3D 0; struct r5conf *conf =3D sh->raid_conf; =20 if (bio->bi_iter.bi_sector >=3D sector) @@ -1391,10 +1388,6 @@ async_copy_data(int frombio, struct bio *bio, struct= page **page, else page_offset =3D (signed)(sector - bio->bi_iter.bi_sector) * -512; =20 - if (frombio) - flags |=3D ASYNC_TX_FENCE; - init_async_submit(&submit, flags, tx, NULL, NULL, NULL); - bio_for_each_segment(bvl, bio, iter) { int len =3D bvl.bv_len; int clen; @@ -1412,30 +1405,34 @@ async_copy_data(int frombio, struct bio *bio, struc= t page **page, clen =3D len; =20 if (clen > 0) { + void *dst, *src; + b_offset +=3D bvl.bv_offset; bio_page =3D bvl.bv_page; if (frombio) { if (conf->skip_copy && b_offset =3D=3D 0 && page_offset =3D=3D 0 && clen =3D=3D RAID5_STRIPE_SIZE(conf) && - !no_skipcopy) + !no_skipcopy) { *page =3D bio_page; - else - tx =3D async_memcpy(*page, bio_page, page_offset + poff, - b_offset, clen, &submit); - } else - tx =3D async_memcpy(bio_page, *page, b_offset, - page_offset + poff, clen, &submit); + } else { + src =3D kmap_local_page(bio_page) + b_offset; + dst =3D page_address(*page) + page_offset + poff; + memcpy(dst, src, clen); + kunmap_local(src); + } + } else { + dst =3D kmap_local_page(bio_page) + b_offset; + src =3D page_address(*page) + page_offset + poff; + memcpy(dst, src, clen); + kunmap_local(dst); + } } - /* chain the operations */ - submit.depend_tx =3D tx; =20 if (clen < len) /* hit end of page */ break; - page_offset +=3D len; + page_offset +=3D len; } - - return tx; } =20 static void ops_complete_biofill(void *stripe_head_ref) @@ -1478,8 +1475,6 @@ static void ops_complete_biofill(void *stripe_head_re= f) =20 static void ops_run_biofill(struct stripe_head *sh) { - struct dma_async_tx_descriptor *tx =3D NULL; - struct async_submit_ctl submit; int i; struct r5conf *conf =3D sh->raid_conf; =20 @@ -1497,17 +1492,15 @@ static void ops_run_biofill(struct stripe_head *sh) spin_unlock_irq(&sh->stripe_lock); while (rbi && rbi->bi_iter.bi_sector < dev->sector + RAID5_STRIPE_SECTORS(conf)) { - tx =3D async_copy_data(0, rbi, &dev->page, - dev->offset, - dev->sector, tx, sh, 0); + sync_copy_data(0, rbi, &dev->page, + dev->offset, dev->sector, sh, 0); rbi =3D r5_next_bio(conf, rbi, dev->sector); } } } =20 atomic_inc(&sh->count); - init_async_submit(&submit, ASYNC_TX_ACK, tx, ops_complete_biofill, sh, NU= LL); - async_trigger_callback(&submit); + ops_complete_biofill(sh); } =20 static void mark_target_uptodate(struct stripe_head *sh, int target) @@ -1541,30 +1534,20 @@ static void ops_complete_compute(void *stripe_head_= ref) raid5_release_stripe(sh); } =20 -/* return a pointer to the address conversion region of the scribble buffe= r */ +/* return a pointer to the page-pointer region of the scribble buffer */ static struct page **to_addr_page(struct raid5_percpu *percpu, int i) { return percpu->scribble + i * percpu->scribble_obj_size; } =20 -/* return a pointer to the address conversion region of the scribble buffe= r */ -static addr_conv_t *to_addr_conv(struct stripe_head *sh, - struct raid5_percpu *percpu, int i) -{ - return (void *) (to_addr_page(percpu, i) + sh->disks + 2); -} - -/* - * Return a pointer to record offset address. - */ +/* return a pointer to the offset array in the scribble buffer */ static unsigned int * to_addr_offs(struct stripe_head *sh, struct raid5_percpu *percpu) { - return (unsigned int *) (to_addr_conv(sh, percpu, 0) + sh->disks + 2); + return (unsigned int *) (to_addr_page(percpu, 0) + sh->disks + 2); } =20 -static struct dma_async_tx_descriptor * -ops_run_compute5(struct stripe_head *sh, struct raid5_percpu *percpu) +static void ops_run_compute5(struct stripe_head *sh, struct raid5_percpu *= percpu) { int disks =3D sh->disks; struct page **xor_srcs =3D to_addr_page(percpu, 0); @@ -1573,9 +1556,10 @@ ops_run_compute5(struct stripe_head *sh, struct raid= 5_percpu *percpu) struct r5dev *tgt =3D &sh->dev[target]; struct page *xor_dest =3D tgt->page; unsigned int off_dest =3D tgt->offset; + size_t len =3D RAID5_STRIPE_SIZE(sh->raid_conf); int count =3D 0; - struct dma_async_tx_descriptor *tx; - struct async_submit_ctl submit; + void **ptrs =3D (void **)xor_srcs; + void *dst; int i; =20 BUG_ON(sh->batch_head); @@ -1593,16 +1577,17 @@ ops_run_compute5(struct stripe_head *sh, struct rai= d5_percpu *percpu) =20 atomic_inc(&sh->count); =20 - init_async_submit(&submit, ASYNC_TX_FENCE|ASYNC_TX_XOR_ZERO_DST, NULL, - ops_complete_compute, sh, to_addr_conv(sh, percpu, 0)); - if (unlikely(count =3D=3D 1)) - tx =3D async_memcpy(xor_dest, xor_srcs[0], off_dest, off_srcs[0], - RAID5_STRIPE_SIZE(sh->raid_conf), &submit); - else - tx =3D async_xor_offs(xor_dest, off_dest, xor_srcs, off_srcs, count, - RAID5_STRIPE_SIZE(sh->raid_conf), &submit); + dst =3D page_address(xor_dest) + off_dest; + if (unlikely(count =3D=3D 1)) { + memcpy(dst, page_address(xor_srcs[0]) + off_srcs[0], len); + } else { + for (i =3D 0; i < count; i++) + ptrs[i] =3D page_address(xor_srcs[i]) + off_srcs[i]; + memset(dst, 0, len); + xor_gen(dst, ptrs, count, len); + } =20 - return tx; + ops_complete_compute(sh); } =20 /* set_syndrome_sources - populate source buffers for gen_syndrome @@ -1660,19 +1645,18 @@ static int set_syndrome_sources(struct page **srcs, return syndrome_disks; } =20 -static struct dma_async_tx_descriptor * -ops_run_compute6_1(struct stripe_head *sh, struct raid5_percpu *percpu) +static void ops_run_compute6_1(struct stripe_head *sh, struct raid5_percpu= *percpu) { int disks =3D sh->disks; struct page **blocks =3D to_addr_page(percpu, 0); unsigned int *offs =3D to_addr_offs(sh, percpu); int target; int qd_idx =3D sh->qd_idx; - struct dma_async_tx_descriptor *tx; - struct async_submit_ctl submit; struct r5dev *tgt; struct page *dest; unsigned int dest_off; + size_t len =3D RAID5_STRIPE_SIZE(sh->raid_conf); + void **ptrs =3D (void **)blocks; int i; int count; =20 @@ -1699,13 +1683,17 @@ ops_run_compute6_1(struct stripe_head *sh, struct r= aid5_percpu *percpu) count =3D set_syndrome_sources(blocks, offs, sh, SYNDROME_SRC_ALL); blocks[count] =3D NULL; /* regenerating p is not necessary */ BUG_ON(blocks[count+1] !=3D dest); /* q should already be set */ - init_async_submit(&submit, ASYNC_TX_FENCE, NULL, - ops_complete_compute, sh, - to_addr_conv(sh, percpu, 0)); - tx =3D async_gen_syndrome(blocks, offs, count+2, - RAID5_STRIPE_SIZE(sh->raid_conf), &submit); + for (i =3D 0; i < count+2; i++) { + if (blocks[i]) + ptrs[i] =3D page_address(blocks[i]) + offs[i]; + else + ptrs[i] =3D NULL; + } + raid6_gen_syndrome(count+2, len, ptrs); } else { /* Compute any data- or p-drive using XOR */ + void *dst =3D page_address(dest) + dest_off; + count =3D 0; for (i =3D disks; i-- ; ) { if (i =3D=3D target || i =3D=3D qd_idx) @@ -1713,19 +1701,16 @@ ops_run_compute6_1(struct stripe_head *sh, struct r= aid5_percpu *percpu) offs[count] =3D sh->dev[i].offset; blocks[count++] =3D sh->dev[i].page; } - - init_async_submit(&submit, ASYNC_TX_FENCE|ASYNC_TX_XOR_ZERO_DST, - NULL, ops_complete_compute, sh, - to_addr_conv(sh, percpu, 0)); - tx =3D async_xor_offs(dest, dest_off, blocks, offs, count, - RAID5_STRIPE_SIZE(sh->raid_conf), &submit); + for (i =3D 0; i < count; i++) + ptrs[i] =3D page_address(blocks[i]) + offs[i]; + memset(dst, 0, len); + xor_gen(dst, ptrs, count, len); } =20 - return tx; + ops_complete_compute(sh); } =20 -static struct dma_async_tx_descriptor * -ops_run_compute6_2(struct stripe_head *sh, struct raid5_percpu *percpu) +static void ops_run_compute6_2(struct stripe_head *sh, struct raid5_percpu= *percpu) { int i, count, disks =3D sh->disks; int syndrome_disks =3D sh->ddf_layout ? disks : disks-2; @@ -1735,10 +1720,10 @@ ops_run_compute6_2(struct stripe_head *sh, struct r= aid5_percpu *percpu) int target2 =3D sh->ops.target2; struct r5dev *tgt =3D &sh->dev[target]; struct r5dev *tgt2 =3D &sh->dev[target2]; - struct dma_async_tx_descriptor *tx; struct page **blocks =3D to_addr_page(percpu, 0); unsigned int *offs =3D to_addr_offs(sh, percpu); - struct async_submit_ctl submit; + size_t len =3D RAID5_STRIPE_SIZE(sh->raid_conf); + void **ptrs =3D (void **)blocks; =20 BUG_ON(sh->batch_head); pr_debug("%s: stripe %llu block1: %d block2: %d\n", @@ -1781,17 +1766,19 @@ ops_run_compute6_2(struct stripe_head *sh, struct r= aid5_percpu *percpu) /* Q disk is one of the missing disks */ if (faila =3D=3D syndrome_disks) { /* Missing P+Q, just recompute */ - init_async_submit(&submit, ASYNC_TX_FENCE, NULL, - ops_complete_compute, sh, - to_addr_conv(sh, percpu, 0)); - return async_gen_syndrome(blocks, offs, syndrome_disks+2, - RAID5_STRIPE_SIZE(sh->raid_conf), - &submit); + for (i =3D 0; i < syndrome_disks+2; i++) { + if (blocks[i]) + ptrs[i] =3D page_address(blocks[i]) + offs[i]; + else + ptrs[i] =3D NULL; + } + raid6_gen_syndrome(syndrome_disks+2, len, ptrs); } else { struct page *dest; unsigned int dest_off; int data_target; int qd_idx =3D sh->qd_idx; + void *d; =20 /* Missing D+Q: recompute D from P, then recompute Q */ if (target =3D=3D qd_idx) @@ -1808,40 +1795,38 @@ ops_run_compute6_2(struct stripe_head *sh, struct r= aid5_percpu *percpu) } dest =3D sh->dev[data_target].page; dest_off =3D sh->dev[data_target].offset; - init_async_submit(&submit, - ASYNC_TX_FENCE|ASYNC_TX_XOR_ZERO_DST, - NULL, NULL, NULL, - to_addr_conv(sh, percpu, 0)); - tx =3D async_xor_offs(dest, dest_off, blocks, offs, count, - RAID5_STRIPE_SIZE(sh->raid_conf), - &submit); + d =3D page_address(dest) + dest_off; + for (i =3D 0; i < count; i++) + ptrs[i] =3D page_address(blocks[i]) + offs[i]; + memset(d, 0, len); + xor_gen(d, ptrs, count, len); =20 count =3D set_syndrome_sources(blocks, offs, sh, SYNDROME_SRC_ALL); - init_async_submit(&submit, ASYNC_TX_FENCE, tx, - ops_complete_compute, sh, - to_addr_conv(sh, percpu, 0)); - return async_gen_syndrome(blocks, offs, count+2, - RAID5_STRIPE_SIZE(sh->raid_conf), - &submit); + for (i =3D 0; i < count+2; i++) { + if (blocks[i]) + ptrs[i] =3D page_address(blocks[i]) + offs[i]; + else + ptrs[i] =3D NULL; + } + raid6_gen_syndrome(count+2, len, ptrs); } } else { - init_async_submit(&submit, ASYNC_TX_FENCE, NULL, - ops_complete_compute, sh, - to_addr_conv(sh, percpu, 0)); + for (i =3D 0; i < syndrome_disks+2; i++) { + if (blocks[i]) + ptrs[i] =3D page_address(blocks[i]) + offs[i]; + else + ptrs[i] =3D NULL; + } if (failb =3D=3D syndrome_disks) { /* We're missing D+P. */ - return async_raid6_datap_recov(syndrome_disks+2, - RAID5_STRIPE_SIZE(sh->raid_conf), - faila, - blocks, offs, &submit); + raid6_recov_datap(syndrome_disks+2, len, faila, ptrs); } else { /* We're missing D+D. */ - return async_raid6_2data_recov(syndrome_disks+2, - RAID5_STRIPE_SIZE(sh->raid_conf), - faila, failb, - blocks, offs, &submit); + raid6_recov_2data(syndrome_disks+2, len, faila, failb, ptrs); } } + + ops_complete_compute(sh); } =20 static void ops_complete_prexor(void *stripe_head_ref) @@ -1859,15 +1844,14 @@ static void ops_complete_prexor(void *stripe_head_r= ef) r5c_release_extra_page(sh); } =20 -static struct dma_async_tx_descriptor * -ops_run_prexor5(struct stripe_head *sh, struct raid5_percpu *percpu, - struct dma_async_tx_descriptor *tx) +static void ops_run_prexor5(struct stripe_head *sh, struct raid5_percpu *p= ercpu) { int disks =3D sh->disks; struct page **xor_srcs =3D to_addr_page(percpu, 0); unsigned int *off_srcs =3D to_addr_offs(sh, percpu); int count =3D 0, pd_idx =3D sh->pd_idx, i; - struct async_submit_ctl submit; + size_t len =3D RAID5_STRIPE_SIZE(sh->raid_conf); + void **ptrs =3D (void **)xor_srcs; =20 /* existing parity data subtracted */ unsigned int off_dest =3D off_srcs[count] =3D sh->dev[pd_idx].offset; @@ -1893,38 +1877,55 @@ ops_run_prexor5(struct stripe_head *sh, struct raid= 5_percpu *percpu, } } =20 - init_async_submit(&submit, ASYNC_TX_FENCE|ASYNC_TX_XOR_DROP_DST, tx, - ops_complete_prexor, sh, to_addr_conv(sh, percpu, 0)); - tx =3D async_xor_offs(xor_dest, off_dest, xor_srcs, off_srcs, count, - RAID5_STRIPE_SIZE(sh->raid_conf), &submit); + /* XOR_DROP_DST: dest (parity) is at ptrs[0], data pages follow. + * xor_gen(dst, ptrs, count, len) computes dst ^=3D ptrs[0..count-1], + * which cancels the old parity and folds in all written data. */ + for (i =3D 0; i < count; i++) + ptrs[i] =3D page_address(xor_srcs[i]) + off_srcs[i]; + xor_gen(page_address(xor_dest) + off_dest, ptrs, count, len); =20 - return tx; + ops_complete_prexor(sh); } =20 -static struct dma_async_tx_descriptor * -ops_run_prexor6(struct stripe_head *sh, struct raid5_percpu *percpu, - struct dma_async_tx_descriptor *tx) +static void ops_run_prexor6(struct stripe_head *sh, struct raid5_percpu *p= ercpu) { struct page **blocks =3D to_addr_page(percpu, 0); unsigned int *offs =3D to_addr_offs(sh, percpu); - int count; - struct async_submit_ctl submit; + size_t len =3D RAID5_STRIPE_SIZE(sh->raid_conf); + void **ptrs =3D (void **)blocks; + int count, i, start =3D -1, stop =3D -1; =20 pr_debug("%s: stripe %llu\n", __func__, (unsigned long long)sh->sector); =20 count =3D set_syndrome_sources(blocks, offs, sh, SYNDROME_SRC_WANT_DRAIN); =20 - init_async_submit(&submit, ASYNC_TX_FENCE|ASYNC_TX_PQ_XOR_DST, tx, - ops_complete_prexor, sh, to_addr_conv(sh, percpu, 0)); - tx =3D async_gen_syndrome(blocks, offs, count+2, - RAID5_STRIPE_SIZE(sh->raid_conf), &submit); + /* PQ_XOR_DST: use xor_syndrome to fold in only the changed disks */ + for (i =3D 0; i < count; i++) { + if (blocks[i]) { + if (start < 0) + start =3D i; + stop =3D i; + } + if (blocks[i]) + ptrs[i] =3D page_address(blocks[i]) + offs[i]; + else + ptrs[i] =3D NULL; + } + /* P slot */ + ptrs[count] =3D blocks[count] ? page_address(blocks[count]) + offs[count]= : NULL; + /* Q slot */ + ptrs[count+1] =3D blocks[count+1] ? page_address(blocks[count+1]) + offs[= count+1] : NULL; + + if (start >=3D 0 && raid6_can_xor_syndrome()) + raid6_xor_syndrome(count+2, start, stop, len, ptrs); + else + raid6_gen_syndrome(count+2, len, ptrs); =20 - return tx; + ops_complete_prexor(sh); } =20 -static struct dma_async_tx_descriptor * -ops_run_biodrain(struct stripe_head *sh, struct dma_async_tx_descriptor *t= x) +static void ops_run_biodrain(struct stripe_head *sh) { struct r5conf *conf =3D sh->raid_conf; int disks =3D sh->disks; @@ -1967,9 +1968,9 @@ ops_run_biodrain(struct stripe_head *sh, struct dma_a= sync_tx_descriptor *tx) if (bio_op(wbi) =3D=3D REQ_OP_DISCARD) set_bit(R5_Discard, &dev->flags); else { - tx =3D async_copy_data(1, wbi, &dev->page, + sync_copy_data(1, wbi, &dev->page, dev->offset, - dev->sector, tx, sh, + dev->sector, sh, r5c_is_writeback(conf->log)); if (dev->page !=3D dev->orig_page && !r5c_is_writeback(conf->log)) { @@ -1991,8 +1992,6 @@ ops_run_biodrain(struct stripe_head *sh, struct dma_a= sync_tx_descriptor *tx) } } } - - return tx; } =20 static void ops_complete_reconstruct(void *stripe_head_ref) @@ -2043,18 +2042,16 @@ static void ops_complete_reconstruct(void *stripe_h= ead_ref) } =20 static void -ops_run_reconstruct5(struct stripe_head *sh, struct raid5_percpu *percpu, - struct dma_async_tx_descriptor *tx) +ops_run_reconstruct5(struct stripe_head *sh, struct raid5_percpu *percpu) { int disks =3D sh->disks; struct page **xor_srcs; unsigned int *off_srcs; - struct async_submit_ctl submit; int count, pd_idx =3D sh->pd_idx, i; struct page *xor_dest; unsigned int off_dest; + size_t len =3D RAID5_STRIPE_SIZE(sh->raid_conf); int prexor =3D 0; - unsigned long flags; int j =3D 0; struct stripe_head *head_sh =3D sh; int last_stripe; @@ -2113,45 +2110,48 @@ ops_run_reconstruct5(struct stripe_head *sh, struct= raid5_percpu *percpu, last_stripe =3D !head_sh->batch_head || list_first_entry(&sh->batch_list, struct stripe_head, batch_list) =3D=3D head_sh; - if (last_stripe) { - flags =3D ASYNC_TX_ACK | - (prexor ? ASYNC_TX_XOR_DROP_DST : ASYNC_TX_XOR_ZERO_DST); =20 - atomic_inc(&head_sh->count); - init_async_submit(&submit, flags, tx, ops_complete_reconstruct, head_sh, - to_addr_conv(sh, percpu, j)); - } else { - flags =3D prexor ? ASYNC_TX_XOR_DROP_DST : ASYNC_TX_XOR_ZERO_DST; - init_async_submit(&submit, flags, tx, NULL, NULL, - to_addr_conv(sh, percpu, j)); + { + void **ptrs =3D (void **)xor_srcs; + void *dst =3D page_address(xor_dest) + off_dest; + + if (unlikely(count =3D=3D 1)) { + if (prexor) + memcpy(dst, page_address(xor_srcs[0]) + off_srcs[0], len); + else + memcpy(dst, page_address(xor_srcs[0]) + off_srcs[0], len); + } else { + int k; + + for (k =3D 0; k < count; k++) + ptrs[k] =3D page_address(xor_srcs[k]) + off_srcs[k]; + if (!prexor) + memset(dst, 0, len); + xor_gen(dst, ptrs, count, len); + } } =20 - if (unlikely(count =3D=3D 1)) - tx =3D async_memcpy(xor_dest, xor_srcs[0], off_dest, off_srcs[0], - RAID5_STRIPE_SIZE(sh->raid_conf), &submit); - else - tx =3D async_xor_offs(xor_dest, off_dest, xor_srcs, off_srcs, count, - RAID5_STRIPE_SIZE(sh->raid_conf), &submit); if (!last_stripe) { j++; sh =3D list_first_entry(&sh->batch_list, struct stripe_head, batch_list); goto again; } + + atomic_inc(&head_sh->count); + ops_complete_reconstruct(head_sh); } =20 static void -ops_run_reconstruct6(struct stripe_head *sh, struct raid5_percpu *percpu, - struct dma_async_tx_descriptor *tx) +ops_run_reconstruct6(struct stripe_head *sh, struct raid5_percpu *percpu) { - struct async_submit_ctl submit; struct page **blocks; unsigned int *offs; int count, i, j =3D 0; struct stripe_head *head_sh =3D sh; int last_stripe; - int synflags; - unsigned long txflags; + size_t len =3D RAID5_STRIPE_SIZE(sh->raid_conf); + int prexor_mode; =20 pr_debug("%s: stripe %llu\n", __func__, (unsigned long long)sh->sector); =20 @@ -2173,34 +2173,43 @@ ops_run_reconstruct6(struct stripe_head *sh, struct= raid5_percpu *percpu, blocks =3D to_addr_page(percpu, j); offs =3D to_addr_offs(sh, percpu); =20 - if (sh->reconstruct_state =3D=3D reconstruct_state_prexor_drain_run) { - synflags =3D SYNDROME_SRC_WRITTEN; - txflags =3D ASYNC_TX_ACK | ASYNC_TX_PQ_XOR_DST; - } else { - synflags =3D SYNDROME_SRC_ALL; - txflags =3D ASYNC_TX_ACK; - } - - count =3D set_syndrome_sources(blocks, offs, sh, synflags); + prexor_mode =3D (sh->reconstruct_state =3D=3D reconstruct_state_prexor_dr= ain_run); + count =3D set_syndrome_sources(blocks, offs, sh, + prexor_mode ? SYNDROME_SRC_WRITTEN : SYNDROME_SRC_ALL); last_stripe =3D !head_sh->batch_head || list_first_entry(&sh->batch_list, struct stripe_head, batch_list) =3D=3D head_sh; =20 - if (last_stripe) { - atomic_inc(&head_sh->count); - init_async_submit(&submit, txflags, tx, ops_complete_reconstruct, - head_sh, to_addr_conv(sh, percpu, j)); - } else - init_async_submit(&submit, 0, tx, NULL, NULL, - to_addr_conv(sh, percpu, j)); - tx =3D async_gen_syndrome(blocks, offs, count+2, - RAID5_STRIPE_SIZE(sh->raid_conf), &submit); + { + void **ptrs =3D (void **)blocks; + int start =3D -1, stop =3D -1; + + for (i =3D 0; i < count; i++) { + if (blocks[i]) { + if (start < 0) + start =3D i; + stop =3D i; + } + ptrs[i] =3D blocks[i] ? page_address(blocks[i]) + offs[i] : NULL; + } + ptrs[count] =3D blocks[count] ? page_address(blocks[count]) + offs= [count] : NULL; + ptrs[count+1] =3D blocks[count+1] ? page_address(blocks[count+1]) + offs= [count+1] : NULL; + + if (prexor_mode && start >=3D 0 && raid6_can_xor_syndrome()) + raid6_xor_syndrome(count+2, start, stop, len, ptrs); + else + raid6_gen_syndrome(count+2, len, ptrs); + } + if (!last_stripe) { j++; sh =3D list_first_entry(&sh->batch_list, struct stripe_head, batch_list); goto again; } + + atomic_inc(&head_sh->count); + ops_complete_reconstruct(head_sh); } =20 static void ops_complete_check(void *stripe_head_ref) @@ -2224,8 +2233,8 @@ static void ops_run_check_p(struct stripe_head *sh, s= truct raid5_percpu *percpu) unsigned int off_dest; struct page **xor_srcs =3D to_addr_page(percpu, 0); unsigned int *off_srcs =3D to_addr_offs(sh, percpu); - struct dma_async_tx_descriptor *tx; - struct async_submit_ctl submit; + void **ptrs =3D (void **)xor_srcs; + size_t len =3D RAID5_STRIPE_SIZE(sh->raid_conf); int count; int i; =20 @@ -2245,23 +2254,27 @@ static void ops_run_check_p(struct stripe_head *sh,= struct raid5_percpu *percpu) xor_srcs[count++] =3D sh->dev[i].page; } =20 - init_async_submit(&submit, 0, NULL, NULL, NULL, - to_addr_conv(sh, percpu, 0)); - tx =3D async_xor_val_offs(xor_dest, off_dest, xor_srcs, off_srcs, count, - RAID5_STRIPE_SIZE(sh->raid_conf), - &sh->ops.zero_sum_result, &submit); + /* XOR_DROP_DST: xor_dest is ptrs[0]; xor_gen computes + * xor_dest ^=3D xor_dest ^ data0 ^ data1 ^ ... =3D data XOR. + * Then check whether the result is zero. */ + for (i =3D 0; i < count; i++) + ptrs[i] =3D page_address(xor_srcs[i]) + off_srcs[i]; + xor_gen(page_address(xor_dest) + off_dest, ptrs, count, len); + sh->ops.zero_sum_result =3D + !!memchr_inv(page_address(xor_dest) + off_dest, 0, len) << SUM_CHECK_P; =20 atomic_inc(&sh->count); - init_async_submit(&submit, ASYNC_TX_ACK, tx, ops_complete_check, sh, NULL= ); - tx =3D async_trigger_callback(&submit); + ops_complete_check(sh); } =20 static void ops_run_check_pq(struct stripe_head *sh, struct raid5_percpu *= percpu, int checkp) { struct page **srcs =3D to_addr_page(percpu, 0); unsigned int *offs =3D to_addr_offs(sh, percpu); - struct async_submit_ctl submit; - int count; + size_t len =3D RAID5_STRIPE_SIZE(sh->raid_conf); + struct page *spare =3D percpu->spare_page; + void **ptrs =3D (void **)srcs; + int count, i; =20 pr_debug("%s: stripe %llu checkp: %d\n", __func__, (unsigned long long)sh->sector, checkp); @@ -2271,18 +2284,52 @@ static void ops_run_check_pq(struct stripe_head *sh= , struct raid5_percpu *percpu if (!checkp) srcs[count] =3D NULL; =20 + sh->ops.zero_sum_result =3D 0; atomic_inc(&sh->count); - init_async_submit(&submit, ASYNC_TX_ACK, NULL, ops_complete_check, - sh, to_addr_conv(sh, percpu, 0)); - async_syndrome_val(srcs, offs, count+2, - RAID5_STRIPE_SIZE(sh->raid_conf), - &sh->ops.zero_sum_result, percpu->spare_page, 0, &submit); + + if (srcs[count]) { + /* Check P: XOR all data into spare, compare with P. */ + int xcnt =3D 0; + void *s =3D page_address(spare); + struct page *p_src =3D srcs[count]; + unsigned int p_off =3D offs[count]; + + for (i =3D 0; i < count; i++) { + if (srcs[i]) + ptrs[xcnt++] =3D page_address(srcs[i]) + offs[i]; + } + memset(s, 0, len); + if (xcnt) + xor_gen(s, ptrs, xcnt, len); + sh->ops.zero_sum_result |=3D + !!memcmp(page_address(p_src) + p_off, s, len) << SUM_CHECK_P; + } + + if (srcs[count+1]) { + /* Check Q: recompute syndrome, compare with Q. */ + struct page *q_src =3D srcs[count+1]; + unsigned int q_off =3D offs[count+1]; + void *s =3D page_address(spare); + + /* Re-populate srcs for Q-only syndrome computation. */ + count =3D set_syndrome_sources(srcs, offs, sh, SYNDROME_SRC_ALL); + srcs[count] =3D NULL; /* skip P regen */ + srcs[count+1] =3D spare; + offs[count+1] =3D 0; + for (i =3D 0; i <=3D count+1; i++) { + ptrs[i] =3D srcs[i] ? page_address(srcs[i]) + offs[i] : NULL; + } + raid6_gen_syndrome(count+2, len, ptrs); + sh->ops.zero_sum_result |=3D + !!memcmp(page_address(q_src) + q_off, s, len) << SUM_CHECK_Q; + } + + ops_complete_check(sh); } =20 static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request) { int overlap_clear =3D 0, i, disks =3D sh->disks; - struct dma_async_tx_descriptor *tx =3D NULL; struct r5conf *conf =3D sh->raid_conf; int level =3D conf->level; struct raid5_percpu *percpu; @@ -2296,38 +2343,35 @@ static void raid_run_ops(struct stripe_head *sh, un= signed long ops_request) =20 if (test_bit(STRIPE_OP_COMPUTE_BLK, &ops_request)) { if (level < 6) - tx =3D ops_run_compute5(sh, percpu); + ops_run_compute5(sh, percpu); else { if (sh->ops.target2 < 0 || sh->ops.target < 0) - tx =3D ops_run_compute6_1(sh, percpu); + ops_run_compute6_1(sh, percpu); else - tx =3D ops_run_compute6_2(sh, percpu); + ops_run_compute6_2(sh, percpu); } - /* terminate the chain if reconstruct is not set to be run */ - if (tx && !test_bit(STRIPE_OP_RECONSTRUCT, &ops_request)) - async_tx_ack(tx); } =20 if (test_bit(STRIPE_OP_PREXOR, &ops_request)) { if (level < 6) - tx =3D ops_run_prexor5(sh, percpu, tx); + ops_run_prexor5(sh, percpu); else - tx =3D ops_run_prexor6(sh, percpu, tx); + ops_run_prexor6(sh, percpu); } =20 if (test_bit(STRIPE_OP_PARTIAL_PARITY, &ops_request)) - tx =3D ops_run_partial_parity(sh, percpu, tx); + ops_run_partial_parity(sh, percpu); =20 if (test_bit(STRIPE_OP_BIODRAIN, &ops_request)) { - tx =3D ops_run_biodrain(sh, tx); + ops_run_biodrain(sh); overlap_clear++; } =20 if (test_bit(STRIPE_OP_RECONSTRUCT, &ops_request)) { if (level < 6) - ops_run_reconstruct5(sh, percpu, tx); + ops_run_reconstruct5(sh, percpu); else - ops_run_reconstruct6(sh, percpu, tx); + ops_run_reconstruct6(sh, percpu); } =20 if (test_bit(STRIPE_OP_CHECK, &ops_request)) { @@ -2455,8 +2499,7 @@ static int grow_stripes(struct r5conf *conf, int num) * * The scribble buffer size must be enough to contain: * 1/ a struct page pointer for each device in the array +2 - * 2/ room to convert each entry in (1) to its corresponding dma - * (dma_map_page()) or page (page_address()) address. + * 2/ an unsigned int offset for each entry in (1) * * Note: the +2 is for the destination buffers of the ddf/raid6 case where= we * calculate over all devices (not just the data blocks), using zeros in p= lace @@ -2467,7 +2510,6 @@ static int scribble_alloc(struct raid5_percpu *percpu, { size_t obj_size =3D sizeof(struct page *) * (num + 2) + - sizeof(addr_conv_t) * (num + 2) + sizeof(unsigned int) * (num + 2); void *scribble; =20 @@ -4629,14 +4671,12 @@ static void handle_stripe_expansion(struct r5conf *= conf, struct stripe_head *sh) /* We have read all the blocks in this stripe and now we need to * copy some of them into a target stripe for expand. */ - struct dma_async_tx_descriptor *tx =3D NULL; BUG_ON(sh->batch_head); clear_bit(STRIPE_EXPAND_SOURCE, &sh->state); for (i =3D 0; i < sh->disks; i++) if (i !=3D sh->pd_idx && i !=3D sh->qd_idx) { int dd_idx, j; struct stripe_head *sh2; - struct async_submit_ctl submit; =20 sector_t bn =3D raid5_compute_blocknr(sh, i, 1); sector_t s =3D raid5_compute_sector(conf, bn, 0, @@ -4656,12 +4696,9 @@ static void handle_stripe_expansion(struct r5conf *c= onf, struct stripe_head *sh) continue; } =20 - /* place all the copies on one channel */ - init_async_submit(&submit, 0, tx, NULL, NULL, NULL); - tx =3D async_memcpy(sh2->dev[dd_idx].page, - sh->dev[i].page, sh2->dev[dd_idx].offset, - sh->dev[i].offset, RAID5_STRIPE_SIZE(conf), - &submit); + memcpy(page_address(sh2->dev[dd_idx].page) + sh2->dev[dd_idx].offset, + page_address(sh->dev[i].page) + sh->dev[i].offset, + RAID5_STRIPE_SIZE(conf)); =20 set_bit(R5_Expanded, &sh2->dev[dd_idx].flags); set_bit(R5_UPTODATE, &sh2->dev[dd_idx].flags); @@ -4677,8 +4714,6 @@ static void handle_stripe_expansion(struct r5conf *co= nf, struct stripe_head *sh) raid5_release_stripe(sh2); =20 } - /* done submitting copies, wait for them to complete */ - async_tx_quiesce(&tx); } =20 static void analyse_stripe(struct stripe_head *sh, struct stripe_head_stat= e *s) @@ -6917,7 +6952,6 @@ static void raid5_do_work(struct work_struct *work) =20 r5l_flush_stripe_to_raid(conf->log); =20 - async_tx_issue_pending_all(); blk_finish_plug(&plug); =20 pr_debug("--- raid5worker inactive\n"); @@ -7011,7 +7045,6 @@ static void raid5d(struct md_thread *thread) =20 r5l_flush_stripe_to_raid(conf->log); =20 - async_tx_issue_pending_all(); blk_finish_plug(&plug); =20 pr_debug("--- raid5d inactive\n"); --=20 2.43.0 From nobody Fri Oct 23 03:31:41 2026 Received: from OSPPR02CU001.outbound.protection.outlook.com (mail-norwayeastazon11013043.outbound.protection.outlook.com [40.107.159.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0F11541462; Thu, 15 Oct 2026 19:23:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.159.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792092203; cv=fail; b=Oy7ZiaEVnHzT1DtaCuJdmrrdA++ZcZEduX+AbWA09Jxkgcf2TUL6cE4Irr/lDketaUBQPqDDxixU1UKW1/twPhPgGc7+yBbQNZXi9taNiBgUZAKIdOA35uYHP7i+aRFU/RUAS4FcdNJ/AjJkJZbEeskR7QNKRdnC9Q39c4XLapA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792092203; c=relaxed/simple; bh=XLTcWVjsvOa9a17R/uLDmbhCbmU+hF/PSet+N4h0cMM=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=APjqF8iEN144VVvZQEu0g1uU7pUMfvdtkTsmGiv+HMEairkQOa1O8o3ZoyOGAFyfsLVUmamjsUVVpp/eOGiX7JP5P0Xod5hlrJeE0lymkvmRukymVJuFZVz+tyn3OJn+pMgNt7ns1jnOw8YdI5jAuiGrfh3jUayo205T4B9cuzs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=LosdO1dY; arc=fail smtp.client-ip=40.107.159.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="LosdO1dY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fYYGPXA1NGeBR25bjCIaje+YrmKnC8454+EA2gZwI4QtQR3wErAtzZqeglE01d3VZsLAn2XD4le2g3FG+gk8YhjYCb8ADfVcOZKJcmbHpfwVt3BMfhmSTHNSZe2jMxjstGFPZZdEkCjLpYJoCy9GFWW+5uTcnoms4DlfJcEfNvXV8tq3w4QJ3nE5qRAt3kLfE4yBDgysuRGfeRM7CdCu9xlKvtvZ/ib5PPpGNr4Xk9UC3kqZJAJH1m22I/mMVHF/8ii3CnuvmUcxnjnQxlhgs2MtFNwF4Bx7Thr+WVwBfGgL5qBfQMtOYMMydJleZQCfYkz7TKDU2JxK9mP7utjBtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CTEjxMzI2/15/sPnGJr4tR/A6TcZPcw6oDOLKmmyFdE=; b=zPzXo5yLTogah8d6AWWIa2R9coA8fWFfozZ1HVO5JRywqK/1vRHQ4/LLVL+W7HGYvp/VPtF0rTvqHEvkgT0f/pc4UM4seENUGfhfjNKmREmGd9D2m0FNi85dVmQYQiwJp6zbtfDJSrOdf8cgX5jH2VhChmFOFDhH5cSl21sZReXpQ8nIB0X/nq6yCUHGoMhMpIKAFhsCTvz73JzJQAeCv0w3Ce5w8zWiZ7odN/ulHaNsOut2jezlK6vF2mGYox3CB6fqKuWhq9fTTP10pNCE+9fFw16jqDGVc6Tp2+S3LT3mycocSUQ0UREiJoqAIJThguXG+w4MfsofrnsIaY8kjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CTEjxMzI2/15/sPnGJr4tR/A6TcZPcw6oDOLKmmyFdE=; b=LosdO1dY7iNzRlATZImd0k9X7OgLEyBP5YQF2oe5cBIUpCSPIlmPluy33igOp5Z/pmJFWzV7cGbiq96rkMxIR9Tuxz+X96bs6/E9UjnbPryKBLtRX54vT2gshzU+TiSyFIkRb5cKxK5Xonu6/hTI/2mG9jVSv7o2d6kiBMtePBvluFn2UVk5gEz/tLj55xAzHKOCYXM0BYoPUBBBT2DTwX5JjcQeeZn3pMA0w+mfCCoDt3Y4zbIeQMfIEOfrreqv4e8WM3seRtiMGTbt06NKV8D5rQovuP4vfjGiqj90mzzkxCjkMNsDR8/set0mT3fpy39qaC2XMgBVh/zQzYXogA== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from GV2PR04MB11799.eurprd04.prod.outlook.com (2603:10a6:150:2cf::9) by MIWPR04MB358405.eurprd04.prod.outlook.com (2603:10a6:290:ab::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.522.14; Thu, 15 Oct 2026 19:23:14 +0000 Received: from GV2PR04MB11799.eurprd04.prod.outlook.com ([fe80::2146:83a2:5329:b7c]) by GV2PR04MB11799.eurprd04.prod.outlook.com ([fe80::2146:83a2:5329:b7c%7]) with mapi id 15.21.0522.012; Thu, 15 Oct 2026 19:23:14 +0000 From: Frank.Li@oss.nxp.com Date: Thu, 15 Oct 2026 15:22:28 -0400 Subject: [PATCH RFC 4/4] crypto: remove async_tx framework Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261015-asycn_tx_remove-v1-4-056a7085e0a1@nxp.com> References: <20261015-asycn_tx_remove-v1-0-056a7085e0a1@nxp.com> In-Reply-To: <20261015-asycn_tx_remove-v1-0-056a7085e0a1@nxp.com> To: Alasdair Kergon , Mike Snitzer , Mikulas Patocka , Benjamin Marzinski , Song Liu , Yu Kuai , Li Nan , Xiao Ni , Dan Williams , Herbert Xu , "David S. Miller" , Jonathan Corbet , Shuah Khan , Randy Dunlap Cc: 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 , Saeed Bishara , Rameshwar Prasad Sahu , Thomas Petazzoni , Anup Patel , Frank Li X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792092167; l=84221; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=ELsS2I4hM860aINwZBRmqACopefjhFizPD/qjs3JO58=; b=+Gna87FTpJNuSqKDjJe5DT5H/8cyDuB5mAath/0C2SWLJOBVn1xBIF7G0A0lBgosuS+YHCAHG pznWnRfIsonC9NVricI+d4X1kY7h2magb+boyLZV0xmUwoEFfbb/8cF X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0041.namprd05.prod.outlook.com (2603:10b6:a03:33f::16) To GV2PR04MB11799.eurprd04.prod.outlook.com (2603:10a6:150:2cf::9) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV2PR04MB11799:EE_|MIWPR04MB358405:EE_ X-MS-Office365-Filtering-Correlation-Id: 3bae8351-2d81-41f1-18ba-08df2af1c1f4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|19092799006|1800799024|23010399003|366016|6133799003|18002099003|22082099003|10067099003|3023799007|921020|11063799006|261009223027099003|56012099006; X-Microsoft-Antispam-Message-Info: mVzTTJHZFUWcJGKEru7X00/hCJKbJq20aHFKJO64AsaakE2Mj3kCn9D4yJsr8bs41tf6ZWPg8vlG5W0Cy/9TOmMWMaUqN87Re/dvG6Pra2OZVzZ7pYUPI3UXS1FXS5cPlPIO4qdIhphxHOhZWxhT2kVwpEGQNt7dTs8isjfOVm2tXPO0xq4hFwzPjjsshtPF3PTOAiTACPYRT2MTWqkp3+qL+RhFQnv5yWHQjYBNwhkQOhxw5NMG/SHIRl+H7SWbZp8PvnOkYG0+iucSgmn+jySrDGuKWfcXx1X2TvTFTpjItQdoV+0+B9Ob4nJ1ledxrdAe725jMaMcHpP0tArKGJkDyMhD25/fpqB2gTDjUt7nF9BTllFjoHhb8iuKUrPkkvKQ4B91jG+mJ766y7OwSkl7Mwjve9JvjE5qhWgdrvsyOzJDZBwH+I9slx0JhGRQjG3Pns9FX/VmpRMqTlnFmdfKRsIh2PuK93iTbf+8dl5UOmtceDE/kfAnRF3ppsSclIgsCMeiOvKfe5wmtOsTdKQOh8hIRfXlNSgzsyCGShwIxxKvVhNFCc/X7ZA3XH/pdkb4w1AaViqZQVUJVhXOiKgdgXMiXcrGPmWNbXCJDGn/CS+V0DdmsaDW2RJN+65udgs/LY7jkGpaMrK0Yf7m4qXASXpyomz4ptYyWjnzbXG9UXVl0bzHyzSdFWtOBDnW/cX1aSZ7Je6Q04Ql+mUyCg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV2PR04MB11799.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(19092799006)(1800799024)(23010399003)(366016)(6133799003)(18002099003)(22082099003)(10067099003)(3023799007)(921020)(11063799006)(261009223027099003)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?V2dYb0FGNzBiMVVvakdZSW5DV3RoQ0dISW9CVE9mQ2syY20wd3RCNENUKzd6?= =?utf-8?B?Qmh4SDVIL0ZlRk5ielc1ZXpZUkJKQTVVNWFsL3VsN1JMSFdwKzdHdDVHQmNa?= =?utf-8?B?dEVWZE8zaHU2MGNmejZDZW9KYVpIdUYxdUt2N0UwQjBmVmVpZklGRm42a2xp?= =?utf-8?B?SXVZcURQVE1WbFlGY2RKemZOTEJRV0RKd1pUaktDZ3pCeXVzWXIxYmhEbkJm?= =?utf-8?B?RDhBMjV1R1ZlaTNRMjVMZWpKU3NUd2lHajVLTzl0SUFJZ3hTelppSEJhMmY4?= =?utf-8?B?Zzduak1lTlRyNUJ3dnpGMlo0OTFySmpxSVAwTHZPOUd4TGJGSXVhT0RuSFA3?= =?utf-8?B?ZFYvcjdjR3dlMWRHRzhwV2hsWmpjT09RRHNxcjdlZ0RkUUR1QWI2NEQ3VStV?= =?utf-8?B?Um1LT1lwb3lNQW0xUTFJQ2V2ZVVjaXJzVjlIM2V6OWxHWVJvdXF6NHJkeTlC?= =?utf-8?B?THp5TU1mbGttMWpkRXFBOXZseU9ub2cvYjFqdUhwK2ZXSVlDeXMrSStLSXdy?= =?utf-8?B?SnhXa1JCRXdjVVFzTjNxRk0wUk8wcVN3d1ZkaFdFRGk3NC9XTThOQThUdjAw?= =?utf-8?B?eDFaRmIzcUljT0FEekRvdkZDc3FJTVdUSmdqNlNhSHRBdVAzZzBhQzUrUHoy?= =?utf-8?B?NElJYzRpQVFuVTFCSk8zdDJxemN2eHVFdy9rQ2NVVy9BM3YvNWtkZDV2Z3Bh?= =?utf-8?B?WENoVmI3S3RodnJnSzVpcnlGbUxrQkNEYjNPbng4eDloK0J6SisyWkxUM2px?= =?utf-8?B?WXYyZlF0TGZXd1FsRVQvVThkWTN5aVFvaEpiV2RjUHhjRGRBL3R3N3EyN2Zj?= =?utf-8?B?NFV4ZmJZeWVoNWVZeUtwLzBFTUpnUWhUWVBGaUxnbk9JcHVNQjB4UWNTcG5Q?= =?utf-8?B?MHBqclZnTDRWczJSZUd2V2NuK084V3lUMTVQYnd5MTlnaVRqOVByWnV0SUYv?= =?utf-8?B?aTIzc3ZHUnZDblFzTUxQY0gzQlFvS0llWDkrQVA4OWZjcFVXZTVJZFdhMUlL?= =?utf-8?B?MzhySExkR215cmxqWFVuZzlidnE4WWg4S2FqWThvU1MzOHhpcDF2OUl4NW9T?= =?utf-8?B?Vjg3dG8xRTBybWFVMVdjQzFvTmNUakZtcFlZOHJvVjFEckVjVmYwNk5aSCsr?= =?utf-8?B?WENiQzFwMHVNbmRyTlRDY0ttaTRob055R0ROUmJaN2xmL2VKUEpWNGNVMHJv?= =?utf-8?B?ZjJ2QWFRZTR4TU9XZ3daRk1EZEtONnFMR2NlZmtGNVZHMitZbS9wU1BUYXI1?= =?utf-8?B?RzNiR0hVTTVpWWovT1R3UFBmM003ZjRHKzN2NlpNblQyNWdBc3orRlh0SFBy?= =?utf-8?B?Z1dFa3JBMDRCNzNXeXNBbG9ZTU95K2xrNkxwZUJCbWpBQXVGWVRtUFNFZVdY?= =?utf-8?B?ZGdyZlB2TXRMZFF1RHZNYUhtS3ErMUgyRE9mZG9ZMGJTcmpsWWVOcVByWXFq?= =?utf-8?B?VXlwY3RrRnlUZkplYVpaOVVLZkp5SEhScTdvdDNZMnU5eHhHYVhDY09FT1Vx?= =?utf-8?B?UlZoRmtuVGJyQndSYUFXTElKUk1vUDR1MzVxWGdCSzVMVmlLTlo3VnhxL0RD?= =?utf-8?B?cEJoeTFKbklqazdBZHp4dHQwWnJxTmhHV0U5cHp5cEh2M0hNenZVSnhxYTli?= =?utf-8?B?K1JJczVqUnQ5ejNiY2N0ektGdEtJakxsazlaQ1JwTmc2M2VuTUdLRGFyV09M?= =?utf-8?B?M3o5dUpvaXpyOUlWeGZmRmMyTjk5K3lzbVQybUptenBNdkZ1LzFiOVZJbjRz?= =?utf-8?B?Nmc3Z2lLeVdjQXd3M3NuLzRuaGUwTlR5V2dhQko2OGtEYnVjbmQ3aUw4ZENS?= =?utf-8?B?UGZndmVjcVRxTVA0Y1pyZkJwZU9oUDRtTEdmbUlISXVIdERMTjIyMnFmV01F?= =?utf-8?B?QkMzNjN5cHdqUER5bW02c092RXdFMzF5NWxnQTJWMEZJZmkvVXZMN0loYzhw?= =?utf-8?B?RVhuVi9hdGI1UndRLzB0VjRVVE4vSTRtUzRvQk5kcElZUTgrby9XTmpTdk9S?= =?utf-8?B?VmUvemRZZzJEYWE4SDVNWkhKNWY1THlPNFZDejg2N2szb0srRGdXVk0vWTRU?= =?utf-8?B?UU9Iakxybjhjbi9qSnUrVXljUldIbUJJN2R5b3RzOTQyQnRvV2VqZmFNc2tD?= =?utf-8?B?R1BiNmdjWTdpV2JxdjNIMEFJeGp2SDhodEZUU2UvK3VrbFRFOG1XK2RNWEZT?= =?utf-8?B?bDZDTkJYLzJOUW9WQjNjbzU2Rmo0Rnl6V1RtdGdJWHc2cVJwSDN2L1BTVE41?= =?utf-8?B?WjFpL0FTaFJXYW1xcXluQnhJU1BpL2R4dmIvQmhiK0ltbUxiRWFpcHVhNEts?= =?utf-8?B?eXNPdUlpcnhIL2d2UFpuaVVsU3FDTWpPU0pwb3puc3dHa0VBSEN4Z3BSL0Vq?= =?utf-8?Q?nDsD9NIYxzqMwzr+J45k/SPM2kjuH3cjBuIPR?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3bae8351-2d81-41f1-18ba-08df2af1c1f4 X-MS-Exchange-CrossTenant-AuthSource: GV2PR04MB11799.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2026 19:23:14.4172 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tpL2LdXSqplDOXIMCnjjQXqxdqrqnnlFgaXjrbCm3pYMH7ondeCqtwHF90/VUeT6Y5BMWUdRdQ3FpPK+RT/NpBpbmdwdOs2oynCsZwuOXFVbvbMDjRZ8K1keifhC84P0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MIWPR04MB358405 From: Frank Li Remove the async_tx API and all associated files now that the last consumer (md/raid5) has been converted to synchronous operations: Signed-off-by: Frank Li --- 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(-) diff --git a/Documentation/crypto/async-tx-api.rst b/Documentation/crypto/a= sync-tx-api.rst deleted file mode 100644 index 49fcfc66314ac..0000000000000 --- a/Documentation/crypto/async-tx-api.rst +++ /dev/null @@ -1,270 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0 - -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D -Asynchronous Transfers/Transforms API -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - -.. 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 -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - -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 -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - -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 -=3D=3D=3D=3D=3D=3D=3D=3D - -3.1 General format of the API ------------------------------ - -:: - - struct dma_async_tx_descriptor * - async_(, struct async_submit_ctl *sub= mit) - -3.2 Supported operations ------------------------- - -=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D -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 serie= s 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 -=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D - -3.3 Descriptor management -------------------------- - -The return value is non-NULL and points to a 'descriptor' when the operati= on -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 recy= cled -before the dependency is submitted. This requires that all descriptors be -acknowledged by the application before the offload engine driver is allowe= d 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_ 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_, 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_ 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 - - 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 =3D async_xor(xor_dest, xor_srcs, 0, NDISKS, xor_len, &submit); - - submit.depend_tx =3D tx; - tx =3D 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 =3D 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 -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D - -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 diff --git a/Documentation/crypto/index.rst b/Documentation/crypto/index.rst index 705f186d662ba..7cd3b0281963d 100644 --- a/Documentation/crypto/index.rst +++ b/Documentation/crypto/index.rst @@ -18,7 +18,6 @@ for cryptographic use cases, as well as programming examp= les. api-intro architecture =20 - async-tx-api asymmetric-keys devel-algos userspace-if diff --git a/crypto/Kconfig b/crypto/Kconfig index 981d5dc422d4c..e1570f8cbc1be 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -3,11 +3,6 @@ # Generic algorithms support # =20 -# -# async_tx api: hardware offloaded memory transfer/transform support -# -source "crypto/async_tx/Kconfig" - # # Cryptographic API Configuration # diff --git a/crypto/Makefile b/crypto/Makefile index 33bb5ad595e8f..4a6fe43c3d22f 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -188,10 +188,6 @@ ecrdsa_generic-y +=3D ecrdsa_params.asn1.o ecrdsa_generic-y +=3D ecrdsa_pub_key.asn1.o obj-$(CONFIG_CRYPTO_ECRDSA) +=3D ecrdsa_generic.o =20 -# -# generic algorithms and the async_tx api -# -obj-$(CONFIG_ASYNC_CORE) +=3D async_tx/ obj-$(CONFIG_ASYMMETRIC_KEY_TYPE) +=3D asymmetric_keys/ crypto_simd-y :=3D simd.o obj-$(CONFIG_CRYPTO_SIMD) +=3D crypto_simd.o diff --git a/crypto/async_tx/Kconfig b/crypto/async_tx/Kconfig deleted file mode 100644 index 89bafa2efc300..0000000000000 --- a/crypto/async_tx/Kconfig +++ /dev/null @@ -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 diff --git a/crypto/async_tx/Makefile b/crypto/async_tx/Makefile deleted file mode 100644 index 056e482453730..0000000000000 --- a/crypto/async_tx/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_ASYNC_CORE) +=3D async_tx.o -obj-$(CONFIG_ASYNC_MEMCPY) +=3D async_memcpy.o -obj-$(CONFIG_ASYNC_XOR) +=3D async_xor.o -obj-$(CONFIG_ASYNC_PQ) +=3D async_pq.o -obj-$(CONFIG_ASYNC_RAID6_RECOV) +=3D async_raid6_recov.o -obj-$(CONFIG_ASYNC_RAID6_TEST) +=3D raid6test.o diff --git a/crypto/async_tx/async_memcpy.c b/crypto/async_tx/async_memcpy.c deleted file mode 100644 index c538e30e99094..0000000000000 --- a/crypto/async_tx/async_memcpy.c +++ /dev/null @@ -1,97 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * copy offload engine support - * - * Copyright =C2=A9 2006, Intel Corporation. - * - * Dan Williams - * - * with architecture considerations by: - * Neil Brown - * Jeff Garzik - */ -#include -#include -#include -#include -#include -#include - -/** - * async_memcpy - attempt to copy memory with a dma engine. - * @dest: destination page - * @src: src page - * @dest_offset: offset into 'dest' to start transaction - * @src_offset: offset into 'src' to start transaction - * @len: length in bytes - * @submit: submission / completion modifiers - * - * honored flags: ASYNC_TX_ACK - */ -struct dma_async_tx_descriptor * -async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset, - unsigned int src_offset, size_t len, - struct async_submit_ctl *submit) -{ - struct dma_chan *chan =3D async_tx_find_channel(submit, DMA_MEMCPY, - &dest, 1, &src, 1, len); - struct dma_device *device =3D chan ? chan->device : NULL; - struct dma_async_tx_descriptor *tx =3D NULL; - struct dmaengine_unmap_data *unmap =3D NULL; - - if (device) - unmap =3D dmaengine_get_unmap_data(device->dev, 2, GFP_NOWAIT); - - if (unmap && is_dma_copy_aligned(device, src_offset, dest_offset, len)) { - unsigned long dma_prep_flags =3D 0; - - if (submit->cb_fn) - dma_prep_flags |=3D DMA_PREP_INTERRUPT; - if (submit->flags & ASYNC_TX_FENCE) - dma_prep_flags |=3D DMA_PREP_FENCE; - - unmap->to_cnt =3D 1; - unmap->addr[0] =3D dma_map_page(device->dev, src, src_offset, len, - DMA_TO_DEVICE); - unmap->from_cnt =3D 1; - unmap->addr[1] =3D dma_map_page(device->dev, dest, dest_offset, len, - DMA_FROM_DEVICE); - unmap->len =3D len; - - tx =3D device->device_prep_dma_memcpy(chan, unmap->addr[1], - unmap->addr[0], len, - dma_prep_flags); - } - - if (tx) { - pr_debug("%s: (async) len: %zu\n", __func__, len); - - dma_set_unmap(tx, unmap); - async_tx_submit(chan, tx, submit); - } else { - void *dest_buf, *src_buf; - pr_debug("%s: (sync) len: %zu\n", __func__, len); - - /* wait for any prerequisite operations */ - async_tx_quiesce(&submit->depend_tx); - - dest_buf =3D kmap_atomic(dest) + dest_offset; - src_buf =3D kmap_atomic(src) + src_offset; - - memcpy(dest_buf, src_buf, len); - - kunmap_atomic(src_buf); - kunmap_atomic(dest_buf); - - async_tx_sync_epilog(submit); - } - - dmaengine_unmap_put(unmap); - - return tx; -} -EXPORT_SYMBOL_GPL(async_memcpy); - -MODULE_AUTHOR("Intel Corporation"); -MODULE_DESCRIPTION("asynchronous memcpy api"); -MODULE_LICENSE("GPL"); diff --git a/crypto/async_tx/async_pq.c b/crypto/async_tx/async_pq.c deleted file mode 100644 index 27f99349e310b..0000000000000 --- a/crypto/async_tx/async_pq.c +++ /dev/null @@ -1,464 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Copyright(c) 2007 Yuri Tikhonov - * Copyright(c) 2009 Intel Corporation - */ -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * struct pq_scribble_page - space to hold throwaway P or Q buffer for - * synchronous gen_syndrome - */ -static struct page *pq_scribble_page; - -/* the struct page *blocks[] parameter passed to async_gen_syndrome() - * and async_syndrome_val() contains the 'P' destination address at - * blocks[disks-2] and the 'Q' destination address at blocks[disks-1] - * - * note: these are macros as they are used as lvalues - */ -#define P(b, d) (b[d-2]) -#define Q(b, d) (b[d-1]) - -#define MAX_DISKS 255 - -/* - * do_async_gen_syndrome - asynchronously calculate P and/or Q - */ -static __async_inline struct dma_async_tx_descriptor * -do_async_gen_syndrome(struct dma_chan *chan, - const unsigned char *scfs, int disks, - struct dmaengine_unmap_data *unmap, - enum dma_ctrl_flags dma_flags, - struct async_submit_ctl *submit) -{ - struct dma_async_tx_descriptor *tx =3D NULL; - struct dma_device *dma =3D chan->device; - enum async_tx_flags flags_orig =3D submit->flags; - dma_async_tx_callback cb_fn_orig =3D submit->cb_fn; - dma_async_tx_callback cb_param_orig =3D submit->cb_param; - int src_cnt =3D disks - 2; - unsigned short pq_src_cnt; - dma_addr_t dma_dest[2]; - int src_off =3D 0; - - while (src_cnt > 0) { - submit->flags =3D flags_orig; - pq_src_cnt =3D min(src_cnt, dma_maxpq(dma, dma_flags)); - /* if we are submitting additional pqs, leave the chain open, - * clear the callback parameters, and leave the destination - * buffers mapped - */ - if (src_cnt > pq_src_cnt) { - submit->flags &=3D ~ASYNC_TX_ACK; - submit->flags |=3D ASYNC_TX_FENCE; - submit->cb_fn =3D NULL; - submit->cb_param =3D NULL; - } else { - submit->cb_fn =3D cb_fn_orig; - submit->cb_param =3D cb_param_orig; - if (cb_fn_orig) - dma_flags |=3D DMA_PREP_INTERRUPT; - } - if (submit->flags & ASYNC_TX_FENCE) - dma_flags |=3D DMA_PREP_FENCE; - - /* Drivers force forward progress in case they can not provide - * a descriptor - */ - for (;;) { - dma_dest[0] =3D unmap->addr[disks - 2]; - dma_dest[1] =3D unmap->addr[disks - 1]; - tx =3D dma->device_prep_dma_pq(chan, dma_dest, - &unmap->addr[src_off], - pq_src_cnt, - &scfs[src_off], unmap->len, - dma_flags); - if (likely(tx)) - break; - async_tx_quiesce(&submit->depend_tx); - dma_async_issue_pending(chan); - } - - dma_set_unmap(tx, unmap); - async_tx_submit(chan, tx, submit); - submit->depend_tx =3D tx; - - /* drop completed sources */ - src_cnt -=3D pq_src_cnt; - src_off +=3D pq_src_cnt; - - dma_flags |=3D DMA_PREP_CONTINUE; - } - - return tx; -} - -/* - * do_sync_gen_syndrome - synchronously calculate a raid6 syndrome - */ -static void -do_sync_gen_syndrome(struct page **blocks, unsigned int *offsets, int disk= s, - size_t len, struct async_submit_ctl *submit) -{ - void **srcs; - int i; - int start =3D -1, stop =3D disks - 3; - - if (submit->scribble) - srcs =3D submit->scribble; - else - srcs =3D (void **) blocks; - - for (i =3D 0; i < disks; i++) { - if (blocks[i] =3D=3D NULL) { - BUG_ON(i > disks - 3); /* P or Q can't be zero */ - srcs[i] =3D page_address(ZERO_PAGE(0)); - } else { - srcs[i] =3D page_address(blocks[i]) + offsets[i]; - - if (i < disks - 2) { - stop =3D i; - if (start =3D=3D -1) - start =3D i; - } - } - } - if (submit->flags & ASYNC_TX_PQ_XOR_DST) { - BUG_ON(!raid6_can_xor_syndrome()); - if (start >=3D 0) - raid6_xor_syndrome(disks, start, stop, len, srcs); - } else - raid6_gen_syndrome(disks, len, srcs); - async_tx_sync_epilog(submit); -} - -static inline bool -is_dma_pq_aligned_offs(struct dma_device *dev, unsigned int *offs, - int src_cnt, size_t len) -{ - int i; - - for (i =3D 0; i < src_cnt; i++) { - if (!is_dma_pq_aligned(dev, offs[i], 0, len)) - return false; - } - return true; -} - -/** - * async_gen_syndrome - asynchronously calculate a raid6 syndrome - * @blocks: source blocks from idx 0..disks-3, P @ disks-2 and Q @ disks-1 - * @offsets: offset array into each block (src and dest) to start transact= ion - * @disks: number of blocks (including missing P or Q, see below) - * @len: length of operation in bytes - * @submit: submission/completion modifiers - * - * General note: This routine assumes a field of GF(2^8) with a - * primitive polynomial of 0x11d and a generator of {02}. - * - * 'disks' note: callers can optionally omit either P or Q (but not - * both) from the calculation by setting blocks[disks-2] or - * blocks[disks-1] to NULL. When P or Q is omitted 'len' must be <=3D - * PAGE_SIZE as a temporary buffer of this size is used in the - * synchronous path. 'disks' always accounts for both destination - * buffers. If any source buffers (blocks[i] where i < disks - 2) are - * set to NULL those buffers will be replaced with the raid6_zero_page - * in the synchronous path and omitted in the hardware-asynchronous - * path. - */ -struct dma_async_tx_descriptor * -async_gen_syndrome(struct page **blocks, unsigned int *offsets, int disks, - size_t len, struct async_submit_ctl *submit) -{ - int src_cnt =3D disks - 2; - struct dma_chan *chan =3D async_tx_find_channel(submit, DMA_PQ, - &P(blocks, disks), 2, - blocks, src_cnt, len); - struct dma_device *device =3D chan ? chan->device : NULL; - struct dmaengine_unmap_data *unmap =3D NULL; - - BUG_ON(disks > MAX_DISKS || !(P(blocks, disks) || Q(blocks, disks))); - - if (device) - unmap =3D dmaengine_get_unmap_data(device->dev, disks, GFP_NOWAIT); - - /* XORing P/Q is only implemented in software */ - if (unmap && !(submit->flags & ASYNC_TX_PQ_XOR_DST) && - (src_cnt <=3D dma_maxpq(device, 0) || - dma_maxpq(device, DMA_PREP_CONTINUE) > 0) && - is_dma_pq_aligned_offs(device, offsets, disks, len)) { - struct dma_async_tx_descriptor *tx; - enum dma_ctrl_flags dma_flags =3D 0; - unsigned char coefs[MAX_DISKS]; - int i, j; - - /* run the p+q asynchronously */ - pr_debug("%s: (async) disks: %d len: %zu\n", - __func__, disks, len); - - /* convert source addresses being careful to collapse 'empty' - * sources and update the coefficients accordingly - */ - unmap->len =3D len; - for (i =3D 0, j =3D 0; i < src_cnt; i++) { - if (blocks[i] =3D=3D NULL) - continue; - unmap->addr[j] =3D dma_map_page(device->dev, blocks[i], - offsets[i], len, DMA_TO_DEVICE); - coefs[j] =3D raid6_gfexp[i]; - unmap->to_cnt++; - j++; - } - - /* - * DMAs use destinations as sources, - * so use BIDIRECTIONAL mapping - */ - unmap->bidi_cnt++; - if (P(blocks, disks)) - unmap->addr[j++] =3D dma_map_page(device->dev, P(blocks, disks), - P(offsets, disks), - len, DMA_BIDIRECTIONAL); - else { - unmap->addr[j++] =3D 0; - dma_flags |=3D DMA_PREP_PQ_DISABLE_P; - } - - unmap->bidi_cnt++; - if (Q(blocks, disks)) - unmap->addr[j++] =3D dma_map_page(device->dev, Q(blocks, disks), - Q(offsets, disks), - len, DMA_BIDIRECTIONAL); - else { - unmap->addr[j++] =3D 0; - dma_flags |=3D DMA_PREP_PQ_DISABLE_Q; - } - - tx =3D do_async_gen_syndrome(chan, coefs, j, unmap, dma_flags, submit); - dmaengine_unmap_put(unmap); - return tx; - } - - dmaengine_unmap_put(unmap); - - /* run the pq synchronously */ - pr_debug("%s: (sync) disks: %d len: %zu\n", __func__, disks, len); - - /* wait for any prerequisite operations */ - async_tx_quiesce(&submit->depend_tx); - - if (!P(blocks, disks)) { - P(blocks, disks) =3D pq_scribble_page; - P(offsets, disks) =3D 0; - } - if (!Q(blocks, disks)) { - Q(blocks, disks) =3D pq_scribble_page; - Q(offsets, disks) =3D 0; - } - do_sync_gen_syndrome(blocks, offsets, disks, len, submit); - - return NULL; -} -EXPORT_SYMBOL_GPL(async_gen_syndrome); - -static inline struct dma_chan * -pq_val_chan(struct async_submit_ctl *submit, struct page **blocks, int dis= ks, size_t len) -{ - #ifdef CONFIG_ASYNC_TX_DISABLE_PQ_VAL_DMA - return NULL; - #endif - return async_tx_find_channel(submit, DMA_PQ_VAL, NULL, 0, blocks, - disks, len); -} - -/** - * async_syndrome_val - asynchronously validate a raid6 syndrome - * @blocks: source blocks from idx 0..disks-3, P @ disks-2 and Q @ disks-1 - * @offsets: common offset into each block (src and dest) to start transac= tion - * @disks: number of blocks (including missing P or Q, see below) - * @len: length of operation in bytes - * @pqres: on val failure SUM_CHECK_P_RESULT and/or SUM_CHECK_Q_RESULT are= set - * @spare: temporary result buffer for the synchronous case - * @s_off: spare buffer page offset - * @submit: submission / completion modifiers - * - * The same notes from async_gen_syndrome apply to the 'blocks', - * and 'disks' parameters of this routine. The synchronous path - * requires a temporary result buffer and submit->scribble to be - * specified. - */ -struct dma_async_tx_descriptor * -async_syndrome_val(struct page **blocks, unsigned int *offsets, int disks, - size_t len, enum sum_check_flags *pqres, struct page *spare, - unsigned int s_off, struct async_submit_ctl *submit) -{ - struct dma_chan *chan =3D pq_val_chan(submit, blocks, disks, len); - struct dma_device *device =3D chan ? chan->device : NULL; - struct dma_async_tx_descriptor *tx; - unsigned char coefs[MAX_DISKS]; - enum dma_ctrl_flags dma_flags =3D submit->cb_fn ? DMA_PREP_INTERRUPT : 0; - struct dmaengine_unmap_data *unmap =3D NULL; - - BUG_ON(disks < 4 || disks > MAX_DISKS); - - if (device) - unmap =3D dmaengine_get_unmap_data(device->dev, disks, GFP_NOWAIT); - - if (unmap && disks <=3D dma_maxpq(device, 0) && - is_dma_pq_aligned_offs(device, offsets, disks, len)) { - struct device *dev =3D device->dev; - dma_addr_t pq[2]; - int i, j =3D 0, src_cnt =3D 0; - - pr_debug("%s: (async) disks: %d len: %zu\n", - __func__, disks, len); - - unmap->len =3D len; - for (i =3D 0; i < disks-2; i++) - if (likely(blocks[i])) { - unmap->addr[j] =3D dma_map_page(dev, blocks[i], - offsets[i], len, - DMA_TO_DEVICE); - coefs[j] =3D raid6_gfexp[i]; - unmap->to_cnt++; - src_cnt++; - j++; - } - - if (!P(blocks, disks)) { - pq[0] =3D 0; - dma_flags |=3D DMA_PREP_PQ_DISABLE_P; - } else { - pq[0] =3D dma_map_page(dev, P(blocks, disks), - P(offsets, disks), len, - DMA_TO_DEVICE); - unmap->addr[j++] =3D pq[0]; - unmap->to_cnt++; - } - if (!Q(blocks, disks)) { - pq[1] =3D 0; - dma_flags |=3D DMA_PREP_PQ_DISABLE_Q; - } else { - pq[1] =3D dma_map_page(dev, Q(blocks, disks), - Q(offsets, disks), len, - DMA_TO_DEVICE); - unmap->addr[j++] =3D pq[1]; - unmap->to_cnt++; - } - - if (submit->flags & ASYNC_TX_FENCE) - dma_flags |=3D DMA_PREP_FENCE; - for (;;) { - tx =3D device->device_prep_dma_pq_val(chan, pq, - unmap->addr, - src_cnt, - coefs, - len, pqres, - dma_flags); - if (likely(tx)) - break; - async_tx_quiesce(&submit->depend_tx); - dma_async_issue_pending(chan); - } - - dma_set_unmap(tx, unmap); - async_tx_submit(chan, tx, submit); - } else { - struct page *p_src =3D P(blocks, disks); - unsigned int p_off =3D P(offsets, disks); - struct page *q_src =3D Q(blocks, disks); - unsigned int q_off =3D Q(offsets, disks); - enum async_tx_flags flags_orig =3D submit->flags; - dma_async_tx_callback cb_fn_orig =3D submit->cb_fn; - void *scribble =3D submit->scribble; - void *cb_param_orig =3D submit->cb_param; - void *p, *q, *s; - - pr_debug("%s: (sync) disks: %d len: %zu\n", - __func__, disks, len); - - /* caller must provide a temporary result buffer and - * allow the input parameters to be preserved - */ - BUG_ON(!spare || !scribble); - - /* wait for any prerequisite operations */ - async_tx_quiesce(&submit->depend_tx); - - /* recompute p and/or q into the temporary buffer and then - * check to see the result matches the current value - */ - tx =3D NULL; - *pqres =3D 0; - if (p_src) { - init_async_submit(submit, ASYNC_TX_XOR_ZERO_DST, NULL, - NULL, NULL, scribble); - tx =3D async_xor_offs(spare, s_off, - blocks, offsets, disks-2, len, submit); - async_tx_quiesce(&tx); - p =3D page_address(p_src) + p_off; - s =3D page_address(spare) + s_off; - *pqres |=3D !!memcmp(p, s, len) << SUM_CHECK_P; - } - - if (q_src) { - P(blocks, disks) =3D NULL; - Q(blocks, disks) =3D spare; - Q(offsets, disks) =3D s_off; - init_async_submit(submit, 0, NULL, NULL, NULL, scribble); - tx =3D async_gen_syndrome(blocks, offsets, disks, - len, submit); - async_tx_quiesce(&tx); - q =3D page_address(q_src) + q_off; - s =3D page_address(spare) + s_off; - *pqres |=3D !!memcmp(q, s, len) << SUM_CHECK_Q; - } - - /* restore P, Q and submit */ - P(blocks, disks) =3D p_src; - P(offsets, disks) =3D p_off; - Q(blocks, disks) =3D q_src; - Q(offsets, disks) =3D q_off; - - submit->cb_fn =3D cb_fn_orig; - submit->cb_param =3D cb_param_orig; - submit->flags =3D flags_orig; - async_tx_sync_epilog(submit); - tx =3D NULL; - } - dmaengine_unmap_put(unmap); - - return tx; -} -EXPORT_SYMBOL_GPL(async_syndrome_val); - -static int __init async_pq_init(void) -{ - pq_scribble_page =3D alloc_page(GFP_KERNEL); - - if (pq_scribble_page) - return 0; - - pr_err("%s: failed to allocate required spare page\n", __func__); - - return -ENOMEM; -} - -static void __exit async_pq_exit(void) -{ - __free_page(pq_scribble_page); -} - -module_init(async_pq_init); -module_exit(async_pq_exit); - -MODULE_DESCRIPTION("asynchronous raid6 syndrome generation/validation"); -MODULE_LICENSE("GPL"); diff --git a/crypto/async_tx/async_raid6_recov.c b/crypto/async_tx/async_ra= id6_recov.c deleted file mode 100644 index e53870d84bc55..0000000000000 --- a/crypto/async_tx/async_raid6_recov.c +++ /dev/null @@ -1,595 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Asynchronous RAID-6 recovery calculations ASYNC_TX API. - * Copyright(c) 2009 Intel Corporation - * - * based on raid6recov.c: - * Copyright 2002 H. Peter Anvin - */ -#include -#include -#include -#include -#include -#include -#include -#include - -static struct dma_async_tx_descriptor * -async_sum_product(struct page *dest, unsigned int d_off, - struct page **srcs, unsigned int *src_offs, unsigned char *coef, - size_t len, struct async_submit_ctl *submit) -{ - struct dma_chan *chan =3D async_tx_find_channel(submit, DMA_PQ, - &dest, 1, srcs, 2, len); - struct dma_device *dma =3D chan ? chan->device : NULL; - struct dmaengine_unmap_data *unmap =3D NULL; - const u8 *amul, *bmul; - u8 ax, bx; - u8 *a, *b, *c; - - if (dma) - unmap =3D dmaengine_get_unmap_data(dma->dev, 3, GFP_NOWAIT); - - if (unmap) { - struct device *dev =3D dma->dev; - dma_addr_t pq[2]; - struct dma_async_tx_descriptor *tx; - enum dma_ctrl_flags dma_flags =3D DMA_PREP_PQ_DISABLE_P; - - if (submit->flags & ASYNC_TX_FENCE) - dma_flags |=3D DMA_PREP_FENCE; - unmap->addr[0] =3D dma_map_page(dev, srcs[0], src_offs[0], - len, DMA_TO_DEVICE); - unmap->addr[1] =3D dma_map_page(dev, srcs[1], src_offs[1], - len, DMA_TO_DEVICE); - unmap->to_cnt =3D 2; - - unmap->addr[2] =3D dma_map_page(dev, dest, d_off, - len, DMA_BIDIRECTIONAL); - unmap->bidi_cnt =3D 1; - /* engine only looks at Q, but expects it to follow P */ - pq[1] =3D unmap->addr[2]; - - unmap->len =3D len; - tx =3D dma->device_prep_dma_pq(chan, pq, unmap->addr, 2, coef, - len, dma_flags); - if (tx) { - dma_set_unmap(tx, unmap); - async_tx_submit(chan, tx, submit); - dmaengine_unmap_put(unmap); - return tx; - } - - /* could not get a descriptor, unmap and fall through to - * the synchronous path - */ - dmaengine_unmap_put(unmap); - } - - /* run the operation synchronously */ - async_tx_quiesce(&submit->depend_tx); - amul =3D raid6_gfmul[coef[0]]; - bmul =3D raid6_gfmul[coef[1]]; - a =3D page_address(srcs[0]) + src_offs[0]; - b =3D page_address(srcs[1]) + src_offs[1]; - c =3D page_address(dest) + d_off; - - while (len--) { - ax =3D amul[*a++]; - bx =3D bmul[*b++]; - *c++ =3D ax ^ bx; - } - - return NULL; -} - -static struct dma_async_tx_descriptor * -async_mult(struct page *dest, unsigned int d_off, struct page *src, - unsigned int s_off, u8 coef, size_t len, - struct async_submit_ctl *submit) -{ - struct dma_chan *chan =3D async_tx_find_channel(submit, DMA_PQ, - &dest, 1, &src, 1, len); - struct dma_device *dma =3D chan ? chan->device : NULL; - struct dmaengine_unmap_data *unmap =3D NULL; - const u8 *qmul; /* Q multiplier table */ - u8 *d, *s; - - if (dma) - unmap =3D dmaengine_get_unmap_data(dma->dev, 3, GFP_NOWAIT); - - if (unmap) { - dma_addr_t dma_dest[2]; - struct device *dev =3D dma->dev; - struct dma_async_tx_descriptor *tx; - enum dma_ctrl_flags dma_flags =3D DMA_PREP_PQ_DISABLE_P; - - if (submit->flags & ASYNC_TX_FENCE) - dma_flags |=3D DMA_PREP_FENCE; - unmap->addr[0] =3D dma_map_page(dev, src, s_off, - len, DMA_TO_DEVICE); - unmap->to_cnt++; - unmap->addr[1] =3D dma_map_page(dev, dest, d_off, - len, DMA_BIDIRECTIONAL); - dma_dest[1] =3D unmap->addr[1]; - unmap->bidi_cnt++; - unmap->len =3D len; - - /* this looks funny, but the engine looks for Q at - * dma_dest[1] and ignores dma_dest[0] as a dest - * due to DMA_PREP_PQ_DISABLE_P - */ - tx =3D dma->device_prep_dma_pq(chan, dma_dest, unmap->addr, - 1, &coef, len, dma_flags); - - if (tx) { - dma_set_unmap(tx, unmap); - dmaengine_unmap_put(unmap); - async_tx_submit(chan, tx, submit); - return tx; - } - - /* could not get a descriptor, unmap and fall through to - * the synchronous path - */ - dmaengine_unmap_put(unmap); - } - - /* no channel available, or failed to allocate a descriptor, so - * perform the operation synchronously - */ - async_tx_quiesce(&submit->depend_tx); - qmul =3D raid6_gfmul[coef]; - d =3D page_address(dest) + d_off; - s =3D page_address(src) + s_off; - - while (len--) - *d++ =3D qmul[*s++]; - - return NULL; -} - -static struct dma_async_tx_descriptor * -__2data_recov_4(int disks, size_t bytes, int faila, int failb, - struct page **blocks, unsigned int *offs, - struct async_submit_ctl *submit) -{ - struct dma_async_tx_descriptor *tx =3D NULL; - struct page *p, *q, *a, *b; - unsigned int p_off, q_off, a_off, b_off; - struct page *srcs[2]; - unsigned int src_offs[2]; - unsigned char coef[2]; - enum async_tx_flags flags =3D submit->flags; - dma_async_tx_callback cb_fn =3D submit->cb_fn; - void *cb_param =3D submit->cb_param; - void *scribble =3D submit->scribble; - - p =3D blocks[disks-2]; - p_off =3D offs[disks-2]; - q =3D blocks[disks-1]; - q_off =3D offs[disks-1]; - - a =3D blocks[faila]; - a_off =3D offs[faila]; - b =3D blocks[failb]; - b_off =3D offs[failb]; - - /* in the 4 disk case P + Pxy =3D=3D P and Q + Qxy =3D=3D Q */ - /* Dx =3D A*(P+Pxy) + B*(Q+Qxy) */ - srcs[0] =3D p; - src_offs[0] =3D p_off; - srcs[1] =3D q; - src_offs[1] =3D q_off; - coef[0] =3D raid6_gfexi[failb-faila]; - coef[1] =3D raid6_gfinv[raid6_gfexp[faila]^raid6_gfexp[failb]]; - init_async_submit(submit, ASYNC_TX_FENCE, tx, NULL, NULL, scribble); - tx =3D async_sum_product(b, b_off, srcs, src_offs, coef, bytes, submit); - - /* Dy =3D P+Pxy+Dx */ - srcs[0] =3D p; - src_offs[0] =3D p_off; - srcs[1] =3D b; - src_offs[1] =3D b_off; - init_async_submit(submit, flags | ASYNC_TX_XOR_ZERO_DST, tx, cb_fn, - cb_param, scribble); - tx =3D async_xor_offs(a, a_off, srcs, src_offs, 2, bytes, submit); - - return tx; - -} - -static struct dma_async_tx_descriptor * -__2data_recov_5(int disks, size_t bytes, int faila, int failb, - struct page **blocks, unsigned int *offs, - struct async_submit_ctl *submit) -{ - struct dma_async_tx_descriptor *tx =3D NULL; - struct page *p, *q, *g, *dp, *dq; - unsigned int p_off, q_off, g_off, dp_off, dq_off; - struct page *srcs[2]; - unsigned int src_offs[2]; - unsigned char coef[2]; - enum async_tx_flags flags =3D submit->flags; - dma_async_tx_callback cb_fn =3D submit->cb_fn; - void *cb_param =3D submit->cb_param; - void *scribble =3D submit->scribble; - int good_srcs, good, i; - - good_srcs =3D 0; - good =3D -1; - for (i =3D 0; i < disks-2; i++) { - if (blocks[i] =3D=3D NULL) - continue; - if (i =3D=3D faila || i =3D=3D failb) - continue; - good =3D i; - good_srcs++; - } - BUG_ON(good_srcs > 1); - - p =3D blocks[disks-2]; - p_off =3D offs[disks-2]; - q =3D blocks[disks-1]; - q_off =3D offs[disks-1]; - g =3D blocks[good]; - g_off =3D offs[good]; - - /* Compute syndrome with zero for the missing data pages - * Use the dead data pages as temporary storage for delta p and - * delta q - */ - dp =3D blocks[faila]; - dp_off =3D offs[faila]; - dq =3D blocks[failb]; - dq_off =3D offs[failb]; - - init_async_submit(submit, ASYNC_TX_FENCE, tx, NULL, NULL, scribble); - tx =3D async_memcpy(dp, g, dp_off, g_off, bytes, submit); - init_async_submit(submit, ASYNC_TX_FENCE, tx, NULL, NULL, scribble); - tx =3D async_mult(dq, dq_off, g, g_off, - raid6_gfexp[good], bytes, submit); - - /* compute P + Pxy */ - srcs[0] =3D dp; - src_offs[0] =3D dp_off; - srcs[1] =3D p; - src_offs[1] =3D p_off; - init_async_submit(submit, ASYNC_TX_FENCE|ASYNC_TX_XOR_DROP_DST, tx, - NULL, NULL, scribble); - tx =3D async_xor_offs(dp, dp_off, srcs, src_offs, 2, bytes, submit); - - /* compute Q + Qxy */ - srcs[0] =3D dq; - src_offs[0] =3D dq_off; - srcs[1] =3D q; - src_offs[1] =3D q_off; - init_async_submit(submit, ASYNC_TX_FENCE|ASYNC_TX_XOR_DROP_DST, tx, - NULL, NULL, scribble); - tx =3D async_xor_offs(dq, dq_off, srcs, src_offs, 2, bytes, submit); - - /* Dx =3D A*(P+Pxy) + B*(Q+Qxy) */ - srcs[0] =3D dp; - src_offs[0] =3D dp_off; - srcs[1] =3D dq; - src_offs[1] =3D dq_off; - coef[0] =3D raid6_gfexi[failb-faila]; - coef[1] =3D raid6_gfinv[raid6_gfexp[faila]^raid6_gfexp[failb]]; - init_async_submit(submit, ASYNC_TX_FENCE, tx, NULL, NULL, scribble); - tx =3D async_sum_product(dq, dq_off, srcs, src_offs, coef, bytes, submit); - - /* Dy =3D P+Pxy+Dx */ - srcs[0] =3D dp; - src_offs[0] =3D dp_off; - srcs[1] =3D dq; - src_offs[1] =3D dq_off; - init_async_submit(submit, flags | ASYNC_TX_XOR_DROP_DST, tx, cb_fn, - cb_param, scribble); - tx =3D async_xor_offs(dp, dp_off, srcs, src_offs, 2, bytes, submit); - - return tx; -} - -static struct dma_async_tx_descriptor * -__2data_recov_n(int disks, size_t bytes, int faila, int failb, - struct page **blocks, unsigned int *offs, - struct async_submit_ctl *submit) -{ - struct dma_async_tx_descriptor *tx =3D NULL; - struct page *p, *q, *dp, *dq; - unsigned int p_off, q_off, dp_off, dq_off; - struct page *srcs[2]; - unsigned int src_offs[2]; - unsigned char coef[2]; - enum async_tx_flags flags =3D submit->flags; - dma_async_tx_callback cb_fn =3D submit->cb_fn; - void *cb_param =3D submit->cb_param; - void *scribble =3D submit->scribble; - - p =3D blocks[disks-2]; - p_off =3D offs[disks-2]; - q =3D blocks[disks-1]; - q_off =3D offs[disks-1]; - - /* Compute syndrome with zero for the missing data pages - * Use the dead data pages as temporary storage for - * delta p and delta q - */ - dp =3D blocks[faila]; - dp_off =3D offs[faila]; - blocks[faila] =3D NULL; - blocks[disks-2] =3D dp; - offs[disks-2] =3D dp_off; - dq =3D blocks[failb]; - dq_off =3D offs[failb]; - blocks[failb] =3D NULL; - blocks[disks-1] =3D dq; - offs[disks-1] =3D dq_off; - - init_async_submit(submit, ASYNC_TX_FENCE, tx, NULL, NULL, scribble); - tx =3D async_gen_syndrome(blocks, offs, disks, bytes, submit); - - /* Restore pointer table */ - blocks[faila] =3D dp; - offs[faila] =3D dp_off; - blocks[failb] =3D dq; - offs[failb] =3D dq_off; - blocks[disks-2] =3D p; - offs[disks-2] =3D p_off; - blocks[disks-1] =3D q; - offs[disks-1] =3D q_off; - - /* compute P + Pxy */ - srcs[0] =3D dp; - src_offs[0] =3D dp_off; - srcs[1] =3D p; - src_offs[1] =3D p_off; - init_async_submit(submit, ASYNC_TX_FENCE|ASYNC_TX_XOR_DROP_DST, tx, - NULL, NULL, scribble); - tx =3D async_xor_offs(dp, dp_off, srcs, src_offs, 2, bytes, submit); - - /* compute Q + Qxy */ - srcs[0] =3D dq; - src_offs[0] =3D dq_off; - srcs[1] =3D q; - src_offs[1] =3D q_off; - init_async_submit(submit, ASYNC_TX_FENCE|ASYNC_TX_XOR_DROP_DST, tx, - NULL, NULL, scribble); - tx =3D async_xor_offs(dq, dq_off, srcs, src_offs, 2, bytes, submit); - - /* Dx =3D A*(P+Pxy) + B*(Q+Qxy) */ - srcs[0] =3D dp; - src_offs[0] =3D dp_off; - srcs[1] =3D dq; - src_offs[1] =3D dq_off; - coef[0] =3D raid6_gfexi[failb-faila]; - coef[1] =3D raid6_gfinv[raid6_gfexp[faila]^raid6_gfexp[failb]]; - init_async_submit(submit, ASYNC_TX_FENCE, tx, NULL, NULL, scribble); - tx =3D async_sum_product(dq, dq_off, srcs, src_offs, coef, bytes, submit); - - /* Dy =3D P+Pxy+Dx */ - srcs[0] =3D dp; - src_offs[0] =3D dp_off; - srcs[1] =3D dq; - src_offs[1] =3D dq_off; - init_async_submit(submit, flags | ASYNC_TX_XOR_DROP_DST, tx, cb_fn, - cb_param, scribble); - tx =3D async_xor_offs(dp, dp_off, srcs, src_offs, 2, bytes, submit); - - return tx; -} - -/** - * async_raid6_2data_recov - asynchronously calculate two missing data blo= cks - * @disks: number of disks in the RAID-6 array - * @bytes: block size - * @faila: first failed drive index - * @failb: second failed drive index - * @blocks: array of source pointers where the last two entries are p and q - * @offs: array of offset for pages in blocks - * @submit: submission/completion modifiers - */ -struct dma_async_tx_descriptor * -async_raid6_2data_recov(int disks, size_t bytes, int faila, int failb, - struct page **blocks, unsigned int *offs, - struct async_submit_ctl *submit) -{ - void *scribble =3D submit->scribble; - int non_zero_srcs, i; - - BUG_ON(faila =3D=3D failb); - if (failb < faila) - swap(faila, failb); - - pr_debug("%s: disks: %d len: %zu\n", __func__, disks, bytes); - - /* if a dma resource is not available or a scribble buffer is not - * available punt to the synchronous path. In the 'dma not - * available' case be sure to use the scribble buffer to - * preserve the content of 'blocks' as the caller intended. - */ - if (!async_dma_find_channel(DMA_PQ) || !scribble) { - void **ptrs =3D scribble ? scribble : (void **) blocks; - - async_tx_quiesce(&submit->depend_tx); - for (i =3D 0; i < disks; i++) - if (blocks[i] =3D=3D NULL) - ptrs[i] =3D page_address(ZERO_PAGE(0)); - else - ptrs[i] =3D page_address(blocks[i]) + offs[i]; - - raid6_recov_2data(disks, bytes, faila, failb, ptrs); - - async_tx_sync_epilog(submit); - - return NULL; - } - - non_zero_srcs =3D 0; - for (i =3D 0; i < disks-2 && non_zero_srcs < 4; i++) - if (blocks[i]) - non_zero_srcs++; - switch (non_zero_srcs) { - case 0: - case 1: - /* There must be at least 2 sources - the failed devices. */ - BUG(); - - case 2: - /* dma devices do not uniformly understand a zero source pq - * operation (in contrast to the synchronous case), so - * explicitly handle the special case of a 4 disk array with - * both data disks missing. - */ - return __2data_recov_4(disks, bytes, faila, failb, - blocks, offs, submit); - case 3: - /* dma devices do not uniformly understand a single - * source pq operation (in contrast to the synchronous - * case), so explicitly handle the special case of a 5 disk - * array with 2 of 3 data disks missing. - */ - return __2data_recov_5(disks, bytes, faila, failb, - blocks, offs, submit); - default: - return __2data_recov_n(disks, bytes, faila, failb, - blocks, offs, submit); - } -} -EXPORT_SYMBOL_GPL(async_raid6_2data_recov); - -/** - * async_raid6_datap_recov - asynchronously calculate a data and the 'p' b= lock - * @disks: number of disks in the RAID-6 array - * @bytes: block size - * @faila: failed drive index - * @blocks: array of source pointers where the last two entries are p and q - * @offs: array of offset for pages in blocks - * @submit: submission/completion modifiers - */ -struct dma_async_tx_descriptor * -async_raid6_datap_recov(int disks, size_t bytes, int faila, - struct page **blocks, unsigned int *offs, - struct async_submit_ctl *submit) -{ - struct dma_async_tx_descriptor *tx =3D NULL; - struct page *p, *q, *dq; - unsigned int p_off, q_off, dq_off; - u8 coef; - enum async_tx_flags flags =3D submit->flags; - dma_async_tx_callback cb_fn =3D submit->cb_fn; - void *cb_param =3D submit->cb_param; - void *scribble =3D submit->scribble; - int good_srcs, good, i; - struct page *srcs[2]; - unsigned int src_offs[2]; - - pr_debug("%s: disks: %d len: %zu\n", __func__, disks, bytes); - - /* if a dma resource is not available or a scribble buffer is not - * available punt to the synchronous path. In the 'dma not - * available' case be sure to use the scribble buffer to - * preserve the content of 'blocks' as the caller intended. - */ - if (!async_dma_find_channel(DMA_PQ) || !scribble) { - void **ptrs =3D scribble ? scribble : (void **) blocks; - - async_tx_quiesce(&submit->depend_tx); - for (i =3D 0; i < disks; i++) - if (blocks[i] =3D=3D NULL) - ptrs[i] =3D page_address(ZERO_PAGE(0)); - else - ptrs[i] =3D page_address(blocks[i]) + offs[i]; - - raid6_recov_datap(disks, bytes, faila, ptrs); - - async_tx_sync_epilog(submit); - - return NULL; - } - - good_srcs =3D 0; - good =3D -1; - for (i =3D 0; i < disks-2; i++) { - if (i =3D=3D faila) - continue; - if (blocks[i]) { - good =3D i; - good_srcs++; - if (good_srcs > 1) - break; - } - } - BUG_ON(good_srcs =3D=3D 0); - - p =3D blocks[disks-2]; - p_off =3D offs[disks-2]; - q =3D blocks[disks-1]; - q_off =3D offs[disks-1]; - - /* Compute syndrome with zero for the missing data page - * Use the dead data page as temporary storage for delta q - */ - dq =3D blocks[faila]; - dq_off =3D offs[faila]; - blocks[faila] =3D NULL; - blocks[disks-1] =3D dq; - offs[disks-1] =3D dq_off; - - /* in the 4-disk case we only need to perform a single source - * multiplication with the one good data block. - */ - if (good_srcs =3D=3D 1) { - struct page *g =3D blocks[good]; - unsigned int g_off =3D offs[good]; - - init_async_submit(submit, ASYNC_TX_FENCE, tx, NULL, NULL, - scribble); - tx =3D async_memcpy(p, g, p_off, g_off, bytes, submit); - - init_async_submit(submit, ASYNC_TX_FENCE, tx, NULL, NULL, - scribble); - tx =3D async_mult(dq, dq_off, g, g_off, - raid6_gfexp[good], bytes, submit); - } else { - init_async_submit(submit, ASYNC_TX_FENCE, tx, NULL, NULL, - scribble); - tx =3D async_gen_syndrome(blocks, offs, disks, bytes, submit); - } - - /* Restore pointer table */ - blocks[faila] =3D dq; - offs[faila] =3D dq_off; - blocks[disks-1] =3D q; - offs[disks-1] =3D q_off; - - /* calculate g^{-faila} */ - coef =3D raid6_gfinv[raid6_gfexp[faila]]; - - srcs[0] =3D dq; - src_offs[0] =3D dq_off; - srcs[1] =3D q; - src_offs[1] =3D q_off; - init_async_submit(submit, ASYNC_TX_FENCE|ASYNC_TX_XOR_DROP_DST, tx, - NULL, NULL, scribble); - tx =3D async_xor_offs(dq, dq_off, srcs, src_offs, 2, bytes, submit); - - init_async_submit(submit, ASYNC_TX_FENCE, tx, NULL, NULL, scribble); - tx =3D async_mult(dq, dq_off, dq, dq_off, coef, bytes, submit); - - srcs[0] =3D p; - src_offs[0] =3D p_off; - srcs[1] =3D dq; - src_offs[1] =3D dq_off; - init_async_submit(submit, flags | ASYNC_TX_XOR_DROP_DST, tx, cb_fn, - cb_param, scribble); - tx =3D async_xor_offs(p, p_off, srcs, src_offs, 2, bytes, submit); - - return tx; -} -EXPORT_SYMBOL_GPL(async_raid6_datap_recov); - -MODULE_AUTHOR("Dan Williams "); -MODULE_DESCRIPTION("asynchronous RAID-6 recovery api"); -MODULE_LICENSE("GPL"); diff --git a/crypto/async_tx/async_tx.c b/crypto/async_tx/async_tx.c deleted file mode 100644 index 7d3009c5c3605..0000000000000 --- a/crypto/async_tx/async_tx.c +++ /dev/null @@ -1,299 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * core routines for the asynchronous memory transfer/transform api - * - * Copyright =C2=A9 2006, Intel Corporation. - * - * Dan Williams - * - * with architecture considerations by: - * Neil Brown - * Jeff Garzik - */ -#include -#include -#include -#include -#include "../../drivers/dma/dmaengine.h" - -#ifdef CONFIG_DMA_ENGINE -static int __init async_tx_init(void) -{ - async_dmaengine_get(); - - printk(KERN_INFO "async_tx: api initialized (async)\n"); - - return 0; -} - -static void __exit async_tx_exit(void) -{ - async_dmaengine_put(); -} - -module_init(async_tx_init); -module_exit(async_tx_exit); - -/** - * __async_tx_find_channel - find a channel to carry out the operation or = let - * the transaction execute synchronously - * @submit: transaction dependency and submission modifiers - * @tx_type: transaction type - */ -struct dma_chan * -__async_tx_find_channel(struct async_submit_ctl *submit, - enum dma_transaction_type tx_type) -{ - struct dma_async_tx_descriptor *depend_tx =3D submit->depend_tx; - - /* see if we can keep the chain on one channel */ - if (depend_tx && - dma_has_cap(tx_type, depend_tx->chan->device->cap_mask)) - return depend_tx->chan; - return async_dma_find_channel(tx_type); -} -EXPORT_SYMBOL_GPL(__async_tx_find_channel); -#endif - - -/** - * async_tx_channel_switch - queue an interrupt descriptor with a dependen= cy - * pre-attached. - * @depend_tx: the operation that must finish before the new operation runs - * @tx: the new operation - */ -static void -async_tx_channel_switch(struct dma_async_tx_descriptor *depend_tx, - struct dma_async_tx_descriptor *tx) -{ - struct dma_chan *chan =3D depend_tx->chan; - struct dma_device *device =3D chan->device; - struct dma_async_tx_descriptor *intr_tx =3D (void *) ~0; - - /* first check to see if we can still append to depend_tx */ - txd_lock(depend_tx); - if (txd_parent(depend_tx) && depend_tx->chan =3D=3D tx->chan) { - txd_chain(depend_tx, tx); - intr_tx =3D NULL; - } - txd_unlock(depend_tx); - - /* attached dependency, flush the parent channel */ - if (!intr_tx) { - device->device_issue_pending(chan); - return; - } - - /* see if we can schedule an interrupt - * otherwise poll for completion - */ - if (dma_has_cap(DMA_INTERRUPT, device->cap_mask)) - intr_tx =3D device->device_prep_dma_interrupt(chan, 0); - else - intr_tx =3D NULL; - - if (intr_tx) { - dmaengine_desc_set_callback(intr_tx, NULL, NULL, NULL); - /* safe to chain outside the lock since we know we are - * not submitted yet - */ - txd_chain(intr_tx, tx); - - /* check if we need to append */ - txd_lock(depend_tx); - if (txd_parent(depend_tx)) { - txd_chain(depend_tx, intr_tx); - async_tx_ack(intr_tx); - intr_tx =3D NULL; - } - txd_unlock(depend_tx); - - if (intr_tx) { - txd_clear_parent(intr_tx); - intr_tx->tx_submit(intr_tx); - async_tx_ack(intr_tx); - } - device->device_issue_pending(chan); - } else { - if (dma_wait_for_async_tx(depend_tx) !=3D DMA_COMPLETE) - panic("%s: DMA error waiting for depend_tx\n", - __func__); - tx->tx_submit(tx); - } -} - - -/** - * enum submit_disposition - flags for routing an incoming operation - * @ASYNC_TX_SUBMITTED: we were able to append the new operation under the= lock - * @ASYNC_TX_CHANNEL_SWITCH: when the lock is dropped schedule a channel s= witch - * @ASYNC_TX_DIRECT_SUBMIT: when the lock is dropped submit directly - * - * while holding depend_tx->lock we must avoid submitting new operations - * to prevent a circular locking dependency with drivers that already - * hold a channel lock when calling async_tx_run_dependencies. - */ -enum submit_disposition { - ASYNC_TX_SUBMITTED, - ASYNC_TX_CHANNEL_SWITCH, - ASYNC_TX_DIRECT_SUBMIT, -}; - -void -async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor *tx, - struct async_submit_ctl *submit) -{ - struct dma_async_tx_descriptor *depend_tx =3D submit->depend_tx; - - dmaengine_desc_set_callback(tx, submit->cb_fn, NULL, submit->cb_param); - - if (depend_tx) { - enum submit_disposition s; - - /* sanity check the dependency chain: - * 1/ if ack is already set then we cannot be sure - * we are referring to the correct operation - * 2/ dependencies are 1:1 i.e. two transactions can - * not depend on the same parent - */ - BUG_ON(async_tx_test_ack(depend_tx) || txd_next(depend_tx) || - txd_parent(tx)); - - /* the lock prevents async_tx_run_dependencies from missing - * the setting of ->next when ->parent !=3D NULL - */ - txd_lock(depend_tx); - if (txd_parent(depend_tx)) { - /* we have a parent so we can not submit directly - * if we are staying on the same channel: append - * else: channel switch - */ - if (depend_tx->chan =3D=3D chan) { - txd_chain(depend_tx, tx); - s =3D ASYNC_TX_SUBMITTED; - } else - s =3D ASYNC_TX_CHANNEL_SWITCH; - } else { - /* we do not have a parent so we may be able to submit - * directly if we are staying on the same channel - */ - if (depend_tx->chan =3D=3D chan) - s =3D ASYNC_TX_DIRECT_SUBMIT; - else - s =3D ASYNC_TX_CHANNEL_SWITCH; - } - txd_unlock(depend_tx); - - switch (s) { - case ASYNC_TX_SUBMITTED: - break; - case ASYNC_TX_CHANNEL_SWITCH: - async_tx_channel_switch(depend_tx, tx); - break; - case ASYNC_TX_DIRECT_SUBMIT: - txd_clear_parent(tx); - tx->tx_submit(tx); - break; - } - } else { - txd_clear_parent(tx); - tx->tx_submit(tx); - } - - if (submit->flags & ASYNC_TX_ACK) - async_tx_ack(tx); - - if (depend_tx) - async_tx_ack(depend_tx); -} -EXPORT_SYMBOL_GPL(async_tx_submit); - -/** - * async_tx_issue_pending - send pending descriptor to the hardware channel - * @tx: descriptor handle to retrieve hardware context - * - * Note: any dependent operations will have already been issued by - * async_tx_channel_switch, or (in the case of no channel switch) will - * be already pending on this channel. - */ -void async_tx_issue_pending(struct dma_async_tx_descriptor *tx) -{ - if (likely(tx)) { - struct dma_chan *chan =3D tx->chan; - struct dma_device *dma =3D chan->device; - - dma->device_issue_pending(chan); - } -} -EXPORT_SYMBOL_GPL(async_tx_issue_pending); - -/** - * async_trigger_callback - schedules the callback function to be run - * @submit: submission and completion parameters - * - * honored flags: ASYNC_TX_ACK - * - * The callback is run after any dependent operations have completed. - */ -struct dma_async_tx_descriptor * -async_trigger_callback(struct async_submit_ctl *submit) -{ - struct dma_chan *chan; - struct dma_device *device; - struct dma_async_tx_descriptor *tx; - struct dma_async_tx_descriptor *depend_tx =3D submit->depend_tx; - - if (depend_tx) { - chan =3D depend_tx->chan; - device =3D chan->device; - - /* see if we can schedule an interrupt - * otherwise poll for completion - */ - if (device && !dma_has_cap(DMA_INTERRUPT, device->cap_mask)) - device =3D NULL; - - tx =3D device ? device->device_prep_dma_interrupt(chan, 0) : NULL; - } else - tx =3D NULL; - - if (tx) { - pr_debug("%s: (async)\n", __func__); - - async_tx_submit(chan, tx, submit); - } else { - pr_debug("%s: (sync)\n", __func__); - - /* wait for any prerequisite operations */ - async_tx_quiesce(&submit->depend_tx); - - async_tx_sync_epilog(submit); - } - - return tx; -} -EXPORT_SYMBOL_GPL(async_trigger_callback); - -/** - * async_tx_quiesce - ensure tx is complete and freeable upon return - * @tx: transaction to quiesce - */ -void async_tx_quiesce(struct dma_async_tx_descriptor **tx) -{ - if (*tx) { - /* if ack is already set then we cannot be sure - * we are referring to the correct operation - */ - BUG_ON(async_tx_test_ack(*tx)); - if (dma_wait_for_async_tx(*tx) !=3D DMA_COMPLETE) - panic("%s: DMA error waiting for transaction\n", - __func__); - async_tx_ack(*tx); - *tx =3D NULL; - } -} -EXPORT_SYMBOL_GPL(async_tx_quiesce); - -MODULE_AUTHOR("Intel Corporation"); -MODULE_DESCRIPTION("Asynchronous Bulk Memory Transactions API"); -MODULE_LICENSE("GPL"); diff --git a/crypto/async_tx/async_xor.c b/crypto/async_tx/async_xor.c deleted file mode 100644 index 84458375b202b..0000000000000 --- a/crypto/async_tx/async_xor.c +++ /dev/null @@ -1,380 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * xor offload engine api - * - * Copyright =C2=A9 2006, Intel Corporation. - * - * Dan Williams - * - * with architecture considerations by: - * Neil Brown - * Jeff Garzik - */ -#include -#include -#include -#include -#include -#include -#include - -/* do_async_xor - dma map the pages and perform the xor with an engine */ -static __async_inline struct dma_async_tx_descriptor * -do_async_xor(struct dma_chan *chan, struct dmaengine_unmap_data *unmap, - struct async_submit_ctl *submit) -{ - struct dma_device *dma =3D chan->device; - struct dma_async_tx_descriptor *tx =3D NULL; - dma_async_tx_callback cb_fn_orig =3D submit->cb_fn; - void *cb_param_orig =3D submit->cb_param; - enum async_tx_flags flags_orig =3D submit->flags; - enum dma_ctrl_flags dma_flags =3D 0; - int src_cnt =3D unmap->to_cnt; - int xor_src_cnt; - dma_addr_t dma_dest =3D unmap->addr[unmap->to_cnt]; - dma_addr_t *src_list =3D unmap->addr; - - while (src_cnt) { - dma_addr_t tmp; - - submit->flags =3D flags_orig; - xor_src_cnt =3D min(src_cnt, (int)dma->max_xor); - /* if we are submitting additional xors, leave the chain open - * and clear the callback parameters - */ - if (src_cnt > xor_src_cnt) { - submit->flags &=3D ~ASYNC_TX_ACK; - submit->flags |=3D ASYNC_TX_FENCE; - submit->cb_fn =3D NULL; - submit->cb_param =3D NULL; - } else { - submit->cb_fn =3D cb_fn_orig; - submit->cb_param =3D cb_param_orig; - } - if (submit->cb_fn) - dma_flags |=3D DMA_PREP_INTERRUPT; - if (submit->flags & ASYNC_TX_FENCE) - dma_flags |=3D DMA_PREP_FENCE; - - /* Drivers force forward progress in case they can not provide a - * descriptor - */ - tmp =3D src_list[0]; - if (src_list > unmap->addr) - src_list[0] =3D dma_dest; - tx =3D dma->device_prep_dma_xor(chan, dma_dest, src_list, - xor_src_cnt, unmap->len, - dma_flags); - - if (unlikely(!tx)) - async_tx_quiesce(&submit->depend_tx); - - /* spin wait for the preceding transactions to complete */ - while (unlikely(!tx)) { - dma_async_issue_pending(chan); - tx =3D dma->device_prep_dma_xor(chan, dma_dest, - src_list, - xor_src_cnt, unmap->len, - dma_flags); - } - src_list[0] =3D tmp; - - dma_set_unmap(tx, unmap); - async_tx_submit(chan, tx, submit); - submit->depend_tx =3D tx; - - if (src_cnt > xor_src_cnt) { - /* drop completed sources */ - src_cnt -=3D xor_src_cnt; - /* use the intermediate result a source */ - src_cnt++; - src_list +=3D xor_src_cnt - 1; - } else - break; - } - - return tx; -} - -static void -do_sync_xor_offs(struct page *dest, unsigned int offset, - struct page **src_list, unsigned int *src_offs, - int src_cnt, size_t len, struct async_submit_ctl *submit) -{ - int i; - int xor_src_cnt =3D 0; - void *dest_buf; - void **srcs; - - if (submit->scribble) - srcs =3D submit->scribble; - else - srcs =3D (void **) src_list; - - /* convert to buffer pointers */ - for (i =3D 0; i < src_cnt; i++) - if (src_list[i]) - srcs[xor_src_cnt++] =3D page_address(src_list[i]) + - (src_offs ? src_offs[i] : offset); - - /* set destination address */ - dest_buf =3D page_address(dest) + offset; - if (submit->flags & ASYNC_TX_XOR_ZERO_DST) - memset(dest_buf, 0, len); - xor_gen(dest_buf, srcs, xor_src_cnt, len); - async_tx_sync_epilog(submit); -} - -static inline bool -dma_xor_aligned_offsets(struct dma_device *device, unsigned int offset, - unsigned int *src_offs, int src_cnt, int len) -{ - int i; - - if (!is_dma_xor_aligned(device, offset, 0, len)) - return false; - - if (!src_offs) - return true; - - for (i =3D 0; i < src_cnt; i++) { - if (!is_dma_xor_aligned(device, src_offs[i], 0, len)) - return false; - } - return true; -} - -/** - * async_xor_offs - attempt to xor a set of blocks with a dma engine. - * @dest: destination page - * @offset: dst offset to start transaction - * @src_list: array of source pages - * @src_offs: array of source pages offset, NULL means common src/dst offs= et - * @src_cnt: number of source pages - * @len: length in bytes - * @submit: submission / completion modifiers - * - * honored flags: ASYNC_TX_ACK, ASYNC_TX_XOR_ZERO_DST, ASYNC_TX_XOR_DROP_D= ST - * - * xor_gen always uses the dest as a source so the ASYNC_TX_XOR_ZERO_DST f= lag - * must be set to not include dest data in the calculation. The assumptio= n with - * dma engines is that they only use the destination buffer as a source wh= en it - * is explicitly specified in the source list. - * - * src_list note: if the dest is also a source it must be at index zero. - * The contents of this array will be overwritten if a scribble region - * is not specified. - */ -struct dma_async_tx_descriptor * -async_xor_offs(struct page *dest, unsigned int offset, - struct page **src_list, unsigned int *src_offs, - int src_cnt, size_t len, struct async_submit_ctl *submit) -{ - struct dma_chan *chan =3D async_tx_find_channel(submit, DMA_XOR, - &dest, 1, src_list, - src_cnt, len); - struct dma_device *device =3D chan ? chan->device : NULL; - struct dmaengine_unmap_data *unmap =3D NULL; - - BUG_ON(src_cnt <=3D 1); - - if (device) - unmap =3D dmaengine_get_unmap_data(device->dev, src_cnt+1, GFP_NOWAIT); - - if (unmap && dma_xor_aligned_offsets(device, offset, - src_offs, src_cnt, len)) { - struct dma_async_tx_descriptor *tx; - int i, j; - - /* run the xor asynchronously */ - pr_debug("%s (async): len: %zu\n", __func__, len); - - unmap->len =3D len; - for (i =3D 0, j =3D 0; i < src_cnt; i++) { - if (!src_list[i]) - continue; - unmap->to_cnt++; - unmap->addr[j++] =3D dma_map_page(device->dev, src_list[i], - src_offs ? src_offs[i] : offset, - len, DMA_TO_DEVICE); - } - - /* map it bidirectional as it may be re-used as a source */ - unmap->addr[j] =3D dma_map_page(device->dev, dest, offset, len, - DMA_BIDIRECTIONAL); - unmap->bidi_cnt =3D 1; - - tx =3D do_async_xor(chan, unmap, submit); - dmaengine_unmap_put(unmap); - return tx; - } else { - dmaengine_unmap_put(unmap); - /* run the xor synchronously */ - pr_debug("%s (sync): len: %zu\n", __func__, len); - WARN_ONCE(chan, "%s: no space for dma address conversion\n", - __func__); - - /* in the sync case the dest is an implied source - * (assumes the dest is the first source) - */ - if (submit->flags & ASYNC_TX_XOR_DROP_DST) { - src_cnt--; - src_list++; - if (src_offs) - src_offs++; - } - - /* wait for any prerequisite operations */ - async_tx_quiesce(&submit->depend_tx); - - do_sync_xor_offs(dest, offset, src_list, src_offs, - src_cnt, len, submit); - - return NULL; - } -} -EXPORT_SYMBOL_GPL(async_xor_offs); - -/** - * async_xor - attempt to xor a set of blocks with a dma engine. - * @dest: destination page - * @src_list: array of source pages - * @offset: common src/dst offset to start transaction - * @src_cnt: number of source pages - * @len: length in bytes - * @submit: submission / completion modifiers - * - * honored flags: ASYNC_TX_ACK, ASYNC_TX_XOR_ZERO_DST, ASYNC_TX_XOR_DROP_D= ST - * - * xor_gen always uses the dest as a source so the ASYNC_TX_XOR_ZERO_DST f= lag - * must be set to not include dest data in the calculation. The assumptio= n with - * dma engines is that they only use the destination buffer as a source wh= en it - * is explicitly specified in the source list. - * - * src_list note: if the dest is also a source it must be at index zero. - * The contents of this array will be overwritten if a scribble region - * is not specified. - */ -struct dma_async_tx_descriptor * -async_xor(struct page *dest, struct page **src_list, unsigned int offset, - int src_cnt, size_t len, struct async_submit_ctl *submit) -{ - return async_xor_offs(dest, offset, src_list, NULL, - src_cnt, len, submit); -} -EXPORT_SYMBOL_GPL(async_xor); - -static int page_is_zero(struct page *p, unsigned int offset, size_t len) -{ - return !memchr_inv(page_address(p) + offset, 0, len); -} - -static inline struct dma_chan * -xor_val_chan(struct async_submit_ctl *submit, struct page *dest, - struct page **src_list, int src_cnt, size_t len) -{ - #ifdef CONFIG_ASYNC_TX_DISABLE_XOR_VAL_DMA - return NULL; - #endif - return async_tx_find_channel(submit, DMA_XOR_VAL, &dest, 1, src_list, - src_cnt, len); -} - -/** - * async_xor_val_offs - attempt a xor parity check with a dma engine. - * @dest: destination page used if the xor is performed synchronously - * @offset: des offset in pages to start transaction - * @src_list: array of source pages - * @src_offs: array of source pages offset, NULL means common src/det offs= et - * @src_cnt: number of source pages - * @len: length in bytes - * @result: 0 if sum =3D=3D 0 else non-zero - * @submit: submission / completion modifiers - * - * honored flags: ASYNC_TX_ACK - * - * src_list note: if the dest is also a source it must be at index zero. - * The contents of this array will be overwritten if a scribble region - * is not specified. - */ -struct dma_async_tx_descriptor * -async_xor_val_offs(struct page *dest, unsigned int offset, - struct page **src_list, unsigned int *src_offs, - int src_cnt, size_t len, enum sum_check_flags *result, - struct async_submit_ctl *submit) -{ - struct dma_chan *chan =3D xor_val_chan(submit, dest, src_list, src_cnt, l= en); - struct dma_device *device =3D chan ? chan->device : NULL; - struct dma_async_tx_descriptor *tx =3D NULL; - struct dmaengine_unmap_data *unmap =3D NULL; - - BUG_ON(src_cnt <=3D 1); - - if (device) - unmap =3D dmaengine_get_unmap_data(device->dev, src_cnt, GFP_NOWAIT); - - if (unmap && src_cnt <=3D device->max_xor && - dma_xor_aligned_offsets(device, offset, src_offs, src_cnt, len)) { - unsigned long dma_prep_flags =3D 0; - int i; - - pr_debug("%s: (async) len: %zu\n", __func__, len); - - if (submit->cb_fn) - dma_prep_flags |=3D DMA_PREP_INTERRUPT; - if (submit->flags & ASYNC_TX_FENCE) - dma_prep_flags |=3D DMA_PREP_FENCE; - - for (i =3D 0; i < src_cnt; i++) { - unmap->addr[i] =3D dma_map_page(device->dev, src_list[i], - src_offs ? src_offs[i] : offset, - len, DMA_TO_DEVICE); - unmap->to_cnt++; - } - unmap->len =3D len; - - tx =3D device->device_prep_dma_xor_val(chan, unmap->addr, src_cnt, - len, result, - dma_prep_flags); - if (unlikely(!tx)) { - async_tx_quiesce(&submit->depend_tx); - - while (!tx) { - dma_async_issue_pending(chan); - tx =3D device->device_prep_dma_xor_val(chan, - unmap->addr, src_cnt, len, result, - dma_prep_flags); - } - } - dma_set_unmap(tx, unmap); - async_tx_submit(chan, tx, submit); - } else { - enum async_tx_flags flags_orig =3D submit->flags; - - pr_debug("%s: (sync) len: %zu\n", __func__, len); - WARN_ONCE(device && src_cnt <=3D device->max_xor, - "%s: no space for dma address conversion\n", - __func__); - - submit->flags |=3D ASYNC_TX_XOR_DROP_DST; - submit->flags &=3D ~ASYNC_TX_ACK; - - tx =3D async_xor_offs(dest, offset, src_list, src_offs, - src_cnt, len, submit); - - async_tx_quiesce(&tx); - - *result =3D !page_is_zero(dest, offset, len) << SUM_CHECK_P; - - async_tx_sync_epilog(submit); - submit->flags =3D flags_orig; - } - dmaengine_unmap_put(unmap); - - return tx; -} -EXPORT_SYMBOL_GPL(async_xor_val_offs); - -MODULE_AUTHOR("Intel Corporation"); -MODULE_DESCRIPTION("asynchronous xor/xor-zero-sum api"); -MODULE_LICENSE("GPL"); diff --git a/crypto/async_tx/raid6test.c b/crypto/async_tx/raid6test.c deleted file mode 100644 index d3fbee1e03e55..0000000000000 --- a/crypto/async_tx/raid6test.c +++ /dev/null @@ -1,250 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * asynchronous raid6 recovery self test - * Copyright (c) 2009, Intel Corporation. - * - * based on drivers/md/raid6test/test.c: - * Copyright 2002-2007 H. Peter Anvin - */ -#include -#include -#include -#include -#include - -#undef pr -#define pr(fmt, args...) pr_info("raid6test: " fmt, ##args) - -#define NDISKS 64 /* Including P and Q */ - -static struct page *dataptrs[NDISKS]; -unsigned int dataoffs[NDISKS]; -static addr_conv_t addr_conv[NDISKS]; -static struct page *data[NDISKS+3]; -static struct page *spare; -static struct page *recovi; -static struct page *recovj; - -static void callback(void *param) -{ - struct completion *cmp =3D param; - - complete(cmp); -} - -static void makedata(int disks) -{ - int i; - - for (i =3D 0; i < disks; i++) { - get_random_bytes(page_address(data[i]), PAGE_SIZE); - dataptrs[i] =3D data[i]; - dataoffs[i] =3D 0; - } -} - -static char disk_type(int d, int disks) -{ - if (d =3D=3D disks - 2) - return 'P'; - else if (d =3D=3D disks - 1) - return 'Q'; - else - return 'D'; -} - -/* Recover two failed blocks. */ -static void raid6_dual_recov(int disks, size_t bytes, int faila, int failb, - struct page **ptrs, unsigned int *offs) -{ - struct async_submit_ctl submit; - struct completion cmp; - struct dma_async_tx_descriptor *tx =3D NULL; - enum sum_check_flags result =3D ~0; - - if (faila > failb) - swap(faila, failb); - - if (failb =3D=3D disks-1) { - if (faila =3D=3D disks-2) { - /* P+Q failure. Just rebuild the syndrome. */ - init_async_submit(&submit, 0, NULL, NULL, NULL, addr_conv); - tx =3D async_gen_syndrome(ptrs, offs, - disks, bytes, &submit); - } else { - struct page *blocks[NDISKS]; - struct page *dest; - int count =3D 0; - int i; - - BUG_ON(disks > NDISKS); - - /* data+Q failure. Reconstruct data from P, - * then rebuild syndrome - */ - for (i =3D disks; i-- ; ) { - if (i =3D=3D faila || i =3D=3D failb) - continue; - blocks[count++] =3D ptrs[i]; - } - dest =3D ptrs[faila]; - init_async_submit(&submit, ASYNC_TX_XOR_ZERO_DST, NULL, - NULL, NULL, addr_conv); - tx =3D async_xor(dest, blocks, 0, count, bytes, &submit); - - init_async_submit(&submit, 0, tx, NULL, NULL, addr_conv); - tx =3D async_gen_syndrome(ptrs, offs, - disks, bytes, &submit); - } - } else { - if (failb =3D=3D disks-2) { - /* data+P failure. */ - init_async_submit(&submit, 0, NULL, NULL, NULL, addr_conv); - tx =3D async_raid6_datap_recov(disks, bytes, - faila, ptrs, offs, &submit); - } else { - /* data+data failure. */ - init_async_submit(&submit, 0, NULL, NULL, NULL, addr_conv); - tx =3D async_raid6_2data_recov(disks, bytes, - faila, failb, ptrs, offs, &submit); - } - } - init_completion(&cmp); - init_async_submit(&submit, ASYNC_TX_ACK, tx, callback, &cmp, addr_conv); - tx =3D async_syndrome_val(ptrs, offs, - disks, bytes, &result, spare, 0, &submit); - async_tx_issue_pending(tx); - - if (wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)) =3D=3D 0) - pr("%s: timeout! (faila: %d failb: %d disks: %d)\n", - __func__, faila, failb, disks); - - if (result !=3D 0) - pr("%s: validation failure! faila: %d failb: %d sum_check_flags: %x\n", - __func__, faila, failb, result); -} - -static int test_disks(int i, int j, int disks) -{ - int erra, errb; - - memset(page_address(recovi), 0xf0, PAGE_SIZE); - memset(page_address(recovj), 0xba, PAGE_SIZE); - - dataptrs[i] =3D recovi; - dataptrs[j] =3D recovj; - - raid6_dual_recov(disks, PAGE_SIZE, i, j, dataptrs, dataoffs); - - erra =3D memcmp(page_address(data[i]), page_address(recovi), PAGE_SIZE); - errb =3D memcmp(page_address(data[j]), page_address(recovj), PAGE_SIZE); - - pr("%s(%d, %d): faila=3D%3d(%c) failb=3D%3d(%c) %s\n", - __func__, i, j, i, disk_type(i, disks), j, disk_type(j, disks), - (!erra && !errb) ? "OK" : !erra ? "ERRB" : !errb ? "ERRA" : "ERRAB"); - - dataptrs[i] =3D data[i]; - dataptrs[j] =3D data[j]; - - return erra || errb; -} - -static int test(int disks, int *tests) -{ - struct dma_async_tx_descriptor *tx; - struct async_submit_ctl submit; - struct completion cmp; - int err =3D 0; - int i, j; - - recovi =3D data[disks]; - recovj =3D data[disks+1]; - spare =3D data[disks+2]; - - makedata(disks); - - /* Nuke syndromes */ - memset(page_address(data[disks-2]), 0xee, PAGE_SIZE); - memset(page_address(data[disks-1]), 0xee, PAGE_SIZE); - - /* Generate assumed good syndrome */ - init_completion(&cmp); - init_async_submit(&submit, ASYNC_TX_ACK, NULL, callback, &cmp, addr_conv); - tx =3D async_gen_syndrome(dataptrs, dataoffs, disks, PAGE_SIZE, &submit); - async_tx_issue_pending(tx); - - if (wait_for_completion_timeout(&cmp, msecs_to_jiffies(3000)) =3D=3D 0) { - pr("error: initial gen_syndrome(%d) timed out\n", disks); - return 1; - } - - pr("testing the %d-disk case...\n", disks); - for (i =3D 0; i < disks-1; i++) - for (j =3D i+1; j < disks; j++) { - (*tests)++; - err +=3D test_disks(i, j, disks); - } - - return err; -} - - -static int __init raid6_test(void) -{ - int err =3D 0; - int tests =3D 0; - int i; - - for (i =3D 0; i < NDISKS+3; i++) { - data[i] =3D alloc_page(GFP_KERNEL); - if (!data[i]) { - while (i--) - put_page(data[i]); - return -ENOMEM; - } - } - - /* the 4-disk and 5-disk cases are special for the recovery code */ - if (NDISKS > 4) - err +=3D test(4, &tests); - if (NDISKS > 5) - err +=3D test(5, &tests); - /* the 11 and 12 disk cases are special for ioatdma (p-disabled - * q-continuation without extended descriptor) - */ - if (NDISKS > 12) { - err +=3D test(11, &tests); - err +=3D test(12, &tests); - } - - /* the 24 disk case is special for ioatdma as it is the boundary point - * at which it needs to switch from 8-source ops to 16-source - * ops for continuation (assumes DMA_HAS_PQ_CONTINUE is not set) - */ - if (NDISKS > 24) - err +=3D test(24, &tests); - - err +=3D test(NDISKS, &tests); - - pr("\n"); - pr("complete (%d tests, %d failure%s)\n", - tests, err, err =3D=3D 1 ? "" : "s"); - - for (i =3D 0; i < NDISKS+3; i++) - put_page(data[i]); - - return 0; -} - -static void __exit raid6_test_exit(void) -{ -} - -/* when compiled-in wait for drivers to load first (assumes dma drivers - * are also compiled-in) - */ -late_initcall(raid6_test); -module_exit(raid6_test_exit); -MODULE_AUTHOR("Dan Williams "); -MODULE_DESCRIPTION("asynchronous RAID-6 recovery self tests"); -MODULE_LICENSE("GPL"); diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h deleted file mode 100644 index d49540570ba09..0000000000000 --- a/include/linux/async_tx.h +++ /dev/null @@ -1,187 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright =C2=A9 2006, Intel Corporation. - */ -#ifndef _ASYNC_TX_H_ -#define _ASYNC_TX_H_ -#include -#include -#include - -/* on architectures without dma-mapping capabilities we need to ensure - * that the asynchronous path compiles away - */ -#ifdef CONFIG_HAS_DMA -#define __async_inline -#else -#define __async_inline __always_inline -#endif - -/** - * dma_chan_ref - object used to manage dma channels received from the - * dmaengine core. - * @chan - the channel being tracked - * @node - node for the channel to be placed on async_tx_master_list - * @rcu - for list_del_rcu - * @count - number of times this channel is listed in the pool - * (for channels with multiple capabiities) - */ -struct dma_chan_ref { - struct dma_chan *chan; - struct list_head node; - struct rcu_head rcu; - atomic_t count; -}; - -/** - * async_tx_flags - modifiers for the async_* calls - * @ASYNC_TX_XOR_ZERO_DST: this flag must be used for xor operations where= the - * destination address is not a source. The asynchronous case handles this - * implicitly, the synchronous case needs to zero the destination block. - * @ASYNC_TX_XOR_DROP_DST: this flag must be used if the destination addre= ss is - * also one of the source addresses. In the synchronous case the destinat= ion - * address is an implied source, whereas the asynchronous case it must be = listed - * as a source. The destination address must be the first address in the = source - * array. - * @ASYNC_TX_ACK: immediately ack the descriptor, precludes setting up a - * dependency chain - * @ASYNC_TX_FENCE: specify that the next operation in the dependency - * chain uses this operation's result as an input - * @ASYNC_TX_PQ_XOR_DST: do not overwrite the syndrome but XOR it with the - * input data. Required for rmw case. - */ -enum async_tx_flags { - ASYNC_TX_XOR_ZERO_DST =3D (1 << 0), - ASYNC_TX_XOR_DROP_DST =3D (1 << 1), - ASYNC_TX_ACK =3D (1 << 2), - ASYNC_TX_FENCE =3D (1 << 3), - ASYNC_TX_PQ_XOR_DST =3D (1 << 4), -}; - -/** - * struct async_submit_ctl - async_tx submission/completion modifiers - * @flags: submission modifiers - * @depend_tx: parent dependency of the current operation being submitted - * @cb_fn: callback routine to run at operation completion - * @cb_param: parameter for the callback routine - * @scribble: caller provided space for dma/page address conversions - */ -struct async_submit_ctl { - enum async_tx_flags flags; - struct dma_async_tx_descriptor *depend_tx; - dma_async_tx_callback cb_fn; - void *cb_param; - void *scribble; -}; - -#if defined(CONFIG_DMA_ENGINE) && !defined(CONFIG_ASYNC_TX_CHANNEL_SWITCH) -#define async_tx_issue_pending_all dma_issue_pending_all - -void async_tx_issue_pending(struct dma_async_tx_descriptor *tx); - -#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL -#include -#else -#define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, l= en) \ - __async_tx_find_channel(dep, type) -struct dma_chan * -__async_tx_find_channel(struct async_submit_ctl *submit, - enum dma_transaction_type tx_type); -#endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */ -#else -static inline void async_tx_issue_pending_all(void) -{ - do { } while (0); -} - -static inline void async_tx_issue_pending(struct dma_async_tx_descriptor *= tx) -{ -} - -static inline struct dma_chan * -async_tx_find_channel(struct async_submit_ctl *submit, - enum dma_transaction_type tx_type, struct page **dst, - int dst_count, struct page **src, int src_count, - size_t len) -{ - return NULL; -} -#endif - -/** - * async_tx_sync_epilog - actions to take if an operation is run synchrono= usly - * @cb_fn: function to call when the transaction completes - * @cb_fn_param: parameter to pass to the callback routine - */ -static inline void -async_tx_sync_epilog(struct async_submit_ctl *submit) -{ - if (submit->cb_fn) - submit->cb_fn(submit->cb_param); -} - -typedef union { - unsigned long addr; - struct page *page; - dma_addr_t dma; -} addr_conv_t; - -static inline void -init_async_submit(struct async_submit_ctl *args, enum async_tx_flags flags, - struct dma_async_tx_descriptor *tx, - dma_async_tx_callback cb_fn, void *cb_param, - addr_conv_t *scribble) -{ - args->flags =3D flags; - args->depend_tx =3D tx; - args->cb_fn =3D cb_fn; - args->cb_param =3D cb_param; - args->scribble =3D scribble; -} - -void async_tx_submit(struct dma_chan *chan, struct dma_async_tx_descriptor= *tx, - struct async_submit_ctl *submit); - -struct dma_async_tx_descriptor * -async_xor(struct page *dest, struct page **src_list, unsigned int offset, - int src_cnt, size_t len, struct async_submit_ctl *submit); - -struct dma_async_tx_descriptor * -async_xor_offs(struct page *dest, unsigned int offset, - struct page **src_list, unsigned int *src_offset, - int src_cnt, size_t len, struct async_submit_ctl *submit); - -struct dma_async_tx_descriptor * -async_xor_val_offs(struct page *dest, unsigned int offset, - struct page **src_list, unsigned int *src_offset, - int src_cnt, size_t len, enum sum_check_flags *result, - struct async_submit_ctl *submit); - -struct dma_async_tx_descriptor * -async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset, - unsigned int src_offset, size_t len, - struct async_submit_ctl *submit); - -struct dma_async_tx_descriptor *async_trigger_callback(struct async_submit= _ctl *submit); - -struct dma_async_tx_descriptor * -async_gen_syndrome(struct page **blocks, unsigned int *offsets, int src_cn= t, - size_t len, struct async_submit_ctl *submit); - -struct dma_async_tx_descriptor * -async_syndrome_val(struct page **blocks, unsigned int *offsets, int src_cn= t, - size_t len, enum sum_check_flags *pqres, struct page *spare, - unsigned int s_off, struct async_submit_ctl *submit); - -struct dma_async_tx_descriptor * -async_raid6_2data_recov(int src_num, size_t bytes, int faila, int failb, - struct page **ptrs, unsigned int *offs, - struct async_submit_ctl *submit); - -struct dma_async_tx_descriptor * -async_raid6_datap_recov(int src_num, size_t bytes, int faila, - struct page **ptrs, unsigned int *offs, - struct async_submit_ctl *submit); - -void async_tx_quiesce(struct dma_async_tx_descriptor **tx); -#endif /* _ASYNC_TX_H_ */ --=20 2.43.0