Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp873339ybl; Fri, 10 Jan 2020 08:08:32 -0800 (PST) X-Google-Smtp-Source: APXvYqwnec5hqf7jvtlF/isVlRn+fWP3R+/KPgpG/WtdBkqSdJm5LP300wI8xWpVeflgmbsSlOp0 X-Received: by 2002:aca:c3c4:: with SMTP id t187mr2824644oif.89.1578672512747; Fri, 10 Jan 2020 08:08:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578672512; cv=none; d=google.com; s=arc-20160816; b=tCrdIvSH/BYBJ31eqTGuqmMXVvQKouflz/sXIIsXSy1S1CmmiPBZt6CISpZs1VmrHf LjNanI5bMheCbWqazOzFhx2Zhbw7DsqeBXQyJNzFzHk9LhMZAD1McGmQ+DIpTtlDc5D+ EVZqpXVem0vIQm4JNQP2IDsSPfVLXYI1ZYBrziMUqzSb7KPyZh3QuMyjfOxGZlQD6cQQ pU3x/4tgzT7tQp/+djjVdMleUJQumE6rVVOs8k2gKonK275gfz/BJChaybfUTaHj6WVz 28EsH0nlkv2+8uuy6EyfNOHJTBVU26m3gbh3MJNelpIbq4LE+PdxCqni9hE3uz1G8ic+ wYzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=psTrY/2caQ4CBVShdQQhSbUFoLLCGF1NjZ84FbAUejE=; b=g10RDDV5xstCgb+sTIZNiHjGOjFAAaY8n1pIMo4eAC86xpuZr2uGyPeMt2QfKYm34J wkZMtgfPyfdFN+BV6rZolPz0Lyi5VXC7IKXImYBkqonzR3EyTjk3LiJJlZT0755EFfw7 Tlgg0D6DDP5HQWgr19ht4ZnPGebhAjikn+iAe84+fKDkItGjNlp2MMBL7ktuKU1npL6R V7FazbCan5iZGzBlKpOwH8Vcq/wgMZdLnNMk3DAA9G2FJTCGxT2xVoo5D18yy/lx6UJY ZgkbXjLUrvxOWbs1lAj+xNz2bPO5V3DY1DkN9YNgjdrF2arFwOElx1XgWVVPPGYxzHgM y0Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F+3qSqu4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 185si1259591oie.52.2020.01.10.08.08.18; Fri, 10 Jan 2020 08:08:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F+3qSqu4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728743AbgAJQHM (ORCPT + 99 others); Fri, 10 Jan 2020 11:07:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:55580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728504AbgAJQHM (ORCPT ); Fri, 10 Jan 2020 11:07:12 -0500 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B9163206ED; Fri, 10 Jan 2020 16:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578672430; bh=qv6KJiPLfpAE7GH8cSS0edxuald5O/rXHA6Jkgf1bpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F+3qSqu4fztjGm1evsJu4Kk8q0yMzTw86fNuo82ycxBawcolZZlccHp0vnQ1p7K6g U5U0hRVI3egRl4jCFNUmx18ba2DxXBpG37TybLKb/P2FSXMMkvOqBscArcE6d2sXgl VHd7rKLS8bnEw55x1xQPeUxTgA37QeJdXQQYPk/U= From: Masami Hiramatsu To: Steven Rostedt Cc: Ingo Molnar , Frank Rowand , Randy Dunlap , Namhyung Kim , Tim Bird , Jiri Olsa , Arnaldo Carvalho de Melo , Tom Zanussi , Rob Herring , Andrew Morton , Thomas Gleixner , Greg Kroah-Hartman , Alexey Dobriyan , Jonathan Corbet , Linus Torvalds , linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 19/22] tracing/boot: Add instance node support Date: Sat, 11 Jan 2020 01:07:04 +0900 Message-Id: <157867242413.17873.9814204526141500278.stgit@devnote2> X-Mailer: git-send-email 2.20.1 In-Reply-To: <157867220019.17873.13377985653744804396.stgit@devnote2> References: <157867220019.17873.13377985653744804396.stgit@devnote2> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Masami Hiramatsu --- Changes in v4: - Use trace_array_get_by_name() instead of trace_array_create(). - Remove global boot option setting. --- kernel/trace/trace_boot.c | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c index 3054921b0877..f5db30d25b0b 100644 --- a/kernel/trace/trace_boot.c +++ b/kernel/trace/trace_boot.c @@ -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; }