iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.36k stars 3.86k forks source link

Fail run disksnoop.py example #4895

Closed gdxie1 closed 7 months ago

gdxie1 commented 8 months ago

I got the following msg:

Exception: Failed to attach BPF program b'trace_completion' to kprobe b'blk_account_io_done'

This is my kernal Linux gdxie-MacBook 6.5.0-15-generic #15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

I installed the package: sudo apt install libbpfcc-dev python3-bpfcc bpfcc-tools I also try to compile the bcc from source and got the same results.

gdxie1 commented 8 months ago

I ended up using blk_mq_end_request to replace blk_account_io_done . It works but I am not sure blk_mq_end_request is the right one?

yonghong-song commented 7 months ago

I ended up using blk_mq_end_request to replace blk_account_io_done . It works but I am not sure blk_mq_end_request is the right one?

If I understand correctly, blk_mq_end_request probably won't work in all cases. For a particular io_submit, the kernel may break it into multiple requests and each request will call blk_mq_end_request. When all requests are done, blk_account_io_done is called. But if request is not big enough, blk_mq_end_request probably okay.

gdxie1 commented 7 months ago

I ended up using blk_mq_end_request to replace blk_account_io_done . It works but I am not sure blk_mq_end_request is the right one?

If I understand correctly, blk_mq_end_request probably won't work in all cases. For a particular io_submit, the kernel may break it into multiple requests and each request will call blk_mq_end_request. When all requests are done, blk_account_io_done is called. But if request is not big enough, blk_mq_end_request probably okay.

thanks. I just move on to next state.