Skip to contentSkip to conversation

tracing: A few trace event triggers fixes

PATCH In review Tom Zanussi 2 participants 6 messages Dec 21, 2013 – Dec 22, 2013 Tracing

lore
Share & tools
lore
#0 lore raw

cover tracing: A few trace event triggers fixes

This patchset fixes a few sparse warnings and build problems seen under certain configurations, as uncovered by the kbuild test robot.

Applies to linux-trace.git ftrace/core.

The following changes since commit 611e9015501ab9597d6a43253813d4efd90936de:

tracing: Add documentation for trace event triggers (2013-12-20 23:24:20 -0500)

are available in the git repository at:

git://git.yoctoproject.org/linux-yocto-contrib.git tzanussi/event-triggers-ftrace-core-kbuild-robot-fixes
http://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto-contrib/log/?h=tzanussi/event-triggers-ftrace-core-kbuild-robot-fixes

Tom Zanussi (3):
tracing: Move tracing_alloc_snapshot() declaration to tracing.h
tracing: Add and use event_trigger_lseek()
tracing: Add rcu annotation for event_trigger_data.filter

 include/linux/kernel.h              |  2 --
 kernel/trace/trace.h                |  3 ++-
 kernel/trace/trace_events_trigger.c | 15 ++++++++++++++-
 3 files changed, 16 insertions(+), 4 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/3 tracing: Move tracing_alloc_snapshot() declaration to tracing.h

tracing_alloc_snapshot() is only used internally by alloc_tracing_snapshot() and trace_event_triggers.c and doesn't need to be in kernel.h. Move it to trace.h, which is more appropriate and both include.

---
 include/linux/kernel.h | 2 --
 kernel/trace/trace.h   | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)
include/linux/kernel.h +0 -2
index d58541b..ecb8754 100644
@@ -498,7 +498,6 @@ void tracing_on(void);
 void tracing_off(void);
 int tracing_is_on(void);
 void tracing_snapshot(void);
-int tracing_alloc_snapshot(void);
 void tracing_snapshot_alloc(void);
 
 extern void tracing_start(void);
@@ -646,7 +645,6 @@ static inline void tracing_on(void) { }
 static inline void tracing_off(void) { }
 static inline int tracing_is_on(void) { return 0; }
 static inline void tracing_snapshot(void) { }
-static inline int tracing_alloc_snapshot(void) { return -ENODEV; }
 static inline void tracing_snapshot_alloc(void) { }
 
 static inline __printf(1, 2)
kernel/trace/trace.h +1 -0
index 993f2fe..433bfc5 100644
@@ -1220,6 +1220,7 @@ struct event_command {
 
 extern int trace_event_enable_disable(struct ftrace_event_file *file,
 				      int enable, int soft_disable);
+extern int tracing_alloc_snapshot(void);
 
 extern const char *__start___trace_bprintk_fmt[];
 extern const char *__stop___trace_bprintk_fmt[];
Signature · 1 line
1.8.3.1
maintainer
#2 lore raw

Re: [PATCH 1/3] tracing: Move tracing_alloc_snapshot() declaration to tracing.h

Quoted 7 lines · On Sat, 21 Dec 2013 16:44:00 -0600 Tom Zanussi <[email protected]>…

tracing_alloc_snapshot() is only used internally by alloc_tracing_snapshot() and trace_event_triggers.c and doesn't need to be in kernel.h. Move it to trace.h, which is more appropriate and both include.

I simply folded this patch into "tracing: Add 'snapshot' event trigger command".

The ftrace/core branch can be rebased. I haven't put this into my for-next branch yet which I do not rebase (unless there's a major reason to do so).

-- Steve

#3 lore raw

PATCH 2/3 tracing: Add and use event_trigger_lseek()

In reply to Tom Zanussi

event_trigger_fops is currently using ftrace_filter_lseek, which doesn't work out so well if CONFIG_FUNCTION_TRACER isn't configured (compile error).

We also wanted to be completely decoupled from ftrace anyway, so create our own version and use it instead.

---
 kernel/trace/trace_events_trigger.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
kernel/trace/trace_events_trigger.c +14 -1
index f5b3f78..ff4d51e 100644
@@ -277,11 +277,24 @@ event_trigger_release(struct inode *inode, struct file *file)
 	return event_trigger_regex_release(inode, file);
 }
 
+static loff_t
+event_trigger_lseek(struct file *file, loff_t offset, int whence)
+{
+	loff_t ret;
+
+	if (file->f_mode & FMODE_READ)
+		ret = seq_lseek(file, offset, whence);
+	else
+		file->f_pos = ret = 1;
+
+	return ret;
+}
+
 const struct file_operations event_trigger_fops = {
 	.open = event_trigger_open,
 	.read = seq_read,
 	.write = event_trigger_write,
-	.llseek = ftrace_filter_lseek,
+	.llseek = event_trigger_lseek,
 	.release = event_trigger_release,
 };
 
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 3/3 tracing: Add rcu annotation for event_trigger_data.filter

In reply to Tom Zanussi

sparse complains about rcu_assign_pointer() and RCU_INIT_POINTER() assignments to event_trigger_data filter; annotate it with __rcu to get rid of the warning.

---
 kernel/trace/trace.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace.h +1 -1
index 433bfc5..24b16fb 100644
@@ -1055,7 +1055,7 @@ struct event_trigger_data {
 	int				ref;
 	struct event_trigger_ops	*ops;
 	struct event_command		*cmd_ops;
-	struct event_filter		*filter;
+	struct event_filter __rcu	*filter;
 	char				*filter_str;
 	void				*private_data;
 	struct list_head		list;
Signature · 1 line
1.8.3.1
maintainer
#5 lore raw
In reply to Tom Zanussi
Quoted 8 lines · On Sat, 21 Dec 2013 16:43:59 -0600 Tom Zanussi <[email protected]>…

This patchset fixes a few sparse warnings and build problems seen under certain configurations, as uncovered by the kbuild test robot.

Applies to linux-trace.git ftrace/core.

The following changes since commit 611e9015501ab9597d6a43253813d4efd90936de:

tracing: Add documentation for trace event triggers (2013-12-20 23:24:20 -0500)

Thanks Tom, but I'm also in the process of fixing these up ;-)

Quoted 8 lines

are available in the git repository at:

git://git.yoctoproject.org/linux-yocto-contrib.git tzanussi/event-triggers-ftrace-core-kbuild-robot-fixes
http://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto-contrib/log/?h=tzanussi/event-triggers-ftrace-core-kbuild-robot-fixes

Tom Zanussi (3):
tracing: Move tracing_alloc_snapshot() declaration to tracing.h

Heh, my fix was just to return -1, but I'll use your fix instead.

Quoted 1 line

tracing: Add and use event_trigger_lseek()

I've actually changed added a generic tracing_lseek() for all to use.

I'll use my patch instead.

Quoted 1 line

tracing: Add rcu annotation for event_trigger_data.filter

Running sparse with this change required more than just the added __rcu that you added (as I did too). I'll fix this up and start testing as well. I'll post the two patches I did just for you to give an ack on.

Thanks!

-- Steve

Quoted 6 lines
 include/linux/kernel.h              |  2 --
 kernel/trace/trace.h                |  3 ++-
 kernel/trace/trace_events_trigger.c | 15 ++++++++++++++-
 3 files changed, 16 insertions(+), 4 deletions(-)