[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0902041605140.32142@vinegar-pot.mit.edu>
Date: Wed, 4 Feb 2009 16:31:16 -0500 (EST)
From: Anders Kaseorg <andersk@....EDU>
To: Rusty Russell <rusty@...tcorp.com.au>
cc: Jeff Arnold <jbarnold@....edu>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
Denys Vlasenko <vda.linux@...glemail.com>,
Tim Abbott <tabbott@....edu>, Waseem Daher <wdaher@....edu>,
Nikanth Karthikesan <knikanth@...e.de>
Subject: Re: [PATCH 5/7] Ksplice: Add functions for walking kallsyms
symbols
On Wed, 4 Feb 2009, Rusty Russell wrote:
> Seems reasonable. Did you really not want a name-filtering version? That
> might be generally useful.
We don’t actually want a name-filtering version for Ksplice. We process
all the symbols we need in one pass, in order to avoid traversing the
kallsyms list separately for each symbol.
> But does no locking at all. It either needs a comment that it can only be
> called from inside stop_machine, or that it needs preempt disabled, or
> whatever.
It might as well use preempt_disable() and RCU itself (patch below).
> Is the !CONFIG_KALLSYMS version useful to you? If not, please don't
> implement the noop version. I want someone who *does* expect it to work to
> have to think about it if they use it...
No, we don’t have a particular use for it; we added it for consistency
with kallsyms_lookup_name(), etc.
Anders
diff --git a/kernel/module.c b/kernel/module.c
index 556112c..6bb5814 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2577,17 +2577,20 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
{
struct module *mod;
unsigned int i;
- int ret;
+ int ret = 0;
- list_for_each_entry(mod, &modules, list) {
+ preempt_disable();
+ list_for_each_entry_rcu(mod, &modules, list) {
for (i = 0; i < mod->num_symtab; i++) {
ret = fn(data, mod->strtab + mod->symtab[i].st_name,
mod, mod->symtab[i].st_value);
if (ret != 0)
- return ret;
+ goto out;
}
}
- return 0;
+out:
+ preempt_enable();
+ return ret;
}
#endif /* CONFIG_KALLSYMS */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists