On Wed, Apr 05, 2023 at 02:42:34AM +0200, Kumar Kartikeya Dwivedi wrote: > @@ -759,6 +759,8 @@ BPF_CALL_4(bpf_loop, u32, nr_loops, void *, callback_fn, void *, callback_ctx, > > for (i = 0; i < nr_loops; i++) { > ret = callback((u64)i, (u64)(long)callback_ctx, 0, 0, 0); > + if (bpf_get_exception()) > + return -EJUKEBOX; This is too slow. We cannot afford a call and conditional here. Some time ago folks tried bpf_loop() and went back to bounded loop, because the overhead of indirect call was not acceptable. After that we've added inlining of bpf_loop() to make overhead to the minimum. With prog->aux->exception[] approach it might be ok-ish, but my preference would be to disallow throw in callbacks. timer cb, rbtree_add cb are typically small. bpf_loop cb can be big, but we have open coded iterators now. So disabling asserts in cb-s is probably acceptable trade-off. The choice of error name is odd, tbh.