mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	tracing/boot: Add instance node support
Add instance node support to boot-time tracing. User can set some options and event nodes under instance node. - ftrace.instance.INSTANCE[...] Add new INSTANCE instance. Some options and event nodes are acceptable for instance node. Link: http://lkml.kernel.org/r/157867242413.17873.9814204526141500278.stgit@devnote2 Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
		
							parent
							
								
									3fbe2d6e1f
								
							
						
					
					
						commit
						4f712a4d04
					
				
					 1 changed files with 38 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -20,7 +20,7 @@ extern ssize_t tracing_resize_ring_buffer(struct trace_array *tr,
 | 
			
		|||
					  unsigned long size, int cpu_id);
 | 
			
		||||
 | 
			
		||||
static void __init
 | 
			
		||||
trace_boot_set_ftrace_options(struct trace_array *tr, struct xbc_node *node)
 | 
			
		||||
trace_boot_set_instance_options(struct trace_array *tr, struct xbc_node *node)
 | 
			
		||||
{
 | 
			
		||||
	struct xbc_node *anode;
 | 
			
		||||
	const char *p;
 | 
			
		||||
| 
						 | 
				
			
			@ -242,6 +242,40 @@ trace_boot_enable_tracer(struct trace_array *tr, struct xbc_node *node)
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void __init
 | 
			
		||||
trace_boot_init_one_instance(struct trace_array *tr, struct xbc_node *node)
 | 
			
		||||
{
 | 
			
		||||
	trace_boot_set_instance_options(tr, node);
 | 
			
		||||
	trace_boot_init_events(tr, node);
 | 
			
		||||
	trace_boot_enable_events(tr, node);
 | 
			
		||||
	trace_boot_enable_tracer(tr, node);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void __init
 | 
			
		||||
trace_boot_init_instances(struct xbc_node *node)
 | 
			
		||||
{
 | 
			
		||||
	struct xbc_node *inode;
 | 
			
		||||
	struct trace_array *tr;
 | 
			
		||||
	const char *p;
 | 
			
		||||
 | 
			
		||||
	node = xbc_node_find_child(node, "instance");
 | 
			
		||||
	if (!node)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	xbc_node_for_each_child(node, inode) {
 | 
			
		||||
		p = xbc_node_get_data(inode);
 | 
			
		||||
		if (!p || *p == '\0')
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		tr = trace_array_get_by_name(p);
 | 
			
		||||
		if (IS_ERR(tr)) {
 | 
			
		||||
			pr_err("Failed to get trace instance %s\n", p);
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		trace_boot_init_one_instance(tr, inode);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int __init trace_boot_init(void)
 | 
			
		||||
{
 | 
			
		||||
	struct xbc_node *trace_node;
 | 
			
		||||
| 
						 | 
				
			
			@ -255,10 +289,9 @@ static int __init trace_boot_init(void)
 | 
			
		|||
	if (!tr)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	trace_boot_set_ftrace_options(tr, trace_node);
 | 
			
		||||
	trace_boot_init_events(tr, trace_node);
 | 
			
		||||
	trace_boot_enable_events(tr, trace_node);
 | 
			
		||||
	trace_boot_enable_tracer(tr, trace_node);
 | 
			
		||||
	/* Global trace array is also one instance */
 | 
			
		||||
	trace_boot_init_one_instance(tr, trace_node);
 | 
			
		||||
	trace_boot_init_instances(trace_node);
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue