aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-03-20 15:29:18 -0400
committerJens Axboe <axboe@fb.com>2014-03-20 15:31:44 -0400
commit676141e48af7463717896352e69c10f945ac22dd (patch)
tree6c583ea4dac7a9cba9ddd44a194984ee3d1a4ada
parent5d12f905cc50c0810628d0deedd478ec2db48659 (diff)
blk-mq: don't dump CPU -> hw queue map on driver load
Now that we are out of initial debug/bringup mode, remove the verbose dump of the mapping table. Provide the mapping table in sysfs, under the hardware queue directory, in the cpu_list file. Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--block/blk-mq-cpumap.c10
-rw-r--r--block/blk-mq-sysfs.c31
-rw-r--r--block/blk-mq.c10
-rw-r--r--block/blk-mq.h2
4 files changed, 43 insertions, 10 deletions
diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c
index f8721278601c..097921329619 100644
--- a/block/blk-mq-cpumap.c
+++ b/block/blk-mq-cpumap.c
@@ -9,15 +9,6 @@
9#include "blk.h" 9#include "blk.h"
10#include "blk-mq.h" 10#include "blk-mq.h"
11 11
12static void show_map(unsigned int *map, unsigned int nr)
13{
14 int i;
15
16 pr_info("blk-mq: CPU -> queue map\n");
17 for_each_online_cpu(i)
18 pr_info(" CPU%2u -> Queue %u\n", i, map[i]);
19}
20
21static int cpu_to_queue_index(unsigned int nr_cpus, unsigned int nr_queues, 12static int cpu_to_queue_index(unsigned int nr_cpus, unsigned int nr_queues,
22 const int cpu) 13 const int cpu)
23{ 14{
@@ -85,7 +76,6 @@ int blk_mq_update_queue_map(unsigned int *map, unsigned int nr_queues)
85 map[i] = map[first_sibling]; 76 map[i] = map[first_sibling];
86 } 77 }
87 78
88 show_map(map, nr_cpus);
89 free_cpumask_var(cpus); 79 free_cpumask_var(cpus);
90 return 0; 80 return 0;
91} 81}
diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
index b91ce75bd35d..b0ba264b0522 100644
--- a/block/blk-mq-sysfs.c
+++ b/block/blk-mq-sysfs.c
@@ -244,6 +244,32 @@ static ssize_t blk_mq_hw_sysfs_tags_show(struct blk_mq_hw_ctx *hctx, char *page)
244 return blk_mq_tag_sysfs_show(hctx->tags, page); 244 return blk_mq_tag_sysfs_show(hctx->tags, page);
245} 245}
246 246
247static ssize_t blk_mq_hw_sysfs_cpus_show(struct blk_mq_hw_ctx *hctx, char *page)
248{
249 unsigned int i, queue_num, first = 1;
250 ssize_t ret = 0;
251
252 blk_mq_disable_hotplug();
253
254 for_each_online_cpu(i) {
255 queue_num = hctx->queue->mq_map[i];
256 if (queue_num != hctx->queue_num)
257 continue;
258
259 if (first)
260 ret += sprintf(ret + page, "%u", i);
261 else
262 ret += sprintf(ret + page, ", %u", i);
263
264 first = 0;
265 }
266
267 blk_mq_enable_hotplug();
268
269 ret += sprintf(ret + page, "\n");
270 return ret;
271}
272
247static struct blk_mq_ctx_sysfs_entry blk_mq_sysfs_dispatched = { 273static struct blk_mq_ctx_sysfs_entry blk_mq_sysfs_dispatched = {
248 .attr = {.name = "dispatched", .mode = S_IRUGO }, 274 .attr = {.name = "dispatched", .mode = S_IRUGO },
249 .show = blk_mq_sysfs_dispatched_show, 275 .show = blk_mq_sysfs_dispatched_show,
@@ -294,6 +320,10 @@ static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_tags = {
294 .attr = {.name = "tags", .mode = S_IRUGO }, 320 .attr = {.name = "tags", .mode = S_IRUGO },
295 .show = blk_mq_hw_sysfs_tags_show, 321 .show = blk_mq_hw_sysfs_tags_show,
296}; 322};
323static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_cpus = {
324 .attr = {.name = "cpu_list", .mode = S_IRUGO },
325 .show = blk_mq_hw_sysfs_cpus_show,
326};
297 327
298static struct attribute *default_hw_ctx_attrs[] = { 328static struct attribute *default_hw_ctx_attrs[] = {
299 &blk_mq_hw_sysfs_queued.attr, 329 &blk_mq_hw_sysfs_queued.attr,
@@ -302,6 +332,7 @@ static struct attribute *default_hw_ctx_attrs[] = {
302 &blk_mq_hw_sysfs_pending.attr, 332 &blk_mq_hw_sysfs_pending.attr,
303 &blk_mq_hw_sysfs_ipi.attr, 333 &blk_mq_hw_sysfs_ipi.attr,
304 &blk_mq_hw_sysfs_tags.attr, 334 &blk_mq_hw_sysfs_tags.attr,
335 &blk_mq_hw_sysfs_cpus.attr,
305 NULL, 336 NULL,
306}; 337};
307 338
diff --git a/block/blk-mq.c b/block/blk-mq.c
index ed216f27e3b8..3b1c425a935e 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1532,6 +1532,16 @@ static int blk_mq_queue_reinit_notify(struct notifier_block *nb,
1532 return NOTIFY_OK; 1532 return NOTIFY_OK;
1533} 1533}
1534 1534
1535void blk_mq_disable_hotplug(void)
1536{
1537 mutex_lock(&all_q_mutex);
1538}
1539
1540void blk_mq_enable_hotplug(void)
1541{
1542 mutex_unlock(&all_q_mutex);
1543}
1544
1535static int __init blk_mq_init(void) 1545static int __init blk_mq_init(void)
1536{ 1546{
1537 blk_mq_cpu_init(); 1547 blk_mq_cpu_init();
diff --git a/block/blk-mq.h b/block/blk-mq.h
index ed0035cd458e..361f9343dab1 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -40,6 +40,8 @@ void blk_mq_init_cpu_notifier(struct blk_mq_cpu_notifier *notifier,
40void blk_mq_register_cpu_notifier(struct blk_mq_cpu_notifier *notifier); 40void blk_mq_register_cpu_notifier(struct blk_mq_cpu_notifier *notifier);
41void blk_mq_unregister_cpu_notifier(struct blk_mq_cpu_notifier *notifier); 41void blk_mq_unregister_cpu_notifier(struct blk_mq_cpu_notifier *notifier);
42void blk_mq_cpu_init(void); 42void blk_mq_cpu_init(void);
43void blk_mq_enable_hotplug(void);
44void blk_mq_disable_hotplug(void);
43 45
44/* 46/*
45 * CPU -> queue mappings 47 * CPU -> queue mappings