Port-xen archive

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

Module support in a NetBSD domU



Hello,

I'm trying to use kernel modules a NetBSD domU and not having much success. Is this not possible?

I'm running NetBSD 5.99.5 with the current- kernel. In a non- virtualized NetBSD OS, I can use modules without a problem. But with a Linux dom0, latest Xen 3 testing snapshot, and NetBSD domU, inserting module fails during a memory allocation. Digging into this, I found that the module_map VM object has module_start = module_end = 0 when running under Xen. Instead of "fixing" this, I changed kern/ kern_module to allocate module memory from kernel_map, instead of module_map. Unfortunately, this didn't fix the problem. I got the following stacktrace when inserting the module:

panic: xpq_flush_cache
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip ffffffff8012983d cs e030 rflags 246 cr2 ffffa0004658e000 cpl 6 rsp ffffa00045ac1b00
Stopped in pid 0.7 (system) at  netbsd:breakpoint+0x5:  leave
breakpoint() at netbsd:breakpoint+0x5
panic() at netbsd:panic+0x255
xpq_flush_cache() at netbsd:xpq_flush_cache+0x58
xc_thread() at netbsd:xc_thread+0x65

(I should note that I had to enable module support in the kernel config file. The GENERIC configuration enabled support for modules, but the XEN3_DOMU configuration did not.)

Debugging the above panic, I found that xpq_flush_cache panicked because the MMUEXT_FLUSH_CACHE hypercall failed. In turn, "xm dmesg" shows that Xen was disallowing the MMUEXT_FLUSH_CACHE hypercall for a VM without "cache_flush_permitted" privilages. So I changed Xen's xen/ arch/x86/mm.c's MMUEXT_FLUSH_CACHE handler to allow any VM to make this hypercall. Unfortunately, the NetBSD domU still crashed, with the following stacktrace:

uvm_fault(0xffffffff805d0b00, 0xffffa00080302000, 4) -> e
fatal page fault in supervisor mode
trap type 6 code 10 rip ffffa00080302060 cs e030 rflags 10246 cr2 ffffa00080302
kernel: page fault trap, code=0
Stopped in pid 408.1 (modload) at 0xffffa00080302060:uvm_fault(0xffffa0004
fatal page fault in supervisor mode
trap type 6 code 0 rip ffffffff80131c7e cs e030 rflags 10202 cr2 7fbfe8002008 c
     kernel: page fau
lt trap, code=0
Stopped in pid 408.1 (modload) at netbsd:db_disasm+0x4e: cmpb $0,0(%rb
x)
db_disasm() at netbsd:db_disasm+0x4e
db_trap() at netbsd:db_trap+0xd8
kdb_trap() at netbsd:kdb_trap+0xc2
trap() at netbsd:trap+0x55f

Any help would be greatly appreciated. This is my first experience with NetBSD so I'm a bit new here.

Thanks in advance,
Mike


Home | Main Index | Thread Index | Old Index