Re: [PATCH v3] ring-buffer: Prevent inconsistent operation on cpu_buffer->resize_disabled

From: Steven Rostedt
Date: Tue Apr 11 2023 - 22:32:18 EST


On Wed, 12 Apr 2023 02:27:53 +0000
Tze-nan Wu (吳澤南) <Tze-nan.Wu@xxxxxxxxxxxx> wrote:

> > > @@ -5368,7 +5372,7 @@ void ring_buffer_reset_online_cpus(struct
> > > trace_buffer *buffer)
> > > /* Make sure all commits have finished */
> > > synchronize_rcu();
> > >
> > > - for_each_online_buffer_cpu(buffer, cpu) {
> > > + for_each_cpu_and(cpu, buffer->cpumask, &reset_online_cpumask)
>
> Maybe we should use for_each_buffer_cpu(buffer, cpu) here?
> since a CPU may also came offline during synchronize_rcu().

Yeah, I guess that works too (not looking at the code at the moment though).

-- Steve

>
> > > {
> > > cpu_buffer = buffer->buffers[cpu];
> >