diff options
author | Keith Busch <keith.busch@intel.com> | 2014-03-24 12:46:26 -0400 |
---|---|---|
committer | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2014-04-10 17:03:42 -0400 |
commit | 33b1e95c90447ea73e37e837ea0268a894919f19 (patch) | |
tree | 63e28b93a0524b69c29595c8648008dcc145b3b9 /drivers/block | |
parent | 42f614201e80ff4cfb8b285d7190149a8e1e6cec (diff) |
NVMe: CPU hot plug notification
Registers with hot cpu notification to rebalance, and potentially allocate
additional, io queues.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/nvme-core.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 48d7bd55207a..ce5a4f1a3950 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -2002,6 +2002,19 @@ static size_t db_bar_size(struct nvme_dev *dev, unsigned nr_io_queues) | |||
2002 | return 4096 + ((nr_io_queues + 1) * 8 * dev->db_stride); | 2002 | return 4096 + ((nr_io_queues + 1) * 8 * dev->db_stride); |
2003 | } | 2003 | } |
2004 | 2004 | ||
2005 | static int nvme_cpu_notify(struct notifier_block *self, | ||
2006 | unsigned long action, void *hcpu) | ||
2007 | { | ||
2008 | struct nvme_dev *dev = container_of(self, struct nvme_dev, nb); | ||
2009 | switch (action) { | ||
2010 | case CPU_ONLINE: | ||
2011 | case CPU_DEAD: | ||
2012 | nvme_assign_io_queues(dev); | ||
2013 | break; | ||
2014 | } | ||
2015 | return NOTIFY_OK; | ||
2016 | } | ||
2017 | |||
2005 | static int nvme_setup_io_queues(struct nvme_dev *dev) | 2018 | static int nvme_setup_io_queues(struct nvme_dev *dev) |
2006 | { | 2019 | { |
2007 | struct nvme_queue *adminq = raw_nvmeq(dev, 0); | 2020 | struct nvme_queue *adminq = raw_nvmeq(dev, 0); |
@@ -2080,6 +2093,11 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) | |||
2080 | nvme_free_queues(dev, nr_io_queues + 1); | 2093 | nvme_free_queues(dev, nr_io_queues + 1); |
2081 | nvme_assign_io_queues(dev); | 2094 | nvme_assign_io_queues(dev); |
2082 | 2095 | ||
2096 | dev->nb.notifier_call = &nvme_cpu_notify; | ||
2097 | result = register_hotcpu_notifier(&dev->nb); | ||
2098 | if (result) | ||
2099 | goto free_queues; | ||
2100 | |||
2083 | return 0; | 2101 | return 0; |
2084 | 2102 | ||
2085 | free_queues: | 2103 | free_queues: |
@@ -2357,6 +2375,7 @@ static void nvme_dev_shutdown(struct nvme_dev *dev) | |||
2357 | int i; | 2375 | int i; |
2358 | 2376 | ||
2359 | dev->initialized = 0; | 2377 | dev->initialized = 0; |
2378 | unregister_hotcpu_notifier(&dev->nb); | ||
2360 | 2379 | ||
2361 | spin_lock(&dev_list_lock); | 2380 | spin_lock(&dev_list_lock); |
2362 | list_del_init(&dev->node); | 2381 | list_del_init(&dev->node); |