2014-01-14 23:20:36

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH v6 1/8] x86: allow to handle errors in text_poke function family


FYI, for future patches, start the subject with a capital letter. ie:
x86: Allow to handle errors in text_poke function family

On Tue, 10 Dec 2013 16:42:13 +0100
Petr Mladek <[email protected]> wrote:

> The text_poke functions called BUG() in case of error. This was too strict.
> There are situations when the system is still usable even when the patching
> has failed, for example when enabling the dynamic ftrace.
>
> This commit modifies text_poke and text_poke_bp functions to return an error
> code instead of calling BUG(). They used to return the patched address. But
> the address was just copied from the first parameter. It was no extra
> information and it has not been used anywhere yet.
>
> There are some situations where it is hard to recover from an error. Masami
> Hiramatsu <[email protected]> suggested to create
> text_poke*_or_die() variants for this purpose.

I don't like the "_or_die()". Although I don't care much about it, I'm
thinking the x86 maintainers might not like it either.

What about just doing the test in the places that would call "or_die"?

ret = text_poke*();
BUG_ON(ret);

?

-- Steve

>
> Last but not least, we modify return value of the text_poke_early() function.
> It is not capable of returning an error code. Let's return void to make
> it clear.
>
> Finally, we also need to modify the few locations where text_poke functions
> were used and the error code has to be handled now.
>
> Signed-off-by: Petr Mladek <[email protected]>
> ---


2014-01-21 13:00:42

by Petr Mladek

[permalink] [raw]
Subject: Re: [PATCH v6 1/8] x86: allow to handle errors in text_poke function family

On Tue, 2014-01-14 at 18:20 -0500, Steven Rostedt wrote:
> FYI, for future patches, start the subject with a capital letter. ie:
> x86: Allow to handle errors in text_poke function family
>
> On Tue, 10 Dec 2013 16:42:13 +0100
> Petr Mladek <[email protected]> wrote:
>
> > The text_poke functions called BUG() in case of error. This was too strict.
> > There are situations when the system is still usable even when the patching
> > has failed, for example when enabling the dynamic ftrace.
> >
> > This commit modifies text_poke and text_poke_bp functions to return an error
> > code instead of calling BUG(). They used to return the patched address. But
> > the address was just copied from the first parameter. It was no extra
> > information and it has not been used anywhere yet.
> >
> > There are some situations where it is hard to recover from an error. Masami
> > Hiramatsu <[email protected]> suggested to create
> > text_poke*_or_die() variants for this purpose.
>
> I don't like the "_or_die()". Although I don't care much about it, I'm
> thinking the x86 maintainers might not like it either.
>
> What about just doing the test in the places that would call "or_die"?
>
> ret = text_poke*();
> BUG_ON(ret);

Exactly this solution has been used in v5 of this patch set, see
https://lkml.org/lkml/2013/12/3/258

Masami suggested to use the "or_die()" because BUG_ON() was used on most
locations, see https://lkml.org/lkml/2013/12/6/1107

I personally do not have any strong opinion about it and will do
whatever makes x86 maintainers happy :-)

Best Regards,
Petr

2014-01-21 14:02:33

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH v6 1/8] x86: allow to handle errors in text_poke function family

On Tue, 21 Jan 2014 14:00:37 +0100
Petr Mladek <[email protected]> wrote:

> > > There are some situations where it is hard to recover from an error. Masami
> > > Hiramatsu <[email protected]> suggested to create
> > > text_poke*_or_die() variants for this purpose.
> >
> > I don't like the "_or_die()". Although I don't care much about it, I'm
> > thinking the x86 maintainers might not like it either.
> >
> > What about just doing the test in the places that would call "or_die"?
> >
> > ret = text_poke*();
> > BUG_ON(ret);
>
> Exactly this solution has been used in v5 of this patch set, see
> https://lkml.org/lkml/2013/12/3/258
>
> Masami suggested to use the "or_die()" because BUG_ON() was used on most
> locations, see https://lkml.org/lkml/2013/12/6/1107

If BUG_ON() is used in most locations, then we can make text_poke()
default to bug, and the just have a text_poke_safe() function that does
not bug. Or some similar name.

The "_die" has a bad taste in several developers mouth ;-)

-- Steve

Subject: Re: Re: [PATCH v6 1/8] x86: allow to handle errors in text_poke function family

(2014/01/21 23:02), Steven Rostedt wrote:
> On Tue, 21 Jan 2014 14:00:37 +0100
> Petr Mladek <[email protected]> wrote:
>
>>>> There are some situations where it is hard to recover from an error. Masami
>>>> Hiramatsu <[email protected]> suggested to create
>>>> text_poke*_or_die() variants for this purpose.
>>>
>>> I don't like the "_or_die()". Although I don't care much about it, I'm
>>> thinking the x86 maintainers might not like it either.
>>>
>>> What about just doing the test in the places that would call "or_die"?
>>>
>>> ret = text_poke*();
>>> BUG_ON(ret);
>>
>> Exactly this solution has been used in v5 of this patch set, see
>> https://lkml.org/lkml/2013/12/3/258
>>
>> Masami suggested to use the "or_die()" because BUG_ON() was used on most
>> locations, see https://lkml.org/lkml/2013/12/6/1107
>
> If BUG_ON() is used in most locations, then we can make text_poke()
> default to bug, and the just have a text_poke_safe() function that does
> not bug. Or some similar name.

Unfortunately, since still there is BUG_ON() in text_poke() when
we failed to modify text, I think text_poke_safe() is not a good
name too.

> The "_die" has a bad taste in several developers mouth ;-)

What about using text_poke() for BUG_ON and __text_poke()
for returning an error ? This may not change caller sites.

Thank you,

--
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]

2014-01-22 01:18:11

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH v6 1/8] x86: allow to handle errors in text_poke function family

On Wed, 22 Jan 2014 09:52:03 +0900
Masami Hiramatsu <[email protected]> wrote:

> What about using text_poke() for BUG_ON and __text_poke()
> for returning an error ? This may not change caller sites.
>


Sounds fine with me.

-- Steve