[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200106142343.GK15478@tassilo.jf.intel.com>
Date: Mon, 6 Jan 2020 06:23:43 -0800
From: Andi Kleen <ak@...ux.intel.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: kan.liang@...ux.intel.com, mingo@...hat.com, acme@...nel.org,
tglx@...utronix.de, bp@...en8.de, linux-kernel@...r.kernel.org,
eranian@...gle.com, alexey.budankov@...ux.intel.com,
vitaly.slobodskoy@...el.com
Subject: Re: [RFC PATCH V2 2/7] perf: Init/fini PMU specific data
> > + rcu_read_lock();
> > + for_each_process_thread(g, p) {
> > + mutex_lock(&p->perf_event_mutex);
> > + if (p->perf_ctx_data) {
> > + /*
> > + * The perf_ctx_data for this thread may has been
> > + * allocated by per-task event.
> > + * Only update refcount for the case.
> > + */
> > + refcount_inc(&p->perf_ctx_data->refcount);
> > + mutex_unlock(&p->perf_event_mutex);
> > + continue;
> > + }
> > +
> > + if (pos < num_thread) {
> > + refcount_set(&data[pos]->refcount, 1);
> > + rcu_assign_pointer(p->perf_ctx_data, data[pos++]);
> > + } else {
> > + /*
> > + * There may be some new threads created,
> > + * when we allocate space.
> > + * Track the number in nr_new_tasks.
> > + */
> > + nr_new_tasks++;
> > + }
> > + mutex_unlock(&p->perf_event_mutex);
> > + }
> > + rcu_read_unlock();
> > +
> > + raw_spin_unlock_irqrestore(&task_data_sys_wide_events_lock, flags);
>
> Still NAK. That's some mightly broken code there.
Yes, Kan you cannot use a mutex (sleeping) inside rcu_read_lock().
Can perf_event_mutex be a spin lock?
-Andi
Powered by blists - more mailing lists