Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: -current amd64 diagnostic panic while loading compat_linux32 module twice



On Sat, Feb 21, 2009 at 12:51:00AM +0000, Andrew Doran wrote:
> On Sat, Feb 21, 2009 at 01:27:59AM +0100, Nicolas Joly wrote:
> 
> > > Can you try changing uvm_map_setup to uvm_map_setup_kernel and see if that
> > > helps? If not print the vm_map structure with "show map module_map_store".
> > 
> > Not sure about that change, it doesn't compile. uvm_map_setup() use a
> > struct vm_map, but uvm_map_setup_kernel() use struct vm_map_kernel
> > which looks like a different beast ...
> 
> Ah, ok. You would need to change module_map_store to be a vm_map_kernel. The
> symbol should be defined in machdep.c already. module_map would then point
> to &module_map_store.vmk_map. Once done you should be able to change the
> call in amd64/machdep.c to uvm_map_setup_kernel(). I think this will fix the
> panic.

With the attached patch, it does not panic anymore ... Great.

root@lanfeust [~]# modstat | grep linux
root@lanfeust [~]# modload compat_linux
root@lanfeust [~]# modload compat_linux32
root@lanfeust [~]# modstat | grep linux  
compat_linux    misc    filesys 1       1147014 
compat,compat_ossaudio,exec_elf64
compat_linux32  misc    filesys 0       1059750 
compat_linux,exec_elf32,compat_netbsd32
root@lanfeust [~]# modload compat_linux32
modload: Cannot allocate memory

> > objdump -h output attached.
> 
> That's not too bad at all, thanks. What about the LOAD sections? You can see
> them with objdump -x at least.
4.6 MB is too big to be posted here ... I made it is available at:

     ftp://ftp.pasteur.fr/pub/computing/NetBSD/misc/objdump-x.mod

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.
Index: sys/arch/amd64/amd64/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amd64/amd64/machdep.c,v
retrieving revision 1.127
diff -u -p -r1.127 machdep.c
--- sys/arch/amd64/amd64/machdep.c      17 Feb 2009 01:39:25 -0000      1.127
+++ sys/arch/amd64/amd64/machdep.c      21 Feb 2009 01:11:30 -0000
@@ -258,7 +258,7 @@ vaddr_t lo32_vaddr;
 paddr_t lo32_paddr;
 
 vaddr_t module_start, module_end;
-static struct vm_map module_map_store;
+static struct vm_map_kernel module_map_store;
 extern struct vm_map *module_map;
 vaddr_t kern_end;
 
@@ -359,9 +359,9 @@ cpu_startup(void)
        mb_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
            nmbclusters * mclbytes, VM_MAP_INTRSAFE, false, NULL);
 
-       uvm_map_setup(&module_map_store, module_start, module_end, 0);
-       module_map_store.pmap = pmap_kernel();
-       module_map = &module_map_store;
+       uvm_map_setup_kernel(&module_map_store, module_start, module_end, 0);
+       module_map_store.vmk_map.pmap = pmap_kernel();
+       module_map = &module_map_store.vmk_map;
 
        format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
        printf("avail memory = %s\n", pbuf);


Home | Main Index | Thread Index | Old Index