block: introduce block_rq_error tracepoint
Subsystems (2)
PATCH v8 1/1 block: introduce block_rq_error tracepoint
Currently, rasdaemon uses the existing tracepoint block_rq_complete and filters out non-error cases in order to capture block disk errors.
But there are a few problems with this approach:
1. Even kernel trace filter could do the filtering work, there is still some overhead after we enable this tracepoint.
2. The filter is merely based on errno, which does not align with kernel logic to check the errors for print_req_error().
3. block_rq_complete only provides dev major and minor to identify the block device, it is not convenient to use in user-space.
So introduce a new tracepoint block_rq_error just for the error case. With this patch, rasdaemon could switch to block_rq_error.
Since the new tracepoint has the similar implementation with block_rq_complete, so move the existing code from TRACE_EVENT block_rq_complete() into new event class block_rq_completion(). Then add event for block_rq_complete and block_rq_err respectively from the newly created event class per the suggestion from Chaitanya Kulkarni.
---
The v3 patch was submitted in Feb 2020, and Steven reviewed the patch, but it was not merged to upstream. See
https://lore.kernel.org/lkml/[email protected]/.
The problems fixed by that patch still exist and we do need it to make disk error handling in rasdaemon easier. So this resurrected it and continued the version number.
v7 --> v8:
* Combined two patches into one per Christoph Hellwig.
* Kept Steven's reviewed-by since there is no significant change for tracepoint other than creating event class.
v6 --> v7:
* Prepared (two patches) by Chaitanya Kulkarni
* Created event class
v5 --> v6:
* Removed disk name per Christoph and Chaitanya
* Kept errno since I didn't find any other block tracepoints print blk status code and userspace (i.e. rasdaemon) does expect errno.
v4 --> v5:
* Report the actual block layer status code instead of the errno per Christoph Hellwig.
v3 --> v4:
* Rebased to v5.17-rc1.
* Collected reviewed-by tag from Steven.
block/blk-mq.c | 4 ++- include/trace/events/block.h | 49 ++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 14 deletions(-)
block/blk-mq.c +3 -1
@@ -789,8 +789,10 @@ bool blk_update_request(struct request *req, blk_status_t error,#endif if (unlikely (error && !blk_rq_is_passthrough (req) && - !(req->rq_flags &RQF_QUIET ))) + !(req->rq_flags &RQF_QUIET ))) {blk_print_req_error (req, error); +trace_block_rq_error (req, error, nr_bytes); + }blk_account_io_completion (req, nr_bytes);
include/trace/events/block.h +36 -13
61 lines not on this page · raw message
Signature · 1 line
2.26.3
Looks good,
Quoted 4 lines · Christoph Hellwig
Looks good,
Reviewed-by Christoph Hellwig <[email protected]>
Thank you!
Quoted 9 lines · Yang Shi
Currently, rasdaemon uses the existing tracepoint
block_rq_completeand filters out non-error cases in order to capture block disk errors.But there are a few problems with this approach:
1. Even kernel trace filter could do the filtering work, there is still some overhead after we enable this tracepoint.
[...]
Applied, thanks!
[1/1] block: introduce block_rq_error tracepoint
commit: d5869fdc189f0f12a954a48d58a48104a2f5d044
Best regards,
Signature · 1 line
Jens Axboe
Quoted 10 lines · Jens Axboe
Quoted 8 lines · Yang Shi
Currently, rasdaemon uses the existing tracepoint
block_rq_completeand filters out non-error cases in order to capture block disk errors.But there are a few problems with this approach:
1. Even kernel trace filter could do the filtering work, there is still some overhead after we enable this tracepoint.
Quoted 6 lines
Quoted 1 line
[...]
Applied, thanks!
[1/1] block: introduce
block_rq_errortracepointcommit: d5869fdc189f0f12a954a48d58a48104a2f5d044
Thank you!
Quoted 6 lines
Best regards,
--
Jens Axboe