From: Steven Rostedt <rostedt@goodmis.org>
To: "Frédéric Weisbecker" <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] tracing/ftrace: don't trace on early stage of secondary cpu boot
Date: Tue, 23 Dec 2008 22:09:53 -0500 (EST) [thread overview]
Message-ID: <alpine.DEB.1.10.0812232201110.20511@gandalf.stny.rr.com> (raw)
In-Reply-To: <c62985530812231844w7bdc493secbbeaf4372afa52@mail.gmail.com>
On Wed, 24 Dec 2008, Fr?d?ric Weisbecker wrote:
> >> /*
> >> @@ -1233,7 +1233,7 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
> >> int cpu;
> >> int pc;
> >>
> >> - if (!ftrace_trace_task(current))
> >> + if (!ftrace_trace_task(current) || ftrace_in_early_cpuinit())
> >> return 0;
> >
> > Actually, didn't you say current is not available either? We are testing
> > current first.
>
> Oops. Strange, my tests didn't give me any problem.
> I will fix it.
Are you sure 'current' is dangerous? Perhaps we do not need to worry here,
since we are testing current against something else, and if the CPU
is just coming on line, it will not be the task we want.
>
>
> > I still wonder if there's a better way to find out if it is safe to run.
> > Perhaps the arch code can test the %gs register to see if it is actually
> > something valid?
> >
> > -- Steve
>
> I could test if MSR_GS_BASE references cpu_pda(cpu) but that remains
> as much heavy...
Perhaps just reading the %gs register and see if it faults would be good
enough?
long dummy;
int faulted=0;
asm(
"1: movq %%gs:0, %0\n"
"2:
".section .fixup \"ax\"\n"
"3: movl $1, %1\n"
" jmp 2b\n"
".previous"
_ASM_EXTABLE(1b, 3b)
: "=r"(dummy), "=r"(faulted)
: "1"(faulted));
Would this work? On the good cases, all we do is a read of the %gs
section, which is the same as doing a smp_process_id(). On the bad case,
we fault, but we also catch that fact. We are more interested in the good
case being fast. but I'm not sure how well the start up code could take a
fault, even when it is expected.
-- Steve
next prev parent reply other threads:[~2008-12-24 3:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-24 0:41 Frederic Weisbecker
2008-12-24 2:19 ` Steven Rostedt
2008-12-24 2:44 ` Frédéric Weisbecker
2008-12-24 3:09 ` Steven Rostedt [this message]
2008-12-24 3:22 ` Frédéric Weisbecker
2008-12-24 3:33 ` Steven Rostedt
2008-12-24 3:51 ` Frédéric Weisbecker
2008-12-24 2:57 ` Frédéric Weisbecker
2008-12-24 3:03 ` Frédéric Weisbecker
2008-12-24 3:11 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.1.10.0812232201110.20511@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®