Re: [RFC] btf: Some structs are doubled because of struct ring_buffer
From: Steven Rostedt
Date: Fri Dec 13 2019 - 13:29:49 EST
On Fri, 13 Dec 2019 19:02:23 +0100
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> On Fri, Dec 13, 2019 at 12:11:18PM -0500, Steven Rostedt wrote:
> > On Fri, 13 Dec 2019 08:51:57 -0800
> > Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote:
> >
> > > It had two choices. Both valid. I don't know why gdb picked this one.
> > > So yeah I think renaming 'ring_buffer' either in ftrace or in perf would be
> > > good. I think renaming ftrace one would be better, since gdb picked perf one
> > > for whatever reason.
> >
> > Because of the sort algorithm. But from a technical perspective, the
> > ring buffer that ftrace uses is generic, where the perf ring buffer can
> > only be used for perf. Call it "event_ring_buffer" or whatever, but
> > it's not generic and should not have a generic name.
>
> Your ring buffer was so generic that I gave up trying to use it after
> trying for days :-( (the fundamental problem was that it was impossible
> to have a single cpu buffer; afaik that is still true today)
Yeah, but that could have been fixed, and the only reason it's not
today, is because it requires more overhead to do so.
IIRC, the main reason that you didn't use it then, is because it wasn't
fully lockless at the time (it is today), and you couldn't use it from
NMI context.
>
> Nor is the perf buffer fundamentally specific to perf, but there not
> being another user means there has been very little effort to remove
> perf specific things from it.
I took a look at doing so, and it was not a trivial task.
>
> There are major design differences between them, which is
> unquestionably, but I don't think it is fair to say one is more or less
> generic.
>
> How about we rename both? I'm a bit adverse to long names, so how about
> we rename the perf one to perf_buffer and the trace one to trace_buffer?
I'm fine with this idea! Now what do we call the ring buffer that
tracing uses, as it is not specific for tracing, it was optimized for
splicing. But sure, I can rename it to trace_buffer. I just finished
renaming perf's...
Thinking about this, perhaps we should remove the word "ring" from
both. That is:
perf_buffer and trace_buffer ?
Anyway, here's the perf update, I can go ahead and rewrite the tracing
one too, and perhaps one day we can make a truly generic ring buffer!
-- Steve