tracing: Some more updates for 4.15
Steven Rostedt
maintainercover tracing: Some more updates for 4.15
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next
Head SHA1: f40a37cb4916f17806b8a89d8eb76f6943c69189
Arnd Bergmann (1):
tracing: mark trace_test_buffer as __maybe_unused
Steven Rostedt (VMware) (3):
printk: Remove superfluous memory barriers from printk_safe tracing/xen: Hide events that are not used when X86_PAE is not defined tracing, memcg, vmscan: Hide trace events when not in use
----
include/trace/events/vmscan.h | 4 ++++ include/trace/events/xen.h | 35 +++++++++++++++++++---------------- kernel/printk/printk_safe.c | 15 ++++++++------- kernel/trace/trace_selftest.c | 2 +- 4 files changed, 32 insertions(+), 24 deletions(-)
Steven Rostedt
maintainerPATCH 1/4 printk: Remove superfluous memory barriers from printk_safe
From: "Steven Rostedt (VMware)" <[email protected]>
The variable printk_safe_irq_ready is set and never cleared at system boot up, when there's only one CPU active. It is set before other CPUs come on line. Also, it is extremely unlikely that an NMI would trigger this early in boot up (which I wonder why we even have this variable at all).
Also mark the printk_safe_irq_ready as read mostly, as it is set at system boot up, and never touched again.
--- kernel/printk/printk_safe.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
kernel/printk/printk_safe.c +8 -7
@@ -39,7 +39,7 @@* There are situations when we want to make sure that all buffers * were handled or when IRQs are blocked. */ -static int printk_safe_irq_ready; +static int printk_safe_irq_ready__read_mostly ;#define SAFE_LOG_BUF_LEN ((1 << CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT) - \ sizeof(atomic_t) - \
@@ -63,11 +63,8 @@ static DEFINE_PER_CPU(struct printk_safe_seq_buf, nmi_print_seq);/* Get flushed in a more safe context. */ static void queue_flush_work (struct printk_safe_seq_buf *s) { -if (printk_safe_irq_ready) { -/* Make sure that IRQ work is really initialized. */ -smp_rmb (); +if (printk_safe_irq_ready)irq_work_queue (&s->work); - } }/*
@@ -398,8 +395,12 @@ void __init printk_safe_init(void)#endif } -/* Make sure that IRQ works are initialized before enabling. */ -smp_wmb (); +/* +* In the highly unlikely event that a NMI were to trigger at +* this moment. Make sure IRQ work is set up before this +* variable is set. +*/ +barrier (); printk_safe_irq_ready =1 ;/* Flush pending messages that did not have scheduled IRQ works. */
Signature · 1 line
2.13.2
Steven Rostedt
maintainerPATCH 2/4 tracing: mark trace_test_buffer as __maybe_unused
In reply to Steven RostedtFrom: Arnd Bergmann <[email protected]>
After trace_selftest_startup_sched_switch is removed, trace_test_buffer() is only used sometimes, leading to this warning:
kernel/trace/trace_selftest.c:62:12: error: 'trace_test_buffer' defined but not used [-Werror=unused-function]
There is no simple #ifdef condition that captures well whether the function is in fact used or not, so marking it as __maybe_unused is probably the best way to shut up the warning. The function will then be silently dropped when there is no user.
--- kernel/trace/trace_selftest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_selftest.c +1 -1
@@ -59,7 +59,7 @@ static int trace_test_buffer_cpu(struct trace_buffer *buf, int cpu)* Test the trace buffer to see if all the elements * are still sane. */ -static int trace_test_buffer (struct trace_buffer *buf,unsigned long *count) +static int __maybe_unused trace_test_buffer (struct trace_buffer *buf,unsigned long *count) {unsigned long flags, cnt =0 ;int cpu, ret =0 ;
Signature · 1 line
2.13.2
Steven Rostedt
maintainerPATCH 3/4 tracing/xen: Hide events that are not used when X86_PAE is not defined
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
TRACE_EVENTS() take up memory. If they are defined but not used, then they simply waste space. If their use case is behind a define, then the trace events should be as well.
The trace events xen_mmu_set_pte_atomic, xen_mmu_pte_clear, and xen_mmu_pmd_clear are not used when CONFIG_X86_PAE is not defined.
--- include/trace/events/xen.h | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-)
include/trace/events/xen.h +19 -16
@@ -147,7 +147,6 @@ DECLARE_EVENT_CLASS(xen_mmu__set_pte, TP_ARGS(ptep, pteval))DEFINE_XEN_MMU_SET_PTE (xen_mmu_set_pte); -DEFINE_XEN_MMU_SET_PTE (xen_mmu_set_pte_atomic); TRACE_EVENT(xen_mmu_set_pte_at, TP_PROTO(struct mm_struct *mm, unsigned long addr,
@@ -169,21 +168,6 @@ TRACE_EVENT(xen_mmu_set_pte_at, (int)sizeof(pteval_t) * 2, (unsigned long long)__entry->pteval) ); -TRACE_EVENT (xen_mmu_pte_clear, - TP_PROTO(struct mm_struct *mm, unsigned long addr, pte_t *ptep), -TP_ARGS (mm, addr, ptep), -TP_STRUCT__entry ( - __field(struct mm_struct *, mm) - __field(unsigned long, addr) - __field(pte_t *, ptep) - ), - TP_fast_assign(__entry->mm = mm; - __entry->addr = addr; - __entry->ptep = ptep), -TP_printk ("mm %p addr %lx ptep %p" , - __entry->mm, __entry->addr, __entry->ptep) - ); -TRACE_DEFINE_SIZEOF (pmdval_t); TRACE_EVENT(xen_mmu_set_pmd,
@@ -201,6 +185,24 @@ TRACE_EVENT(xen_mmu_set_pmd, (int)sizeof(pmdval_t) * 2, (unsigned long long)__entry->pmdval) ); +#ifdef CONFIG_X86_PAE +DEFINE_XEN_MMU_SET_PTE (xen_mmu_set_pte_atomic); + +TRACE_EVENT (xen_mmu_pte_clear, + TP_PROTO(struct mm_struct *mm, unsigned long addr, pte_t *ptep), +TP_ARGS (mm, addr, ptep), +TP_STRUCT__entry ( + __field(struct mm_struct *, mm) + __field(unsigned long, addr) + __field(pte_t *, ptep) + ), + TP_fast_assign(__entry->mm = mm; + __entry->addr = addr; + __entry->ptep = ptep), +TP_printk ("mm %p addr %lx ptep %p" , + __entry->mm, __entry->addr, __entry->ptep) + ); + TRACE_EVENT(xen_mmu_pmd_clear, TP_PROTO(pmd_t *pmdp), TP_ARGS(pmdp),
@@ -210,6 +212,7 @@ TRACE_EVENT(xen_mmu_pmd_clear,TP_fast_assign (__entry->pmdp = pmdp),TP_printk ("pmdp %p" , __entry->pmdp) ); +#endif #if CONFIG_PGTABLE_LEVELS >=4
Signature · 1 line
2.13.2
Steven Rostedt
maintainerPATCH 4/4 tracing, memcg, vmscan: Hide trace events when not in use
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
When trace events are defined but not used they still create data structures and functions for their use, even though nothing may be using them.
The trace events mm_vmscan_memcg_reclaim_begin, mm_vmscan_memcg_softlimit_reclaim_begin, mm_vmscan_memcg_reclaim_end, and mm_vmscan_memcg_softlimit_reclaim_end are not used if CONFIG_MEMCG is not defined. Do not create these trace events unless CONFIG_MEMCG is defined.
--- include/trace/events/vmscan.h | 4 ++++ 1 file changed, 4 insertions(+)
include/trace/events/vmscan.h +4 -0
@@ -133,6 +133,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_bTP_ARGS (order, may_writepage, gfp_flags, classzone_idx) ); +#ifdef CONFIG_MEMCG DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin, TP_PROTO(int order, int may_writepage, gfp_t gfp_flags, int classzone_idx),
@@ -146,6 +147,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_softlimit_TP_ARGS (order, may_writepage, gfp_flags, classzone_idx) ); +#endif /* CONFIG_MEMCG */ DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template,
@@ -171,6 +173,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_direct_reclaim_endTP_ARGS (nr_reclaimed) ); +#ifdef CONFIG_MEMCG DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_reclaim_end, TP_PROTO(unsigned long nr_reclaimed),
@@ -184,6 +187,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_softlimit_reTP_ARGS (nr_reclaimed) ); +#endif /* CONFIG_MEMCG */ TRACE_EVENT(mm_shrink_slab_start, TP_PROTO(struct shrinker *shr, struct shrink_control *sc,
Signature · 1 line
2.13.2