#bcc Count map.ringbuf_reserve() failures #bcc


Eelco Chaudron
 
Edited

On Tue, Nov 2, 2021 at 03:24 PM, Eelco Chaudron wrote:

Hi,

Was wondering if there is a way to count the number of times map.ringbuf_reserve() fails for a BPF_RINGBUF_OUTPUT buffer?

This way I can get notified in userspace that I have missed events, and might need to increase the buffer size.

Cheers,

Eelco

Thought I added the #bcc tag but I no longer see it :( So just in case, it's not clear, this is with BCC.


Yonghong Song
 

On Tue, Nov 2, 2021 at 7:31 AM Eelco Chaudron <echaudro@...> wrote:

[Edited Message Follows]

On Tue, Nov 2, 2021 at 03:24 PM, Eelco Chaudron wrote:

Hi,

Was wondering if there is a way to count the number of times map.ringbuf_reserve() fails for a BPF_RINGBUF_OUTPUT buffer?

This way I can get notified in userspace that I have missed events, and might need to increase the buffer size.

Cheers,

Eelco

Thought I added the #bcc tag but I no longer see it :( So just in case, it's not clear, this is with BCC.
You can check return value of map.ringbuf_reserve(). If the
reservation failed, you can notify user space through map, another
side channel ringbuf, perf buf, etc. Depending on your program type
and program running context, you might be able to use
bpf_send_signal() helper to send a signal to the *current* process.



Eelco Chaudron
 

On 3 Nov 2021, at 6:26, Y Song wrote:

On Tue, Nov 2, 2021 at 7:31 AM Eelco Chaudron <echaudro@...> wrote:

[Edited Message Follows]

On Tue, Nov 2, 2021 at 03:24 PM, Eelco Chaudron wrote:

Hi,

Was wondering if there is a way to count the number of times map.ringbuf_reserve() fails for a BPF_RINGBUF_OUTPUT buffer?

This way I can get notified in userspace that I have missed events, and might need to increase the buffer size.

Cheers,

Eelco

Thought I added the #bcc tag but I no longer see it :( So just in case, it's not clear, this is with BCC.
You can check return value of map.ringbuf_reserve(). If the
reservation failed, you can notify user space through map, another
side channel ringbuf, perf buf, etc. Depending on your program type
and program running context, you might be able to use
bpf_send_signal() helper to send a signal to the *current* process.
Thanks, I was looking at BCC to solve this in the wrappers, but you are right, as simple BPF_TABLE() solved it.

//Eelco


นิวัฒน์ ไชยจันทร์
 


ในวันที่ อ. 2 พ.ย. 2021 21:31 น. Eelco Chaudron <echaudro@...> เขียนว่า:

[Edited Message Follows]

On Tue, Nov 2, 2021 at 03:24 PM, Eelco Chaudron wrote:

Hi,

Was wondering if there is a way to count the number of times map.ringbuf_reserve() fails for a BPF_RINGBUF_OUTPUT buffer?

This way I can get notified in userspace that I have missed events, and might need to increase the buffer size.

Cheers,

Eelco

Thought I added the #bcc tag but I no longer see it :( So just in case, it's not clear, this is with BCC.