~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/bootconfig/scripts/ftrace2bconf.sh

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/bootconfig/scripts/ftrace2bconf.sh (Version linux-6.11.5) and /tools/bootconfig/scripts/ftrace2bconf.sh (Version linux-4.16.18)


  1 #!/bin/sh                                         
  2 # SPDX-License-Identifier: GPL-2.0-only           
  3                                                   
  4 usage() {                                         
  5         echo "Dump boot-time tracing bootconfi    
  6         echo "Usage: $0 [--debug] [ > BOOTCONF    
  7         exit 1                                    
  8 }                                                 
  9                                                   
 10 DEBUG=                                            
 11 while [ x"$1" != x ]; do                          
 12         case "$1" in                              
 13         "--debug")                                
 14                 DEBUG=$1;;                        
 15         -*)                                       
 16                 usage                             
 17                 ;;                                
 18         esac                                      
 19         shift 1                                   
 20 done                                              
 21                                                   
 22 if [ x"$DEBUG" != x ]; then                       
 23         set -x                                    
 24 fi                                                
 25                                                   
 26 TRACEFS=`grep -m 1 -w tracefs /proc/mounts | c    
 27 if [ -z "$TRACEFS" ]; then                        
 28         if ! grep -wq debugfs /proc/mounts; th    
 29                 echo "Error: No tracefs/debugf    
 30                 exit 1                            
 31         fi                                        
 32         TRACEFS=`grep -m 1 -w debugfs /proc/mo    
 33         if [ ! -d $TRACEFS ]; then                
 34                 echo "Error: ftrace is not ena    
 35                 exit 1                            
 36         fi                                        
 37 fi                                                
 38                                                   
 39 ######## main #########                           
 40                                                   
 41 set -e                                            
 42                                                   
 43 emit_kv() { # key =|+= value                      
 44         echo "$@"                                 
 45 }                                                 
 46                                                   
 47 global_options() {                                
 48         val=`cat $TRACEFS/max_graph_depth`        
 49         [ $val != 0 ] && emit_kv kernel.fgraph    
 50         if grep -qv "^#" $TRACEFS/set_graph_fu    
 51                 cat 1>&2 << EOF                   
 52 # WARN: kernel.fgraph_filters and kernel.fgrap    
 53 EOF                                               
 54         fi                                        
 55 }                                                 
 56                                                   
 57 kprobe_event_options() {                          
 58         cat $TRACEFS/kprobe_events | while rea    
 59                 case $p in                        
 60                 r*)                               
 61                 cat 1>&2 << EOF                   
 62 # WARN: A return probe found but it is not sup    
 63 EOF                                               
 64                 continue;;                        
 65                 esac                              
 66                 p=${p#*:}                         
 67                 event=${p#*/}                     
 68                 group=${p%/*}                     
 69                 if [ $group != "kprobes" ]; th    
 70                         cat 1>&2 << EOF           
 71 # WARN: kprobes group name $group is changed t    
 72 EOF                                               
 73                 fi                                
 74                 emit_kv $PREFIX.event.kprobes.    
 75         done                                      
 76 }                                                 
 77                                                   
 78 synth_event_options() {                           
 79         cat $TRACEFS/synthetic_events | while     
 80                 emit_kv $PREFIX.event.syntheti    
 81         done                                      
 82 }                                                 
 83                                                   
 84 # Variables resolver                              
 85 DEFINED_VARS=                                     
 86 UNRESOLVED_EVENTS=                                
 87                                                   
 88 defined_vars() { # event-dir                      
 89         grep "^hist" $1/trigger | grep -o ':[a    
 90 }                                                 
 91 referred_vars() {                                 
 92         grep "^hist" $1/trigger | grep -o '$[a    
 93 }                                                 
 94                                                   
 95 event_is_enabled() { # enable-file                
 96         test -f $1 && grep -q "1" $1              
 97 }                                                 
 98                                                   
 99 per_event_options() { # event-dir                 
100         evdir=$1                                  
101         # Check the special event which has no    
102         [ ! -f $evdir/filter ] && return          
103                                                   
104         if grep -q "^hist:" $evdir/trigger; th    
105                 # hist action can refer the un    
106                 __vars=`defined_vars $evdir`      
107                 for v in `referred_vars $evdir    
108                         if echo $DEFINED_VARS     
109                                 # $v is not de    
110                                 UNRESOLVED_EVE    
111                                 return;           
112                         fi                        
113                 done                              
114                 DEFINED_VARS="$DEFINED_VARS "`    
115         fi                                        
116         grep -v "^#" $evdir/trigger | while re    
117                 emit_kv $PREFIX.event.$group.$    
118         done                                      
119                                                   
120         if [ $GROUP_ENABLED -eq 0 ] && event_i    
121                 emit_kv $PREFIX.event.$group.$    
122         fi                                        
123         val=`cat $evdir/filter`                   
124         if [ "$val" != "none" ]; then             
125                 emit_kv $PREFIX.event.$group.$    
126         fi                                        
127 }                                                 
128                                                   
129 retry_unresolved() {                              
130         unresolved=$UNRESOLVED_EVENTS             
131         UNRESOLVED_EVENTS=                        
132         for evdir in $unresolved; do              
133                 event=${evdir##*/}                
134                 group=${evdir%/*}; group=${gro    
135                 per_event_options $evdir          
136         done                                      
137 }                                                 
138                                                   
139 event_options() {                                 
140         # PREFIX and INSTANCE must be set         
141         if [ $PREFIX = "ftrace" ]; then           
142                 # define the dynamic events       
143                 kprobe_event_options              
144                 synth_event_options               
145         fi                                        
146         ALL_ENABLED=0                             
147         if event_is_enabled $INSTANCE/events/e    
148                 emit_kv $PREFIX.event.enable      
149                 ALL_ENABLED=1                     
150         fi                                        
151         for group in `ls $INSTANCE/events/` ;     
152                 [ ! -d $INSTANCE/events/$group    
153                 GROUP_ENABLED=$ALL_ENABLED        
154                 if [ $ALL_ENABLED -eq 0 ] && \    
155                    event_is_enabled $INSTANCE/    
156                         emit_kv $PREFIX.event.    
157                         GROUP_ENABLED=1           
158                 fi                                
159                 for event in `ls $INSTANCE/eve    
160                         [ ! -d $INSTANCE/event    
161                         per_event_options $INS    
162                 done                              
163         done                                      
164         retry=0                                   
165         while [ $retry -lt 3 ]; do                
166                 retry_unresolved                  
167                 retry=$((retry + 1))              
168         done                                      
169         if [ "$UNRESOLVED_EVENTS" ]; then         
170                 cat 1>&2 << EOF                   
171 ! ERROR: hist triggers in $UNRESOLVED_EVENTS u    
172 EOF                                               
173         fi                                        
174 }                                                 
175                                                   
176 is_default_trace_option() { # option              
177 grep -qw $1 << EOF                                
178 print-parent                                      
179 nosym-offset                                      
180 nosym-addr                                        
181 noverbose                                         
182 noraw                                             
183 nohex                                             
184 nobin                                             
185 noblock                                           
186 trace_printk                                      
187 annotate                                          
188 nouserstacktrace                                  
189 nosym-userobj                                     
190 noprintk-msg-only                                 
191 context-info                                      
192 nolatency-format                                  
193 record-cmd                                        
194 norecord-tgid                                     
195 overwrite                                         
196 nodisable_on_free                                 
197 irq-info                                          
198 markers                                           
199 noevent-fork                                      
200 nopause-on-trace                                  
201 function-trace                                    
202 nofunction-fork                                   
203 nodisplay-graph                                   
204 nostacktrace                                      
205 notest_nop_accept                                 
206 notest_nop_refuse                                 
207 EOF                                               
208 }                                                 
209                                                   
210 instance_options() { # [instance-name]            
211         if [ $# -eq 0 ]; then                     
212                 PREFIX="ftrace"                   
213                 INSTANCE=$TRACEFS                 
214         else                                      
215                 PREFIX="ftrace.instance.$1"       
216                 INSTANCE=$TRACEFS/instances/$1    
217         fi                                        
218         val=                                      
219         for i in `cat $INSTANCE/trace_options`    
220                 is_default_trace_option $i &&     
221                 val="$val, $i"                    
222         done                                      
223         [ "$val" ] && emit_kv $PREFIX.options     
224         val="local"                               
225         for i in `cat $INSTANCE/trace_clock` ;    
226                 [ "${i#*]}" ] && continue         
227                 i=${i%]}; val=${i#[}              
228         done                                      
229         [ $val != "local" ] && emit_kv $PREFIX    
230         val=`cat $INSTANCE/buffer_size_kb`        
231         if echo $val | grep -vq "expanded" ; t    
232                 emit_kv $PREFIX.buffer_size =     
233         fi                                        
234         if grep -q "is allocated" $INSTANCE/sn    
235                 emit_kv $PREFIX.alloc_snapshot    
236         fi                                        
237         val=`cat $INSTANCE/tracing_cpumask`       
238         if [ `echo $val | sed -e s/f//g`x != x    
239                 emit_kv $PREFIX.cpumask = $val    
240         fi                                        
241         val=`cat $INSTANCE/tracing_on`            
242         if [ "$val" = "0" ]; then                 
243                 emit_kv $PREFIX.tracing_on = 0    
244         fi                                        
245                                                   
246         val=`cat $INSTANCE/current_tracer`        
247         [ $val != nop ] && emit_kv $PREFIX.tra    
248         if grep -qv "^#" $INSTANCE/set_ftrace_    
249                 cat 1>&2 << EOF                   
250 # WARN: kernel.ftrace.filters and kernel.ftrac    
251 EOF                                               
252         fi                                        
253         event_options                             
254 }                                                 
255                                                   
256 global_options                                    
257 instance_options                                  
258 for i in `ls $TRACEFS/instances` ; do             
259         instance_options $i                       
260 done                                              
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php