lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 11 Feb 2020 11:02:08 -0500 (EST)
From:   Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     rostedt <rostedt@...dmis.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        "Joel Fernandes, Google" <joel@...lfernandes.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        paulmck <paulmck@...nel.org>,
        Josh Triplett <josh@...htriplett.org>,
        Lai Jiangshan <jiangshanlai@...il.com>
Subject: Re: [PATCH v2] tracing/perf: Move rcu_irq_enter/exit_irqson() to
 perf trace point hook

----- On Feb 11, 2020, at 10:46 AM, Peter Zijlstra peterz@...radead.org wrote:

> On Tue, Feb 11, 2020 at 10:34:38AM -0500, Mathieu Desnoyers wrote:
>> 
>> I'm puzzled by this function. It does:
>> 
>> perf_tp_event(...)
>> {
>>      hlist_for_each_entry_rcu(event, head, hlist_entry) {
>>          ...
>>      }
>>      if (task && task != current) {
>>          rcu_read_lock();
>>          ... = rcu_dereference();
>>          list_for_each_entry_rcu(...) {
>>              ....
>>          }
>>          rcu_read_unlock();
>>      }
>> }
>> 
>> What is the purpose of the rcu_read_lock/unlock within the if (),
>> considering that there is already an hlist rcu iteration just before ?
>> It seems to assume that a RCU read-side of some kind of already
>> ongoing.
> 
> IIRC the hlist_for_each_entry_rcu() uses the RCU stuff from the
> tracepoint API, while the stuff inside the if() uses regular RCU.
> 
> Them were note the same one -- tracepoints used rcu-sched, perf used
> rcu.

Indeed, there is a call to tracepoint_synchronize_unregister() within
perf_trace_event_unreg(), which provides the required grace period
before freeing the perf event.

That tracepoint_synchronize_unregister() was initially doing a synchronize_sched()
as you point out. It then moved to synchronize_rcu() with the RCU flavors
consolidation, and we've added the synchronize_srcu(&tracepoint_srcu) as well,
which handles the rcuidle cases.

Adding a comment in perf_tp_event() detailing how each RCU use is synchronized
might help readability, e.g.:

At top of function:

/*
 * Synchronization of the perf event RCU hlist is performed by the tracepoint API.
 * Synchronization of the perf event context and perf event context event list
 * is performed through explicit use of RCU.
 */

Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ