public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Thomas Gleixner <tglx@linutronix.de>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	jbaron@redhat.com, rostedt@goodmis.com,
	linux-kernel@vger.kernel.org, mingo@elte.hu, hpa@zytor.com,
	roland@redhat.com, rth@redhat.com, mhiramat@redhat.com,
	fweisbec@gmail.com, avi@redhat.com, davem@davemloft.net,
	vgoyal@redhat.com, sam@ravnborg.org, tony@bakeyournoodle.com,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 1/2] Add for_each_module iterator function
Date: Wed, 22 Sep 2010 10:03:11 -0400	[thread overview]
Message-ID: <20100922140310.GA30730@Krystal> (raw)
In-Reply-To: <alpine.LFD.2.00.1009221424590.2416@localhost6.localdomain6>

* Thomas Gleixner (tglx@linutronix.de) wrote:
> 
> 
> On Wed, 22 Sep 2010, Andi Kleen 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.
> > 
> > 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..b8fb3e6 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;
> > +
> > +	preempt_disable();
> 
>   That wants rcu_read_lock()

Then we might need to add synchronize_rcu() call when modules are
unloaded. For now, there is only synchronize_sched().

Mathieu

> 
> > +	list_for_each_entry_rcu(mod, &modules, list)
> > +		op(mod, arg);
> > +	preempt_enable();
> 
> Thanks,
> 
> 	tglx

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

      parent reply	other threads:[~2010-09-22 14:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-22 10:08 [PATCH 1/2] Add for_each_module iterator function Andi Kleen
2010-09-22 10:08 ` [PATCH 2/2] Rewrite jump_label.c to use binary search Andi Kleen
2010-09-22 11:31   ` Mathieu Desnoyers
2010-09-22 11:56     ` Andi Kleen
2010-09-22 12:04       ` Andi Kleen
2010-09-22 15:02         ` Mathieu Desnoyers
2010-09-22 15:07           ` Mathieu Desnoyers
2010-09-22 15:43             ` Jason Baron
2010-09-22 15:28           ` Jason Baron
2010-09-22 19:19             ` Mathieu Desnoyers
2010-09-22 13:46       ` Jason Baron
2010-09-22 18:14       ` Jason Baron
2010-09-22 11:57     ` Frederic Weisbecker
2010-09-22 16:12   ` H. Peter Anvin
2010-09-22 19:43     ` Mathieu Desnoyers
2010-09-22 20:06       ` H. Peter Anvin
2010-09-22 20:41         ` Mathieu Desnoyers
2010-09-22 20:54           ` H. Peter Anvin
2010-09-22 12:25 ` [PATCH 1/2] Add for_each_module iterator function Thomas Gleixner
2010-09-22 12:52   ` Andi Kleen
2010-09-22 14:03   ` Mathieu Desnoyers [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=20100922140310.GA30730@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=avi@redhat.com \
    --cc=davem@davemloft.net \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@redhat.com \
    --cc=mingo@elte.hu \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=roland@redhat.com \
    --cc=rostedt@goodmis.com \
    --cc=rth@redhat.com \
    --cc=sam@ravnborg.org \
    --cc=tglx@linutronix.de \
    --cc=tony@bakeyournoodle.com \
    --cc=vgoyal@redhat.com \
    /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