From nobody Sun Feb 8 13:10:49 2026 Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (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 B8C24346AD3; Fri, 6 Feb 2026 09:01:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770368503; cv=none; b=GcprOp2jby9MPUukio5XTRCIavLsF6hxksmELraQ0lAQfDZ/YrtitNGDhqfN7jDaTey03z1HwicX9FsJ3ZZ/D615ypB3iz4gWUB5F5ZP57qGVjeKk8+waUZL1QjxFc/BZ8roAfGpucsjoaiM1LHGqVa7LFK6DqEVTnDk7NwN5i0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770368503; c=relaxed/simple; bh=asJVk3oDuqmwmZ312NC0mB7ORGNHM32Qh/uEQ9O2u5s=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qUQ7oaC3TnfbGn96wSn2IHWQEKyJdnPemVpx9GEfzpy+pvHkqy+9p/B+momVuQUIUnOhTwWhMKsaqI70VXXGIvCPjEtujK6/Gvf5tA1tVwFBDxrrszCzTQ1JKGMoMOFIsaCi8lPsPMeBnNTpEUZDtxP1uuCGy40TEX5biZCAP8E= 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=j/yR3Rmc; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=pjku9ZbL; arc=none smtp.client-ip=202.12.124.157 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="j/yR3Rmc"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="pjku9ZbL" Received: from phl-compute-08.internal (phl-compute-08.internal [10.202.2.48]) by mailfhigh.stl.internal (Postfix) with ESMTP id 91C687A0021; Fri, 6 Feb 2026 04:01:41 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Fri, 06 Feb 2026 04:01:42 -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=1770368501; x=1770454901; bh=e6Q5jFK43Z J1Twf/eEHkLZQeVBspSGKtpQIWC0nWZzI=; b=j/yR3RmcRCUQB3p3fOJmIVSMfN l+iXWCqX6UvNAyb5hQVBeGVVMwciZbgRFYQjcM7dgneTs6unJEsdVMvxVwUEIoGz Xyr59fxbOPg4HIgmA858d8ytVE0rSb2HlDdgYzvo2QNsogP5U7u2EgDEiDjvEO7n 9gGOd0O3jd1yJp0v8/yVuhWO+L6MGcXElD33Ktbz5/x3LOyLLRj4MXKmqgtY7Dpn wWHtCOv287afDheS9TOyMmXPC8WYrL7+CXOfrx23Lm0gItc7J6K6pGoLVGSe0qeF YXDEWZhzLZO6sU+n23nU5PFpL8d7CJ9ym51Qu+Jgi8M8lknjCIkFKzam2kaQ== 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= 1770368501; x=1770454901; bh=e6Q5jFK43ZJ1Twf/eEHkLZQeVBspSGKtpQI WC0nWZzI=; b=pjku9ZbLF9pgCVJ6NcW4j8i70bylRNpHUdSFQwiNkUOVzrvn9K0 L1zfywn23i8jHdH37inaSX3nxMLpal7/jV8dj3eiO9T11cWk1C74K1z24dWiQENm dZfJcDNhbZv1GYTPkOcqy0cdaXyz368PshzBcLRg2ZUzYe+XByUu9iFRv7cDwMed emok0U6Vdcccmyn88WQHmwC/5gcZgIdoEFun0oPCLH/dP56bgM+0oVPaUIQbINGm xYWfe6ey5q9qFc2Bf4bu2phW5p09clR66mp8bkI/ENpwqF/Wp6t2yaqAOY2DJD8f ppNCH3057Xh80k0nkbkWOaG5g4BpnBg9I1A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukeejjeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgggfestdekredtredttdenucfhrhhomheprfgrthcuufhomhgr rhhuuceophgrthhsoheslhhikhgvfihhrghtvghvshdrihhoqeenucggtffrrghtthgvrh hnpeefveeiveeijefgueettdejleelieefvddtkeekudduveetveeutdehffeiueehuden ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehprghtsh hosehlihhkvgifhhgrthgvvhhsrdhiohdpnhgspghrtghpthhtohepuddtpdhmohguvgep 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 04:01:40 -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 Subject: [PATCH] dma: apple-admac: Convert from tasklet to BH workqueue Date: Fri, 6 Feb 2026 04:01:37 -0500 Message-ID: <20260206090137.1127897-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. This patch converts drivers/dma/apple-admac.c from tasklet to BH workqueue. 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 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. Maintainers can apply this directly to the DMA subsystem tree or ack it for the workqueue tree to carry. Signed-off-by: Pat Somaru Reviewed-by: Frank Li --- 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