[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1899212311.7583.1627393579305.JavaMail.zimbra@efficios.com>
Date: Tue, 27 Jul 2021 09:46:19 -0400 (EDT)
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>,
linux-trace-devel <linux-trace-devel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Stefan Metzmacher <metze@...ba.org>,
io-uring <io-uring@...r.kernel.org>, paulmck <paulmck@...nel.org>
Subject: Re: [PATCH] tracepoints: Update static_call before tp_funcs when
adding a tracepoint
----- On Jul 27, 2021, at 7:44 AM, Peter Zijlstra peterz@...radead.org wrote:
> On Mon, Jul 26, 2021 at 02:49:03PM -0400, Steven Rostedt wrote:
>> OK. I see the issue you are saying. And this came from my assumption
>> that the tracepoint code did a synchronization when unregistering the
>> last callback. But of course it wont because that would make a lot of
>> back to back synchronizations of a large number of tracepoints being
>> unregistered at once.
>>
>> And doing it for all 0->1 or 1->0 or even a 1->0->1 can be costly.
>>
>> One way to handle this is when going from 1->0, set off a worker that
>> will do the synchronization asynchronously, and if a 0->1 comes in,
>> have that block until the synchronization is complete. This should
>> work, and not have too much of an overhead.
>>
>> If one 1->0 starts the synchronization, and one or more 1->0
>> transitions happen, it will be recorded where the worker will do
>> another synchronization, to make sure all 1->0 have went through a full
>> synchronization before a 0->1 can happen.
>>
>> If a 0->1 comes in while a synchronization is happening, it will note
>> the current "number" for the synchronizations (if another one is
>> queued, it will wait for one more), before it can begin. As locks will
>> be held while waiting for synchronizations to finish, we don't need to
>> worry about another 1->0 coming in while a 0->1 is waiting.
>
> Wouldn't get_state_synchronize_rcu() and cond_synchronize_rcu() get you
> what you need?
Indeed, snapshotting the state and conditionally waiting for a grace period
if none happened since the snapshot appears to be the intent here. Using
get_state+cond_sync should allow us to do this without any additional worker
thread.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Powered by blists - more mailing lists