mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	tracing: Fix regression with irqsoff tracer and tracing_on file
Commit 02404baf1b "tracing: Remove deprecated tracing_enabled file"
removed the tracing_enabled file as it never worked properly and
the tracing_on file should be used instead. But the tracing_on file
didn't call into the tracers start/stop routines like the
tracing_enabled file did. This caused trace-cmd to break when it
enabled the irqsoff tracer.
If you just did "echo irqsoff > current_tracer" then it would work
properly. But the tool trace-cmd disables tracing first by writing
"0" into the tracing_on file. Then it writes "irqsoff" into
current_tracer and then writes "1" into tracing_on. Unfortunately,
the above commit changed the irqsoff tracer to check the tracing_on
status instead of the tracing_enabled status. If it's disabled then
it does not start the tracer internals.
The problem is that writing "1" into tracing_on does not call the
tracers "start" routine like writing "1" into tracing_enabled did.
This makes the irqsoff tracer not start when using the trace-cmd
tool, and is a regression for userspace.
Simple fix is to have the tracing_on file call the tracers start()
method when being enabled (and the stop() method when disabled).
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
			
			
This commit is contained in:
		
							parent
							
								
									a8dd2176a8
								
							
						
					
					
						commit
						2df8f8a6a8
					
				
					 1 changed files with 9 additions and 2 deletions
				
			
		| 
						 | 
					@ -4817,10 +4817,17 @@ rb_simple_write(struct file *filp, const char __user *ubuf,
 | 
				
			||||||
		return ret;
 | 
							return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (buffer) {
 | 
						if (buffer) {
 | 
				
			||||||
		if (val)
 | 
							mutex_lock(&trace_types_lock);
 | 
				
			||||||
 | 
							if (val) {
 | 
				
			||||||
			ring_buffer_record_on(buffer);
 | 
								ring_buffer_record_on(buffer);
 | 
				
			||||||
		else
 | 
								if (current_trace->start)
 | 
				
			||||||
 | 
									current_trace->start(tr);
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
			ring_buffer_record_off(buffer);
 | 
								ring_buffer_record_off(buffer);
 | 
				
			||||||
 | 
								if (current_trace->stop)
 | 
				
			||||||
 | 
									current_trace->stop(tr);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							mutex_unlock(&trace_types_lock);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	(*ppos)++;
 | 
						(*ppos)++;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue