linux.kernel - 26 new messages in 10 topics - digest
linux.kernel
http://groups.google.com/group/linux.kernel?hl=en
linux.kernel@googlegroups.com
Today's topics:
* perf callchain: Spare double comparison of callchain first entry - 2
messages, 1 author
http://groups.google.com/group/linux.kernel/t/fbde0854e39b253b?hl=en
* tools lib traceevent: Add pevent_unregister_event_handler() - 10 messages, 1
author
http://groups.google.com/group/linux.kernel/t/2f7ee8acf818546b?hl=en
* target/iblock: Add blk_integrity + BIP passthrough support - 3 messages, 1
author
http://groups.google.com/group/linux.kernel/t/109d6f35263ac9b4?hl=en
* Adding hyperv.h to uapi headers - 3 messages, 2 authors
http://groups.google.com/group/linux.kernel/t/9109a55de9e0039d?hl=en
* perf probe: Release allocated probe_trace_event if failed - 3 messages, 1
author
http://groups.google.com/group/linux.kernel/t/d6b43d2b9d80482d?hl=en
* x86, mpx: hook #BR exception handler to allocate bound tables - 1 messages,
1 author
http://groups.google.com/group/linux.kernel/t/f580cf37a477f810?hl=en
* turbostat, servers do not support uncore power register - 1 messages, 1
author
http://groups.google.com/group/linux.kernel/t/672fc57bc1242bc6?hl=en
* random32: add prandom_u32_max and convert open coded users - 1 messages, 1
author
http://groups.google.com/group/linux.kernel/t/f9445d8d04de145d?hl=en
* project!! - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/03d0d457cd832152?hl=en
* Implement new PTRACE_EVENT_SYSCALL_{ENTER,EXIT} - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/b5d27cb9eafa4d04?hl=en
==============================================================================
TOPIC: perf callchain: Spare double comparison of callchain first entry
http://groups.google.com/group/linux.kernel/t/fbde0854e39b253b?hl=en
==============================================================================
== 1 of 2 ==
Date: Sun, Jan 19 2014 4:30 am
From: tip-bot for Frederic Weisbecker
Commit-ID: b965bb41061ad8d3eafda6e7feef89279fcd3916
Gitweb: http://git.kernel.org/tip/b965bb41061ad8d3eafda6e7feef89279fcd3916
Author: Frederic Weisbecker <fweisbec@gmail.com>
AuthorDate: Tue, 14 Jan 2014 16:37:15 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 17 Jan 2014 11:11:01 -0300
perf callchain: Spare double comparison of callchain first entry
When a new callchain child branch matches an existing one in the rbtree,
the comparison of its first entry is performed twice:
1) From append_chain_children() on branch lookup
2) If 1) reports a match, append_chain() then compares all entries of
the new branch against the matching node in the rbtree, and this
comparison includes the first entry of the new branch again.
Lets shortcut this by performing the whole comparison only from
append_chain() which then returns the result of the comparison between
the first entry of the new branch and the iterating node in the rbtree.
If the first entry matches, the lookup on the current level of siblings
stops and propagates to the children of the matching nodes.
This results in less comparisons performed by the CPU.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1389713836-13375-3-git-send-email-fweisbec@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/callchain.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 9eb4f57..662867d 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -15,6 +15,8 @@
#include <errno.h>
#include <math.h>
+#include "asm/bug.h"
+
#include "hist.h"
#include "util.h"
#include "sort.h"
@@ -358,19 +360,14 @@ append_chain_children(struct callchain_node *root,
/* lookup in childrens */
while (*p) {
s64 ret;
- struct callchain_list *cnode;
parent = *p;
rnode = rb_entry(parent, struct callchain_node, rb_node_in);
- cnode = list_first_entry(&rnode->val, struct callchain_list,
- list);
- /* just check first entry */
- ret = match_chain(node, cnode);
- if (ret == 0) {
- append_chain(rnode, cursor, period);
+ /* If at least first entry matches, rely to children */
+ ret = append_chain(rnode, cursor, period);
+ if (ret == 0)
goto inc_children_hit;
- }
if (ret < 0)
p = &parent->rb_left;
@@ -396,6 +393,7 @@ append_chain(struct callchain_node *root,
u64 start = cursor->pos;
bool found = false;
u64 matches;
+ int cmp = 0;
/*
* Lookup in the current node
@@ -410,7 +408,8 @@ append_chain(struct callchain_node *root,
if (!node)
break;
- if (match_chain(node, cnode) != 0)
+ cmp = match_chain(node, cnode);
+ if (cmp)
break;
found = true;
@@ -420,9 +419,10 @@ append_chain(struct callchain_node *root,
/* matches not, relay no the parent */
if (!found) {
+ WARN_ONCE(!cmp, "Chain comparison error\n");
cursor->curr = curr_snap;
cursor->pos = start;
- return -1;
+ return cmp;
}
matches = cursor->pos - start;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
== 2 of 2 ==
Date: Sun, Jan 19 2014 4:30 am
From: tip-bot for Frederic Weisbecker
Commit-ID: 2a29190c040c0b11e39197c67abf6f87e0a61f9a
Gitweb: http://git.kernel.org/tip/2a29190c040c0b11e39197c67abf6f87e0a61f9a
Author: Frederic Weisbecker <fweisbec@gmail.com>
AuthorDate: Tue, 14 Jan 2014 16:37:16 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 17 Jan 2014 11:25:24 -0300
perf tools: Remove unnecessary callchain cursor state restore on unmatch
If a new callchain branch doesn't match a single entry of the node that
it is given against comparison in append_chain(), then the cursor is
expected to be at the same position as it was before the comparison
loop.
As such, there is no need to restore the cursor position on exit in case
of non matching branches.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1389713836-13375-4-git-send-email-fweisbec@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/callchain.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 662867d..8d9db45 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -388,7 +388,6 @@ append_chain(struct callchain_node *root,
struct callchain_cursor *cursor,
u64 period)
{
- struct callchain_cursor_node *curr_snap = cursor->curr;
struct callchain_list *cnode;
u64 start = cursor->pos;
bool found = false;
@@ -420,8 +419,6 @@ append_chain(struct callchain_node *root,
/* matches not, relay no the parent */
if (!found) {
WARN_ONCE(!cmp, "Chain comparison error\n");
- cursor->curr = curr_snap;
- cursor->pos = start;
return cmp;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
==============================================================================
TOPIC: tools lib traceevent: Add pevent_unregister_event_handler()
http://groups.google.com/group/linux.kernel/t/2f7ee8acf818546b?hl=en
==============================================================================
== 1 of 10 ==
Date: Sun, Jan 19 2014 4:30 am
From: tip-bot for Namhyung Kim
Commit-ID: ad13701d4905e820f32ce3c2590e19ca65765d63
Gitweb: http://git.kernel.org/tip/ad13701d4905e820f32ce3c2590e19ca65765d63
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 16 Jan 2014 11:31:07 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 16 Jan 2014 16:26:24 -0300
tools lib traceevent: Add pevent_unregister_event_handler()
When a plugin is unloaded it needs to unregister its handler from pevent.
So add an unregister function to do it.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1389839478-5887-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/event-parse.c | 113 ++++++++++++++++++++++++++++++++-----
tools/lib/traceevent/event-parse.h | 3 +
2 files changed, 102 insertions(+), 14 deletions(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 2ce565a..d1973cb 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -5560,6 +5560,29 @@ int pevent_register_print_function(struct pevent *pevent,
return ret;
}
+static struct event_format *pevent_search_event(struct pevent *pevent, int id,
+ const char *sys_name,
+ const char *event_name)
+{
+ struct event_format *event;
+
+ if (id >= 0) {
+ /* search by id */
+ event = pevent_find_event(pevent, id);
+ if (!event)
+ return NULL;
+ if (event_name && (strcmp(event_name, event->name) != 0))
+ return NULL;
+ if (sys_name && (strcmp(sys_name, event->system) != 0))
+ return NULL;
+ } else {
+ event = pevent_find_event_by_name(pevent, sys_name, event_name);
+ if (!event)
+ return NULL;
+ }
+ return event;
+}
+
/**
* pevent_register_event_handler - register a way to parse an event
* @pevent: the handle to the pevent
@@ -5584,20 +5607,9 @@ int pevent_register_event_handler(struct pevent *pevent, int id,
struct event_format *event;
struct event_handler *handle;
- if (id >= 0) {
- /* search by id */
- event = pevent_find_event(pevent, id);
- if (!event)
- goto not_found;
- if (event_name && (strcmp(event_name, event->name) != 0))
- goto not_found;
- if (sys_name && (strcmp(sys_name, event->system) != 0))
- goto not_found;
- } else {
- event = pevent_find_event_by_name(pevent, sys_name, event_name);
- if (!event)
- goto not_found;
- }
+ event = pevent_search_event(pevent, id, sys_name, event_name);
+ if (event == NULL)
+ goto not_found;
pr_stat("overriding event (%d) %s:%s with new print handler",
event->id, event->system, event->name);
@@ -5637,6 +5649,79 @@ int pevent_register_event_handler(struct pevent *pevent, int id,
return -1;
}
+static int handle_matches(struct event_handler *handler, int id,
+ const char *sys_name, const char *event_name,
+ pevent_event_handler_func func, void *context)
+{
+ if (id >= 0 && id != handler->id)
+ return 0;
+
+ if (event_name && (strcmp(event_name, handler->event_name) != 0))
+ return 0;
+
+ if (sys_name && (strcmp(sys_name, handler->sys_name) != 0))
+ return 0;
+
+ if (func != handler->func || context != handler->context)
+ return 0;
+
+ return 1;
+}
+
+/**
+ * pevent_unregister_event_handler - unregister an existing event handler
+ * @pevent: the handle to the pevent
+ * @id: the id of the event to unregister
+ * @sys_name: the system name the handler belongs to
+ * @event_name: the name of the event handler
+ * @func: the function to call to parse the event information
+ * @context: the data to be passed to @func
+ *
+ * This function removes existing event handler (parser).
+ *
+ * If @id is >= 0, then it is used to find the event.
+ * else @sys_name and @event_name are used.
+ *
+ * Returns 0 if handler was removed successfully, -1 if event was not found.
+ */
+int pevent_unregister_event_handler(struct pevent *pevent, int id,
+ const char *sys_name, const char *event_name,
+ pevent_event_handler_func func, void *context)
+{
+ struct event_format *event;
+ struct event_handler *handle;
+ struct event_handler **next;
+
+ event = pevent_search_event(pevent, id, sys_name, event_name);
+ if (event == NULL)
+ goto not_found;
+
+ if (event->handler == func && event->context == context) {
+ pr_stat("removing override handler for event (%d) %s:%s. Going back to default handler.",
+ event->id, event->system, event->name);
+
+ event->handler = NULL;
+ event->context = NULL;
+ return 0;
+ }
+
+not_found:
+ for (next = &pevent->handlers; *next; next = &(*next)->next) {
+ handle = *next;
+ if (handle_matches(handle, id, sys_name, event_name,
+ func, context))
+ break;
+ }
+
+ if (!(*next))
+ return -1;
+
+ *next = handle->next;
+ free_handler(handle);
+
+ return 0;
+}
+
/**
* pevent_alloc - create a pevent handle
*/
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index a3beca5..c48acfb 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -624,6 +624,9 @@ int pevent_print_func_field(struct trace_seq *s, const char *fmt,
int pevent_register_event_handler(struct pevent *pevent, int id,
const char *sys_name, const char *event_name,
pevent_event_handler_func func, void *context);
+int pevent_unregister_event_handler(struct pevent *pevent, int id,
+ const char *sys_name, const char *event_name,
+ pevent_event_handler_func func, void *context);
int pevent_register_print_function(struct pevent *pevent,
pevent_func_handler func,
enum pevent_func_arg_type ret_type,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
== 2 of 10 ==
Date: Sun, Jan 19 2014 4:30 am
From: tip-bot for Namhyung Kim
Commit-ID: 02bafd377c1137d0705f224881cd21de123204f0
Gitweb: http://git.kernel.org/tip/02bafd377c1137d0705f224881cd21de123204f0
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 16 Jan 2014 11:31:13 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 16 Jan 2014 16:26:25 -0300
tools lib traceevent: Unregister handler when sched_switch plugin is unloaded
The event handlers should be unregistered when the plugin is unloaded
otherwise they'll try to access invalid memory.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1389839478-5887-8-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/plugin_sched_switch.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tools/lib/traceevent/plugin_sched_switch.c b/tools/lib/traceevent/plugin_sched_switch.c
index fea3724..f1ce600 100644
--- a/tools/lib/traceevent/plugin_sched_switch.c
+++ b/tools/lib/traceevent/plugin_sched_switch.c
@@ -146,3 +146,15 @@ int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
sched_wakeup_handler, NULL);
return 0;
}
+
+void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
+{
+ pevent_unregister_event_handler(pevent, -1, "sched", "sched_switch",
+ sched_switch_handler, NULL);
+
+ pevent_unregister_event_handler(pevent, -1, "sched", "sched_wakeup",
+ sched_wakeup_handler, NULL);
+
+ pevent_unregister_event_handler(pevent, -1, "sched", "sched_wakeup_new",
+ sched_wakeup_handler, NULL);
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
== 3 of 10 ==
Date: Sun, Jan 19 2014 4:30 am
From: tip-bot for Namhyung Kim
Commit-ID: 6024cf3898d25088b01025d72a6929839de9c7b6
Gitweb: http://git.kernel.org/tip/6024cf3898d25088b01025d72a6929839de9c7b6
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 16 Jan 2014 11:31:15 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 16 Jan 2014 16:26:25 -0300
tools lib traceevent: Unregister handler when cfg80211 plugin is unloaded
The function handler should be unregistered when the plugin is unloaded
otherwise it'll try to access invalid memory.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1389839478-5887-10-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/plugin_cfg80211.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/lib/traceevent/plugin_cfg80211.c b/tools/lib/traceevent/plugin_cfg80211.c
index 57e9822..c066b25 100644
--- a/tools/lib/traceevent/plugin_cfg80211.c
+++ b/tools/lib/traceevent/plugin_cfg80211.c
@@ -22,3 +22,9 @@ int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
PEVENT_FUNC_ARG_VOID);
return 0;
}
+
+void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
+{
+ pevent_unregister_print_function(pevent, process___le16_to_cpup,
+ "__le16_to_cpup");
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
== 4 of 10 ==
Date: Sun, Jan 19 2014 4:30 am
From: tip-bot for Namhyung Kim
Commit-ID: 11e99c55414ebade1031a0ed3b49915824c7c3ea
Gitweb: http://git.kernel.org/tip/11e99c55414ebade1031a0ed3b49915824c7c3ea
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 16 Jan 2014 11:31:11 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 16 Jan 2014 16:26:24 -0300
tools lib traceevent: Unregister handler when kmem plugin is unloaded
The kmem handlers should be unregistered when the plugin is unloaded
otherwise they'll try to access invalid memory.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1389839478-5887-6-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/plugin_kmem.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/tools/lib/traceevent/plugin_kmem.c b/tools/lib/traceevent/plugin_kmem.c
index 7115c80..70650ff 100644
--- a/tools/lib/traceevent/plugin_kmem.c
+++ b/tools/lib/traceevent/plugin_kmem.c
@@ -70,3 +70,25 @@ int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
call_site_handler, NULL);
return 0;
}
+
+void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
+{
+ pevent_unregister_event_handler(pevent, -1, "kmem", "kfree",
+ call_site_handler, NULL);
+
+ pevent_unregister_event_handler(pevent, -1, "kmem", "kmalloc",
+ call_site_handler, NULL);
+
+ pevent_unregister_event_handler(pevent, -1, "kmem", "kmalloc_node",
+ call_site_handler, NULL);
+
+ pevent_unregister_event_handler(pevent, -1, "kmem", "kmem_cache_alloc",
+ call_site_handler, NULL);
+
+ pevent_unregister_event_handler(pevent, -1, "kmem",
+ "kmem_cache_alloc_node",
+ call_site_handler, NULL);
+
+ pevent_unregister_event_handler(pevent, -1, "kmem", "kmem_cache_free",
+ call_site_handler, NULL);
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
== 5 of 10 ==
Date: Sun, Jan 19 2014 4:30 am
From: tip-bot for Namhyung Kim
Commit-ID: ec7c6debdd446ad2262f236d13964efae90ba0f7
Gitweb: http://git.kernel.org/tip/ec7c6debdd446ad2262f236d13964efae90ba0f7
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 16 Jan 2014 11:31:14 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 16 Jan 2014 16:26:25 -0300
tools lib traceevent: Unregister handler when mac80211 plugin is unloaded
The event handler should be unregistered when the plugin is unloaded
otherwise it'll try to access invalid memory.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1389839478-5887-9-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/plugin_mac80211.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/lib/traceevent/plugin_mac80211.c b/tools/lib/traceevent/plugin_mac80211.c
index 558a3b9..7e15a0f 100644
--- a/tools/lib/traceevent/plugin_mac80211.c
+++ b/tools/lib/traceevent/plugin_mac80211.c
@@ -93,3 +93,10 @@ int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
drv_bss_info_changed, NULL);
return 0;
}
+
+void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
+{
+ pevent_unregister_event_handler(pevent, -1, "mac80211",
+ "drv_bss_info_changed",
+ drv_bss_info_changed, NULL);
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
== 6 of 10 ==
Date: Sun, Jan 19 2014 4:30 am
From: tip-bot for Namhyung Kim
Commit-ID: bf6b3a95ff439b1dcd6151b3f38810f3cec1e319
Gitweb: http://git.kernel.org/tip/bf6b3a95ff439b1dcd6151b3f38810f3cec1e319
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 16 Jan 2014 11:31:18 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 16 Jan 2014 16:26:25 -0300
tools lib traceevent: Unregister handler when xen plugin is unloaded
The function handler should be unregistered when the plugin is unloaded
otherwise it'll try to access invalid memory.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1389839478-5887-13-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/plugin_xen.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/lib/traceevent/plugin_xen.c b/tools/lib/traceevent/plugin_xen.c
index e779429..3a413ea 100644
--- a/tools/lib/traceevent/plugin_xen.c
+++ b/tools/lib/traceevent/plugin_xen.c
@@ -128,3 +128,9 @@ int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
PEVENT_FUNC_ARG_VOID);
return 0;
}
+
+void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
+{
+ pevent_unregister_print_function(pevent, process_xen_hypercall_name,
+ "xen_hypercall_name");
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
== 7 of 10 ==
Date: Sun, Jan 19 2014 4:30 am
From: tip-bot for Namhyung Kim
Commit-ID: 4061edaa54744dca833051119e763f073dd3c334
Gitweb: http://git.kernel.org/tip/4061edaa54744dca833051119e763f073dd3c334
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 16 Jan 2014 11:31:10 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 16 Jan 2014 16:26:24 -0300
tools lib traceevent: Unregister handler when hrtimer plugin is unloaded
The timer handlers should be unregistered when the plugin is unloaded
otherwise they'll try to access invalid memory.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1389839478-5887-5-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/plugin_hrtimer.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/lib/traceevent/plugin_hrtimer.c b/tools/lib/traceevent/plugin_hrtimer.c
index 0b0ebf3..12bf14c 100644
--- a/tools/lib/traceevent/plugin_hrtimer.c
+++ b/tools/lib/traceevent/plugin_hrtimer.c
@@ -76,3 +76,13 @@ int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
timer_start_handler, NULL);
return 0;
}
+
+void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
+{
+ pevent_unregister_event_handler(pevent, -1,
+ "timer", "hrtimer_expire_entry",
+ timer_expire_handler, NULL);
+
+ pevent_unregister_event_handler(pevent, -1, "timer", "hrtimer_start",
+ timer_start_handler, NULL);
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
== 8 of 10 ==
Date: Sun, Jan 19 2014 4:30 am
From: tip-bot for Namhyung Kim
Commit-ID: 354a2bd0318e0758f93b8b24553f3376fa9dfa21
Gitweb: http://git.kernel.org/tip/354a2bd0318e0758f93b8b24553f3376fa9dfa21
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 16 Jan 2014 11:31:12 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 16 Jan 2014 16:26:24 -0300
tools lib traceevent: Unregister handler when kvm plugin is unloaded
The kvm handlers should be unregistered when the plugin is unloaded
otherwise they'll try to access invalid memory.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1389839478-5887-7-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/plugin_kvm.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/tools/lib/traceevent/plugin_kvm.c b/tools/lib/traceevent/plugin_kvm.c
index a0e282c..9e0e8c6 100644
--- a/tools/lib/traceevent/plugin_kvm.c
+++ b/tools/lib/traceevent/plugin_kvm.c
@@ -434,3 +434,32 @@ int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
PEVENT_FUNC_ARG_VOID);
return 0;
}
+
+void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
+{
+ pevent_unregister_event_handler(pevent, -1, "kvm", "kvm_exit",
+ kvm_exit_handler, NULL);
+
+ pevent_unregister_event_handler(pevent, -1, "kvm", "kvm_emulate_insn",
+ kvm_emulate_insn_handler, NULL);
+
+ pevent_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_get_page",
+ kvm_mmu_get_page_handler, NULL);
+
+ pevent_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_sync_page",
+ kvm_mmu_print_role, NULL);
+
+ pevent_unregister_event_handler(pevent, -1,
+ "kvmmmu", "kvm_mmu_unsync_page",
+ kvm_mmu_print_role, NULL);
+
+ pevent_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_zap_page",
+ kvm_mmu_print_role, NULL);
+
+ pevent_unregister_event_handler(pevent, -1, "kvmmmu",
+ "kvm_mmu_prepare_zap_page", kvm_mmu_print_role,
+ NULL);
+
+ pevent_unregister_print_function(pevent, process_is_writable_pte,
+ "is_writable_pte");
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
== 9 of 10 ==
Date: Sun, Jan 19 2014 4:30 am
From: tip-bot for Namhyung Kim
Commit-ID: a157112cfc67b3889f6493933cbd32620aa4be18
Gitweb: http://git.kernel.org/tip/a157112cfc67b3889f6493933cbd32620aa4be18
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 16 Jan 2014 11:31:17 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 16 Jan 2014 16:26:25 -0300
tools lib traceevent: Unregister handler when scsi plugin is unloaded
The function handler should be unregistered when the plugin is unloaded
otherwise it'll try to access invalid memory.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1389839478-5887-12-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/plugin_scsi.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/lib/traceevent/plugin_scsi.c b/tools/lib/traceevent/plugin_scsi.c
index 7ef16cc..eda326f 100644
--- a/tools/lib/traceevent/plugin_scsi.c
+++ b/tools/lib/traceevent/plugin_scsi.c
@@ -421,3 +421,9 @@ int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
PEVENT_FUNC_ARG_VOID);
return 0;
}
+
+void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
+{
+ pevent_unregister_print_function(pevent, process_scsi_trace_parse_cdb,
+ "scsi_trace_parse_cdb");
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
== 10 of 10 ==
Date: Sun, Jan 19 2014 4:30 am
From: tip-bot for Namhyung Kim
Commit-ID: 20c7e5abbd0cdfaa656f46af052a6e6a8ce94775
Gitweb: http://git.kernel.org/tip/20c7e5abbd0cdfaa656f46af052a6e6a8ce94775
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 16 Jan 2014 11:31:08 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 16 Jan 2014 16:26:24 -0300
tools lib traceevent: Add pevent_unregister_print_function()
When a plugin unloaded it needs to unregister its print handler from
pevent.
So add an unregister function to do it.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1389839478-5887-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/event-parse.c | 23 +++++++++++++++++++++++
tools/lib/traceevent/event-parse.h | 2 ++
2 files changed, 25 insertions(+)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index d1973cb..1587ea39 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -5560,6 +5560,29 @@ int pevent_register_print_function(struct pevent *pevent,
return ret;
}
+/**
+ * pevent_unregister_print_function - unregister a helper function
+ * @pevent: the handle to the pevent
+ * @func: the function to process the helper function
+ * @name: the name of the helper function
+ *
+ * This function removes existing print handler for function @name.
+ *
+ * Returns 0 if the handler was removed successully, -1 otherwise.
+ */
+int pevent_unregister_print_function(struct pevent *pevent,
+ pevent_func_handler func, char *name)
+{
+ struct pevent_function_handler *func_handle;
+
+ func_handle = find_func_handler(pevent, name);
+ if (func_handle && func_handle->func == func) {
+ remove_func_handler(pevent, name);
+ return 0;
+ }
+ return -1;
+}
+
static struct event_format *pevent_search_event(struct pevent *pevent, int id,
const char *sys_name,
const char *event_name)
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index c48acfb..791c539 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -631,6 +631,8 @@ int pevent_register_print_function(struct pevent *pevent,
pevent_func_handler func,
enum pevent_func_arg_type ret_type,
char *name, ...);
+int pevent_unregister_print_function(struct pevent *pevent,
+ pevent_func_handler func, char *name);
struct format_field *pevent_find_common_field(struct event_format *event, const char *name);
struct format_field *pevent_find_field(struct event_format *event, const char *name);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
==============================================================================
TOPIC: target/iblock: Add blk_integrity + BIP passthrough support
http://groups.google.com/group/linux.kernel/t/109d6f35263ac9b4?hl=en
==============================================================================
== 1 of 3 ==
Date: Sun, Jan 19 2014 4:30 am
From: Sagi Grimberg
On 1/19/2014 4:44 AM, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
>
> This patch adds blk_integrity passthrough support for block_device
> backends using IBLOCK.
Nice!
> This includes iblock_alloc_bip() + setup of bio_integrity_payload
> information that attaches to the leading struct bio once bio_list
> is populated during fast-path iblock_execute_rw() I/O dispatch.
>
> It also updates setup in iblock_configure_device() to detect modes
> of protection + se dev->dev_attrib.pi_prot_type accordingly, along
> with creating required bio_set integrity mempools.
>
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Sagi Grimberg <sagig@mellanox.com>
> Cc: Or Gerlitz <ogerlitz@mellanox.com>
> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
> ---
> drivers/target/Kconfig | 1 +
> drivers/target/target_core_iblock.c | 91 ++++++++++++++++++++++++++++++++++-
> 2 files changed, 90 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/target/Kconfig b/drivers/target/Kconfig
> index 50aad2e..dc2d84a 100644
> --- a/drivers/target/Kconfig
> +++ b/drivers/target/Kconfig
> @@ -14,6 +14,7 @@ if TARGET_CORE
>
> config TCM_IBLOCK
> tristate "TCM/IBLOCK Subsystem Plugin for Linux/BLOCK"
> + select BLK_DEV_INTEGRITY
> help
> Say Y here to enable the TCM/IBLOCK subsystem plugin for non-buffered
> access to Linux/Block devices using BIO
> diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
> index 15d9121..293d9b0 100644
> --- a/drivers/target/target_core_iblock.c
> +++ b/drivers/target/target_core_iblock.c
> @@ -91,6 +91,7 @@ static int iblock_configure_device(struct se_device *dev)
> struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
> struct request_queue *q;
> struct block_device *bd = NULL;
> + struct blk_integrity *bi;
> fmode_t mode;
> int ret = -ENOMEM;
>
> @@ -155,8 +156,40 @@ static int iblock_configure_device(struct se_device *dev)
> if (blk_queue_nonrot(q))
> dev->dev_attrib.is_nonrot = 1;
>
> + bi = bdev_get_integrity(bd);
> + if (bi) {
> + struct bio_set *bs = ib_dev->ibd_bio_set;
> +
> + if (!strcmp(bi->name, "T10-DIF-TYPE3-IP") ||
> + !strcmp(bi->name, "T10-DIF-TYPE1-IP")) {
> + pr_err("IBLOCK export of blk_integrity: %s not"
> + " supported\n", bi->name);
> + ret = -ENOSYS;
> + goto out_blkdev_put;
> + }
Please remind me why we ignore IP-CSUM guard type again?
MKP, will this be irrelevant for the initiator as well? if so, I don't
see a reason to expose this in RDMA verbs.
> +
> + if (!strcmp(bi->name, "T10-DIF-TYPE3-CRC")) {
> + dev->dev_attrib.pi_prot_type = TARGET_DIF_TYPE3_PROT;
> + } else if (!strcmp(bi->name, "T10-DIF-TYPE1-CRC")) {
> + dev->dev_attrib.pi_prot_type = TARGET_DIF_TYPE1_PROT;
> + }
> +
> + if (dev->dev_attrib.pi_prot_type) {
> + if (bioset_integrity_create(bs, IBLOCK_BIO_POOL_SIZE) < 0) {
> + pr_err("Unable to allocate bioset for PI\n");
> + ret = -ENOMEM;
> + goto out_blkdev_put;
> + }
> + pr_debug("IBLOCK setup BIP bs->bio_integrity_pool: %p\n",
> + bs->bio_integrity_pool);
> + }
> + dev->dev_attrib.hw_pi_prot_type = dev->dev_attrib.pi_prot_type;
> + }
> +
> return 0;
>
> +out_blkdev_put:
> + blkdev_put(ib_dev->ibd_bd, FMODE_WRITE|FMODE_READ|FMODE_EXCL);
> out_free_bioset:
> bioset_free(ib_dev->ibd_bio_set);
> ib_dev->ibd_bio_set = NULL;
> @@ -170,8 +203,10 @@ static void iblock_free_device(struct se_device *dev)
>
> if (ib_dev->ibd_bd != NULL)
> blkdev_put(ib_dev->ibd_bd, FMODE_WRITE|FMODE_READ|FMODE_EXCL);
> - if (ib_dev->ibd_bio_set != NULL)
> + if (ib_dev->ibd_bio_set != NULL) {
> + bioset_integrity_free(ib_dev->ibd_bio_set);
> bioset_free(ib_dev->ibd_bio_set);
> + }
> kfree(ib_dev);
> }
>
> @@ -586,13 +621,58 @@ static ssize_t iblock_show_configfs_dev_params(struct se_device *dev, char *b)
> return bl;
> }
>
> +static int
> +iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio)
> +{
> + struct se_device *dev = cmd->se_dev;
> + struct blk_integrity *bi;
> + struct bio_integrity_payload *bip;
> + struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
> + struct scatterlist *sg;
> + int i, rc;
> +
> + bi = bdev_get_integrity(ib_dev->ibd_bd);
> + if (!bi) {
> + pr_err("Unable to locate bio_integrity\n");
> + return -ENODEV;
> + }
> +
> + bip = bio_integrity_alloc(bio, GFP_NOIO, cmd->t_prot_nents);
> + if (!bip) {
> + pr_err("Unable to allocate bio_integrity_payload\n");
> + return -ENOMEM;
> + }
> +
> + bip->bip_size = (cmd->data_length / dev->dev_attrib.block_size) *
> + dev->prot_length;
> + bip->bip_sector = bio->bi_sector;
> +
> + pr_debug("IBLOCK BIP Size: %u Sector: %llu\n", bip->bip_size,
> + (unsigned long long)bip->bip_sector);
> +
> + for_each_sg(cmd->t_prot_sg, sg, cmd->t_prot_nents, i) {
> +
> + rc = bio_integrity_add_page(bio, sg_page(sg), sg->length,
> + sg->offset);
> + if (rc != sg->length) {
> + pr_err("bio_integrity_add_page() failed; %d\n", rc);
> + return -ENOMEM;
> + }
> +
> + pr_debug("Added bio integrity page: %p length: %d offset; %d\n",
> + sg_page(sg), sg->length, sg->offset);
> + }
> +
> + return 0;
> +}
> +
> static sense_reason_t
> iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
> enum dma_data_direction data_direction)
> {
> struct se_device *dev = cmd->se_dev;
> struct iblock_req *ibr;
> - struct bio *bio;
> + struct bio *bio, *bio_start;
> struct bio_list list;
> struct scatterlist *sg;
> u32 sg_num = sgl_nents;
> @@ -655,6 +735,7 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
> if (!bio)
> goto fail_free_ibr;
>
> + bio_start = bio;
> bio_list_init(&list);
> bio_list_add(&list, bio);
>
> @@ -688,6 +769,12 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
> sg_num--;
> }
>
> + if (cmd->prot_type) {
> + int rc = iblock_alloc_bip(cmd, bio_start);
> + if (rc)
> + goto fail_put_bios;
> + }
> +
> iblock_submit_bios(&list, rw);
> iblock_complete_cmd(cmd);
> return 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
== 2 of 3 ==
Date: Sun, Jan 19 2014 4:40 am
From: Sagi Grimberg
On 1/19/2014 4:44 AM, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
>
> This patch adds support for DIF protection init/format support into
> the FILEIO backend.
>
> It involves using a seperate $FILE.protection for storing PI that is
> opened via fd_init_prot() using the common pi_prot_type attribute.
> The actual formatting of the protection is done via fd_format_prot()
> using the common pi_prot_format attribute, that will populate the
> initial PI data based upon the currently configured pi_prot_type.
>
> Based on original FILEIO code from Sagi.
Nice! see comments below...
> v1 changes:
> - Fix sparse warnings in fd_init_format_buf (Fengguang)
>
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Sagi Grimberg <sagig@mellanox.com>
> Cc: Or Gerlitz <ogerlitz@mellanox.com>
> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
> ---
> drivers/target/target_core_file.c | 137 +++++++++++++++++++++++++++++++++++++
> drivers/target/target_core_file.h | 4 ++
> 2 files changed, 141 insertions(+)
>
> diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
> index 0e34cda..119d519 100644
> --- a/drivers/target/target_core_file.c
> +++ b/drivers/target/target_core_file.c
> @@ -700,6 +700,140 @@ static sector_t fd_get_blocks(struct se_device *dev)
> dev->dev_attrib.block_size);
> }
>
> +static int fd_init_prot(struct se_device *dev)
> +{
> + struct fd_dev *fd_dev = FD_DEV(dev);
> + struct file *prot_file, *file = fd_dev->fd_file;
> + struct inode *inode;
> + int ret, flags = O_RDWR | O_CREAT | O_LARGEFILE | O_DSYNC;
> + char buf[FD_MAX_DEV_PROT_NAME];
> +
> + if (!file) {
> + pr_err("Unable to locate fd_dev->fd_file\n");
> + return -ENODEV;
> + }
> +
> + inode = file->f_mapping->host;
> + if (S_ISBLK(inode->i_mode)) {
> + pr_err("FILEIO Protection emulation only supported on"
> + " !S_ISBLK\n");
> + return -ENOSYS;
> + }
> +
> + if (fd_dev->fbd_flags & FDBD_HAS_BUFFERED_IO_WCE)
> + flags &= ~O_DSYNC;
> +
> + snprintf(buf, FD_MAX_DEV_PROT_NAME, "%s.protection",
> + fd_dev->fd_dev_name);
> +
> + prot_file = filp_open(buf, flags, 0600);
> + if (IS_ERR(prot_file)) {
> + pr_err("filp_open(%s) failed\n", buf);
> + ret = PTR_ERR(prot_file);
> + return ret;
> + }
> + fd_dev->fd_prot_file = prot_file;
> +
> + return 0;
> +}
> +
> +static void fd_init_format_buf(struct se_device *dev, unsigned char *buf,
> + u32 unit_size, u32 *ref_tag, u16 app_tag,
> + bool inc_reftag)
> +{
> + unsigned char *p = buf;
> + int i;
> +
> + for (i = 0; i < unit_size; i += dev->prot_length) {
> + *((u16 *)&p[0]) = 0xffff;
> + *((__be16 *)&p[2]) = cpu_to_be16(app_tag);
> + *((__be32 *)&p[4]) = cpu_to_be32(*ref_tag);
> +
> + if (inc_reftag)
> + (*ref_tag)++;
> +
> + p += dev->prot_length;
> + }
> +}
> +
> +static int fd_format_prot(struct se_device *dev)
> +{
> + struct fd_dev *fd_dev = FD_DEV(dev);
> + struct file *prot_fd = fd_dev->fd_prot_file;
> + sector_t prot_length, prot;
> + unsigned char *buf;
> + loff_t pos = 0;
> + u32 ref_tag = 0;
> + int unit_size = FDBD_FORMAT_UNIT_SIZE * dev->dev_attrib.block_size;
> + int rc, ret = 0, size, len;
> + bool inc_reftag = false;
> +
> + if (!dev->dev_attrib.pi_prot_type) {
> + pr_err("Unable to format_prot while pi_prot_type == 0\n");
> + return -ENODEV;
> + }
> + if (!prot_fd) {
> + pr_err("Unable to locate fd_dev->fd_prot_file\n");
> + return -ENODEV;
> + }
> +
> + switch (dev->dev_attrib.pi_prot_type) {
redundant - see below.
> + case TARGET_DIF_TYPE3_PROT:
> + ref_tag = 0xffffffff;
> + break;
> + case TARGET_DIF_TYPE2_PROT:
> + case TARGET_DIF_TYPE1_PROT:
> + inc_reftag = true;
> + break;
> + default:
> + break;
> + }
> +
> + buf = vzalloc(unit_size);
> + if (!buf) {
> + pr_err("Unable to allocate FILEIO prot buf\n");
> + return -ENOMEM;
> + }
> +
> + prot_length = (dev->transport->get_blocks(dev) + 1) * dev->prot_length;
> + size = prot_length;
> +
> + pr_debug("Using FILEIO prot_length: %llu\n",
> + (unsigned long long)prot_length);
> +
> + for (prot = 0; prot < prot_length; prot += unit_size) {
> +
> + fd_init_format_buf(dev, buf, unit_size, &ref_tag, 0xffff,
> + inc_reftag);
I didn't send you my latest patches (my fault...).T10-PI format should
only place
escape values throughout the protection file (fill it with 0xff). so I
guess in this case
fd_init_formast_buf() boils down to memset(buf, 0xff, unit_size) once
before the loop
and just loop until prot_length writing buf, no need to address
apptag/reftag...
> +
> + len = min(unit_size, size);
> +
> + rc = kernel_write(prot_fd, buf, len, pos);
> + if (rc != len) {
> + pr_err("vfs_write to prot file failed: %d\n", rc);
> + ret = -ENODEV;
> + goto out;
> + }
> + pos += len;
> + size -= len;
> + }
> +
> +out:
> + vfree(buf);
> + return ret;
> +}
> +
> +static void fd_free_prot(struct se_device *dev)
> +{
> + struct fd_dev *fd_dev = FD_DEV(dev);
> +
> + if (!fd_dev->fd_prot_file)
> + return;
> +
> + filp_close(fd_dev->fd_prot_file, NULL);
> + fd_dev->fd_prot_file = NULL;
> +}
> +
> static struct sbc_ops fd_sbc_ops = {
> .execute_rw = fd_execute_rw,
> .execute_sync_cache = fd_execute_sync_cache,
> @@ -730,6 +864,9 @@ static struct se_subsystem_api fileio_template = {
> .show_configfs_dev_params = fd_show_configfs_dev_params,
> .get_device_type = sbc_get_device_type,
> .get_blocks = fd_get_blocks,
> + .init_prot = fd_init_prot,
> + .format_prot = fd_format_prot,
> + .free_prot = fd_free_prot,
> };
>
> static int __init fileio_module_init(void)
> diff --git a/drivers/target/target_core_file.h b/drivers/target/target_core_file.h
> index 37ffc5b..583691e 100644
> --- a/drivers/target/target_core_file.h
> +++ b/drivers/target/target_core_file.h
> @@ -4,6 +4,7 @@
> #define FD_VERSION "4.0"
>
> #define FD_MAX_DEV_NAME 256
> +#define FD_MAX_DEV_PROT_NAME FD_MAX_DEV_NAME + 16
> #define FD_DEVICE_QUEUE_DEPTH 32
> #define FD_MAX_DEVICE_QUEUE_DEPTH 128
> #define FD_BLOCKSIZE 512
> @@ -15,6 +16,8 @@
> #define FBDF_HAS_PATH 0x01
> #define FBDF_HAS_SIZE 0x02
> #define FDBD_HAS_BUFFERED_IO_WCE 0x04
> +#define FDBD_FORMAT_UNIT_SIZE 2048
> +
>
> struct fd_dev {
> struct se_device dev;
> @@ -29,6 +32,7 @@ struct fd_dev {
> u32 fd_block_size;
> unsigned long long fd_dev_size;
> struct file *fd_file;
> + struct file *fd_prot_file;
> /* FILEIO HBA device is connected to */
> struct fd_host *fd_host;
> } ____cacheline_aligned;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
== 3 of 3 ==
Date: Sun, Jan 19 2014 4:40 am
From: Sagi Grimberg
On 1/19/2014 4:44 AM, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
>
> This patch adds support for DIF protection into fd_execute_rw() code
> for WRITE/READ I/O using sbc_dif_verify_[write,read]() logic.
>
> It adds fd_do_prot_rw() for handling interface with FILEIO PI, and
> uses a locally allocated fd_prot->prot_buf + fd_prot->prot_sg for
> interacting with SBC DIF verify emulation code.
>
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Sagi Grimberg <sagig@mellanox.com>
> Cc: Or Gerlitz <ogerlitz@mellanox.com>
> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
> ---
> drivers/target/target_core_file.c | 119 ++++++++++++++++++++++++++++++++++++-
> drivers/target/target_core_file.h | 5 ++
> 2 files changed, 123 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
> index 119d519..aaba7c5 100644
> --- a/drivers/target/target_core_file.c
> +++ b/drivers/target/target_core_file.c
> @@ -257,6 +257,72 @@ static void fd_free_device(struct se_device *dev)
> kfree(fd_dev);
> }
>
> +static int fd_do_prot_rw(struct se_cmd *cmd, struct fd_prot *fd_prot,
> + int is_write)
> +{
> + struct se_device *se_dev = cmd->se_dev;
> + struct fd_dev *dev = FD_DEV(se_dev);
> + struct file *prot_fd = dev->fd_prot_file;
> + struct scatterlist *sg;
> + loff_t pos = (cmd->t_task_lba * se_dev->prot_length);
> + unsigned char *buf;
> + u32 prot_size, len, size;
> + int rc, ret = 1, i;
> +
> + prot_size = (cmd->data_length / se_dev->dev_attrib.block_size) *
> + se_dev->prot_length;
> +
> + if (!is_write) {
> + fd_prot->prot_buf = vzalloc(prot_size);
> + if (!fd_prot->prot_buf) {
> + pr_err("Unable to allocate fd_prot->prot_buf\n");
> + return -ENOMEM;
> + }
> + buf = fd_prot->prot_buf;
> +
> + fd_prot->prot_sg_nents = cmd->t_prot_nents;
> + fd_prot->prot_sg = kzalloc(sizeof(struct scatterlist) *
> + fd_prot->prot_sg_nents, GFP_KERNEL);
> + if (!fd_prot->prot_sg) {
> + pr_err("Unable to allocate fd_prot->prot_sg\n");
> + vfree(fd_prot->prot_buf);
> + return -ENOMEM;
> + }
> + size = prot_size;
> +
> + for_each_sg(fd_prot->prot_sg, sg, fd_prot->prot_sg_nents, i) {
> +
> + len = min_t(u32, PAGE_SIZE, size);
> + sg_set_buf(sg, buf, len);
> + size -= len;
> + buf += len;
> + }
> + }
> +
> + if (is_write) {
> + rc = kernel_write(prot_fd, fd_prot->prot_buf, prot_size, pos);
> + if (rc < 0 || prot_size != rc) {
> + pr_err("kernel_write() for fd_do_prot_rw failed:"
> + " %d\n", rc);
> + ret = -EINVAL;
> + }
> + } else {
> + rc = kernel_read(prot_fd, pos, fd_prot->prot_buf, prot_size);
> + if (rc < 0) {
> + pr_err("kernel_read() for fd_do_prot_rw failed:"
> + " %d\n", rc);
> + ret = -EINVAL;
> + }
> + }
> +
> + if (is_write || ret < 0) {
> + kfree(fd_prot->prot_sg);
> + vfree(fd_prot->prot_buf);
> + }
> +
> + return ret;
> +}
> +
> static int fd_do_rw(struct se_cmd *cmd, struct scatterlist *sgl,
> u32 sgl_nents, int is_write)
> {
> @@ -551,6 +617,8 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
> enum dma_data_direction data_direction)
> {
> struct se_device *dev = cmd->se_dev;
> + struct fd_prot fd_prot;
> + sense_reason_t rc;
> int ret = 0;
>
> /*
> @@ -558,8 +626,48 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
> * physical memory addresses to struct iovec virtual memory.
> */
> if (data_direction == DMA_FROM_DEVICE) {
Maybe its better to export this one to a separate function?
fd_execute_prot_rw()? just a nit...
> + memset(&fd_prot, 0, sizeof(struct fd_prot));
> +
> + if (cmd->prot_type) {
> + ret = fd_do_prot_rw(cmd, &fd_prot, false);
> + if (ret < 0)
> + return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
> + }
> +
> ret = fd_do_rw(cmd, sgl, sgl_nents, 0);
> +
> + if (ret > 0 && cmd->prot_type) {
> + u32 sectors = cmd->data_length / dev->dev_attrib.block_size;
> +
> + rc = sbc_dif_verify_read(cmd, cmd->t_task_lba, sectors,
> + 0, fd_prot.prot_sg, 0);
> + if (rc) {
> + kfree(fd_prot.prot_sg);
> + vfree(fd_prot.prot_buf);
> + return rc;
> + }
> + kfree(fd_prot.prot_sg);
> + vfree(fd_prot.prot_buf);
> + }
> } else {
> + memset(&fd_prot, 0, sizeof(struct fd_prot));
> +
> + if (cmd->prot_type) {
> + u32 sectors = cmd->data_length / dev->dev_attrib.block_size;
> +
> + ret = fd_do_prot_rw(cmd, &fd_prot, false);
> + if (ret < 0)
> + return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
> +
> + rc = sbc_dif_verify_write(cmd, cmd->t_task_lba, sectors,
> + 0, fd_prot.prot_sg, 0);
> + if (rc) {
> + kfree(fd_prot.prot_sg);
> + vfree(fd_prot.prot_buf);
> + return rc;
> + }
> + }
> +
> ret = fd_do_rw(cmd, sgl, sgl_nents, 1);
> /*
> * Perform implicit vfs_fsync_range() for fd_do_writev() ops
> @@ -576,10 +684,19 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
>
> vfs_fsync_range(fd_dev->fd_file, start, end, 1);
> }
> +
> + if (ret > 0 && cmd->prot_type) {
> + ret = fd_do_prot_rw(cmd, &fd_prot, true);
> + if (ret < 0)
> + return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
> + }
> }
>
> - if (ret < 0)
> + if (ret < 0) {
> + kfree(fd_prot.prot_sg);
> + vfree(fd_prot.prot_buf);
> return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
> + }
>
> if (ret)
> target_complete_cmd(cmd, SAM_STAT_GOOD);
> diff --git a/drivers/target/target_core_file.h b/drivers/target/target_core_file.h
> index 583691e..97e5e7d 100644
> --- a/drivers/target/target_core_file.h
> +++ b/drivers/target/target_core_file.h
> @@ -18,6 +18,11 @@
> #define FDBD_HAS_BUFFERED_IO_WCE 0x04
> #define FDBD_FORMAT_UNIT_SIZE 2048
>
> +struct fd_prot {
> + unsigned char *prot_buf;
> + struct scatterlist *prot_sg;
> + u32 prot_sg_nents;
> +};
>
> struct fd_dev {
> struct se_device dev;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
==============================================================================
TOPIC: Adding hyperv.h to uapi headers
http://groups.google.com/group/linux.kernel/t/9109a55de9e0039d?hl=en
==============================================================================
== 1 of 3 ==
Date: Sun, Jan 19 2014 4:30 am
From: Borislav Petkov
On Sun, Jan 19, 2014 at 12:57:11AM +0100, Bjarke Istrup Pedersen wrote:
> To be able to build the kvp deamon, which has been broken since the
> UAPI split a few versions ago.
Right.
> The tool located in tools/hv.
Ah, I see.
Those things there could use a Makefile, btw.
$ gcc -Wall -o hv_kvp_daemon{,.c}
hv_kvp_daemon.c:38:26: fatal error: linux/hyperv.h: No such file or directory
#include <linux/hyperv.h>
^
compilation terminated.
Oh, and some build infra so that they can be buildable from within the
kernel tree.
Oh well...
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
== 2 of 3 ==
Date: Sun, Jan 19 2014 6:40 am
From: Bjarke Istrup Pedersen
2014/1/19 Borislav Petkov <bp@alien8.de>:
> On Sun, Jan 19, 2014 at 12:57:11AM +0100, Bjarke Istrup Pedersen wrote:
>> To be able to build the kvp deamon, which has been broken since the
>> UAPI split a few versions ago.
>
> Right.
>
>> The tool located in tools/hv.
>
> Ah, I see.
>
> Those things there could use a Makefile, btw.
>
> $ gcc -Wall -o hv_kvp_daemon{,.c}
> hv_kvp_daemon.c:38:26: fatal error: linux/hyperv.h: No such file or directory
> #include <linux/hyperv.h>
> ^
> compilation terminated.
Yep, but applying the v2 patch, and then building the headers,
followed by copying hyperv.h from the output to /usr/include/linux
makes it build fine. :-)
> Oh, and some build infra so that they can be buildable from within the
> kernel tree.
Indeed, but first lets get it building :-)
/Bjarke
> Oh well...
>
> --
> Regards/Gruss,
> Boris.
>
> Sent from a fat crate under my desk. Formatting is fine.
> --
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
== 3 of 3 ==
Date: Sun, Jan 19 2014 6:50 am
From: Borislav Petkov
On Sun, Jan 19, 2014 at 03:37:24PM +0100, Bjarke Istrup Pedersen wrote:
> > Oh, and some build infra so that they can be buildable from within the
> > kernel tree.
>
> Indeed, but first lets get it building :-)
Oh, I didn't mean you with that, rather the other readers on this
thread. Unless you really want to do it - which is then cool. :-)
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
==============================================================================
TOPIC: perf probe: Release allocated probe_trace_event if failed
http://groups.google.com/group/linux.kernel/t/d6b43d2b9d80482d?hl=en
==============================================================================
== 1 of 3 ==
Date: Sun, Jan 19 2014 4:30 am
From: tip-bot for Masami Hiramatsu
Commit-ID: 981d05adf2e2acc328abb929a6ed3536c0d41c5f
Gitweb: http://git.kernel.org/tip/981d05adf2e2acc328abb929a6ed3536c0d41c5f
Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Thu, 16 Jan 2014 09:39:44 +0000
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 16 Jan 2014 16:26:50 -0300
perf probe: Release allocated probe_trace_event if failed
To fix a memory leak, release all allocated probe_trace_event on the
error path of try_to_find_probe_trace_events.
Reported-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: "David A. Long" <dave.long@linaro.org>
Cc: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: yrl.pp-manager.tt@hitachi.com
Link: http://lkml.kernel.org/r/20140116093944.24403.30228.stgit@kbuild-fedora.novalocal
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-event.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index a4ee6b4..579b655 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -72,6 +72,7 @@ static int e_snprintf(char *str, size_t size, const char *format, ...)
static char *synthesize_perf_probe_point(struct perf_probe_point *pp);
static int convert_name_to_addr(struct perf_probe_event *pev,
const char *exec);
+static void clear_probe_trace_event(struct probe_trace_event *tev);
static struct machine machine;
/* Initialize symbol maps and path of vmlinux/modules */
@@ -407,6 +408,14 @@ static int add_module_to_probe_trace_events(struct probe_trace_event *tevs,
return ret;
}
+static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs)
+{
+ int i;
+
+ for (i = 0; i < ntevs; i++)
+ clear_probe_trace_event(tevs + i);
+}
+
/* Try to find perf_probe_event with debuginfo */
static int try_to_find_probe_trace_events(struct perf_probe_event *pev,
struct probe_trace_event **tevs,
@@ -442,6 +451,10 @@ static int try_to_find_probe_trace_events(struct perf_probe_event *pev,
ret = add_module_to_probe_trace_events(*tevs,
ntevs, target);
}
+ if (ret < 0) {
+ clear_probe_trace_events(*tevs, ntevs);
+ zfree(tevs);
+ }
return ret < 0 ? ret : ntevs;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
== 2 of 3 ==
Date: Sun, Jan 19 2014 4:30 am
From: tip-bot for Masami Hiramatsu
Commit-ID: e53b00d382f4d8f55bcae301f49863c469fdff65
Gitweb: http://git.kernel.org/tip/e53b00d382f4d8f55bcae301f49863c469fdff65
Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Thu, 16 Jan 2014 09:39:47 +0000
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 16 Jan 2014 16:29:02 -0300
perf probe: Release all dynamically allocated parameters
To fix a memory leak, release all dynamically allocated
options/parameters in params data structure. This also
introduces/exports some init/clear routines.
Reported-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: "David A. Long" <dave.long@linaro.org>
Cc: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: yrl.pp-manager.tt@hitachi.com
Link: http://lkml.kernel.org/r/20140116093947.24403.80118.stgit@kbuild-fedora.novalocal
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-probe.c | 48 ++++++++++++++++++++++++++++++++++++++-----
tools/perf/util/probe-event.c | 22 ++++++++++++++++++++
tools/perf/util/probe-event.h | 6 ++++++
3 files changed, 71 insertions(+), 5 deletions(-)
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 43ff33d..7894888 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -59,7 +59,7 @@ static struct {
struct perf_probe_event events[MAX_PROBES];
struct strlist *dellist;
struct line_range line_range;
- const char *target;
+ char *target;
int max_probe_points;
struct strfilter *filter;
} params;
@@ -98,7 +98,10 @@ static int set_target(const char *ptr)
* short module name.
*/
if (!params.target && ptr && *ptr == '/') {
- params.target = ptr;
+ params.target = strdup(ptr);
+ if (!params.target)
+ return -ENOMEM;
+
found = 1;
buf = ptr + (strlen(ptr) - 3);
@@ -116,6 +119,9 @@ static int parse_probe_event_argv(int argc, const char **argv)
char *buf;
found_target = set_target(argv[0]);
+ if (found_target < 0)
+ return found_target;
+
if (found_target && argc == 1)
return 0;
@@ -217,7 +223,6 @@ static int opt_show_lines(const struct option *opt __maybe_unused,
params.show_lines = true;
ret = parse_line_range_desc(str, ¶ms.line_range);
- INIT_LIST_HEAD(¶ms.line_range.line_list);
return ret;
}
@@ -263,7 +268,28 @@ static int opt_set_filter(const struct option *opt __maybe_unused,
return 0;
}
-int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
+static void init_params(void)
+{
+ line_range__init(¶ms.line_range);
+}
+
+static void cleanup_params(void)
+{
+ int i;
+
+ for (i = 0; i < params.nevents; i++)
+ clear_perf_probe_event(params.events + i);
+ if (params.dellist)
+ strlist__delete(params.dellist);
+ line_range__clear(¶ms.line_range);
+ free(params.target);
+ if (params.filter)
+ strfilter__delete(params.filter);
+ memset(¶ms, 0, sizeof(params));
+}
+
+static int
+__cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
{
const char * const probe_usage[] = {
"perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]",
@@ -417,6 +443,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
ret = show_available_funcs(params.target, params.filter,
params.uprobes);
strfilter__delete(params.filter);
+ params.filter = NULL;
if (ret < 0)
pr_err(" Error: Failed to show functions."
" (%d)\n", ret);
@@ -456,6 +483,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
params.filter,
params.show_ext_vars);
strfilter__delete(params.filter);
+ params.filter = NULL;
if (ret < 0)
pr_err(" Error: Failed to show vars. (%d)\n", ret);
return ret;
@@ -464,7 +492,6 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
if (params.dellist) {
ret = del_perf_probe_events(params.dellist);
- strlist__delete(params.dellist);
if (ret < 0) {
pr_err(" Error: Failed to delete events. (%d)\n", ret);
return ret;
@@ -483,3 +510,14 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
}
return 0;
}
+
+int cmd_probe(int argc, const char **argv, const char *prefix)
+{
+ int ret;
+
+ init_params();
+ ret = __cmd_probe(argc, argv, prefix);
+ cleanup_params();
+
+ return ret;
+}
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 579b655..c68711c 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -794,6 +794,28 @@ int show_available_vars(struct perf_probe_event *pevs __maybe_unused,
}
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home