lkml.org 
[lkml]   [2010]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/2] Add for_each_module iterator function v2
    On Wed, Sep 22, 2010 at 10:14:32AM -0400, Mathieu Desnoyers wrote:
    > * Andi Kleen (andi@firstfloor.org) wrote:
    > > From: Andi Kleen <ak@linux.intel.com>
    > >
    > > This is a generic function to iterate over all modules.
    > > To be used in the next patch.
    > >
    > > v2: Use module_mutex instead of preempt disabling
    > >
    > > Signed-off-by: Andi Kleen <ak@linux.intel.com>
    > > ---
    > > include/linux/module.h | 1 +
    > > kernel/module.c | 10 ++++++++++
    > > 2 files changed, 11 insertions(+), 0 deletions(-)
    > >
    > > diff --git a/include/linux/module.h b/include/linux/module.h
    > > index 403ac26..809b6db 100644
    > > --- a/include/linux/module.h
    > > +++ b/include/linux/module.h
    > > @@ -410,6 +410,7 @@ struct module *__module_address(unsigned long addr);
    > > bool is_module_address(unsigned long addr);
    > > bool is_module_percpu_address(unsigned long addr);
    > > bool is_module_text_address(unsigned long addr);
    > > +void for_each_module(void (*op)(struct module *, void *arg), void *arg);
    > >
    > > static inline int within_module_core(unsigned long addr, struct module *mod)
    > > {
    > > diff --git a/kernel/module.c b/kernel/module.c
    > > index eba1341..9e2a561 100644
    > > --- a/kernel/module.c
    > > +++ b/kernel/module.c
    > > @@ -384,6 +384,16 @@ struct module *find_module(const char *name)
    > > }
    > > EXPORT_SYMBOL_GPL(find_module);
    > >
    > > +void for_each_module(void (*op)(struct module *, void *arg), void *arg)
    > > +{
    > > + struct module *mod;
    > > +
    > > + mutex_lock(&module_mutex);
    >
    > I'm concerned about the following mutex dependency chain:
    >
    > module_mutex -> jump_label_mutex (on module load)

    with the new code, this path doesn't exist. No state needs to be updated
    at this point.

    > jump_label_mutex -> module_mutex (on jump_label_update)
    >
    > Actually, I think your module notifier is missing in your version. This
    > is why you don't see this dependency problem.
    >

    the jump label design in stateless. When a new module is loaded the
    module notifier in the tracepoint call will call jump_label_update via
    enable_jump_label(). Since the module is on the the module_list before
    the notifier, I think this is ok.

    thanks,

    -Jason


    \
     
     \ /
      Last update: 2010-09-22 16:33    [W:0.026 / U:211.820 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site