Bug 8947 - anolis: use %px to print request in rq_hang
Summary: anolis: use %px to print request in rq_hang
Status: RESOLVED FIXED
Alias: None
Product: ANCK 6.6 Dev
Classification: ANCK
Component: block/storage (show other bugs) block/storage
Version: 6.6.25-2
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: Joseph Qi
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-07 11:34 UTC by loobin
Modified: 2024-05-07 17:59 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description loobin 2024-05-07 11:34:10 UTC
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:
Comment 1 loobin 2024-05-07 11:35:52 UTC
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=");
Comment 2 Joseph Qi alibaba_cloud_group 2024-05-07 13:59:40 UTC
"%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.
Comment 3 小龙 admin 2024-05-07 14:12:13 UTC
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3129
Comment 4 小龙 admin 2024-05-07 16:45:38 UTC
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3135
Comment 5 Joseph Qi alibaba_cloud_group 2024-05-07 17:59:58 UTC
Fixed both in ANCK 6.6 & 5.10.