mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Wang Nan <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: namhyung@kernel.org, mingo@kernel.org, lizefan@huawei.com,
	masami.hiramatsu.pt@hitachi.com, ast@kernel.org,
	linux-kernel@vger.kernel.org, wangnan0@huawei.com, hpa@zytor.com,
	acme@redhat.com, tglx@linutronix.de
Subject: [tip:perf/core] perf bpf: Rename bpf config to program config
Date: Sat, 28 Nov 2015 23:58:01 -0800	[thread overview]
Message-ID: <tip-0bb93490170477224f8bd4cc9ce8920517461643@git.kernel.org> (raw)
In-Reply-To: <1448614067-197576-4-git-send-email-wangnan0@huawei.com>

Commit-ID:  0bb93490170477224f8bd4cc9ce8920517461643
Gitweb:     http://git.kernel.org/tip/0bb93490170477224f8bd4cc9ce8920517461643
Author:     Wang Nan <wangnan0@huawei.com>
AuthorDate: Fri, 27 Nov 2015 08:47:37 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 27 Nov 2015 22:00:46 -0300

perf bpf: Rename bpf config to program config

Following patches are going to introduce BPF object level configuration
to enable setting values into BPF maps. To avoid confusion, this patch
renames existing 'config' in bpf-loader.c to 'program config'. Following
patches would introduce 'object config'.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1448614067-197576-4-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/bpf-loader.c | 65 ++++++++++++++++++++++----------------------
 tools/perf/util/bpf-loader.h |  2 +-
 2 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index 36544e5..540a7ef 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -120,7 +120,7 @@ bpf_prog_priv__clear(struct bpf_program *prog __maybe_unused,
 }
 
 static int
-config__exec(const char *value, struct perf_probe_event *pev)
+prog_config__exec(const char *value, struct perf_probe_event *pev)
 {
 	pev->uprobes = true;
 	pev->target = strdup(value);
@@ -130,7 +130,7 @@ config__exec(const char *value, struct perf_probe_event *pev)
 }
 
 static int
-config__module(const char *value, struct perf_probe_event *pev)
+prog_config__module(const char *value, struct perf_probe_event *pev)
 {
 	pev->uprobes = false;
 	pev->target = strdup(value);
@@ -140,8 +140,7 @@ config__module(const char *value, struct perf_probe_event *pev)
 }
 
 static int
-config__bool(const char *value,
-	     bool *pbool, bool invert)
+prog_config__bool(const char *value, bool *pbool, bool invert)
 {
 	int err;
 	bool bool_value;
@@ -158,17 +157,17 @@ config__bool(const char *value,
 }
 
 static int
-config__inlines(const char *value,
-		struct perf_probe_event *pev __maybe_unused)
+prog_config__inlines(const char *value,
+		     struct perf_probe_event *pev __maybe_unused)
 {
-	return config__bool(value, &probe_conf.no_inlines, true);
+	return prog_config__bool(value, &probe_conf.no_inlines, true);
 }
 
 static int
-config__force(const char *value,
-	      struct perf_probe_event *pev __maybe_unused)
+prog_config__force(const char *value,
+		   struct perf_probe_event *pev __maybe_unused)
 {
-	return config__bool(value, &probe_conf.force_add, false);
+	return prog_config__bool(value, &probe_conf.force_add, false);
 }
 
 static struct {
@@ -176,58 +175,58 @@ static struct {
 	const char *usage;
 	const char *desc;
 	int (*func)(const char *, struct perf_probe_event *);
-} bpf_config_terms[] = {
+} bpf_prog_config_terms[] = {
 	{
 		.key	= "exec",
 		.usage	= "exec=<full path of file>",
 		.desc	= "Set uprobe target",
-		.func	= config__exec,
+		.func	= prog_config__exec,
 	},
 	{
 		.key	= "module",
 		.usage	= "module=<module name>    ",
 		.desc	= "Set kprobe module",
-		.func	= config__module,
+		.func	= prog_config__module,
 	},
 	{
 		.key	= "inlines",
 		.usage	= "inlines=[yes|no]        ",
 		.desc	= "Probe at inline symbol",
-		.func	= config__inlines,
+		.func	= prog_config__inlines,
 	},
 	{
 		.key	= "force",
 		.usage	= "force=[yes|no]          ",
 		.desc	= "Forcibly add events with existing name",
-		.func	= config__force,
+		.func	= prog_config__force,
 	},
 };
 
 static int
-do_config(const char *key, const char *value,
-	  struct perf_probe_event *pev)
+do_prog_config(const char *key, const char *value,
+	       struct perf_probe_event *pev)
 {
 	unsigned int i;
 
 	pr_debug("config bpf program: %s=%s\n", key, value);
-	for (i = 0; i < ARRAY_SIZE(bpf_config_terms); i++)
-		if (strcmp(key, bpf_config_terms[i].key) == 0)
-			return bpf_config_terms[i].func(value, pev);
+	for (i = 0; i < ARRAY_SIZE(bpf_prog_config_terms); i++)
+		if (strcmp(key, bpf_prog_config_terms[i].key) == 0)
+			return bpf_prog_config_terms[i].func(value, pev);
 
-	pr_debug("BPF: ERROR: invalid config option in object: %s=%s\n",
+	pr_debug("BPF: ERROR: invalid program config option: %s=%s\n",
 		 key, value);
 
-	pr_debug("\nHint: Currently valid options are:\n");
-	for (i = 0; i < ARRAY_SIZE(bpf_config_terms); i++)
-		pr_debug("\t%s:\t%s\n", bpf_config_terms[i].usage,
-			 bpf_config_terms[i].desc);
+	pr_debug("\nHint: Valid options are:\n");
+	for (i = 0; i < ARRAY_SIZE(bpf_prog_config_terms); i++)
+		pr_debug("\t%s:\t%s\n", bpf_prog_config_terms[i].usage,
+			 bpf_prog_config_terms[i].desc);
 	pr_debug("\n");
 
-	return -BPF_LOADER_ERRNO__CONFIG_TERM;
+	return -BPF_LOADER_ERRNO__PROGCONF_TERM;
 }
 
 static const char *
-parse_config_kvpair(const char *config_str, struct perf_probe_event *pev)
+parse_prog_config_kvpair(const char *config_str, struct perf_probe_event *pev)
 {
 	char *text = strdup(config_str);
 	char *sep, *line;
@@ -253,7 +252,7 @@ parse_config_kvpair(const char *config_str, struct perf_probe_event *pev)
 		}
 		*equ = '\0';
 
-		err = do_config(line, equ + 1, pev);
+		err = do_prog_config(line, equ + 1, pev);
 		if (err)
 			break;
 nextline:
@@ -268,10 +267,10 @@ nextline:
 }
 
 static int
-parse_config(const char *config_str, struct perf_probe_event *pev)
+parse_prog_config(const char *config_str, struct perf_probe_event *pev)
 {
 	int err;
-	const char *main_str = parse_config_kvpair(config_str, pev);
+	const char *main_str = parse_prog_config_kvpair(config_str, pev);
 
 	if (IS_ERR(main_str))
 		return PTR_ERR(main_str);
@@ -312,7 +311,7 @@ config_bpf_program(struct bpf_program *prog)
 	pev = &priv->pev;
 
 	pr_debug("bpf: config program '%s'\n", config_str);
-	err = parse_config(config_str, pev);
+	err = parse_prog_config(config_str, pev);
 	if (err)
 		goto errout;
 
@@ -750,7 +749,7 @@ static const char *bpf_loader_strerror_table[NR_ERRNO] = {
 	[ERRCODE_OFFSET(EVENTNAME)]	= "No event name found in config string",
 	[ERRCODE_OFFSET(INTERNAL)]	= "BPF loader internal error",
 	[ERRCODE_OFFSET(COMPILE)]	= "Error when compiling BPF scriptlet",
-	[ERRCODE_OFFSET(CONFIG_TERM)]	= "Invalid config term in config string",
+	[ERRCODE_OFFSET(PROGCONF_TERM)]	= "Invalid program config term in config string",
 	[ERRCODE_OFFSET(PROLOGUE)]	= "Failed to generate prologue",
 	[ERRCODE_OFFSET(PROLOGUE2BIG)]	= "Prologue too big for program",
 	[ERRCODE_OFFSET(PROLOGUEOOB)]	= "Offset out of bound for prologue",
@@ -834,7 +833,7 @@ int bpf__strerror_probe(struct bpf_object *obj __maybe_unused,
 			int err, char *buf, size_t size)
 {
 	bpf__strerror_head(err, buf, size);
-	case BPF_LOADER_ERRNO__CONFIG_TERM: {
+	case BPF_LOADER_ERRNO__PROGCONF_TERM: {
 		scnprintf(buf, size, "%s (add -v to see detail)", emsg);
 		break;
 	}
diff --git a/tools/perf/util/bpf-loader.h b/tools/perf/util/bpf-loader.h
index a58740b..6fdc045 100644
--- a/tools/perf/util/bpf-loader.h
+++ b/tools/perf/util/bpf-loader.h
@@ -20,7 +20,7 @@ enum bpf_loader_errno {
 	BPF_LOADER_ERRNO__EVENTNAME,	/* Event name is missing */
 	BPF_LOADER_ERRNO__INTERNAL,	/* BPF loader internal error */
 	BPF_LOADER_ERRNO__COMPILE,	/* Error when compiling BPF scriptlet */
-	BPF_LOADER_ERRNO__CONFIG_TERM,	/* Invalid config term in config term */
+	BPF_LOADER_ERRNO__PROGCONF_TERM,/* Invalid program config term in config string */
 	BPF_LOADER_ERRNO__PROLOGUE,	/* Failed to generate prologue */
 	BPF_LOADER_ERRNO__PROLOGUE2BIG,	/* Prologue too big for program */
 	BPF_LOADER_ERRNO__PROLOGUEOOB,	/* Offset out of bound for prologue */

  reply	other threads:[~2015-11-29  7:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27  8:47 [PATCH v2 00/13] perf tools: BPF related update Wang Nan
2015-11-27  8:47 ` [PATCH v2 01/13] bpf tools: Collect map definition in bpf_object Wang Nan
2015-11-29  7:57   ` [tip:perf/core] tools lib bpf: " tip-bot for Wang Nan
2015-11-27  8:47 ` [PATCH v2 02/13] bpf tools: Extract and collect map names from BPF object file Wang Nan
2015-11-29  7:57   ` [tip:perf/core] tools lib bpf: " tip-bot for Wang Nan
2015-11-29 16:14   ` [PATCH v2 02/13] bpf tools: " Namhyung Kim
2015-11-30  5:00     ` Wangnan (F)
2015-11-30  8:51       ` Namhyung Kim
2015-11-30  9:27         ` Wangnan (F)
2015-11-30  9:43           ` Namhyung Kim
2015-11-30  9:48             ` Wangnan (F)
2015-11-30 10:39             ` [PATCH] tools lib bpf: Fetch map names from correct strtab Wang Nan
2015-11-30 11:19               ` Namhyung Kim
2015-11-27  8:47 ` [PATCH v2 03/13] perf tools: Rename bpf config to program config Wang Nan
2015-11-29  7:58   ` tip-bot for Wang Nan [this message]
2015-11-27  8:47 ` [PATCH v2 04/13] perf tools: Add API to config maps in bpf object Wang Nan
2015-11-28  1:10   ` RFC " Arnaldo Carvalho de Melo
2015-11-28  1:20     ` Wangnan (F)
2015-11-28  1:21       ` Wangnan (F)
2015-11-29 16:21     ` Namhyung Kim
2015-11-27  8:47 ` [PATCH v2 05/13] perf tools: Enable BPF object configure syntax Wang Nan
2015-11-27  8:47 ` [PATCH v2 06/13] perf record: Apply config to BPF objects before recording Wang Nan
2015-11-27  8:47 ` [PATCH v2 07/13] perf tools: Support perf event alias name Wang Nan
2015-11-27  8:47 ` [PATCH v2 08/13] perf tools: Enable passing event to BPF object Wang Nan
2015-11-27  8:47 ` [PATCH v2 09/13] perf tools: Support setting different slots in a BPF map separately Wang Nan
2015-11-27  8:47 ` [PATCH v2 10/13] perf tools: Enable indices setting syntax for BPF maps Wang Nan
2015-11-27  8:47 ` [PATCH v2 11/13] perf tools: Introduce bpf-output event Wang Nan
2015-11-27  8:47 ` [PATCH v2 12/13] perf data: Add u32_hex data type Wang Nan
2015-11-27  8:47 ` [PATCH v2 13/13] perf data: Support converting data from bpf_perf_event_output() Wang Nan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-0bb93490170477224f8bd4cc9ce8920517461643@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=ast@kernel.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome