linux/kernel/trace/trace_stack.c
<<
opti v/spa v/form va opti href="../linux+v3.2.6./kernel/trace/trace_stack.c">opti vimg src="../.static/gfx/right.png" alt=">>">opv/spa opvspa class="lxr_search">optiopti vinput typptihidden" namptinavtarget" 2opti vinput typptitext" namptisearch" idtisearch">opti vbutt22.typptisubmit">Searchopti Prefs v/a>opv/spa ti v/div ti vform ac.1" ="ajax+*" method="post" onsubmit="return false;">opvinput typptihidden" namptiajax_lookup" idtiajax_lookup" 2oti v/form oti vdiv class="headingbott2m">
vdiv idtifile_contents"
   1v/a>vspa
 class="comment">/*v/spa
	    2v/a>vspa
 class="comment"> * Copyright (C) 2008 Steven Rostedt <srostedt@redhat.com>v/spa
	    3v/a>vspa
 class="comment"> *v/spa
	    4v/a>vspa
 class="comment"> */v/spa
	    5v/a>#include <linux/stacktrace.hv/a>>    6v/a>#include <linux/kallsyms.hv/a>>    7v/a>#include <linux/seq_file.hv/a>>    8v/a>#include <linux/spinlock.hv/a>>    9v/a>#include <linux/uaccess.hv/a>>   6.17a>#include <linux/debugfs.hv/a>>   1117a>#include <linux/ftrace.hv/a>>   1217a>#include <linux/module.hv/a>>   13v/a>#include <linux/sysctl.hv/a>>   14v/a>#include <linux/init.hv/a>>   15v/a>#include <linux/fs.hv/a>>   16v/a>   17v/a>#include <asm/setup.hv/a>>   18v/a>   19v/a>#include "trace.hv/a>"   20v/a>   2117a>#define va href="+code=STACK_TRACE_ENTRIES" class="sref">STACK_TRACE_ENTRIES17a> 500   22v/a>   23v/a>static unsigned long va href="+code=stack_dump_trace" class="sref">stack_dump_tracev/a>[va href="+code=STACK_TRACE_ENTRIES" class="sref">STACK_TRACE_ENTRIES17a>+1] =   24v/a>         { [0 ... (va href="+code=STACK_TRACE_ENTRIES" class="sref">STACK_TRACE_ENTRIES17a>)] = va href="+code=ULONG_MAX" class="sref">ULONG_MAXv/a> };   25v/a>static unsigned va href="+code=stack_dump_index" class="sref">stack_dump_indexv/a>[va href="+code=STACK_TRACE_ENTRIES" class="sref">STACK_TRACE_ENTRIES17a>];   26v/a>   27v/a>static struct va href="+code=stack_trace" class="sref">stack_tracev/a> va href="+code=max_stack_trace" class="sref">max_stack_tracev/a> = {   28v/a>        .va href="+code=max_entries" class="sref">max_entriesv/a>            = va href="+code=STACK_TRACE_ENTRIES" class="sref">STACK_TRACE_ENTRIES17a>,   29v/a>        .va href="+code=entries" class="sref">entriesv/a>                = va href="+code=stack_dump_trace" class="sref">stack_dump_tracev/a>,   30v/a>};   31v/a>   32v/a>static unsigned long va href="+code=max_stack_size" class="sref">max_stack_sizev/a>;   33v/a>static va href="+code=arch_spinlock_t" class="sref">arch_spinlock_tv/a> va href="+code=max_stack_lock" class="sref">max_stack_lockv/a> =   34v/a>        (va href="+code=arch_spinlock_t" class="sref">arch_spinlock_tv/a>)va href="+code=__ARCH_SPIN_LOCK_UNLOCKED" class="sref">__ARCH_SPIN_LOCK_UNLOCKEDv/a>;   35v/a>   36v/a>static int va href="+code=stack_trace_disabled" class="sref">stack_trace_disabledv/a> va href="+code=__read_mostly" class="sref">__read_mostlyv/a>;   37v/a>static va href="+code=DEFINE_PER_CPU" class="sref">DEFINE_PER_CPUv/a>(int, va href="+code=trace_ac.1ve" class="sref">trace_ac.1vev/a>);   38v/a>static va href="+code=DEFINE_MUTEX" class="sref">DEFINE_MUTEXv/a>(va href="+code=stack_sysctl_mutex" class="sref">stack_sysctl_mutexv/a>);   39v/a>   40v/a>int va href="+code=stack_tracer_enabled" class="sref">stack_tracer_enabledv/a>;   41v/a>static int va href="+code=last_stack_tracer_enabled" class="sref">last_stack_tracer_enabledv/a>;   42v/a>   43v/a>static va href="+code=inline" class="sref">inlinev/a> void va href="+code=check_stack" class="sref">check_stackv/a>(void)   44v/a>{   45v/a>        unsigned long va href="+code=this_size" class="sref">this_sizev/a>, va href="+code=flags" class="sref">flagsv/a>;   46v/a>        unsigned long *va href="+code=p" class="sref">pv/a>, *va href="+code=top" class="sref">topv/a>, *va href="+code=start" class="sref">startv/a>;   47v/a>        int va href="+code=i" class="sref">iv/a>;   48v/a>   49v/a>        va href="+code=this_size" class="sref">this_sizev/a> = ((unsigned long)&va href="+code=this_size" class="sref">this_sizev/a>) & (va href="+code=THREAD_SIZE" class="sref">THREAD_SIZEv/a>-1);   50v/a>        va href="+code=this_size" class="sref">this_sizev/a> = va href="+code=THREAD_SIZE" class="sref">THREAD_SIZEv/a> - va href="+code=this_size" class="sref">this_sizev/a>;   51v/a>   52v/a>        if (va href="+code=this_size" class="sref">this_sizev/a> <= va href="+code=max_stack_size" class="sref">max_stack_sizev/a>)   53v/a>                return;   54v/a>   55v/a>        vspa
 class="comment">/* we do not handle interrupt stacks yet */v/spa
	   56v/a>        if (!va href="+code=object_is_on_stack" class="sref">object_is_on_stackv/a>(&va href="+code=this_size" class="sref">this_sizev/a>))   57v/a>                return;   58v/a>   59v/a>        va href="+code=local_irq_save" class="sref">local_irq_savev/a>(va href="+code=flags" class="sref">flagsv/a>);   60v/a>        va href="+code=arch_spin_lock" class="sref">arch_spin_lockv/a>(&va href="+code=max_stack_lock" class="sref">max_stack_lockv/a>);   61v/a>   62v/a>        vspa
 class="comment">/* a race could have already updated it */v/spa
	   63v/a>        if (va href="+code=this_size" class="sref">this_sizev/a> <= va href="+code=max_stack_size" class="sref">max_stack_sizev/a>)   64v/a>                goto va href="+code=out" class="sref">outv/a>;   65v/a>   66v/a>        va href="+code=max_stack_size" class="sref">max_stack_sizev/a> = va href="+code=this_size" class="sref">this_sizev/a>;   67v/a>   68v/a>        va href="+code=max_stack_trace" class="sref">max_stack_tracev/a>.va href="+code=nr_entries" class="sref">nr_entriesv/a>      = 0;   69v/a>        va href="+code=max_stack_trace" class="sref">max_stack_tracev/a>.va href="+code=skip" class="sref">skipv/a>            = 3;   70v/a>   71v/a>        va href="+code=save_stack_trace" class="sref">save_stack_tracev/a>(&va href="+code=max_stack_trace" class="sref">max_stack_tracev/a>);   72v/a>   73v/a>        vspa
 class="comment">/*v/spa
	   74v/a>vspa
 class="comment">         * Now find where in the stack these are.v/spa
	   75v/a>vspa
 class="comment">         */v/spa
	   76v/a>        va href="+code=i" class="sref">iv/a> = 0;   77v/a>        va href="+code=start" class="sref">startv/a> = &va href="+code=this_size" class="sref">this_sizev/a>;   78v/a>        va href="+code=top" class="sref">topv/a> = (unsigned long *)   79v/a>                (((unsigned long)va href="+code=start" class="sref">startv/a> & ~(va href="+code=THREAD_SIZE" class="sref">THREAD_SIZEv/a>-1)) + va href="+code=THREAD_SIZE" class="sref">THREAD_SIZEv/a>);   80v/a>   81v/a>        vspa
 class="comment">/*v/spa
	   82v/a>vspa
 class="comment">         * Loop through all the entries. One of the entries mayv/spa
	   83v/a>vspa
 class="comment">         * for some reason be missed on the stack, so we mayv/spa
	   84v/a>vspa
 class="comment">         * have to account for them. If they are all there, thisv/spa
	   85v/a>vspa
 class="comment">         * loop will only happen once. This code only takes placev/spa
	   86v/a>vspa
 class="comment">         * on a new max, so it is far from a fast path.v/spa
	   87v/a>vspa
 class="comment">         */v/spa
	   88v/a>        while (va href="+code=i" class="sref">iv/a> < va href="+code=max_stack_trace" class="sref">max_stack_tracev/a>.va href="+code=nr_entries" class="sref">nr_entriesv/a>) {   89v/a>                int va href="+code=found" class="sref">foundv/a> = 0;   90v/a>   91v/a>                va href="+code=stack_dump_index" class="sref">stack_dump_indexv/a>[va href="+code=i" class="sref">iv/a>] = va href="+code=this_size" class="sref">this_sizev/a>;   92v/a>                va href="+code=p" class="sref">pv/a> = va href="+code=start" class="sref">startv/a>;   93v/a>   94v/a>                for (; va href="+code=p" class="sref">pv/a> < va href="+code=top" class="sref">topv/a> && va href="+code=i" class="sref">iv/a> < va href="+code=max_stack_trace" class="sref">max_stack_tracev/a>.va href="+code=nr_entries" class="sref">nr_entriesv/a>; va href="+code=p" class="sref">pv/a>++) {   95v/a>                        if (*va href="+code=p" class="sref">pv/a> == va href="+code=stack_dump_trace" class="sref">stack_dump_tracev/a>[va href="+code=i" class="sref">iv/a>]) {   96v/a>                                va href="+code=this_size" class="sref">this_sizev/a> = va href="+code=stack_dump_index" class="sref">stack_dump_indexv/a>[va href="+code=i" class="sref">iv/a>++] =   97v/a>                                        (va href="+code=top" class="sref">topv/a> - va href="+code=p" class="sref">pv/a>) * sizeof(unsigned long);   98v/a>                                va href="+code=found" class="sref">foundv/a> = 1;   99v/a>                                vspa
 class="comment">/* Start the search from here */v/spa
	  100v/a>                                va href="+code=start" class="sref">startv/a> = va href="+code=p" class="sref">pv/a> + 1;  101v/a>                        }  102v/a>                }  103v/a>  104v/a>                if (!va href="+code=found" class="sref">foundv/a>)  105v/a>                        va href="+code=i" class="sref">iv/a>++;  106v/a>        }  107v/a>  108v/a> va href="+code=out" class="sref">outv/a>:  109v/a>        va href="+code=arch_spin_unlock" class="sref">arch_spin_unlockv/a>(&va href="+code=max_stack_lock" class="sref">max_stack_lockv/a>);  110v/a>        va href="+code=local_irq_restore" class="sref">local_irq_restorev/a>(va href="+code=flags" class="sref">flagsv/a>);  11117a>}  112v/a>  113v/a>static void  114v/a>va href="+code=stack_trace_call" class="sref">stack_trace_callv/a>(unsigned long va href="+code=ip" class="sref">ipv/a>, unsigned long va href="+code=parent_ip" class="sref">parent_ipv/a>,  115v/a>                 struct va href="+code=ftrace_ops" class="sref">ftrace_opsv/a> *va href="+code=op" class="sref">opv/a>, struct va href="+code=pt_regs" class="sref">pt_regsv/a> *va href="+code=pt_regs" class="sref">pt_regsv/a>)  116v/a>{  117v/a>        int va href="+code=cpu" class="sref">cpuv/a>;  118v/a>  119v/a>        if (va href="+code=unlikely" class="sref">unlikelyv/a>(!va href="+code=ftrace_enabled" class="sref">ftrace_enabledv/a> || va href="+code=stack_trace_disabled" class="sref">stack_trace_disabledv/a>))  120v/a>                return;  121v/a>  122v/a>        va href="+code=preempt_disable_notrace" class="sref">preempt_disable_notracev/a>();  123v/a>  124v/a>        va href="+code=cpu" class="sref">cpuv/a> = va href="+code=raw_smp_processor_id" class="sref">raw_smp_processor_idv/a>();  125v/a>        vspa
 class="comment">/* no atomic needed, we only modify this variable by this cpu */v/spa
	  126v/a>        if (va href="+code=per_cpu" class="sref">per_cpuv/a>(va href="+code=trace_ac.1ve" class="sref">trace_ac.1vev/a>, va href="+code=cpu" class="sref">cpuv/a>)++ != 0)  127v/a>                goto va href="+code=out" class="sref">outv/a>;  128v/a>  129v/a>        va href="+code=check_stack" class="sref">check_stackv/a>();  130v/a>  131v/a> va href="+code=out" class="sref">outv/a>:  132v/a>        va href="+code=per_cpu" class="sref">per_cpuv/a>(va href="+code=trace_ac.1ve" class="sref">trace_ac.1vev/a>, va href="+code=cpu" class="sref">cpuv/a>)--;  133v/a>        vspa
 class="comment">/* prevent recurs.22.in schedule */v/spa
	  134v/a>        va href="+code=preempt_enable_notrace" class="sref">preempt_enable_notracev/a>();  135v/a>}  136v/a>  137v/a>static struct va href="+code=ftrace_ops" class="sref">ftrace_opsv/a> va href="+code=trace_ops" class="sref">trace_opsv/a> va href="+code=__read_mostly" class="sref">__read_mostlyv/a> =  138v/a>{  139v/a>        .va href="+code=func" class="sref">funcv/a> = va href="+code=stack_trace_call" class="sref">stack_trace_callv/a>,  140v/a>        .va href="+code=flags" class="sref">flagsv/a> = va href="+code=FTRACE_OPS_FL_RECURSION_SAFE" class="sref">FTRACE_OPS_FL_RECURSION_SAFEv/a>,  141v/a>};  142v/a>  143v/a>static va href="+code=ssize_t" class="sref">ssize_tv/a>  144v/a>va href="+code=stack_max_size_read" class="sref">stack_max_size_readv/a>(struct va href="+code=file" class="sref">filev/a> *va href="+code=filp" class="sref">filpv/a>, char va href="+code=__user" class="sref">__userv/a> *va href="+code=ubuf" class="sref">ubufv/a>,  145v/a>                    va href="+code=size_t" class="sref">size_tv/a> va href="+code=count" class="sref">countv/a>, va href="+code=loff_t" class="sref">loff_tv/a> *va href="+code=ppos" class="sref">pposv/a>)  146v/a>{  147v/a>        unsigned long *va href="+code=ptr" class="sref">ptrv/a> = va href="+code=filp" class="sref">filpv/a>->va href="+code=private_data" class="sref">private_datav/a>;  148v/a>        char va href="+code=buf" class="sref">bufv/a>[64];  149v/a>        int va href="+code=r" class="sref">rv/a>;  150v/a>  151v/a>        va href="+code=r" class="sref">rv/a> = va href="+code=snprintf" class="sref">snprintfv/a>(va href="+code=buf" class="sref">bufv/a>, sizeof(va href="+code=buf" class="sref">bufv/a>), vspa
 class="string">"%ld\n"ptrv/a>);  152v/a>        if (va href="+code=r" class="sref">rv/a> > sizeof(va href="+code=buf" class="sref">bufv/a>))  153v/a>                va href="+code=r" class="sref">rv/a> = sizeof(va href="+code=buf" class="sref">bufv/a>);  154v/a>        return va href="+code=simple_read_from_buffer" class="sref">simple_read_from_bufferv/a>(va href="+code=ubuf" class="sref">ubufv/a>, va href="+code=count" class="sref">countv/a>, va href="+code=ppos" class="sref">pposv/a>, va href="+code=buf" class="sref">bufv/a>, va href="+code=r" class="sref">rv/a>);  155v/a>}  156v/a>  157v/a>static va href="+code=ssize_t" class="sref">ssize_tv/a>  158v/a>va href="+code=stack_max_size_write" class="sref">stack_max_size_writev/a>(struct va href="+code=file" class="sref">filev/a> *va href="+code=filp" class="sref">filpv/a>, const char va href="+code=__user" class="sref">__userv/a> *va href="+code=ubuf" class="sref">ubufv/a>,  159v/a>                     va href="+code=size_t" class="sref">size_tv/a> va href="+code=count" class="sref">countv/a>, va href="+code=loff_t" class="sref">loff_tv/a> *va href="+code=ppos" class="sref">pposv/a>)  160v/a>{  161v/a>        long *va href="+code=ptr" class="sref">ptrv/a> = va href="+code=filp" class="sref">filpv/a>->va href="+code=private_data" class="sref">private_datav/a>;  162v/a>        unsigned long va href="+code=val" class="sref">valv/a>, va href="+code=flags" class="sref">flagsv/a>;  163v/a>        int va href="+code=ret" class="sref">retv/a>;  164v/a>        int va href="+code=cpu" class="sref">cpuv/a>;  165v/a>  166v/a>        va href="+code=ret" class="sref">retv/a> = va href="+code=kstrtoul_from_user" class="sref">kstrtoul_from_userv/a>(va href="+code=ubuf" class="sref">ubufv/a>, va href="+code=count" class="sref">countv/a>, 10, &va href="+code=val" class="sref">valv/a>);  167v/a>        if (va href="+code=ret" class="sref">retv/a>)  168v/a>                return va href="+code=ret" class="sref">retv/a>;  169v/a>  170v/a>        va href="+code=local_irq_save" class="sref">local_irq_savev/a>(va href="+code=flags" class="sref">flagsv/a>);  171v/a>  172v/a>        vspa
 class="comment">/*v/spa
	  173v/a>vspa
 class="comment">         * I
 case we trace inside arch_spin_lock() or after (NMI),v/spa
	  174v/a>vspa
 class="comment">         * we will cause circular lock, so we also need to increasev/spa
	  175v/a>vspa
 class="comment">         * the percpu trace_ac.1ve here.v/spa
	  176v/a>vspa
 class="comment">         */v/spa
	  177v/a>        va href="+code=cpu" class="sref">cpuv/a> = va href="+code=smp_processor_id" class="sref">smp_processor_idv/a>();  178v/a>        va href="+code=per_cpu" class="sref">per_cpuv/a>(va href="+code=trace_ac.1ve" class="sref">trace_ac.1vev/a>, va href="+code=cpu" class="sref">cpuv/a>)++;  179v/a>  180v/a>        va href="+code=arch_spin_lock" class="sref">arch_spin_lockv/a>(&va href="+code=max_stack_lock" class="sref">max_stack_lockv/a>);  181v/a>        *va href="+code=ptr" class="sref">ptrv/a> = va href="+code=val" class="sref">valv/a>;  182v/a>        va href="+code=arch_spin_unlock" class="sref">arch_spin_unlockv/a>(&va href="+code=max_stack_lock" class="sref">max_stack_lockv/a>);  183v/a>  184v/a>        va href="+code=per_cpu" class="sref">per_cpuv/a>(va href="+code=trace_ac.1ve" class="sref">trace_ac.1vev/a>, va href="+code=cpu" class="sref">cpuv/a>)--;  185v/a>        va href="+code=local_irq_restore" class="sref">local_irq_restorev/a>(va href="+code=flags" class="sref">flagsv/a>);  186v/a>  187v/a>        return va href="+code=count" class="sref">countv/a>;  188v/a>}  189v/a>  190v/a>static const struct va href="+code=file_opera.1"
s" class="sref">file_opera.1"
sv/a> va href="+code=stack_max_size_fops" class="sref">stack_max_size_fopsv/a> = {  191v/a>        .va href="+code=open" class="sref">openv/a>           = va href="+code=tracing_open_generic" class="sref">tracing_open_genericv/a>,  192v/a>        .va href="+code=read" class="sref">readv/a>           = va href="+code=stack_max_size_read" class="sref">stack_max_size_readv/a>,  193v/a>        .va href="+code=write" class="sref">writev/a>          = va href="+code=stack_max_size_write" class="sref">stack_max_size_writev/a>,  194v/a>        .va href="+code=llseek" class="sref">llseekv/a>         = va href="+code=default_llseek" class="sref">default_llseekv/a>,  195v/a>};  196v/a>  197v/a>static void *  198v/a>va href="+code=__next" class="sref">__nextv/a>(struct va href="+code=seq_file" class="sref">seq_filev/a> *va href="+code=m" class="sref">mv/a>, va href="+code=loff_t" class="sref">loff_tv/a> *va href="+code=pos" class="sref">posv/a>)  199v/a>{  200v/a>        long va href="+code=n" class="sref">nv/a> = *va href="+code=pos" class="sref">posv/a> - 1;  201v/a>  202v/a>        if (va href="+code=n" class="sref">nv/a> >= va href="+code=max_stack_trace" class="sref">max_stack_tracev/a>.va href="+code=nr_entries" class="sref">nr_entriesv/a> || va href="+code=stack_dump_trace" class="sref">stack_dump_tracev/a>[va href="+code=n" class="sref">nv/a>] == va href="+code=ULONG_MAX" class="sref">ULONG_MAXv/a>)  203v/a>                return va href="+code=NULL" class="sref">NULLv/a>;  204v/a>  205v/a>        va href="+code=m" class="sref">mv/a>->va href="+code=private" class="sref">privatev/a> = (void *)va href="+code=n" class="sref">nv/a>;  206v/a>        return &va href="+code=m" class="sref">mv/a>->va href="+code=private" class="sref">privatev/a>;  207v/a>}  208v/a>  209v/a>static void *  210v/a>va href="+code=t_next" class="sref">t_nextv/a>(struct va href="+code=seq_file" class="sref">seq_filev/a> *va href="+code=m" class="sref">mv/a>, void *va href="+code=v" class="sref">vv/a>, va href="+code=loff_t" class="sref">loff_tv/a> *va href="+code=pos" class="sref">posv/a>)  21117a>{  212v/a>        (*va href="+code=pos" class="sref">posv/a>)++;  213v/a>        return va href="+code=__next" class="sref">__nextv/a>(va href="+code=m" class="sref">mv/a>, va href="+code=pos" class="sref">posv/a>);  214v/a>}  215v/a>  216v/a>static void *va href="+code=t_start" class="sref">t_startv/a>(struct va href="+code=seq_file" class="sref">seq_filev/a> *va href="+code=m" class="sref">mv/a>, va href="+code=loff_t" class="sref">loff_tv/a> *va href="+code=pos" class="sref">posv/a>)  217v/a>{  218v/a>        int va href="+code=cpu" class="sref">cpuv/a>;  219v/a>  220v/a>        va href="+code=local_irq_disable" class="sref">local_irq_disablev/a>();  221v/a>  222v/a>        va href="+code=cpu" class="sref">cpuv/a> = va href="+code=smp_processor_id" class="sref">smp_processor_idv/a>();  223v/a>        va href="+code=per_cpu" class="sref">per_cpuv/a>(va href="+code=trace_ac.1ve" class="sref">trace_ac.1vev/a>, va href="+code=cpu" class="sref">cpuv/a>)++;  224v/a>  225v/a>        va href="+code=arch_spin_lock" class="sref">arch_spin_lockv/a>(&va href="+code=max_stack_lock" class="sref">max_stack_lockv/a>);  226v/a>  227v/a>        if (*va href="+code=pos" class="sref">posv/a> == 0)  228v/a>                return va href="+code=SEQ_START_TOKEN" class="sref">SEQ_START_TOKENv/a>;  229v/a>  230v/a>        return va href="+code=__next" class="sref">__nextv/a>(va href="+code=m" class="sref">mv/a>, va href="+code=pos" class="sref">posv/a>);  23117a>}  232v/a>  233v/a>static void va href="+code=t_stop" class="sref">t_stopv/a>(struct va href="+code=seq_file" class="sref">seq_filev/a> *va href="+code=m" class="sref">mv/a>, void *va href="+code=p" class="sref">pv/a>)  234v/a>{  235v/a>        int va href="+code=cpu" class="sref">cpuv/a>;  236v/a>  237v/a>        va href="+code=arch_spin_unlock" class="sref">arch_spin_unlockv/a>(&va href="+code=max_stack_lock" class="sref">max_stack_lockv/a>);  238v/a>  239v/a>        va href="+code=cpu" class="sref">cpuv/a> = va href="+code=smp_processor_id" class="sref">smp_processor_idv/a>();  240v/a>        va href="+code=per_cpu" class="sref">per_cpuv/a>(va href="+code=trace_ac.1ve" class="sref">trace_ac.1vev/a>, va href="+code=cpu" class="sref">cpuv/a>)--;  241v/a>  242v/a>        va href="+code=local_irq_enable" class="sref">local_irq_enablev/a>();  243v/a>}  244v/a>  245v/a>static int va href="+code=trace_lookup_stack" class="sref">trace_lookup_stackv/a>(struct va href="+code=seq_file" class="sref">seq_filev/a> *va href="+code=m" class="sref">mv/a>, long va href="+code=i" class="sref">iv/a>)  246v/a>{  247v/a>        unsigned long va href="+code=addr" class="sref">addrv/a> = va href="+code=stack_dump_trace" class="sref">stack_dump_tracev/a>[va href="+code=i" class="sref">iv/a>];  248v/a>  249v/a>        return va href="+code=seq_printf" class="sref">seq_printfv/a>(va href="+code=m" class="sref">mv/a>, vspa
 class="string">"%pS\n"addrv/a>);  250v/a>}  251v/a>  252v/a>static void va href="+code=print_disabled" class="sref">print_disabledv/a>(struct va href="+code=seq_file" class="sref">seq_filev/a> *va href="+code=m" class="sref">mv/a>)  253v/a>{  254v/a>        va href="+code=seq_puts" class="sref">seq_putsv/a>(va href="+code=m" class="sref">mv/a>, vspa
 class="string">"#\n" 255v/a>                 vspa
 class="string">"#  Stack tracer disabled\n" 256v/a>                 vspa
 class="string">"#\n" 257v/a>                 vspa
 class="string">"# To enable the stack tracer, either add 'stacktrace' to the\n" 258v/a>                 vspa
 class="string">"# kernel command line\n" 259v/a>                 vspa
 class="string">"# or 'echo 1 > /proc/sys/kernel/stack_tracer_enabled'\n" 260v/a>                 vspa
 class="string">"#\n" 26117a>}  262v/a>  263v/a>static int va href="+code=t_show" class="sref">t_showv/a>(struct va href="+code=seq_file" class="sref">seq_filev/a> *va href="+code=m" class="sref">mv/a>, void *va href="+code=v" class="sref">vv/a>)  264v/a>{  265v/a>        long va href="+code=i" class="sref">iv/a>;  266v/a>        int va href="+code=size" class="sref">sizev/a>;  267v/a>  268v/a>        if (va href="+code=v" class="sref">vv/a> == va href="+code=SEQ_START_TOKEN" class="sref">SEQ_START_TOKENv/a>) {  269v/a>                va href="+code=seq_printf" class="sref">seq_printfv/a>(va href="+code=m" class="sref">mv/a>, vspa
 class="string">"        Depth    Size   Loca.1"
" 270v/a>                           vspa
 class="string">"    (%d entries)\n" 271v/a>                           vspa
 class="string">"        -----    ----   --------\n" 272v/a>                           va href="+code=max_stack_trace" class="sref">max_stack_tracev/a>.va href="+code=nr_entries" class="sref">nr_entriesv/a> - 1);  273v/a>  274v/a>                if (!va href="+code=stack_tracer_enabled" class="sref">stack_tracer_enabledv/a> && !va href="+code=max_stack_size" class="sref">max_stack_sizev/a>)  275v/a>                        va href="+code=print_disabled" class="sref">print_disabledv/a>(va href="+code=m" class="sref">mv/a>);  276v/a>  277v/a>                return 0;  278v/a>        }  279v/a>  280v/a>        va href="+code=i" class="sref">iv/a> = *(long *)va href="+code=v" class="sref">vv/a>;  281v/a>  282v/a>        if (va href="+code=i" class="sref">iv/a> >= va href="+code=max_stack_trace" class="sref">max_stack_tracev/a>.va href="+code=nr_entries" class="sref">nr_entriesv/a> ||  283v/a>            va href="+code=stack_dump_trace" class="sref">stack_dump_tracev/a>[va href="+code=i" class="sref">iv/a>] == va href="+code=ULONG_MAX" class="sref">ULONG_MAXv/a>)  284v/a>                return 0;  285v/a>  286v/a>        if (va href="+code=i" class="sref">iv/a>+1 == va href="+code=max_stack_trace" class="sref">max_stack_tracev/a>.va href="+code=nr_entries" class="sref">nr_entriesv/a> ||  287v/a>            va href="+code=stack_dump_trace" class="sref">stack_dump_tracev/a>[va href="+code=i" class="sref">iv/a>+1] == va href="+code=ULONG_MAX" class="sref">ULONG_MAXv/a>)  288v/a>                va href="+code=size" class="sref">sizev/a> = va href="+code=stack_dump_index" class="sref">stack_dump_indexv/a>[va href="+code=i" class="sref">iv/a>];  289v/a>        else  290v/a>                va href="+code=size" class="sref">sizev/a> = va href="+code=stack_dump_index" class="sref">stack_dump_indexv/a>[va href="+code=i" class="sref">iv/a>] - va href="+code=stack_dump_index" class="sref">stack_dump_indexv/a>[va href="+code=i" class="sref">iv/a>+1];  291v/a>  292v/a>        va href="+code=seq_printf" class="sref">seq_printfv/a>(va href="+code=m" class="sref">mv/a>, vspa
 class="string">"%3ld) %8d   %5d   "iv/a>, va href="+code=stack_dump_index" class="sref">stack_dump_indexv/a>[va href="+code=i" class="sref">iv/a>], va href="+code=size" class="sref">sizev/a>);  293v/a>  294v/a>        va href="+code=trace_lookup_stack" class="sref">trace_lookup_stackv/a>(va href="+code=m" class="sref">mv/a>, va href="+code=i" class="sref">iv/a>);  295v/a>  296v/a>        return 0;  297v/a>}  298v/a>  299v/a>static const struct va href="+code=seq_opera.1"
s" class="sref">seq_opera.1"
sv/a> va href="+code=stack_trace_seq_ops" class="sref">stack_trace_seq_opsv/a> = {  300v/a>        .va href="+code=start" class="sref">startv/a>          = va href="+code=t_start" class="sref">t_startv/a>,  301v/a>        .va href="+code=next" class="sref">nextv/a>           = va href="+code=t_next" class="sref">t_nextv/a>,  302v/a>        .va href="+code=stop" class="sref">stopv/a>           = va href="+code=t_stop" class="sref">t_stopv/a>,  303v/a>        .va href="+code=show" class="sref">showv/a>           = va href="+code=t_show" class="sref">t_showv/a>,  304v/a>};  305v/a>  306v/a>static int va href="+code=stack_trace_open" class="sref">stack_trace_openv/a>(struct va href="+code=inode" class="sref">inodev/a> *va href="+code=inode" class="sref">inodev/a>, struct va href="+code=file" class="sref">filev/a> *va href="+code=file" class="sref">filev/a>)  307v/a>{  308v/a>        return va href="+code=seq_open" class="sref">seq_openv/a>(va href="+code=file" class="sref">filev/a>, &va href="+code=stack_trace_seq_ops" class="sref">stack_trace_seq_opsv/a>);  309v/a>}  310v/a>  31117a>static const struct va href="+code=file_opera.1"
s" class="sref">file_opera.1"
sv/a> va href="+code=stack_trace_fops" class="sref">stack_trace_fopsv/a> = {  312v/a>        .va href="+code=open" class="sref">openv/a>           = va href="+code=stack_trace_open" class="sref">stack_trace_openv/a>,  313v/a>        .va href="+code=read" class="sref">readv/a>           = va href="+code=seq_read" class="sref">seq_readv/a>,  314v/a>        .va href="+code=llseek" class="sref">llseekv/a>         = va href="+code=seq_lseek" class="sref">seq_lseekv/a>,  315v/a>        .va href="+code=release" class="sref">releasev/a>        = va href="+code=seq_release" class="sref">seq_releasev/a>,  316v/a>};  317v/a>  318v/a>static int  319v/a>va href="+code=stack_trace_filter_open" class="sref">stack_trace_filter_openv/a>(struct va href="+code=inode" class="sref">inodev/a> *va href="+code=inode" class="sref">inodev/a>, struct va href="+code=file" class="sref">filev/a> *va href="+code=file" class="sref">filev/a>)  320v/a>{  321v/a>        return va href="+code=ftrace_regex_open" class="sref">ftrace_regex_openv/a>(&va href="+code=trace_ops" class="sref">trace_opsv/a>, va href="+code=FTRACE_ITER_FILTER" class="sref">FTRACE_ITER_FILTERv/a>,  322v/a>                                 va href="+code=inode" class="sref">inodev/a>, va href="+code=file" class="sref">filev/a>);  323v/a>}  324v/a>  325v/a>static const struct va href="+code=file_opera.1"
s" class="sref">file_opera.1"
sv/a> va href="+code=stack_trace_filter_fops" class="sref">stack_trace_filter_fopsv/a> = {  326v/a>        .va href="+code=open" class="sref">openv/a> = va href="+code=stack_trace_filter_open" class="sref">stack_trace_filter_openv/a>,  327v/a>        .va href="+code=read" class="sref">readv/a> = va href="+code=seq_read" class="sref">seq_readv/a>,  328v/a>        .va href="+code=write" class="sref">writev/a> = va href="+code=ftrace_filter_write" class="sref">ftrace_filter_writev/a>,  329v/a>        .va href="+code=llseek" class="sref">llseekv/a> = va href="+code=ftrace_regex_lseek" class="sref">ftrace_regex_lseekv/a>,  330v/a>        .va href="+code=release" class="sref">releasev/a> = va href="+code=ftrace_regex_release" class="sref">ftrace_regex_releasev/a>,  331v/a>};  332v/a>  333v/a>int  334v/a>va href="+code=stack_trace_sysctl" class="sref">stack_trace_sysctlv/a>(struct va href="+code=ctl_table" class="sref">ctl_tablev/a> *va href="+code=table" class="sref">tablev/a>, int va href="+code=write" class="sref">writev/a>,  335v/a>                   void va href="+code=__user" class="sref">__userv/a> *va href="+code=buffer" class="sref">bufferv/a>, va href="+code=size_t" class="sref">size_tv/a> *va href="+code=lenp" class="sref">lenpv/a>,  336v/a>                   va href="+code=loff_t" class="sref">loff_tv/a> *va href="+code=ppos" class="sref">pposv/a>)  334" class="line" namptiL334"> 334v/a>va href="e_filter_fops" class="sref">stack_trace_filef="+code=t_2d" idt3ref="+code=cpu" class="sref">cpuv/a>;  239v/a>        3a hre33/trace/trace_stack.c#L280" idtiL280" class=3line" nam3tiL240"> 240v/a>        3a hre3="+code=per_cpu" class="sref"mut="ke_stack_lockv/a>); (strurref="_ 241v/a>  242v/a>        3a hre3="+code=local_irq_enable" clav/a> = va href="+code=kstrtoul_from_user" c_tra_dou" veng_open_genericv_tra_dou" venile" class="sref">fiablev/a>, int va href="+code=wr class="sref">writev/a>, wbufferv/a>, va href="+code=size_t" class="sref">npv/a>, )  243v/a>}  244v/a> retv/a>)  = va href="+code=ftraace/trace_stack.c#L287" idtiL287" class=3line" nam3tiL245"> 245v/a>static i3t va 34   void va href="class="sref">ret5">tref="+code=nf">stack_tracer_enabledv5">tref="+code=nf">stack_=kstrt= !_tracer_enabled" class="sref">stack_tracer_enabledv/a> && !va href=)ce/trace_stack.c#L337" idtiL337" class="line" nam3tiL246"> 246v/a>{ )  247v/a>        3nsign34/trace/trace_stack.c#L318" idtiL318" class="line" nam3tiL248"> 248v/a> tref="+code=nf">stack_tracer_enabledv5">tref="+code=nf">stack_=kstrt !_tracer_enabled" class="sref">stack_tracer_enabledv/a> && !va href=ce/trace_stack.c#L169" idtiL169" class=3line" nam3tiL249"> 249v/a>        3eturn34/trace/trace_stack.c#L280" idtiL280" class=3line" nam3tiL250"> 250v/a>} ret class="sref">stack_tracer_enabledv/a> && !va href=)e/trace_stack.c#L280" idtiL280" class=3line" nam3tiL251"> 251v/a> retv/gisref=">, ) , trace_opsv/a>, va href="+code=FTRAcce/trace_stack.c#L323" idtiL323" class="line" nam3tiL252"> 252v/a>static v3id va35"+code=local_trace/trace_stack.c#L290" idtiL290" class=3line" nam3tiL253"> 253v/a>{ , ) , trace_opsv/a>, va href="+code=FTRAcce/trace_stack.c#L323" idtiL323" class="line" nam3tiL254"> 254v/a>        3a hre35/trace/trace_stack.c#L325" idtiL325" class="line" nam3tiL255"> 255v/a>        3     3  vspa
ul_from_user" coua>)  256v/a>        3     35"+code=ret" class="sref">ret((strurref="_ 257v/a>        3     35a href="+code=count" class="sref">cv/a>;  258v/a>        3     35l/trace/trace_stack.c#L189" idtiL189" class=3line" nam3tiL259"> 259v/a>        3     35/trace/trace_stack.c#L280" idtiL280" class=3line" nam3tiL260"> 260v/a>        3     36uct va href="har_trace_filter_open" class="sref">stfv/a>, va href="+cen" class="sref">stfv/ct vass="sref">iv/a>COMMAND_LINE_SIZEa>, va href="+cCOMMAND_LINE_SIZEct v=ULO" class="sref">__initdatav/a> *va href="+cinitdata/trace/trace_stack.c#L169" idtiL169" class=3line" nam3tiL261"> 26117a>}  262v/a> __initv/a> *va href="+cinit hrefu" class="sref">cpu; !va 42" cldtiL2v/a> *va href="; !va 42" cldtiL2ode=t"har_ class="sref">pps/a> = va href="+csde=val)e/trace_stack.c#L280" idtiL280" class=3line" nam3tiL263"> 263v/a>static i3t va 36l/trace/trace_stack.c#L254" idtiL254" class=3line" nam3tiL264"> 264v/a>{ retsdencm/a>           = vaencm/ile" class="sref">fis/a> = va href="+csde=val">"%3ld) %8d   &sref">s=f="+code=i" cla8)l/trace/trace_stack.c#L228" idtiL228" class=3line" nam3tiL265"> 265v/a>        3ong v36   void va href="+codlass="sref">retsdencpya>           = vaencpyile" class="sref">fis/" class="sref">stfv/a>, va href="+cen" class="sref">stfv/ct vk_dump_index" classa> = va href="+csde=val+8k_dump_index" claCOMMAND_LINE_SIZEa>, va href="+cCOMMAND_LINE_SIZEct vace/trace_stack.c#L323" idtiL323" class="line" nam3tiL266"> 266v/a>        3nt va36/trace/trace_stack.c#L277" idtiL277" class=3line" nam3tiL267"> 267v/a> stack_tracer_enabledv/a> && !va href=rt ace/trace_stack.c#L201" idtiL201" class=3line" nam3tiL268"> 268v/a>        3f (va36"+code=per_cpu" class="sref"5">tref="+code=nf">stack_tracer_enabledv5">tref="+code=nf">stack_=kstrt ace/trace_stack.c#L201" idtiL201" class=3line" nam3tiL269"> 269v/a>        3     36a href="+code=seq_prace/trace_stack.c#L201" idtiL201" class=3line" nam3tiL270"> 270v/a>        3     37l/trace/trace_stack.c#L251" idtiL251" class=3line" nam3tiL271"> 271v/a>        3     3      " class="sref">__sseq/a>           = __sseq/ile" cquot;%3ld) %8d   &2" cldtiL2f="+code=i" class="sref">iv/a>; !va 42" cldtiL2v/a> *va href="; !va 42" cldtiL2ode=ace/trace_stack.c#L323" idtiL323" class="line" nam3tiL272"> 272v/a>        3     37/trace/trace_stack.c#L333" idtiL333" class="line" nam3tiL273"> 273v/a> __initv/a> *va href="+cinit hrefu" class="sref">cpuen" class="sinitv/a> *va href="en" class="sinitile" _usece/trace_stack.c#L228" idtiL228" class=3line" nam3tiL274"> 274v/a>        3     37l/trace/trace_stack.c#L265" idtiL265" class=3line" nam3tiL275"> 275v/a>        3     3         va hr=ctl_table" class="sredf="kya>           = df="kyppos" class="sref">ppdcode=nfa>           = dcode=nf/trace/trace_stack.c#L169" idtiL169" class=3line" nam3tiL276"> 276v/a>  277v/a>        3     37"+code=arch_spin_unlock" cladcode=nfa>           = dcode=nf/tracing_open_generic" class="init_df="kya>           =  class="init_df="kyile" ace/trace_stack.c#L323" idtiL323" class="line" nam3tiL278"> 278v/a>        3  279v/a> cpudtiL29createeq_filev/a> *va hrefdtiL29createeq_fiile" cquot;%3ld) %8d   &2" cliv/a>dcode=nfa>           = dcode=nf/trace/trace_stack.c#L336" idtiL336" class="line" nam3tiL280"> 280v/a>        3a hre38           vspa
 class="strinax_stack_lock" class="sref">max_stack_sizev/a>) stack_max_size_fopsv/a> = {  281v/a>  282v/a>        3f (va38"+code=local_irq_enable" cladtiL29createeq_filev/a> *va hrefdtiL29createeq_fiile" cquot;%3ld) %8d   &2" cliv/a>dcode=nfa>           = dcode=nf/trace/trace_stack.c#L336" idtiL336" class="line" nam3tiL283"> 283v/a>        3   va3href="+code=stack_a href="+codlass="sref">retLLv/a>;  = {  284v/a>        3     38/trace/trace_stack.c#L325" idtiL325" class="line" nam3tiL285"> 285v/a>  *va hrefdtiL29createeq_fiile" cquot;%3ld) %8d   &2" clsf="+code=i" cla0444lass="sref">iv/a>dcode=nfa>           = dcode=nf/trace/trace_stack.c#L336" idtiL336" class="line" nam3tiL286"> 286v/a>        3f (va38   va href="+code=loff_t"+codlass="sref">retLLv/a>; stack_trace_filter_fopsv/a> = {  287v/a>        3   va38/trace/trace_stack.c#L318" idtiL318" class="line" nam3tiL288"> 288v/a>        3     38ref="+code=v" class="sref">vv/a>en" class="sref">stfv/a>, va href="+cen" class="sref">stfv/ct va0]ce/trace_stack.c#L228" idtiL228" class=3line" nam3tiL289"> 289v/a>        3lse <38va href="+code=seq_printf" class="sr">, sa>, va href="+c">, sode=trace_ops" class="sref">trace_opsv/a>, va href="+code=FTRAk_dump_index" class="srass="sref">stfv/a>, va href="+cen" class="sref">stfv/ct vk_race/trace_stack.c#L273" idtiL273" class=3line" nam3tiL290"> 290v/a>        3     39/trace/trace_stack.c#L311" idtiL311" class="line" nam3tiL291"> 291v/a> vv/a>en" class="f">stack_tracer_enabledv/a> && !va href=)e/trace_stack.c#L280" idtiL280" class=3line" nam3tiL292"> 292v/a>        3a hre39                 va hlass="sref">retv/gisref=">, ) , trace_opsv/a>, va href="+code=FTRAcce/trace_stack.c#L323" idtiL323" class="line" nam3tiL293"> 293v/a>  294v/a>        3a hre3="+code=trace_rnel/trace/trace_stack.c#L297" idtiL297" class=3line" nam3tiL295"> 295v/a>  296v/a>        3eturn39/trace/trace_stack.c#L277" idtiL277" class=3line" nam3tiL297"> 297v/a>} fis/" class="sinitv/a> *va href="en" class="sinitile"cce/trace_stack.c#L323" idtiL323" class="line" nam3tiL298"> 298v/a> 


29foo">sa> The original LXR software byther /trace_sthttp://sourceforge.netk_trjects/lxsa>LXR /spaunityct vk_this experimf="al versde= byt/trace_stmaef"o:lxs@8v/ux.no">lxs@8v/ux.noct v. 29subfoo">sa> lxs.8v/ux.no kindly hosred byt/trace_sthttp://www.redpill-8v/_tr.no">Redpill Lv/_tr ASct vk__trvider of Lv/ux="+coult