[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250207095844.c2d761f3a3588f705e5c5832@kernel.org>
Date: Fri, 7 Feb 2025 09:58:44 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org, Mark
Rutland <mark.rutland@....com>, Mathieu Desnoyers
<mathieu.desnoyers@...icios.com>, Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 4/8] tracing: Have persistent trace instances save KASLR
offset
On Thu, 6 Feb 2025 10:24:25 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:
> On Thu, 6 Feb 2025 14:22:32 +0900
> Masami Hiramatsu (Google) <mhiramat@...nel.org> wrote:
>
> > On Wed, 05 Feb 2025 17:50:35 -0500
> > Steven Rostedt <rostedt@...dmis.org> wrote:
> >
> > > From: Steven Rostedt <rostedt@...dmis.org>
> > >
> > > There's no reason to save the KASLR offset for the ring buffer itself.
> > > That is used by the tracer. Now that the tracer has a way to save data in
> > > the persistent memory of the ring buffer, have the tracing infrastructure
> > > take care of the saving of the KASLR offset.
> > >
> >
> > Looks good to me. But note that the scratchpad size may not enough for
> > module table later, because 1 module requires at least the name[]
> > (64byte - sizeof(ulong)) and the base address (ulong). This means
> > 1 entry consumes 64byte. Thus there can be only 63 entries + meta
> > data in 4K page. My ubuntu loads 189(!) modules;
> >
> > $ lsmod | wc -l
> > 190
> >
> > so we want 255 entries, which requires 16KB.
>
> So, I was thinking of modifying the allocation of the persistent ring
> buffer, which currently is
>
> #define ring_buffer_alloc_range(size, flags, order, start, range_size)
>
> [ it's a macro to add lockdep key information in it ]
>
> But I should change it to include a scratch size, and allow the tracing
> system to define how much of the range it should allocate for scratch.
>
> Then we could do:
>
> buf->buffer = ring_buffer_alloc_range(size, rb_flags, 0,
> tr->range_addr_start,
> tr->range_addr_size,
> struct_size(tscratch, entries, 128));
>
> Which would make sure that the scratch size contains enough memory to hold
> 128 modules.
Yeah, this idea looks godd to me. BTW, the scratch size will be aligned to
the subbuffer size (or page size?)
Thanks,
>
> -- Steve
>
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists