From: Allen Pais <apais@linux.microsoft.com>
To: linux-kernel@vger.kernel.org
Cc: imx@lists.linux.dev, ulf.hansson@linaro.org, oneukum@suse.com,
duncan.sands@free.fr, hayashi.kunihiko@socionext.com,
linux-mmc@vger.kernel.org, aubin.constans@microchip.com,
linus.walleij@linaro.org, Frank.Li@nxp.com,
linux-hyperv@vger.kernel.org, HaraldWelte@viatech.com,
paul@crapouillou.net, linux-tegra@vger.kernel.org,
netdev@vger.kernel.org, maintainers@bluecherrydvr.com,
peter.ujfalusi@gmail.com, manivannan.sadhasivam@linaro.org,
linux-riscv@lists.infradead.org, kys@microsoft.com,
robert.jarzmik@free.fr, haijie1@huawei.com,
linux-renesas-soc@vger.kernel.org, wei.liu@kernel.org,
linux-omap@vger.kernel.org, florian.fainelli@broadcom.com,
linux-rdma@vger.kernel.org, vireshk@kernel.org,
jassisinghbrar@gmail.com, decui@microsoft.com,
wangzhou1@hisilicon.com, jernej.skrabec@gmail.com,
jh80.chung@samsung.com, zw@zh-kernel.org, wens@csie.org,
stern@rowland.harvard.edu, linux-arm-msm@vger.kernel.org,
orsonzhai@gmail.com, pierre@ossman.eu, linux-usb@vger.kernel.org,
Eugeniy.Paltsev@sy nopsys.com, patrice.chotard@foss.st.com,
asahi@lists.linux.dev, brucechang@via.com.tw,
keescook@chromium.org, oakad@yahoo.com, sven@svenpeter.dev,
rjui@broadcom.com, s.hauer@pengutronix.de,
sean.wang@mediatek.com, linux-actions@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org, haojian.zhuang@gmail.com,
mirq-linux@rere.qmqm.pl, dmaengine@vger.kernel.org,
linux-mediatek@lists.infradead.org,
linux-rpi-kernel@lists.infradead.org,
baolin.wang@linux.alibaba.com, matthias.bgg@gmail.com,
openipmi-developer@lists.sourceforge.net, mchehab@kernel.org,
linux-arm-kernel@lists.infradead.org,
angelogioacchino.delregno@collabora.com, sbranden@broadcom.com,
logang@deltatee.com, andersson@kernel.org, marcan@marcan.st,
haiyangz@microsoft.com, linux-mips@vger.kernel.org,
leoyang.li@nxp.com, konrad.dybcio@linaro.org,
linux-sunxi@lists.linux.dev, vkoul@kernel.org,
linux-s390@vger.kernel.org, mhiramat@kernel.org,
zhang.lyra@gmail.com, tj@kernel.org, manuel.lauss@gmail.com,
linux-media@vger.kernel.org, s hawnguo@kernel.org,
afaerber@suse.de, daniel@zonque.org
Subject: [PATCH 5/9] mailbox: Convert from tasklet to BH workqueue
Date: Wed, 27 Mar 2024 16:03:10 +0000 [thread overview]
Message-ID: <20240327160314.9982-6-apais@linux.microsoft.com> (raw)
In-Reply-To: <20240327160314.9982-1-apais@linux.microsoft.com>
The only generic interface to execute asynchronously in the BH context is
tasklet; however, it's marked deprecated and has some design flaws. 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/infiniband/* from tasklet to BH workqueue.
Based on the work done by Tejun Heo <tj@kernel.org>
Branch: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-6.10
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
drivers/mailbox/bcm-pdc-mailbox.c | 21 +++++++++++----------
drivers/mailbox/imx-mailbox.c | 16 ++++++++--------
2 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/drivers/mailbox/bcm-pdc-mailbox.c b/drivers/mailbox/bcm-pdc-mailbox.c
index 1768d3d5aaa0..242e7504a628 100644
--- a/drivers/mailbox/bcm-pdc-mailbox.c
+++ b/drivers/mailbox/bcm-pdc-mailbox.c
@@ -43,6 +43,7 @@
#include <linux/dma-direction.h>
#include <linux/dma-mapping.h>
#include <linux/dmapool.h>
+#include <linux/workqueue.h>
#define PDC_SUCCESS 0
@@ -293,8 +294,8 @@ struct pdc_state {
unsigned int pdc_irq;
- /* tasklet for deferred processing after DMA rx interrupt */
- struct tasklet_struct rx_tasklet;
+ /* work for deferred processing after DMA rx interrupt */
+ struct work_struct rx_work;
/* Number of bytes of receive status prior to each rx frame */
u32 rx_status_len;
@@ -952,18 +953,18 @@ static irqreturn_t pdc_irq_handler(int irq, void *data)
iowrite32(intstatus, pdcs->pdc_reg_vbase + PDC_INTSTATUS_OFFSET);
/* Wakeup IRQ thread */
- tasklet_schedule(&pdcs->rx_tasklet);
+ queue_work(system_bh_wq, &pdcs->rx_work);
return IRQ_HANDLED;
}
/**
- * pdc_tasklet_cb() - Tasklet callback that runs the deferred processing after
+ * pdc_work_cb() - Work callback that runs the deferred processing after
* a DMA receive interrupt. Reenables the receive interrupt.
* @t: Pointer to the Altera sSGDMA channel structure
*/
-static void pdc_tasklet_cb(struct tasklet_struct *t)
+static void pdc_work_cb(struct work_struct *t)
{
- struct pdc_state *pdcs = from_tasklet(pdcs, t, rx_tasklet);
+ struct pdc_state *pdcs = from_work(pdcs, t, rx_work);
pdc_receive(pdcs);
@@ -1577,8 +1578,8 @@ static int pdc_probe(struct platform_device *pdev)
pdc_hw_init(pdcs);
- /* Init tasklet for deferred DMA rx processing */
- tasklet_setup(&pdcs->rx_tasklet, pdc_tasklet_cb);
+ /* Init work for deferred DMA rx processing */
+ INIT_WORK(&pdcs->rx_work, pdc_work_cb);
err = pdc_interrupts_init(pdcs);
if (err)
@@ -1595,7 +1596,7 @@ static int pdc_probe(struct platform_device *pdev)
return PDC_SUCCESS;
cleanup_buf_pool:
- tasklet_kill(&pdcs->rx_tasklet);
+ cancel_work_sync(&pdcs->rx_work);
dma_pool_destroy(pdcs->rx_buf_pool);
cleanup_ring_pool:
@@ -1611,7 +1612,7 @@ static void pdc_remove(struct platform_device *pdev)
pdc_free_debugfs();
- tasklet_kill(&pdcs->rx_tasklet);
+ cancel_work_sync(&pdcs->rx_work);
pdc_hw_disable(pdcs);
diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c
index 5c1d09cad761..933727f89431 100644
--- a/drivers/mailbox/imx-mailbox.c
+++ b/drivers/mailbox/imx-mailbox.c
@@ -21,6 +21,7 @@
#include <linux/pm_runtime.h>
#include <linux/suspend.h>
#include <linux/slab.h>
+#include <linux/workqueue.h>
#include "mailbox.h"
@@ -80,7 +81,7 @@ struct imx_mu_con_priv {
char irq_desc[IMX_MU_CHAN_NAME_SIZE];
enum imx_mu_chan_type type;
struct mbox_chan *chan;
- struct tasklet_struct txdb_tasklet;
+ struct work_struct txdb_work;
};
struct imx_mu_priv {
@@ -232,7 +233,7 @@ static int imx_mu_generic_tx(struct imx_mu_priv *priv,
break;
case IMX_MU_TYPE_TXDB:
imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIRn(priv->dcfg->type, cp->idx), 0);
- tasklet_schedule(&cp->txdb_tasklet);
+ queue_work(system_bh_wq, &cp->txdb_work);
break;
case IMX_MU_TYPE_TXDB_V2:
imx_mu_xcr_rmw(priv, IMX_MU_GCR, IMX_MU_xCR_GIRn(priv->dcfg->type, cp->idx), 0);
@@ -420,7 +421,7 @@ static int imx_mu_seco_tx(struct imx_mu_priv *priv, struct imx_mu_con_priv *cp,
}
/* Simulate hack for mbox framework */
- tasklet_schedule(&cp->txdb_tasklet);
+ queue_work(system_bh_wq, &cp->txdb_work);
break;
default:
@@ -484,9 +485,9 @@ static int imx_mu_seco_rxdb(struct imx_mu_priv *priv, struct imx_mu_con_priv *cp
return err;
}
-static void imx_mu_txdb_tasklet(unsigned long data)
+static void imx_mu_txdb_work(struct work_struct *t)
{
- struct imx_mu_con_priv *cp = (struct imx_mu_con_priv *)data;
+ struct imx_mu_con_priv *cp = from_work(cp, t, txdb_work);
mbox_chan_txdone(cp->chan, 0);
}
@@ -570,8 +571,7 @@ static int imx_mu_startup(struct mbox_chan *chan)
if (cp->type == IMX_MU_TYPE_TXDB) {
/* Tx doorbell don't have ACK support */
- tasklet_init(&cp->txdb_tasklet, imx_mu_txdb_tasklet,
- (unsigned long)cp);
+ INIT_WORK(&cp->txdb_work, imx_mu_txdb_work);
return 0;
}
@@ -615,7 +615,7 @@ static void imx_mu_shutdown(struct mbox_chan *chan)
}
if (cp->type == IMX_MU_TYPE_TXDB) {
- tasklet_kill(&cp->txdb_tasklet);
+ cancel_work_sync(&cp->txdb_work);
pm_runtime_put_sync(priv->dev);
return;
}
--
2.17.1
next prev parent reply other threads:[~2024-03-27 21:17 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 16:03 [PATCH 0/9] Convert Tasklets to BH Workqueues Allen Pais
2024-03-27 16:03 ` [PATCH 1/9] hyperv: Convert from tasklet to BH workqueue Allen Pais
2024-04-03 16:43 ` Allen
2024-03-27 16:03 ` [PATCH 2/9] dma: " Allen Pais
2024-03-28 5:55 ` Vinod Koul
2024-03-28 10:08 ` Arnd Bergmann
2024-03-28 18:31 ` Vinod Koul
2024-03-28 19:39 ` Allen
2024-03-28 19:49 ` Arnd Bergmann
2024-03-28 20:01 ` Allen
2024-03-29 16:38 ` Vinod Koul
2024-03-29 16:39 ` Vinod Koul
2024-03-28 17:49 ` Allen
2024-04-02 12:25 ` Linus Walleij
2024-04-02 13:11 ` Vinod Koul
2024-03-27 16:03 ` [PATCH 3/9] IB: " Allen Pais
2024-03-27 16:03 ` [PATCH 4/9] USB: " Allen Pais
2024-03-27 16:20 ` Duncan Sands
2024-03-27 16:55 ` Greg KH
2024-03-27 16:58 ` Allen
2024-03-27 17:55 ` Alan Stern
2024-03-28 17:54 ` Allen
2024-03-27 16:03 ` Allen Pais [this message]
2024-03-27 16:03 ` [PATCH 6/9] ipmi: " Allen Pais
2024-03-27 17:58 ` Corey Minyard
2024-03-28 17:52 ` Allen
2024-03-28 19:23 ` Corey Minyard
2024-03-28 19:41 ` Allen
2024-03-28 19:52 ` Corey Minyard
2024-03-28 19:58 ` Allen
2024-03-27 16:03 ` [PATCH 7/9] s390: " Allen Pais
2024-04-02 12:48 ` Alexandra Winter
2024-04-03 13:33 ` Allen
2024-03-27 16:03 ` [PATCH 8/9] drivers/media/*: " Allen Pais
2024-03-27 16:03 ` [PATCH 9/9] mmc: " Allen Pais
2024-03-27 19:35 ` Jernej Škrabec
2024-03-28 10:16 ` Christian Loehle
2024-03-28 17:47 ` Allen
2024-03-28 12:53 ` Ulf Hansson
2024-03-28 13:37 ` Linus Walleij
2024-03-28 16:21 ` Tejun Heo
2024-04-02 10:15 ` Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240327160314.9982-6-apais@linux.microsoft.com \
--to=apais@linux.microsoft.com \
--cc=Eugeniy.Paltsev@sy \
--cc=Frank.Li@nxp.com \
--cc=HaraldWelte@viatech.com \
--cc=aubin.constans@microchip.com \
--cc=decui@microsoft.com \
--cc=duncan.sands@free.fr \
--cc=florian.fainelli@broadcom.com \
--cc=haijie1@huawei.com \
--cc=hayashi.kunihiko@socionext.com \
--cc=imx@lists.linux.dev \
--cc=jassisinghbrar@gmail.com \
--cc=jernej.skrabec@gmail.com \
--cc=jh80.chung@samsung.com \
--cc=kys@microsoft.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=maintainers@bluecherrydvr.com \
--cc=manivannan.sadhasivam@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=oneukum@suse.com \
--cc=orsonzhai@gmail.com \
--cc=paul@crapouillou.net \
--cc=peter.ujfalusi@gmail.com \
--cc=pierre@ossman.eu \
--cc=robert.jarzmik@free.fr \
--cc=stern@rowland.harvard.edu \
--cc=ulf.hansson@linaro.org \
--cc=vireshk@kernel.org \
--cc=wangzhou1@hisilicon.com \
--cc=wei.liu@kernel.org \
--cc=wens@csie.org \
--cc=zw@zh-kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).