summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/ftrace.c
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2017-03-28 09:58:21 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2017-03-28 12:35:16 -0400
commit2b87965a1e6b6051435315d3f04627a5dbad979c (patch)
tree39105b31b267b88a7182202327c5a4fc2c656952 /arch/x86/kernel/ftrace.c
parentaf0009fc16a45d091f896794e97a6457f9a7eddf (diff)
downloadop-kernel-dev-2b87965a1e6b6051435315d3f04627a5dbad979c.zip
op-kernel-dev-2b87965a1e6b6051435315d3f04627a5dbad979c.tar.gz
ftrace/x86: Do no run CPU sync when there is only one CPU online
Moving enabling of function tracing to early boot, even before scheduling is enabled, means that it is not safe to enable interrupts. When function tracing was enabled at boot up, it use to happen after scheduling and the other CPUs were brought up. That required running a sync across all CPUs when modifying the function hook locations in the code. To do the synchronization, interrupts had to be enabled. Now function tracing can be started before the other CPUs are brought up, and enabling interrupts in that case is dangerous. As only tho boot CPU is active, there is no reason to run the synchronization. If the online CPU count is one, do not bother doing the synchronization. This removes the need to enable interrupts. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@kernel.org> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'arch/x86/kernel/ftrace.c')
-rw-r--r--arch/x86/kernel/ftrace.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 8f3d9cf..70945fb 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -533,7 +533,13 @@ static void do_sync_core(void *data)
static void run_sync(void)
{
- int enable_irqs = irqs_disabled();
+ int enable_irqs;
+
+ /* No need to sync if there's only one CPU */
+ if (num_online_cpus() == 1)
+ return;
+
+ enable_irqs = irqs_disabled();
/* We may be called with interrupts disabled (on bootup). */
if (enable_irqs)
OpenPOWER on IntegriCloud