Description of problem: bad request address in /sys/kernel/debug/block/<device>/rq_hang Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1.通过systemtap模拟io hung probe kernel.statement("blk_mq_start_request@block/blk-mq.c:780") { if (kernel_string($q->disk->disk_name) == "vdb") { if ($rq->__sector == 8) mdelay(10000); printf("liuwei io hung %p:%p %d\n", $rq, $q, $rq->__sector); } } 2.查看hung住的request信息,可以看到request地址不对 Actual results: 000000006c8f6016 {.op=READ, .cmd_flags=, .rq_flags=IO_STAT|STATS, .state=idle, .tag=133, .internal_tag=-1, .start_time_ns=542496309469680, .io_start_time_ns=542496309469940, .current_time=542528292311880, .bio = ffff8000084cfbf0, .sector = 8, .len=4096, .bio_pages = { ffffffc000437980 }} Expected results: ffffxxxxxxxxxxxx {.op=READ, .cmd_flags=, .rq_flags=IO_STAT|STATS, .state=idle, .tag=133, .internal_tag=-1, .start_time_ns=542496309469680, .io_start_time_ns=542496309469940, .current_time=542528292311880, .bio = ffff8000084cfbf0, .sector = 8, .len=4096, .bio_pages = { ffffffc000437980 }} Additional info:
348 static void blk_mq_debugfs_rq_hang_show(struct seq_file *m, struct request *rq) 349 { 350 const struct blk_mq_ops *const mq_ops = rq->q->mq_ops; 351 const unsigned int op = req_op(rq); 352 const char *op_str = blk_op_str(op); 353 struct bio *bio; 354 struct bio_vec *bvec; 355 struct bvec_iter_all iter_all; 356 357 seq_printf(m, "%p {.op=", rq); ---<<<< 应该是“%px”,而不是“%p” 358 if (strcmp(op_str, "UNKNOWN") == 0) 359 seq_printf(m, "%u", op); 360 else 361 seq_printf(m, "%s", op_str); 362 seq_puts(m, ", .cmd_flags=");
"%p" is plain pointer, which is hashed to prevent leaking information about the kernel memory layout. So it is not "bad address". Anyway, since this is a debug interface which requires administrator privileges, so use "%px" to print the real address is the designed way.
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3129
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3135
Fixed both in ANCK 6.6 & 5.10.