lkml.org 
[lkml]   [2018]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH RFC 01/19] kallsyms: Simplify update_iter_mod()
Date
> -----Original Message-----
> From: Jiri Olsa [mailto:jolsa@redhat.com]
> Sent: Thursday, May 10, 2018 4:02 PM
> To: Hunter, Adrian <adrian.hunter@intel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>; Arnaldo Carvalho de Melo
> <acme@kernel.org>; Ingo Molnar <mingo@redhat.com>; Peter Zijlstra
> <peterz@infradead.org>; Andy Lutomirski <luto@kernel.org>; H. Peter
> Anvin <hpa@zytor.com>; Andi Kleen <ak@linux.intel.com>; Alexander
> Shishkin <alexander.shishkin@linux.intel.com>; Dave Hansen
> <dave.hansen@linux.intel.com>; Joerg Roedel <joro@8bytes.org>; linux-
> kernel@vger.kernel.org; x86@kernel.org
> Subject: Re: [PATCH RFC 01/19] kallsyms: Simplify update_iter_mod()
>
> On Wed, May 09, 2018 at 02:43:30PM +0300, Adrian Hunter wrote:
> > Simplify logic in update_iter_mod().
> >
> > Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> > ---
> > kernel/kallsyms.c | 20 ++++++--------------
> > 1 file changed, 6 insertions(+), 14 deletions(-)
> >
> > diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index
> > a23e21ada81b..eda4b0222dab 100644
> > --- a/kernel/kallsyms.c
> > +++ b/kernel/kallsyms.c
> > @@ -510,23 +510,15 @@ static int update_iter_mod(struct kallsym_iter
> > *iter, loff_t pos) {
> > iter->pos = pos;
> >
> > - if (iter->pos_ftrace_mod_end > 0 &&
> > - iter->pos_ftrace_mod_end < iter->pos)
> > - return get_ksymbol_bpf(iter);
> > -
> > - if (iter->pos_mod_end > 0 &&
> > - iter->pos_mod_end < iter->pos) {
> > - if (!get_ksymbol_ftrace_mod(iter))
> > - return get_ksymbol_bpf(iter);
> > + if ((!iter->pos_mod_end || iter->pos_mod_end > pos) &&
> > + get_ksymbol_mod(iter))
> > return 1;
>
> hum, should that be iter-> pos_mod_end >= pos ?

But module_get_kallsym() returned -1 when pos_mod_end was set to pos.

>
>
> > - }
> >
> > - if (!get_ksymbol_mod(iter)) {
> > - if (!get_ksymbol_ftrace_mod(iter))
> > - return get_ksymbol_bpf(iter);
> > - }
> > + if ((!iter->pos_ftrace_mod_end || iter->pos_ftrace_mod_end >
> pos) &&
> > + get_ksymbol_ftrace_mod(iter))
>
> same here? iter->pos_ftrace_mod_end >= pos
>
> jirka
>
> > + return 1;
> >
> > - return 1;
> > + return get_ksymbol_bpf(iter);
> > }
> >
> > /* Returns false if pos at or past end of file. */
> > --
> > 1.9.1
> >

\
 
 \ /
  Last update: 2018-05-10 19:03    [W:0.051 / U:0.836 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site