From: Jiang Liu <liuj97@gmail.com>
To: Vinod Koul <vinod.koul@intel.com>,
Dan Williams <dan.j.williams@intel.com>
Cc: Jiang Liu <jiang.liu@huawei.com>,
Keping Chen <chenkeping@huawei.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Jiang Liu <liuj97@gmail.com>
Subject: [PATCH v1 2/8] dmaengine: rebalance DMA channels when CPU hotplug happens
Date: Mon, 23 Apr 2012 21:51:43 +0800 [thread overview]
Message-ID: <1335189109-4871-3-git-send-email-jiang.liu@huawei.com> (raw)
In-Reply-To: <1335189109-4871-1-git-send-email-jiang.liu@huawei.com>
Rebalance DMA channels when CPU hotplug happens to correctly update
DMA channel reference count.
Signed-off-by: Jiang Liu <liuj97@gmail.com>
---
drivers/dma/dmaengine.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 5b6ad58..198d891 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -49,6 +49,7 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mm.h>
+#include <linux/cpu.h>
#include <linux/device.h>
#include <linux/dmaengine.h>
#include <linux/hardirq.h>
@@ -1008,8 +1009,29 @@ void dma_run_dependencies(struct dma_async_tx_descriptor *tx)
}
EXPORT_SYMBOL_GPL(dma_run_dependencies);
+static int __cpuinit
+hotcpu_rebalance(struct notifier_block *nfb, unsigned long action, void *hcpu)
+{
+ switch (action) {
+ case CPU_ONLINE:
+ case CPU_POST_DEAD:
+ mutex_lock(&dma_list_mutex);
+ dma_channel_rebalance();
+ mutex_unlock(&dma_list_mutex);
+ break;
+ }
+
+ return NOTIFY_OK;
+}
+
+static struct notifier_block __refdata dma_cpu_notifier = {
+ .notifier_call = hotcpu_rebalance,
+};
+
+
static int __init dma_bus_init(void)
{
+ register_hotcpu_notifier(&dma_cpu_notifier);
return class_register(&dma_devclass);
}
arch_initcall(dma_bus_init);
--
1.7.5.4
next prev parent reply other threads:[~2012-04-23 13:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-23 13:51 [PATCH v1 0/8] enhance dmaengine core to support DMA device hotplug Jiang Liu
2012-04-23 13:51 ` [PATCH v1 1/8] dmaengine: enhance DMA channel reference count management Jiang Liu
2012-04-23 13:51 ` Jiang Liu [this message]
2012-04-23 13:51 ` [PATCH v1 3/8] dmaengine: introduce CONFIG_DMA_ENGINE_HOTPLUG for DMA device hotplug Jiang Liu
2012-04-23 13:51 ` [PATCH v1 4/8] dmaengine: use atomic_t for struct dma_chan->client_count field Jiang Liu
2012-04-23 13:51 ` [PATCH v1 5/8] dmaengine: enhance dma_async_device_unregister() to be called by drv->remove() Jiang Liu
2012-04-23 13:51 ` [PATCH v1 6/8] dmaengine: enhance network subsystem to support DMA device hotplug Jiang Liu
2012-04-23 18:30 ` Dan Williams
2012-04-24 2:30 ` Jiang Liu
2012-04-24 3:09 ` Dan Williams
2012-04-24 3:56 ` Jiang Liu
2012-04-25 15:47 ` Jiang Liu
2012-04-23 13:51 ` [PATCH v1 7/8] dmaengine: enhance ASYNC_TX " Jiang Liu
2012-04-23 13:51 ` [RFC PATCH v1 8/8] dmaengine: assign DMA channel to CPU according to NUMA affinity Jiang Liu
2012-04-23 16:40 ` [PATCH v1 0/8] enhance dmaengine core to support DMA device hotplug Dan Williams
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=1335189109-4871-3-git-send-email-jiang.liu@huawei.com \
--to=liuj97@gmail.com \
--cc=chenkeping@huawei.com \
--cc=dan.j.williams@intel.com \
--cc=jiang.liu@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=vinod.koul@intel.com \
/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).