Skip to content

Commit a89d4bd

Browse files
author
Ingo Molnar
committed
Merge branch 'tip/perf/urgent-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/urgent
2 parents e53beac + 91e86e5 commit a89d4bd

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

arch/x86/include/asm/paravirt.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -824,27 +824,27 @@ static __always_inline void arch_spin_unlock(struct arch_spinlock *lock)
824824
#define __PV_IS_CALLEE_SAVE(func) \
825825
((struct paravirt_callee_save) { func })
826826

827-
static inline unsigned long arch_local_save_flags(void)
827+
static inline notrace unsigned long arch_local_save_flags(void)
828828
{
829829
return PVOP_CALLEE0(unsigned long, pv_irq_ops.save_fl);
830830
}
831831

832-
static inline void arch_local_irq_restore(unsigned long f)
832+
static inline notrace void arch_local_irq_restore(unsigned long f)
833833
{
834834
PVOP_VCALLEE1(pv_irq_ops.restore_fl, f);
835835
}
836836

837-
static inline void arch_local_irq_disable(void)
837+
static inline notrace void arch_local_irq_disable(void)
838838
{
839839
PVOP_VCALLEE0(pv_irq_ops.irq_disable);
840840
}
841841

842-
static inline void arch_local_irq_enable(void)
842+
static inline notrace void arch_local_irq_enable(void)
843843
{
844844
PVOP_VCALLEE0(pv_irq_ops.irq_enable);
845845
}
846846

847-
static inline unsigned long arch_local_irq_save(void)
847+
static inline notrace unsigned long arch_local_irq_save(void)
848848
{
849849
unsigned long f;
850850

kernel/module.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2326,6 +2326,18 @@ static void find_module_sections(struct module *mod, struct load_info *info)
23262326
kmemleak_scan_area(mod->trace_events, sizeof(*mod->trace_events) *
23272327
mod->num_trace_events, GFP_KERNEL);
23282328
#endif
2329+
#ifdef CONFIG_TRACING
2330+
mod->trace_bprintk_fmt_start = section_objs(info, "__trace_printk_fmt",
2331+
sizeof(*mod->trace_bprintk_fmt_start),
2332+
&mod->num_trace_bprintk_fmt);
2333+
/*
2334+
* This section contains pointers to allocated objects in the trace
2335+
* code and not scanning it leads to false positives.
2336+
*/
2337+
kmemleak_scan_area(mod->trace_bprintk_fmt_start,
2338+
sizeof(*mod->trace_bprintk_fmt_start) *
2339+
mod->num_trace_bprintk_fmt, GFP_KERNEL);
2340+
#endif
23292341
#ifdef CONFIG_FTRACE_MCOUNT_RECORD
23302342
/* sechdrs[0].sh_size is always zero */
23312343
mod->ftrace_callsites = section_objs(info, "__mcount_loc",

kernel/trace/trace.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,8 @@ void trace_dump_stack(void)
12841284
__ftrace_trace_stack(global_trace.buffer, flags, 3, preempt_count());
12851285
}
12861286

1287+
static DEFINE_PER_CPU(int, user_stack_count);
1288+
12871289
void
12881290
ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
12891291
{
@@ -1302,6 +1304,18 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
13021304
if (unlikely(in_nmi()))
13031305
return;
13041306

1307+
/*
1308+
* prevent recursion, since the user stack tracing may
1309+
* trigger other kernel events.
1310+
*/
1311+
preempt_disable();
1312+
if (__this_cpu_read(user_stack_count))
1313+
goto out;
1314+
1315+
__this_cpu_inc(user_stack_count);
1316+
1317+
1318+
13051319
event = trace_buffer_lock_reserve(buffer, TRACE_USER_STACK,
13061320
sizeof(*entry), flags, pc);
13071321
if (!event)
@@ -1319,6 +1333,11 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
13191333
save_stack_trace_user(&trace);
13201334
if (!filter_check_discard(call, entry, buffer, event))
13211335
ring_buffer_unlock_commit(buffer, event);
1336+
1337+
__this_cpu_dec(user_stack_count);
1338+
1339+
out:
1340+
preempt_enable();
13221341
}
13231342

13241343
#ifdef UNUSED

0 commit comments

Comments
 (0)