Add RecursionMisses to access ProgramInfo recursion misses counter#1465
Add RecursionMisses to access ProgramInfo recursion misses counter#1465lmb merged 1 commit intocilium:mainfrom
Conversation
info.go
Outdated
| // it keeps the return values pattern as the other stats accessors and returns | ||
| // bool (allways true) together with the counter value. | ||
| func (pi *ProgramInfo) RecursionMisses() (uint64, bool) { | ||
| return pi.stats.recursionMisses, true |
There was a problem hiding this comment.
Which kernel did this appear on though? The boolean is meant to indicate whether the kernel exposes this flag in general, not whether stats were enabled (IIRC).
There was a problem hiding this comment.
it got in v5.11 9ed9e9ba2337 bpf: Count the number of times recursion was prevented
I'm actually not sure how is the availability detected, both Runtime and RunCount
return values if pi.stats != nil which seems to be the case always AFAICS
I can keep the same checks as for the Runtime and RunCount
There was a problem hiding this comment.
I'm actually not sure how is the availability detected, both Runtime and RunCount
return values if pi.stats != nil which seems to be the case always AFAICS
Can't remember who contributed it, but iirc they were planning to add a probe, and the bool was added to not have to break API later. Looks like the probe was never implemented, and looking back it hardly seems worth it to load a prog, call prog_run and verify if the run counter increases just so we can return that bool correctly.
In the case of RecursionMisses, that one feels unrealistic to try to reproduce reliably at all. I'd just drop the bool and add a comment about it being 5.11+.
There was a problem hiding this comment.
That breaks when using newProgramInfoFromProc. So unless we deprecate that we should just stick with the established pattern of returning a bool.
There was a problem hiding this comment.
ok, keeping the bool then, thanks
There was a problem hiding this comment.
That breaks when using newProgramInfoFromProc. So unless we deprecate that we should just stick with the established pattern of returning a bool.
@lmb Could you elaborate on what breaks exactly?
There was a problem hiding this comment.
pi.stats is nil and therefore the line panics.
ti-mo
left a comment
There was a problem hiding this comment.
Thanks! Left some feedback. Let's just drop the bool, fix up the comment and call it a day.
info.go
Outdated
| // it keeps the return values pattern as the other stats accessors and returns | ||
| // bool (allways true) together with the counter value. | ||
| func (pi *ProgramInfo) RecursionMisses() (uint64, bool) { | ||
| return pi.stats.recursionMisses, true |
There was a problem hiding this comment.
I'm actually not sure how is the availability detected, both Runtime and RunCount
return values if pi.stats != nil which seems to be the case always AFAICS
Can't remember who contributed it, but iirc they were planning to add a probe, and the bool was added to not have to break API later. Looks like the probe was never implemented, and looking back it hardly seems worth it to load a prog, call prog_run and verify if the run counter increases just so we can return that bool correctly.
In the case of RecursionMisses, that one feels unrealistic to try to reproduce reliably at all. I'd just drop the bool and add a comment about it being 5.11+.
c320be3 to
1210b92
Compare
|
Pushed a fixup, PTAL. Looking at the upstream commit it's not clear to me where the idea that this is related to program statistics comes from? Seems easier to me to just treat these things as completely independent. Just returning |
|
hm, it's per program stats collected under same struct in kernel together with run count and run time it's incremented through it makes sense to me to place it under |
74e9661 to
08e672b
Compare
|
I can see your point, moving it out of the struct doesn't really add value. I've changed it back, fixed the panic and added a comment. |
info.go
Outdated
| runtime time.Duration | ||
| // Total number of times the program was called. | ||
| runCount uint64 | ||
| // Total number of timer the programm was NOT called. |
There was a problem hiding this comment.
| // Total number of timer the programm was NOT called. | |
| // Total number of times the program was NOT called. |
08e672b to
ddc6323
Compare
Adding RecursionMisses to access ProgramInfo recursion misses counter. This value is always measured on supported kernels, regardless of statistics being enabled or not. Signed-off-by: Lorenz Bauer <[email protected]> Signed-off-by: Jiri Olsa <[email protected]>
ddc6323 to
b4bd7f6
Compare
|
CI failures are due to unrelated upstream changes. |
Adding RecursionMisses to access ProgramInfo recursion misses counter.
It does not depend on whether collection of statistics is enabled, the value is always counted.