Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1591578 > unrolled thread
| Started by | "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> |
|---|---|
| First post | 2017-03-03 01:40 +0100 |
| Last post | 2017-03-07 22:50 +0100 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v2 4/5] perf: kretprobes: offset from reloc_sym if kernel supports it "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-03-03 01:40 +0100
[PATCH v4 1/3] perf: probe: factor out the ftrace README scanning "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-03-03 01:40 +0100
Re: [PATCH v4 1/3] perf: probe: factor out the ftrace README scanning Masami Hiramatsu <mhiramat@kernel.org> - 2017-03-04 01:20 +0100
Re: [PATCH v4 1/3] perf: probe: factor out the ftrace README scanning Steven Rostedt <rostedt@goodmis.org> - 2017-03-07 22:50 +0100
| From | "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> |
|---|---|
| Date | 2017-03-03 01:40 +0100 |
| Subject | Re: [PATCH v2 4/5] perf: kretprobes: offset from reloc_sym if kernel supports it |
| Message-ID | <tgEJY-6SM-19@gated-at.bofh.it> |
On 2017/02/24 05:11PM, Arnaldo Carvalho de Melo wrote: > Em Sat, Feb 25, 2017 at 02:29:17AM +0900, Masami Hiramatsu escreveu: > > On Fri, 24 Feb 2017 00:46:08 +0530 > > "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote: > > > Thanks. I hope that's an Ack for this patchset? > > > > OK, for 1/5, 2/5, 3/5, and 5/5; > > > > Acked-by: Masami Hiramatsu <mhiramat@kernel.org> > > > > And could you make v4 series including all patches? (Not only updates) > > So, to make progress I processed these: > > [acme@jouet linux]$ git log --oneline -3 > eb55608340b7 perf probe: Generalize probe event file open routine > 859d718fac06 trace/kprobes: Allow return probes with offsets and absolute addresses > a10489121c81 kretprobes: Ensure probe location is at function entry > [acme@jouet linux]$ > > Waiting for Naveen to react to these last minute considerations from > Masami and for the Ack from the PPC guys about "[PATCH v2 2/5] powerpc: > kretprobes: override default function entry offset". Arnaldo, I am posting the remaining three patches in this series. These three patches are on top of the above 3 patches you have processed and the other powerpc kretprobes patch (v2 2/5). Masami, Kindly review and let me know if this is fine. Thanks, Naveen --- Naveen N. Rao (3): perf: probe: factor out the ftrace README scanning perf: kretprobes: offset from reloc_sym if kernel supports it perf: powerpc: choose local entry point with kretprobes tools/perf/arch/powerpc/util/sym-handling.c | 10 ++-- tools/perf/util/probe-event.c | 12 ++--- tools/perf/util/probe-file.c | 77 ++++++++++++++++------------- tools/perf/util/probe-file.h | 1 + 4 files changed, 56 insertions(+), 44 deletions(-) -- 2.11.1
[toc] | [next] | [standalone]
| From | "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> |
|---|---|
| Date | 2017-03-03 01:40 +0100 |
| Subject | [PATCH v4 1/3] perf: probe: factor out the ftrace README scanning |
| Message-ID | <tgJqh-1AZ-17@gated-at.bofh.it> |
| In reply to | #1591578 |
Simplify and separate out the ftrace README scanning logic into a
separate helper. This is used subsequently to scan for all patterns of
interest and to cache the result.
Since we are only interested in availability of probe argument type x,
we will only scan for that.
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
tools/perf/util/probe-file.c | 70 +++++++++++++++++++++++---------------------
1 file changed, 37 insertions(+), 33 deletions(-)
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index 1a62daceb028..8a219cd831b7 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -877,35 +877,31 @@ int probe_cache__show_all_caches(struct strfilter *filter)
return 0;
}
+enum ftrace_readme {
+ FTRACE_README_PROBE_TYPE_X = 0,
+ FTRACE_README_END,
+};
+
static struct {
const char *pattern;
- bool avail;
- bool checked;
-} probe_type_table[] = {
-#define DEFINE_TYPE(idx, pat, def_avail) \
- [idx] = {.pattern = pat, .avail = (def_avail)}
- DEFINE_TYPE(PROBE_TYPE_U, "* u8/16/32/64,*", true),
- DEFINE_TYPE(PROBE_TYPE_S, "* s8/16/32/64,*", true),
- DEFINE_TYPE(PROBE_TYPE_X, "* x8/16/32/64,*", false),
- DEFINE_TYPE(PROBE_TYPE_STRING, "* string,*", true),
- DEFINE_TYPE(PROBE_TYPE_BITFIELD,
- "* b<bit-width>@<bit-offset>/<container-size>", true),
+ bool avail;
+} ftrace_readme_table[] = {
+#define DEFINE_TYPE(idx, pat) \
+ [idx] = {.pattern = pat, .avail = false}
+ DEFINE_TYPE(FTRACE_README_PROBE_TYPE_X, "*type: * x8/16/32/64,*"),
};
-bool probe_type_is_available(enum probe_type type)
+static bool scan_ftrace_readme(enum ftrace_readme type)
{
+ int fd;
FILE *fp;
char *buf = NULL;
size_t len = 0;
- bool target_line = false;
- bool ret = probe_type_table[type].avail;
- int fd;
+ bool ret = false;
+ static bool scanned = false;
- if (type >= PROBE_TYPE_END)
- return false;
- /* We don't have to check the type which supported by default */
- if (ret || probe_type_table[type].checked)
- return ret;
+ if (scanned)
+ goto result;
fd = open_trace_file("README", false);
if (fd < 0)
@@ -917,21 +913,29 @@ bool probe_type_is_available(enum probe_type type)
return ret;
}
- while (getline(&buf, &len, fp) > 0 && !ret) {
- if (!target_line) {
- target_line = !!strstr(buf, " type: ");
- if (!target_line)
- continue;
- } else if (strstr(buf, "\t ") != buf)
- break;
- ret = strglobmatch(buf, probe_type_table[type].pattern);
- }
- /* Cache the result */
- probe_type_table[type].checked = true;
- probe_type_table[type].avail = ret;
+ while (getline(&buf, &len, fp) > 0)
+ for (enum ftrace_readme i = 0; i < FTRACE_README_END; i++)
+ if (!ftrace_readme_table[i].avail)
+ ftrace_readme_table[i].avail =
+ strglobmatch(buf, ftrace_readme_table[i].pattern);
+ scanned = true;
fclose(fp);
free(buf);
- return ret;
+result:
+ if (type >= FTRACE_README_END)
+ return false;
+
+ return ftrace_readme_table[type].avail;
+}
+
+bool probe_type_is_available(enum probe_type type)
+{
+ if (type >= PROBE_TYPE_END)
+ return false;
+ else if (type == PROBE_TYPE_X)
+ return scan_ftrace_readme(FTRACE_README_PROBE_TYPE_X);
+
+ return true;
}
--
2.11.1
[toc] | [prev] | [next] | [standalone]
| From | Masami Hiramatsu <mhiramat@kernel.org> |
|---|---|
| Date | 2017-03-04 01:20 +0100 |
| Subject | Re: [PATCH v4 1/3] perf: probe: factor out the ftrace README scanning |
| Message-ID | <th5At-t5-1@gated-at.bofh.it> |
| In reply to | #1591580 |
On Thu, 2 Mar 2017 23:25:05 +0530
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote:
> Simplify and separate out the ftrace README scanning logic into a
> separate helper. This is used subsequently to scan for all patterns of
> interest and to cache the result.
>
> Since we are only interested in availability of probe argument type x,
> we will only scan for that.
Ah, OK, this can simplify and shorten the actual scanning time.
If there are any needs for checking those in the future, we can
add it again at that moment.
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Thank you!
>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> ---
> tools/perf/util/probe-file.c | 70 +++++++++++++++++++++++---------------------
> 1 file changed, 37 insertions(+), 33 deletions(-)
>
> diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
> index 1a62daceb028..8a219cd831b7 100644
> --- a/tools/perf/util/probe-file.c
> +++ b/tools/perf/util/probe-file.c
> @@ -877,35 +877,31 @@ int probe_cache__show_all_caches(struct strfilter *filter)
> return 0;
> }
>
> +enum ftrace_readme {
> + FTRACE_README_PROBE_TYPE_X = 0,
> + FTRACE_README_END,
> +};
> +
> static struct {
> const char *pattern;
> - bool avail;
> - bool checked;
> -} probe_type_table[] = {
> -#define DEFINE_TYPE(idx, pat, def_avail) \
> - [idx] = {.pattern = pat, .avail = (def_avail)}
> - DEFINE_TYPE(PROBE_TYPE_U, "* u8/16/32/64,*", true),
> - DEFINE_TYPE(PROBE_TYPE_S, "* s8/16/32/64,*", true),
> - DEFINE_TYPE(PROBE_TYPE_X, "* x8/16/32/64,*", false),
> - DEFINE_TYPE(PROBE_TYPE_STRING, "* string,*", true),
> - DEFINE_TYPE(PROBE_TYPE_BITFIELD,
> - "* b<bit-width>@<bit-offset>/<container-size>", true),
> + bool avail;
> +} ftrace_readme_table[] = {
> +#define DEFINE_TYPE(idx, pat) \
> + [idx] = {.pattern = pat, .avail = false}
> + DEFINE_TYPE(FTRACE_README_PROBE_TYPE_X, "*type: * x8/16/32/64,*"),
> };
>
> -bool probe_type_is_available(enum probe_type type)
> +static bool scan_ftrace_readme(enum ftrace_readme type)
> {
> + int fd;
> FILE *fp;
> char *buf = NULL;
> size_t len = 0;
> - bool target_line = false;
> - bool ret = probe_type_table[type].avail;
> - int fd;
> + bool ret = false;
> + static bool scanned = false;
>
> - if (type >= PROBE_TYPE_END)
> - return false;
> - /* We don't have to check the type which supported by default */
> - if (ret || probe_type_table[type].checked)
> - return ret;
> + if (scanned)
> + goto result;
>
> fd = open_trace_file("README", false);
> if (fd < 0)
> @@ -917,21 +913,29 @@ bool probe_type_is_available(enum probe_type type)
> return ret;
> }
>
> - while (getline(&buf, &len, fp) > 0 && !ret) {
> - if (!target_line) {
> - target_line = !!strstr(buf, " type: ");
> - if (!target_line)
> - continue;
> - } else if (strstr(buf, "\t ") != buf)
> - break;
> - ret = strglobmatch(buf, probe_type_table[type].pattern);
> - }
> - /* Cache the result */
> - probe_type_table[type].checked = true;
> - probe_type_table[type].avail = ret;
> + while (getline(&buf, &len, fp) > 0)
> + for (enum ftrace_readme i = 0; i < FTRACE_README_END; i++)
> + if (!ftrace_readme_table[i].avail)
> + ftrace_readme_table[i].avail =
> + strglobmatch(buf, ftrace_readme_table[i].pattern);
> + scanned = true;
>
> fclose(fp);
> free(buf);
>
> - return ret;
> +result:
> + if (type >= FTRACE_README_END)
> + return false;
> +
> + return ftrace_readme_table[type].avail;
> +}
> +
> +bool probe_type_is_available(enum probe_type type)
> +{
> + if (type >= PROBE_TYPE_END)
> + return false;
> + else if (type == PROBE_TYPE_X)
> + return scan_ftrace_readme(FTRACE_README_PROBE_TYPE_X);
> +
> + return true;
> }
> --
> 2.11.1
>
--
Masami Hiramatsu <mhiramat@kernel.org>
[toc] | [prev] | [next] | [standalone]
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Date | 2017-03-07 22:50 +0100 |
| Subject | Re: [PATCH v4 1/3] perf: probe: factor out the ftrace README scanning |
| Message-ID | <tiv9v-5b2-9@gated-at.bofh.it> |
| In reply to | #1591580 |
FYI, When creating new patch series, please start a new thread, and don't post a patch as a reply to another patch. It gets easily lost that way. -- Steve On Thu, 2 Mar 2017 23:25:05 +0530 "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> wrote: > Simplify and separate out the ftrace README scanning logic into a > separate helper. This is used subsequently to scan for all patterns of > interest and to cache the result. > > Since we are only interested in availability of probe argument type x, > we will only scan for that. > > Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> > ---
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web