diff mbox series

[4/4] blk-mq-debugfs: export hctx->type

Message ID 20181216022517.26650-5-ming.lei@redhat.com (mailing list archive)
State New, archived
Headers show
Series blk-mq: queue mapping fix & improvement | expand

Commit Message

Ming Lei Dec. 16, 2018, 2:25 a.m. UTC
Now we only export hctx->type via sysfs, and there isn't such info
in hctx entry under debugfs. We often use debugfs only to diagnose
queue mapping issue, so add the support in debugfs.

Queue mapping becomes a bit more complicated after multiple queue
mapping is supported, we may write blktest to verify if queue mapping
is valid based on blk-mq-debug.

Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-mq-debugfs.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Christoph Hellwig Dec. 16, 2018, 4:17 p.m. UTC | #1
On Sun, Dec 16, 2018 at 10:25:17AM +0800, Ming Lei wrote:
> Now we only export hctx->type via sysfs, and there isn't such info
> in hctx entry under debugfs. We often use debugfs only to diagnose
> queue mapping issue, so add the support in debugfs.
> 
> Queue mapping becomes a bit more complicated after multiple queue
> mapping is supported, we may write blktest to verify if queue mapping
> is valid based on blk-mq-debug.

I'll let Jens decide if we really want to double export information
like this (or maybe even move it to debugfs only?)

> +static int hctx_type_show(void *data, struct seq_file *m)
> +{
> +	struct blk_mq_hw_ctx *hctx = data;
> +
> +	seq_printf(m, "%u\n", hctx->type);
> +	return 0;

But if we export it we should probably export it as a text, just
like we do for sysfs now.
Jens Axboe Dec. 16, 2018, 7:12 p.m. UTC | #2
On 12/16/18 9:17 AM, Christoph Hellwig wrote:
> On Sun, Dec 16, 2018 at 10:25:17AM +0800, Ming Lei wrote:
>> Now we only export hctx->type via sysfs, and there isn't such info
>> in hctx entry under debugfs. We often use debugfs only to diagnose
>> queue mapping issue, so add the support in debugfs.
>>
>> Queue mapping becomes a bit more complicated after multiple queue
>> mapping is supported, we may write blktest to verify if queue mapping
>> is valid based on blk-mq-debug.
> 
> I'll let Jens decide if we really want to double export information
> like this (or maybe even move it to debugfs only?)

Let's just move it to debugfs, we don't need it twice.

>> +static int hctx_type_show(void *data, struct seq_file *m)
>> +{
>> +	struct blk_mq_hw_ctx *hctx = data;
>> +
>> +	seq_printf(m, "%u\n", hctx->type);
>> +	return 0;
> 
> But if we export it we should probably export it as a text, just
> like we do for sysfs now.

Indeed
Ming Lei Dec. 17, 2018, 1:06 a.m. UTC | #3
On Sun, Dec 16, 2018 at 05:17:44PM +0100, Christoph Hellwig wrote:
> On Sun, Dec 16, 2018 at 10:25:17AM +0800, Ming Lei wrote:
> > Now we only export hctx->type via sysfs, and there isn't such info
> > in hctx entry under debugfs. We often use debugfs only to diagnose
> > queue mapping issue, so add the support in debugfs.
> > 
> > Queue mapping becomes a bit more complicated after multiple queue
> > mapping is supported, we may write blktest to verify if queue mapping
> > is valid based on blk-mq-debug.
> 
> I'll let Jens decide if we really want to double export information
> like this (or maybe even move it to debugfs only?)

It is pretty friendly to export all in one place, given users may
collect log just by one single command or familiar way.

> 
> > +static int hctx_type_show(void *data, struct seq_file *m)
> > +{
> > +	struct blk_mq_hw_ctx *hctx = data;
> > +
> > +	seq_printf(m, "%u\n", hctx->type);
> > +	return 0;
> 
> But if we export it we should probably export it as a text, just
> like we do for sysfs now.

OK.


Thanks,
Ming
diff mbox series

Patch

diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index a32bb79d6c95..219e29d49a49 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -636,6 +636,14 @@  static int hctx_dispatch_busy_show(void *data, struct seq_file *m)
 	return 0;
 }
 
+static int hctx_type_show(void *data, struct seq_file *m)
+{
+	struct blk_mq_hw_ctx *hctx = data;
+
+	seq_printf(m, "%u\n", hctx->type);
+	return 0;
+}
+
 static void *ctx_rq_list_start(struct seq_file *m, loff_t *pos)
 	__acquires(&ctx->lock)
 {
@@ -798,6 +806,7 @@  static const struct blk_mq_debugfs_attr blk_mq_debugfs_hctx_attrs[] = {
 	{"run", 0600, hctx_run_show, hctx_run_write},
 	{"active", 0400, hctx_active_show},
 	{"dispatch_busy", 0400, hctx_dispatch_busy_show},
+	{"type", 0400, hctx_type_show},
 	{},
 };