From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Nigel Cunningham <nigel@nigel.suspend2.net>,
Pavel Machek <pavel@ucw.cz>, LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: ftraced and suspend to ram
Date: Thu, 21 Aug 2008 21:59:36 +0200 [thread overview]
Message-ID: <200808212159.37678.rjw@sisk.pl> (raw)
In-Reply-To: <200808212037.11775.rjw@sisk.pl>
On Thursday, 21 of August 2008, Rafael J. Wysocki wrote:
> On Thursday, 21 of August 2008, Steven Rostedt wrote:
> >
> > On Thu, 21 Aug 2008, Rafael J. Wysocki wrote:
> >
> > > On Thursday, 21 of August 2008, Steven Rostedt wrote:
> > > >
> > > > In latest 2.6.27(git) enabling dynamic ftrace makes resume from a suspend
> > > > to ram reboot instead of resuming. Queued for 2.6.28 is a new method of
> > > > recording mcount callers at compile time that does not have this issue.
> > > >
> > > > But the new method is still too "green" to be pulled into 27, so the old
> > > > ftraced (daemon method) needs to be fixed for 27.
> > > >
> > > > The way dynamic ftrace works with the daemon method is this. On boot up
> > > > the mcount function simply returns. When ftrace is initialized, it calls
> > > > kstop_machine to modify the mcount function to call another function
> > > > called "ftrace_record_ip". This new function will record in a preallocated
> > > > hash (allocated by the ftrace initializer) all the callers of mcount. A
> > > > check is made to see if the caller has already been put into the hash, and
> > > > if so, it is not recorded again.
> > > >
> > > > Later on a kernel thread ftraced is created. This kernel thread wakes up
> > > > once a second and checks to see if any new functions were added to the
> > > > hash. If so, it then calls kstop_machine and modifies those callers to
> > > > mcount into nops.
> > > >
> > > > Again, this daemon method makes resume from suspend to ram reboot instead
> > > > of resuming. Now, I'm asking the s2r gurus, what did I miss? Do I need to
> > > > add a "NO_FREEZE" flag or something to the "ftraced" kernel thread?
> > > >
> > > > Just asking for some advice.
> > >
> > > If I'm not mistaken, it'll probably suffice to make it freezable, so that it
> > > doesn't run while the system is suspending and resuming. Would that be
> > > acceptable?
> >
> > Does it not freeze by default.
>
> No, it doesn't. Kernel threads are not freezable by default
>
> > > Please tell me where exactly the ftraced source code is located.
> >
> > It's in Linus's latest git tree.
> >
> > The code in question is the ftraced() function in kernel/trace/ftrace.c
>
> Thanks, I'll have a look in a while.
Can you try the appended patch, please?
Thanks,
Rafael
---
kernel/trace/ftrace.c | 5 +++++
1 file changed, 5 insertions(+)
Index: linux-2.6/kernel/trace/ftrace.c
===================================================================
--- linux-2.6.orig/kernel/trace/ftrace.c
+++ linux-2.6/kernel/trace/ftrace.c
@@ -796,8 +796,13 @@ static int ftraced(void *ignore)
{
unsigned long usecs;
+ set_freezable();
+
while (!kthread_should_stop()) {
+ if (try_to_freeze())
+ continue;
+
set_current_state(TASK_INTERRUPTIBLE);
/* check once a second */
next prev parent reply other threads:[~2008-08-21 19:56 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-21 15:49 ftraced and suspend to ram Steven Rostedt
2008-08-21 18:15 ` Rafael J. Wysocki
2008-08-21 18:26 ` Steven Rostedt
2008-08-21 18:37 ` Rafael J. Wysocki
2008-08-21 19:59 ` Rafael J. Wysocki [this message]
2008-08-22 4:46 ` Ingo Molnar
2008-08-22 7:23 ` Pavel Machek
2008-08-22 10:35 ` Marcin Slusarz
2008-08-22 10:46 ` Pavel Machek
2008-08-22 20:33 ` Steven Rostedt
2008-08-22 20:52 ` Rafael J. Wysocki
2008-08-22 20:55 ` Steven Rostedt
2008-08-22 21:11 ` Rafael J. Wysocki
2008-08-27 13:14 ` [PATCH] ftrace: disable tracing for " Steven Rostedt
2008-08-27 13:26 ` Rafael J. Wysocki
2008-08-28 12:39 ` [PATCH] ftrace: disable tracing for hibernation Rafael J. Wysocki
2008-08-28 12:42 ` Ingo Molnar
2008-08-28 12:44 ` Steven Rostedt
2008-08-29 23:53 ` Pavel Machek
2008-08-27 21:27 ` [PATCH] ftrace: disable tracing for suspend to ram Marcin Slusarz
2008-08-28 7:28 ` Pavel Machek
2008-08-29 13:43 ` Steven Rostedt
2008-08-22 16:39 ` ftraced and " Rafael J. Wysocki
2008-08-22 20:54 ` Marcin Slusarz
2008-08-22 21:17 ` Rafael J. Wysocki
2008-08-23 4:18 ` Russ Dill
2008-08-22 10:22 ` Rafael J. Wysocki
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=200808212159.37678.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=nigel@nigel.suspend2.net \
--cc=pavel@ucw.cz \
--cc=rostedt@goodmis.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox