[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240709120551.GK27299@noisy.programming.kicks-ass.net>
Date: Tue, 9 Jul 2024 14:05:51 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: mingo@...nel.org, andrii@...nel.org
Cc: linux-kernel@...r.kernel.org, rostedt@...dmis.org, mhiramat@...nel.org,
oleg@...hat.com, jolsa@...nel.org, clm@...a.com, paulmck@...nel.org
Subject: Re: [PATCH 05/10] perf/uprobe: SRCU-ify uprobe->consumer list
On Mon, Jul 08, 2024 at 11:12:46AM +0200, Peter Zijlstra wrote:
> @@ -2087,14 +2092,19 @@ static struct uprobe *find_active_uprobe
> return uprobe;
> }
>
> +#define for_each_consumer_rcu(pos, head) \
> + for (pos = rcu_dereference_raw(head); pos; \
> + pos = rcu_dereference_raw(pos->next))
> +
> static void handler_chain(struct uprobe *uprobe, struct pt_regs *regs)
> {
> struct uprobe_consumer *uc;
> int remove = UPROBE_HANDLER_REMOVE;
> bool need_prep = false; /* prepare return uprobe, when needed */
>
> - down_read(&uprobe->register_rwsem);
> - for (uc = uprobe->consumers; uc; uc = uc->next) {
> + guard(srcu)(&uprobes_srcu);
> +
> + for_each_consumer_rcu(uc, uprobe->consumers) {
> int rc = 0;
>
> if (uc->handler) {
> @@ -2116,7 +2126,6 @@ static void handler_chain(struct uprobe
> WARN_ON(!uprobe_is_active(uprobe));
> unapply_uprobe(uprobe, current->mm);
^^^ this remove case needs more thought.
> }
> - up_read(&uprobe->register_rwsem);
> }
Powered by blists - more mailing lists