perf tools: Fixup exit path when not able to open events
We have to deal with the TUI mode in perf top, so that we don't end up with a garbled screen when, say, a non root user on a machine with a paranoid setting (the default) tries to use 'perf top'. Introduce a ui__warning_paranoid() routine shared by top and record that tells the user the valid values for /proc/sys/kernel/perf_event_paranoid. Cc: David Ahern <daahern@cisco.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
		
					parent
					
						
							
								1dfd7b494b
							
						
					
				
			
			
				commit
				
					
						c286c419c7
					
				
			
		
					 4 changed files with 39 additions and 19 deletions
				
			
		|  | @ -57,6 +57,16 @@ void ui__warning(const char *format, ...) | |||
| } | ||||
| #endif | ||||
| 
 | ||||
| void ui__warning_paranoid(void) | ||||
| { | ||||
| 	ui__warning("Permission error - are you root?\n" | ||||
| 		    "Consider tweaking /proc/sys/kernel/perf_event_paranoid:\n" | ||||
| 		    " -1 - Not paranoid at all\n" | ||||
| 		    "  0 - Disallow raw tracepoint access for unpriv\n" | ||||
| 		    "  1 - Disallow cpu events for unpriv\n" | ||||
| 		    "  2 - Disallow kernel profiling for unpriv\n"); | ||||
| } | ||||
| 
 | ||||
| void trace_event(union perf_event *event) | ||||
| { | ||||
| 	unsigned char *raw_event = (void *)event; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Arnaldo Carvalho de Melo
				Arnaldo Carvalho de Melo