public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Slow loading big kernel module in 2.6 on PPC platform
@ 2005-09-28 19:29 Wilson Li
  2005-09-28 19:53 ` linux-os (Dick Johnson)
  2005-09-28 20:55 ` Bill Davidsen
  0 siblings, 2 replies; 13+ messages in thread
From: Wilson Li @ 2005-09-28 19:29 UTC (permalink / raw)
  To: linux-kernel

Hi,

I am trying to port several third party kernel modules from kernel
2.4 to 2.6 on a ppc (MPC824x) platform. For small size of modules, it
works perfectly in 2.6. But there's one huge kernel module which size
is about 2.7M bytes (size reported by lsmod after insmod), and it
takes about 90 seconds to load this module before init_module starts.
I did not notice there's such obvious delay in 2.4 kernel.

Initially I suspected there might be a problem of the insmod of
busybox I was using. I switched to module-init-tools-3.1 insmod. It
didn't help. I also tried other things like disabling CONFIG_KALLSYMS
and commenting out all the EXPORT_SYMBOLs in that module. Nothing
works so far. I've not been able to find any relevant thread about
slow loading of big kernel module on PPC platform.

Is this related to the new way of loading kernel module in 2.6 or
vmalloc since the kernel module also needs contiguous memory? I am
running 2.6.8 kernel on a ppc platform (MPC824x) with 24M bytes
memory visible to kernel. Two small kernel modules are loaded first
through shell command right after system boots up. And there are
about 10M bytes free memory left before loading this big chunk. The
memory seems big enough to me and memory is not that fragmented since
it just boots up. 

Any suggestions?

Thanks a lot,
Wilson Li






		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: Slow loading big kernel module in 2.6 on PPC platform
@ 2005-09-29  1:30 Samuel Masham
  2005-09-29 23:46 ` Wilson Li
  2005-09-30  2:57 ` Wilson Li
  0 siblings, 2 replies; 13+ messages in thread
From: Samuel Masham @ 2005-09-29  1:30 UTC (permalink / raw)
  To: Bill Davidsen, Linux Kernel Mailing List, Wilson Li
  Cc: Yamaguchi, Yohei, Tim Bird

> Wilson Li wrote:
> > Hi,
> > 
> > I am trying to port several third party kernel modules from
> kernel
> > 2.4 to 2.6 on a ppc (MPC824x) platform. For small size of
> modules, it
> > works perfectly in 2.6. But there's one huge kernel module which
> size
> > is about 2.7M bytes (size reported by lsmod after insmod), and it
> > takes about 90 seconds to load this module before init_module
> starts.
> > I did not notice there's such obvious delay in 2.4 kernel.

I assume you are on a slow ppc32 platform.

The time taken is a function of the number of symbols, you can work around it 
as shown in the patch below. Obviously this is just an example patch and is
NOT signed off for anything but reading :)

I would really like do some work on a pre-link for modules but don't really know 
where to start.

Any hints?

Samuel

ps Not subscribed, just  so please cc me

diff -ru src.orig/include/linux/moduleparam.h src/include/linux/moduleparam.h
--- src.orig/include/linux/moduleparam.h
+++ src/include/linux/moduleparam.h
@@ -85,6 +85,11 @@
 		      unsigned num,
 		      int (*unknown)(char *param, char *val));
 
+
+struct module;
+
+extern int parse_args_reloc(char ** args, struct module * me, int * core_size, int * init_size);
+
 /* All the helper functions */
 /* The macros to do compile-time type checking stolen from Jakub
    Jelinek, who IIRC came up with this idea for the 2.4 module init code. */
diff -ru src.orig/kernel/module.c src/kernel/module.c
--- src.orig/kernel/module.c
+++ src/kernel/module.c
@@ -1429,6 +1429,8 @@
 }
 #endif /* CONFIG_KALLSYMS */
 
+
+
 /* Allocate and load the module: note that size of section 0 is always
    zero, and we rely on this for optional sections. */
 static struct module *load_module(void __user *umod,
@@ -1446,7 +1448,9 @@
 	long err = 0;
 	void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */
 	struct exception_table_entry *extable;
-
+	int no_frob_arch_sections = 0;
+	int core_size=0, init_size=0;
+ 
 	DEBUGP("load_module: umod=%p, len=%lu, uargs=%p¥n",
 	       umod, len, uargs);
 	if (len < sizeof(*hdr))
@@ -1579,8 +1583,25 @@
 
 	mod->state = MODULE_STATE_COMING;
 
-	/* Allow arches to frob section contents and sizes.  */
-	err = module_frob_arch_sections(hdr, sechdrs, secstrings, mod);
+	if(strncmp("elf_plt_info=",args, strlen("elf_plt_info="))==0){
+		if(parse_args_reloc(&args, mod, &core_size, &init_size)) {
+			/* Allow passing hard coded relocation sizes. */
+			sechdrs[mod->arch.core_plt_section].sh_size = core_size;
+			sechdrs[mod->arch.init_plt_section].sh_size = init_size;
+			no_frob_arch_sections = 1;
+		} 	
+	}
+	
+	if(!no_frob_arch_sections) 
+	{
+		/* Allow arches to frob section contents and sizes.  */
+		err = module_frob_arch_sections(hdr, sechdrs, secstrings, mod);
+		printk("init_module: consider ¥"insmod %s elf_plt_info=%d,%d,%d,%d %s¥"¥n", mod->name,
+			mod->arch.core_plt_section, mod->arch.init_plt_section,
+			sechdrs[mod->arch.core_plt_section].sh_size, sechdrs[mod->arch.init_plt_section].sh_size, args);
+	}
+
+
 	if (err < 0)
 		goto free_mod;
 
diff -ru src.orig/kernel/params.c src/kernel/params.c
--- src.orig/kernel/params.c
+++ src/kernel/params.c
@@ -164,6 +164,17 @@
 	return 0;
 }
 
+
+int parse_args_reloc(char ** args, struct module *me, int* core_size, int* init_size){
+	char *param, *val;
+	int ret=0;
+	*args = next_arg(*args, &param, &val);//args pointing to next of elf_plt_info=x,y.z,v
+	ret = sscanf(val, "%d,%d,%d,%d",	
+		&me->arch.core_plt_section, &me->arch.init_plt_section, core_size, init_size);
+	if(ret!=4) return 0;  /* fail */
+        return 1;             /* success */
+}
+
 /* Lazy bastard, eh? */
 #define STANDARD_PARAM_DEF(name, type, format, tmptype, strtolfn)      	¥
 	int param_set_##name(const char *val, struct kernel_param *kp)	¥








^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2005-09-30 15:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-28 19:29 Slow loading big kernel module in 2.6 on PPC platform Wilson Li
2005-09-28 19:53 ` linux-os (Dick Johnson)
2005-09-28 22:27   ` Wilson Li
2005-09-29 13:04     ` linux-os (Dick Johnson)
2005-09-29 23:50       ` Wilson Li
2005-09-30 15:46         ` linux-os (Dick Johnson)
2005-09-28 20:55 ` Bill Davidsen
2005-09-28 21:37   ` Wilson Li
2005-09-29  7:36     ` Arjan van de Ven
  -- strict thread matches above, loose matches on Subject: below --
2005-09-29  1:30 Samuel Masham
2005-09-29 23:46 ` Wilson Li
2005-09-30  0:58   ` Wilson Li
2005-09-30  2:57 ` Wilson Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox