lkml.org 
[lkml]   [2020]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 4/5] x86/ftrace: Add annotations for ftrace_arch_code_modify_prepare() and ftrace_arch_code_modify_post_process()
    On Mon,  1 Jun 2020 19:45:51 +0100
    Jules Irenge <jbi.octave@gmail.com> wrote:

    > Sparse reports warnings
    >
    > warning: context imbalance in ftrace_arch_code_modify_prepare()
    > - wrong count at exit
    > warning: context imbalance in ftrace_arch_code_modify_post_process()
    > - wrong count at exit
    >
    > The root cause is that even if
    > the annotations on the function are correct,
    > mutex do not support annotation
    > This makes Sparse to complain.
    > To fix this,
    > __acquire(&text_mutex) and
    > __release(&text_mutex) annotations are added
    > inside ftrace_arch_code_modify_prepare()
    > and ftrace_arch_code_modify_post_process()
    > respectively.

    Wait what? This looks like either a bug in sparse, or we just remove the
    annotations. This just makes the code ugly, and looks silly.

    Nack!

    -- Steve


    >
    > Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
    > ---
    > arch/x86/kernel/ftrace.c | 2 ++
    > 1 file changed, 2 insertions(+)
    >
    > diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
    > index 37a0aeaf89e7..737c07ab2e07 100644
    > --- a/arch/x86/kernel/ftrace.c
    > +++ b/arch/x86/kernel/ftrace.c
    > @@ -46,6 +46,7 @@ int ftrace_arch_code_modify_prepare(void)
    > * ftrace has it set to "read/write".
    > */
    > mutex_lock(&text_mutex);
    > + __acquire(&text_mutex);
    > ftrace_poke_late = 1;
    > return 0;
    > }
    > @@ -61,6 +62,7 @@ int ftrace_arch_code_modify_post_process(void)
    > text_poke_finish();
    > ftrace_poke_late = 0;
    > mutex_unlock(&text_mutex);
    > + __release(&text_mutex);
    > return 0;
    > }
    >

    \
     
     \ /
      Last update: 2020-06-01 21:47    [W:2.115 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site