mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Petr Mládek" <pmladek@suse.cz>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Jiri Kosina <jkosina@suse.cz>,
	linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH 0/4] x86: Fix ftrace recovery when code modification failed
Date: Fri, 21 Feb 2014 13:01:02 -0500	[thread overview]
Message-ID: <20140221130102.31253ad2@gandalf.local.home> (raw)
In-Reply-To: <20140221163351.GA1833@pathway.suse.cz>

On Fri, 21 Feb 2014 17:33:52 +0100
Petr Mládek <pmladek@suse.cz> wrote:
 
> Yes, it works but I would still do few more changes:
> 
>      + run_sync() also in ftrace_modify_code() in the recovery
>        part; I would solve this by moving the "out" label.

Sounds good.

> 
>      + print some warning in update_ftrace_func() when
>        ftrace_modify_code() fails; otherwise, the error
>        is silently ignored

The error is passed down to the callers. Any warning should happen
there. We can move that up to the generic code. Otherwise, this is a
x86 only fix, and we leave all the other archs broken.

ftrace_modify_all_code() looks to be where the warnings should be. And
yes, any warning should also call ftrace_bug(). That can be done via a
FTRACE_WARN_ON().

> 
>      + BUG when the breakpoint cannot be removed; the system
>        silently crash anyway because the breakpoint will not
>        be handled
> 
> I wonder if we should call FTRACE_WARN_ON_ONCE that calls
> "ftrace_kill" when update_ftrace_func() fails.

Don't need the _ONCE() version. Something like this (I'll let you make
the patch ;-)

	int ret = 0;

	if (update)
		ret = ftrace_update_ftrace_func(ftrace_ops_list_func);
	if (ret)
		goto out;

	if (command & FTRACE_UPDATE_CALLS)
		ret = ftrace_replace_code(1);
	else if (command & FTRACE_DISABLE_CALLS)
		ret = ftrace_replace_code(0);

	if (ret)
		goto out;

	if (update && ftrace_trace_function != ftrace_ops_list_func) {
		function_trace_op = set_function_trace_op;
		smp_wmb();
		/* If irqs are disabled, we are in stop machine */
		if (!irqs_disabled())
			smp_call_function(ftrace_sync_ipi, NULL, 1);
		ret = ftrace_update_ftrace_func(ftrace_trace_function);
	}

	if (ret)
		goto out;

	if (command & FTRACE_START_FUNC_RET)
		ret = ftrace_enable_ftrace_graph_caller();
	else if (command & FTRACE_STOP_FUNC_RET)
		ret = ftrace_disable_ftrace_graph_caller();

out:
	FTRACE_WARN_ON(ret);

Or if you want to keep where it failed, just replace the if (ret) goto
out, with:

	if (FTRACE_WARN_ON(ret))
		return;

That may actually be better.

I've already added my patch. I'll push it up to my ftrace/urgent branch
at

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git

And you can write a patch based on that.

Thanks!

-- Steve


      reply	other threads:[~2014-02-21 18:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17 15:22 Petr Mladek
2014-02-17 15:22 ` [PATCH 1/4] x86: Clean up remove_breakpoint() in ftrace code Petr Mladek
2014-02-17 15:22 ` [PATCH 2/4] x86: Fix ftrace patching recovery code to work on x86_64 Petr Mladek
2014-02-17 15:22 ` [PATCH 3/4] x86: BUG when ftrace patching recovery fails Petr Mladek
2014-02-17 15:22 ` [PATCH 4/4] x86: Fix order of warning messages when ftrace modifies code Petr Mladek
2014-03-06 23:19   ` Steven Rostedt
2014-03-07  8:43     ` Petr Mládek
2014-03-07 18:15       ` Steven Rostedt
2014-03-07 18:18   ` Steven Rostedt
2014-03-10  8:37     ` Petr Mládek
2014-03-10 12:50       ` Steven Rostedt
2014-02-21  4:23 ` [PATCH 0/4] x86: Fix ftrace recovery when code modification failed Steven Rostedt
2014-02-21 16:33   ` Petr Mládek
2014-02-21 18:01     ` Steven Rostedt [this message]

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=20140221130102.31253ad2@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=fweisbec@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=pmladek@suse.cz \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®