Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Strengthen tracepoint format parsing
There's issue in current RHEL real time kernel with tracepoint format, which makes bcc-tools to return wrong data. Two new 'common_' fields were added and it causes 2 issues for tracepoint format parser. First issue - is the gap between common fields and other fields, which is not picked up by the parser, so the resulted struct is not aligned with the data. Second issue - is the fact that current parser covers common fields with: u64 __do_not_use__ so the new common fields are not accounted for. This issue is solved in the following patch. I kept both issues and fixes separated to make the change readable. There's a 'not described gap' in the sched_wakeup's format file and probably in other formats as well: Having: # cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/format name: sched_wakeup ID: 310 format: field:unsigned short common_type; offset:0; size:2; signed:0; field:unsigned char common_flags; offset:2; size:1; signed:0; field:unsigned char common_preempt_count; offset:3; size:1; signed:0; field:int common_pid; offset:4; size:4; signed:1; field:unsigned char common_migrate_disable; offset:8; size:1; signed:0; field:unsigned char common_preempt_lazy_count; offset:9; size:1; signed:0; field:char comm[16]; offset:12; size:16; signed:1; field:pid_t pid; offset:28; size:4; signed:1; field:int prio; offset:32; size:4; signed:1; field:int success; offset:36; size:4; signed:1; field:int target_cpu; offset:40; size:4; signed:1; There's "common_preempt_lazy_count" field on offset 9 with size 1: common_preempt_lazy_count; offset:9; size:1; and it's followed by "comm" field on offset 12: field:char comm[16]; offset:12; size:16; signed:1; which makes 2 bytes gap in between, that might confuse some applications like bpftrace or bcc-tools library. The tracepoint parser makes struct out of the field descriptions, but does not account for such gaps. I posted patch to fix this [1] in RT kernel, but that might take a while, and we could easily fix our tracepoint parser to workaround this issue. Adding code to detect this gaps and add 1 byte __pad_X fields, where X is the offset number. [1] https://lore.kernel.org/linux-rt-users/[email protected]/ Signed-off-by: Jiri Olsa <[email protected]>
- Loading branch information