Re: [PATCH bpf-next v2 05/11] bpf: Add dump_stack() analogue to print to BPF stderr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> writes:

[...]

>> > diff --git a/include/linux/bpf.h b/include/linux/bpf.h
>> > index 6985e793e927..aab5ea17a329 100644
>> > --- a/include/linux/bpf.h
>> > +++ b/include/linux/bpf.h
>> > @@ -3613,8 +3613,10 @@ __printf(2, 3)
>> >  int bpf_stream_stage_printk(struct bpf_stream_stage *ss, const char *fmt, ...);
>> >  int bpf_stream_stage_commit(struct bpf_stream_stage *ss, struct bpf_prog *prog,
>> >                           enum bpf_stream_id stream_id);
>> > +int bpf_stream_stage_dump_stack(struct bpf_stream_stage *ss);
>> >
>> >  #define bpf_stream_printk(...) bpf_stream_stage_printk(&__ss, __VA_ARGS__)
>> > +#define bpf_stream_dump_stack() bpf_stream_stage_dump_stack(&__ss)
>>
>> I don't think we should add macro with hard-coded variable names (`__ss`)
>> in common headers.
>
> Hm, right. But this is supposed to be used within the stream stage
> block, and we have __i variables in macros that wrap around loops
> etc., hence the double / triple underscore to not conflict. Anyhow,
> I'm open to other suggestions.

I missed that this macro is supposed to be used only inside
`bpf_stream_stage`. Nothing pretty comes to mind, I thought about using
cleanup.h:DEFINE_CLASS, but that thing is ugly in its own way.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux