From nobody Sun Feb 8 15:25:17 2026 Received: from fout-b8-smtp.messagingengine.com (fout-b8-smtp.messagingengine.com [202.12.124.151]) (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 878C030497C; Fri, 6 Feb 2026 22:12:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770415938; cv=none; b=LzzOHwAbb0302PlavqvKnWoB0lbX2Nnkl/+QvQSKAka8Wgl8gv1GF2MNhYGomhO2whzSMrbCdxqSVEdfHt/iWx3VFwQkIgnt1uPlXkZw+tdfaSh30apad1Z9sq482ABLNbSik6i+lXOhkIHkGnDYKaGWRsqdgZ+nx6CnbZUyKu8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770415938; c=relaxed/simple; bh=NhBTIoUFO3jPR/nChJXtmHx5jc1jcGiEH9jTLs13ilo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=M0VLh3tZWvY2zGVMeSEhWQGRaSJBgSfjh3ftUkBGLul1u/BWUFWIKpVcSGeisRtZ6hJwD+ieLrnxMPXqb+2sHqEeeBAVbzi3Engf+G5HvZxMZPqhp36l0JQKm7NlgOffEPUxOJLhaPLplVxDR4lQNlqrIwzfYUue5LyjO9O2Sxw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=likewhatevs.io; spf=pass smtp.mailfrom=likewhatevs.io; dkim=pass (2048-bit key) header.d=likewhatevs.io header.i=@likewhatevs.io header.b=XeSX3y5W; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=fm+4d4qh; arc=none smtp.client-ip=202.12.124.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=likewhatevs.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=likewhatevs.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=likewhatevs.io header.i=@likewhatevs.io header.b="XeSX3y5W"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="fm+4d4qh" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id 49FB71D00011; Fri, 6 Feb 2026 17:12:17 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Fri, 06 Feb 2026 17:12:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=likewhatevs.io; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to; s=fm2; t=1770415937; x=1770502337; bh=7gD00ofvgd E2X5UA+AH8QBhGtuM17gN4fure9pmx0xo=; b=XeSX3y5WNjP3YOv/mH/kzEMF8j KsSP5hRz5psK/lWHyHwwdGIzye0Q60sfPUn7oSG/alqgJ+tQOVqhOH4mEPx+zuru MiaCd11l9SoMyViTMD9r9L/UIclVWcvfvKzRFixUkHYrwsAqSchwYeBSj7TbVsUf uRSU2hkWNbvgjVtuF/TVnONcb+PCj5bO75Y5pPu1MJ4vrWPqjzj1/H9wKvb2di/g Lb0cYXtVSqCm6w7diCJ2GB14GMI+sOAHJEHn7uM7aiBP+c+DC3I0oUkuyA53mN4I yQGr6OyMfg5i7TtcE/A0bvrcTcKNwc0h23tTb8oAOi1Is9jAxNwhUwjgK3uQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1770415937; x=1770502337; bh=7gD00ofvgdE2X5UA+AH8QBhGtuM17gN4fur e9pmx0xo=; b=fm+4d4qhBAR0zgb4evNXydaGTby/BHkfsRsQnZvZ/KG8/WXEADc vT0MQvgdHOsspvf/MBh1DsiQw39MvSVHGcet+xX0UZShUah1kqBngnmC+9ZPNngD YkvVLPgLRbvs1EjpasFzjyN2FkP7uDtKh9R2y+iUe8i0eto8Xycop0NVtF+Nna7s Df6uMgaOR4O7tAmQUVkVfYPlJLlAcs0NiRw14hd1XuVsJ4kAAIEVlDTYoEIL+TeO E4tETnsoDxDss5gZjnGOFp+O2Za78xIBKrK3y1reIoYUfEW4omKkRrA+6m3MV3m0 e1PtvR5mZhIZGIaYPkwJVcHv8jEb+Vj/yrg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukeelfeegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgggfestdekredtredttdenucfhrhhomheprfgrthcuufhomhgr rhhuuceophgrthhsoheslhhikhgvfihhrghtvghvshdrihhoqeenucggtffrrghtthgvrh hnpeefveeiveeijefgueettdejleelieefvddtkeekudduveetveeutdehffeiueehuden ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehprghtsh hosehlihhkvgifhhgrthgvvhhsrdhiohdpnhgspghrtghpthhtohepuddupdhmohguvgep shhmthhpohhuthdprhgtphhtthhopehtjheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoh epshhvvghnsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehjsehjrghnnhgruhdrnhgv thdprhgtphhtthhopehvkhhouhhlsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehnvg grlhesghhomhhprgdruggvvhdprhgtphhtthhopegrshgrhhhisehlihhsthhsrdhlihhn uhigrdguvghvpdhrtghpthhtoheplhhinhhugidqrghrmhdqkhgvrhhnvghlsehlihhsth hsrdhinhhfrhgruggvrggurdhorhhgpdhrtghpthhtohepughmrggvnhhgihhnvgesvhhg vghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvh hgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i7f194913:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 6 Feb 2026 17:12:16 -0500 (EST) From: Pat Somaru To: Tejun Heo , Sven Peter , Janne Grunau , Vinod Koul Cc: Neal Gompa , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Pat Somaru , Frank Li Subject: [PATCH v2] dma: apple-admac: Convert from tasklet to BH workqueue Date: Fri, 6 Feb 2026 17:11:43 -0500 Message-ID: <20260206221143.1261191-1-patso@likewhatevs.io> X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The only generic interface to execute asynchronously in the BH context is tasklet; however, it's marked deprecated and has some design flaws such as the execution code accessing the tasklet item after the execution is complete which can lead to subtle use-after-free in certain usage scenarios and less-developed flush and cancel mechanisms. To replace tasklets, BH workqueue support was recently added. A BH workqueue behaves similarly to regular workqueues except that the queued work items are executed in the BH context. Convert apple-admac.c from tasklet to BH workqueue Semantically, this is an equivalent conversion and there shouldn't be any user-visible behavior changes. The BH workqueue implementation uses the same softirq infrastructure, and performance-critical networking conversions have shown no measurable performance impact. Signed-off-by: Pat Somaru Reviewed-by: Frank Li --- v2: Updated commit message The Apple ADMAC driver uses a per-channel tasklet to invoke DMA completion callbacks for cyclic transactions. This conversion maintains the same execution semantics while using the modern BH workqueue infrastructure. This patch was tested by: - Building with allmodconfig: no new warnings (compared to v6.18) - Building with allyesconfig: no new warnings (compared to v6.18) - Booting defconfig kernel via vng and running `uname -a`: Linux virtme-ng 6.18.0-virtme #1 SMP PREEMPT_DYNAMIC 0 x86_64 GNU/Linux Maintainers can apply this directly to the DMA subsystem tree or ack it for the workqueue tree to carry. Thanks for letting me know about talk to maintainer section, Frank! drivers/dma/apple-admac.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/dma/apple-admac.c b/drivers/dma/apple-admac.c index bd49f0374291..8a0e100d5aaf 100644 --- a/drivers/dma/apple-admac.c +++ b/drivers/dma/apple-admac.c @@ -16,6 +16,7 @@ #include #include #include +#include =20 #include "dmaengine.h" =20 @@ -89,7 +90,7 @@ struct admac_chan { unsigned int no; struct admac_data *host; struct dma_chan chan; - struct tasklet_struct tasklet; + struct work_struct work; =20 u32 carveout; =20 @@ -522,8 +523,8 @@ static int admac_terminate_all(struct dma_chan *chan) adchan->current_tx =3D NULL; } /* - * Descriptors can only be freed after the tasklet - * has been killed (in admac_synchronize). + * Descriptors can only be freed after the work + * has been cancelled (in admac_synchronize). */ list_splice_tail_init(&adchan->submitted, &adchan->to_free); list_splice_tail_init(&adchan->issued, &adchan->to_free); @@ -543,7 +544,7 @@ static void admac_synchronize(struct dma_chan *chan) list_splice_tail_init(&adchan->to_free, &head); spin_unlock_irqrestore(&adchan->lock, flags); =20 - tasklet_kill(&adchan->tasklet); + cancel_work_sync(&adchan->work); =20 list_for_each_entry_safe(adtx, _adtx, &head, node) { list_del(&adtx->node); @@ -662,7 +663,7 @@ static void admac_handle_status_desc_done(struct admac_= data *ad, int channo) tx->reclaimed_pos %=3D 2 * tx->buf_len; =20 admac_cyclic_write_desc(ad, channo, tx); - tasklet_schedule(&adchan->tasklet); + queue_work(system_bh_wq, &adchan->work); } spin_unlock_irqrestore(&adchan->lock, flags); } @@ -712,9 +713,9 @@ static irqreturn_t admac_interrupt(int irq, void *devid) return IRQ_HANDLED; } =20 -static void admac_chan_tasklet(struct tasklet_struct *t) +static void admac_chan_work(struct work_struct *work) { - struct admac_chan *adchan =3D from_tasklet(adchan, t, tasklet); + struct admac_chan *adchan =3D from_work(adchan, work, work); struct admac_tx *adtx; struct dmaengine_desc_callback cb; struct dmaengine_result tx_result; @@ -886,7 +887,7 @@ static int admac_probe(struct platform_device *pdev) INIT_LIST_HEAD(&adchan->issued); INIT_LIST_HEAD(&adchan->to_free); list_add_tail(&adchan->chan.device_node, &dma->channels); - tasklet_setup(&adchan->tasklet, admac_chan_tasklet); + INIT_WORK(&adchan->work, admac_chan_work); } =20 err =3D reset_control_reset(ad->rstc); --=20 2.52.0