All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Dave Chinner <david@fromorbit.com>, Jens Axboe <axboe@kernel.dk>,
	Tejun Heo <tj@kernel.org>, Dave Jones <davej@redhat.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Eric Sandeen <sandeen@sandeen.net>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	xfs@oss.sgi.com, Ingo Molnar <mingo@kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: 3.14-rc2 XFS backtrace because irqs_disabled.
Date: Wed, 12 Feb 2014 14:29:52 +0100	[thread overview]
Message-ID: <20140212132952.GX27965@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20140212074036.4c6105b5@gandalf.local.home>

On Wed, Feb 12, 2014 at 07:40:36AM -0500, Steven Rostedt wrote:
> The pt_regs structure.
> 
> That's what? 21 unsigned longs? 21 * 8 = 168. I think that's the
> culprit here.
> 
> Peter and Frederic, is there a way not to store that on the stack?

Something like so?

---
 include/trace/ftrace.h          | 7 ++++---
 kernel/trace/trace_event_perf.c | 5 ++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 1a8b28db3775..87ae3ef1d278 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -678,7 +678,7 @@ perf_trace_##call(void *__data, proto)					\
 	struct ftrace_event_call *event_call = __data;			\
 	struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
 	struct ftrace_raw_##call *entry;				\
-	struct pt_regs __regs;						\
+	struct pt_regs *__regs;						\
 	u64 __addr = 0, __count = 1;					\
 	struct task_struct *__task = NULL;				\
 	struct hlist_head *head;					\
@@ -697,18 +697,19 @@ perf_trace_##call(void *__data, proto)					\
 			     sizeof(u64));				\
 	__entry_size -= sizeof(u32);					\
 									\
-	perf_fetch_caller_regs(&__regs);				\
 	entry = perf_trace_buf_prepare(__entry_size,			\
 			event_call->event.type, &__regs, &rctx);	\
 	if (!entry)							\
 		return;							\
 									\
+	perf_fetch_caller_regs(__regs);					\
+									\
 	tstruct								\
 									\
 	{ assign; }							\
 									\
 	perf_trace_buf_submit(entry, __entry_size, rctx, __addr,	\
-		__count, &__regs, head, __task);			\
+		__count, __regs, head, __task);				\
 }
 
 /*
diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
index e854f420e033..1885f4aac109 100644
--- a/kernel/trace/trace_event_perf.c
+++ b/kernel/trace/trace_event_perf.c
@@ -232,8 +232,10 @@ void perf_trace_del(struct perf_event *p_event, int flags)
 	tp_event->class->reg(tp_event, TRACE_REG_PERF_DEL, p_event);
 }
 
+static DEFINE_PER_CPU(struct pt_regs, tp_regs[4]);
+
 __kprobes void *perf_trace_buf_prepare(int size, unsigned short type,
-				       struct pt_regs *regs, int *rctxp)
+				       struct pt_regs **regs, int *rctxp)
 {
 	struct trace_entry *entry;
 	unsigned long flags;
@@ -252,6 +254,7 @@ __kprobes void *perf_trace_buf_prepare(int size, unsigned short type,
 	if (*rctxp < 0)
 		return NULL;
 
+	*regs = this_cpu_ptr(&tp_regs[*rctxp]);
 	raw_data = this_cpu_ptr(perf_trace_buf[*rctxp]);
 
 	/* zero the dead bytes from align to not leak stack to user */


WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Jens Axboe <axboe@kernel.dk>, Eric Sandeen <sandeen@sandeen.net>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	xfs@oss.sgi.com, Al Viro <viro@zeniv.linux.org.uk>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Tejun Heo <tj@kernel.org>, Dave Jones <davej@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: 3.14-rc2 XFS backtrace because irqs_disabled.
Date: Wed, 12 Feb 2014 14:29:52 +0100	[thread overview]
Message-ID: <20140212132952.GX27965@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20140212074036.4c6105b5@gandalf.local.home>

On Wed, Feb 12, 2014 at 07:40:36AM -0500, Steven Rostedt wrote:
> The pt_regs structure.
> 
> That's what? 21 unsigned longs? 21 * 8 = 168. I think that's the
> culprit here.
> 
> Peter and Frederic, is there a way not to store that on the stack?

Something like so?

---
 include/trace/ftrace.h          | 7 ++++---
 kernel/trace/trace_event_perf.c | 5 ++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 1a8b28db3775..87ae3ef1d278 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -678,7 +678,7 @@ perf_trace_##call(void *__data, proto)					\
 	struct ftrace_event_call *event_call = __data;			\
 	struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
 	struct ftrace_raw_##call *entry;				\
-	struct pt_regs __regs;						\
+	struct pt_regs *__regs;						\
 	u64 __addr = 0, __count = 1;					\
 	struct task_struct *__task = NULL;				\
 	struct hlist_head *head;					\
@@ -697,18 +697,19 @@ perf_trace_##call(void *__data, proto)					\
 			     sizeof(u64));				\
 	__entry_size -= sizeof(u32);					\
 									\
-	perf_fetch_caller_regs(&__regs);				\
 	entry = perf_trace_buf_prepare(__entry_size,			\
 			event_call->event.type, &__regs, &rctx);	\
 	if (!entry)							\
 		return;							\
 									\
+	perf_fetch_caller_regs(__regs);					\
+									\
 	tstruct								\
 									\
 	{ assign; }							\
 									\
 	perf_trace_buf_submit(entry, __entry_size, rctx, __addr,	\
-		__count, &__regs, head, __task);			\
+		__count, __regs, head, __task);				\
 }
 
 /*
diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
index e854f420e033..1885f4aac109 100644
--- a/kernel/trace/trace_event_perf.c
+++ b/kernel/trace/trace_event_perf.c
@@ -232,8 +232,10 @@ void perf_trace_del(struct perf_event *p_event, int flags)
 	tp_event->class->reg(tp_event, TRACE_REG_PERF_DEL, p_event);
 }
 
+static DEFINE_PER_CPU(struct pt_regs, tp_regs[4]);
+
 __kprobes void *perf_trace_buf_prepare(int size, unsigned short type,
-				       struct pt_regs *regs, int *rctxp)
+				       struct pt_regs **regs, int *rctxp)
 {
 	struct trace_entry *entry;
 	unsigned long flags;
@@ -252,6 +254,7 @@ __kprobes void *perf_trace_buf_prepare(int size, unsigned short type,
 	if (*rctxp < 0)
 		return NULL;
 
+	*regs = this_cpu_ptr(&tp_regs[*rctxp]);
 	raw_data = this_cpu_ptr(perf_trace_buf[*rctxp]);
 
 	/* zero the dead bytes from align to not leak stack to user */

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2014-02-12 13:30 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11 17:27 3.14-rc2 XFS backtrace because irqs_disabled Dave Jones
2014-02-11 17:27 ` Dave Jones
2014-02-11 21:08 ` Dave Chinner
2014-02-11 21:08   ` Dave Chinner
2014-02-11 21:49   ` Eric Sandeen
2014-02-11 21:49     ` Eric Sandeen
2014-02-12  0:44     ` Dave Jones
2014-02-12  0:44       ` Dave Jones
2014-02-12  1:09       ` Al Viro
2014-02-12  1:09         ` Al Viro
2014-02-12  2:52         ` Linus Torvalds
2014-02-12  2:52           ` Linus Torvalds
2014-02-12  4:03           ` Dave Jones
2014-02-12  4:03             ` Dave Jones
2014-02-12  4:22             ` Al Viro
2014-02-12  4:22               ` Al Viro
2014-02-12  5:40               ` Dave Chinner
2014-02-12  5:40                 ` Dave Chinner
2014-02-12  5:50                 ` Dave Jones
2014-02-12  5:50                   ` Dave Jones
2014-02-12  6:10                   ` Dave Chinner
2014-02-12  6:10                     ` Dave Chinner
2014-02-12  6:31                     ` Dave Chinner
2014-02-12  6:31                       ` Dave Chinner
2014-02-12  6:59                       ` Linus Torvalds
2014-02-12  6:59                         ` Linus Torvalds
2014-02-12  8:13                         ` Tejun Heo
2014-02-12  8:13                           ` Tejun Heo
2014-02-12 12:44                           ` Steven Rostedt
2014-02-12 12:44                             ` Steven Rostedt
2014-02-12  8:35                         ` Dave Chinner
2014-02-12  8:35                           ` Dave Chinner
2014-02-12 12:50                           ` Steven Rostedt
2014-02-12 12:50                             ` Steven Rostedt
2014-02-12 12:40                         ` Steven Rostedt
2014-02-12 12:40                           ` Steven Rostedt
2014-02-12 13:29                           ` Peter Zijlstra [this message]
2014-02-12 13:29                             ` Peter Zijlstra
2014-02-12 14:25                     ` Dave Jones
2014-02-12 14:25                       ` Dave Jones
2014-02-12 21:14                       ` Dave Chinner
2014-02-12 21:14                         ` Dave Chinner
2014-02-12 15:57                     ` Eric Sandeen
2014-02-12 15:57                       ` Eric Sandeen
2014-02-12  6:28                 ` Linus Torvalds
2014-02-12  6:28                   ` Linus Torvalds
2014-02-12  7:18                   ` Dave Chinner
2014-02-12  7:18                     ` Dave Chinner
2014-02-14  0:24                     ` Dave Chinner
2014-02-14  0:24                       ` Dave Chinner
2014-02-14 16:01                       ` Dave Jones
2014-02-14 16:01                         ` Dave Jones
2014-02-15 22:23                         ` Dave Chinner
2014-02-15 22:23                           ` Dave Chinner
2014-02-15 22:28                           ` Dave Jones
2014-02-15 22:28                             ` Dave Jones
2014-02-15 22:43                             ` Linus Torvalds
2014-02-15 22:43                               ` Linus Torvalds
2014-02-15 23:50                       ` Linus Torvalds
2014-02-15 23:50                         ` Linus Torvalds
2014-02-15 23:50                         ` Linus Torvalds
2014-02-18  1:27                         ` Dave Chinner
2014-02-18  1:27                           ` Dave Chinner
2014-02-18  1:27                           ` Dave Chinner
2014-02-12 11:39                   ` Al Viro
2014-02-12 11:39                     ` Al Viro
2014-02-12 20:13                     ` Linus Torvalds
2014-02-12 20:13                       ` Linus Torvalds
2014-02-12 21:14                       ` Al Viro
2014-02-12 21:14                         ` Al Viro
2014-02-12 21:32                         ` Linus Torvalds
2014-02-12 21:32                           ` Linus Torvalds
2014-02-12 21:44                           ` Al Viro
2014-02-12 21:44                             ` Al Viro
2014-02-13 20:51                             ` Al Viro
2014-02-13 20:51                               ` Al Viro
2014-02-14  0:09                               ` Al Viro
2014-02-14  0:09                                 ` Al Viro
2014-02-14 13:25                               ` Christoph Hellwig
2014-02-14 13:25                                 ` Christoph Hellwig
2014-02-14 13:29                                 ` Richard Weinberger
2014-02-14 13:29                                   ` Richard Weinberger
2014-02-14 15:20                                   ` Al Viro
2014-02-14 15:20                                     ` Al Viro
2014-02-14 16:08                                     ` Oleg Nesterov
2014-02-14 16:08                                       ` Oleg Nesterov
2014-02-13 17:40                           ` Oleg Nesterov
2014-02-13 17:40                             ` Oleg Nesterov
2014-02-13 17:58                             ` Linus Torvalds
2014-02-13 17:58                               ` Linus Torvalds
2014-02-13 18:10                               ` Oleg Nesterov
2014-02-13 18:10                                 ` Oleg Nesterov
2014-02-13 18:37                                 ` Oleg Nesterov
2014-02-13 18:37                                   ` Oleg Nesterov
2014-02-15  5:25                               ` Al Viro
2014-02-15  5:25                                 ` Al Viro
2014-02-15 14:27                                 ` Oleg Nesterov
2014-02-15 14:27                                   ` Oleg Nesterov
2014-02-15 15:22                                   ` Al Viro
2014-02-15 15:22                                     ` Al Viro
2014-02-15 15:33                                     ` Oleg Nesterov
2014-02-15 15:33                                       ` Oleg Nesterov
2014-02-15 15:36                                     ` Al Viro
2014-02-15 15:36                                       ` Al Viro
2014-02-15 15:58                                       ` Al Viro
2014-02-15 15:58                                         ` Al Viro
2014-02-15 16:59                                         ` Al Viro
2014-02-15 16:59                                           ` Al Viro
2014-02-15 17:43                                         ` Oleg Nesterov
2014-02-15 17:43                                           ` Oleg Nesterov
2014-02-15 18:05                                           ` Al Viro
2014-02-15 18:05                                             ` Al Viro
2014-02-15 18:45                                             ` Oleg Nesterov
2014-02-15 18:45                                               ` Oleg Nesterov
2014-02-17 16:57                                               ` Oleg Nesterov
2014-02-17 16:57                                                 ` Oleg Nesterov
2014-02-17 17:40                                                 ` Al Viro
2014-02-17 17:40                                                   ` Al Viro
2014-02-17 17:46                                                   ` Oleg Nesterov
2014-02-17 17:46                                                     ` Oleg Nesterov
2014-02-17 17:54                                                     ` Al Viro
2014-02-17 17:54                                                       ` Al Viro
2014-02-14 16:13                           ` Christoph Hellwig
2014-02-14 16:13                             ` Christoph Hellwig
2014-02-14 16:16                             ` Al Viro
2014-02-14 16:16                               ` Al Viro
2014-02-14 16:18                               ` Al Viro
2014-02-14 16:18                                 ` Al Viro
2014-02-14 16:19                               ` Christoph Hellwig
2014-02-14 16:19                                 ` Christoph Hellwig
2014-02-15 14:46                                 ` Oleg Nesterov
2014-02-15 14:46                                   ` Oleg Nesterov

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=20140212132952.GX27965@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=davej@redhat.com \
    --cc=david@fromorbit.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sandeen@sandeen.net \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xfs@oss.sgi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.