[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191126175812.c6e0cd1249422989007c91fe@kernel.org>
Date: Tue, 26 Nov 2019 17:58:12 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Peter Zijlstra <peterz@...radead.org>, x86@...nel.org,
linux-kernel@...r.kernel.org, bristot@...hat.com,
jbaron@...mai.com, torvalds@...ux-foundation.org,
tglx@...utronix.de, mingo@...nel.org, namit@...are.com,
hpa@...or.com, luto@...nel.org, ard.biesheuvel@...aro.org,
jpoimboe@...hat.com, jeyu@...nel.org, alexei.starovoitov@...il.com
Subject: Re: [PATCH -v5 00/17] Rewrite x86/ftrace to use text_poke (and
more)
On Tue, 26 Nov 2019 09:11:04 +0900
Masami Hiramatsu <mhiramat@...nel.org> wrote:
> On Mon, 25 Nov 2019 12:32:45 -0500
> Steven Rostedt <rostedt@...dmis.org> wrote:
>
> > On Mon, 25 Nov 2019 12:55:34 +0900
> > Masami Hiramatsu <mhiramat@...nel.org> wrote:
> >
> > > void text_poke_bp_batch(struct text_poke_loc *tp, unsigned int nr_entries)
> > > ...
> > > on_each_cpu(do_sync_core, NULL, 1);
> > > /*
> > > * sync_core() implies an smp_mb() and orders this store against
> > > * the writing of the new instruction.
> > > */
> > > bp_patching.vec = NULL;
> > > bp_patching.nr_entries = 0;
> > > }
> > > -----
> > >
> > > I think the "on_each_cpu(do_sync_core, NULL, 1);" can sync the pipeline
> > > but doesn't ensure all ongoing int3 handling is done. Thus, we may need a
> >
> > How does it not ensure all ongoing int3 handling is done? int3 is done
> > with interrupts disabled, and the on_each_cpu() requires all CPUs to
> > have had their interrupts enabled, thus int3 handling should be
> > completed. Perhaps we need another sync core?
> >
> > on_each_cpu(do_sync_core, NULL, 1);
> > bp_patching.nr_entries = 0;
> > on_each_cpu(do_sync_core, NULL, 1);
> > bp_patching.vec = NULL;
>
> OK, let me check.
>
> The 1st sync_core will ensure the poking "int3" is removed. Thus any
> int3-hit address (ip) should NOT match the bp_patching.vec[*].addr after
> that. At this point, "if (likely(!bp_patching.nr_entries))" check does not
> work.
>
> And the 2nd sync_core will ensure all poke_int3_handler() will see the
> bp_patching.nr_entries = 0.
> After this point, "if (likely(!bp_patching.nr_entries))" works and
> poke_int3_handler() will exit soon. (before touching bp_patching.vec)
>
Oops, I've tested a bit older kernel (with above change it seems to be fixed).
I'll check the latest -tip.
Thank you,
--
Masami Hiramatsu <mhiramat@...nel.org>
Powered by blists - more mailing lists