Ok, I seem to have sent an earlier and not-well-though-out version of
the patch - attaching the correct one now (I dug into this a couple of
months ago and needed some time to remember the details). I tried it
with your test setup and - module loads/unloads cleanly, but will
freeze the vbox FreeBSD 10 host if I try to run openbsd 5.5 VM (my
FreeBSD current host freezes too if I try to run a VirtualBox VM with
vmm.ko and nmdm.ko modules loaded, not sure why).

I tested it again on a FreeBSD current host running on real hardware
with a number of VMs/OSes and the results I got are  -

* Ubuntu-12.04.4 both amd64 and i386 fail to boot from CD - get stuck
somewhere after a purple screen
* Debian 7.3.0 both amd64 and i386 boot and install fine from  CD,
booting from hard disk gets stuck at GRUB though
* FreeBSD 10 i386 boots from CD and disk, however is very slow
(installation took literally several hours)
* pfSense 2.1 i386 works fine
* OpenBSD 5.5 i386 boots and installs from CD, boots from disk after
installation only when ACPI is disabled at boot
* OpenBSD 5.5 amd64 boots and installs from CD, booting the installed
OS from disk however crashes qemu late around starting sndiod with

RAX=0000000000000000 RBX=00001a938686c340 RCX=00001a91832031e5
RSI=0000000000000012 RDI=00001a938686c350 RBP=00001a938dfb6f60
R8 =00001a938dfb6f60 R9 =000000000000000d R10=0000000000000000
R12=00001a91832031e5 R13=0000000000000012 R14=00001a9392ff4000
RIP=00001a938db21c7d RFL=00010246 [---Z-P-] CPL=3 II=0 A20=1 SMM=0
ES =0023 0000000000000000 ffffbfff 00aff300 DPL=3 DS16 [-WA]
CS =002b 0000000000000000 ffffbfff 00affb00 DPL=3 CS64 [-RA]
SS =0023 0000000000000000 ffffbfff 00aff300 DPL=3 DS16 [-WA]
DS =0023 0000000000000000 ffffbfff 00aff300 DPL=3 DS16 [-WA]
FS =0023 0000000000000000 ffffbfff 00aff300 DPL=3 DS16 [-WA]
GS =0023 0000000000000000 ffffbfff 00aff300 DPL=3 DS16 [-WA]
LDT=0000 0000000000000000 00000000 00008200 DPL=0 LDT
TR =0030 ffff800000011000 00000067 00008900 DPL=0 TSS64-avl
GDT=     ffff800000011068 0000003f
IDT=     ffff800000010000 00000fff
CR0=e001003b CR2=00001a938686c348 CR3=000000003f498000 CR4=000007b0
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000
DR6=00000000ffff0ff0 DR7=0000000000000400
Unsupported return value: 0xffffffff


kqemu: closed by pid=26323
kqemu: aborting: Unexpected exception 0x0d in monitor space

in dmesg. This however looks like a problem with kqemu-kmod not
related to the KPI changes. I tested this with kqemu-kmod-devel with
the patch applied and qemu-0.11.1_13 since obviously KQEMU support was
dropped in later versions. Considering that kqemu support was dropped
in newer versions of qemu however, the patch is probably useless and
kqemu-kmod ports should just be marked obsolete.


On Thu, Feb 6, 2014 at 10:12 PM, Juergen Lock <n...@jelal.kn-bremen.de> wrote:

> The commit does look relevant but testing your patch on a 10.0-RC1
> vbox guest (it's what I had available) with the RC1 iso like so:
>         # kldload kqemu
>         % qemu-system-x86_64 -cdrom /dev/cd0 -m 512 -curses -enable-kqemu
> panics like this:
> ----------------------------------------------------------
> 10rc1amd64mbr2 dumped core - see /var/crash/vmcore.1
--- kqemu-freebsd.c~    2014-02-07 20:00:33.656255395 +0200
+++ kqemu-freebsd.c     2014-02-08 08:43:19.209100708 +0200
@@ -105,17 +105,29 @@
 struct kqemu_page *CDECL kqemu_alloc_zeroed_page(unsigned long *ppage_index)
+#if __FreeBSD_version < 1000030
     pmap_t pmap;
     vm_offset_t va;
     vm_paddr_t pa;
+#if __FreeBSD_version >= 1000030
+    va = kmem_malloc(kernel_arena, PAGE_SIZE, M_ZERO | M_WAITOK);
     va = kmem_alloc(kernel_map, PAGE_SIZE);
     if (va == 0) {
        kqemu_log("kqemu_alloc_zeroed_page: NULL\n");
        return NULL;
+#if __FreeBSD_version >= 1000030
+    pa = vtophys(va);
     pmap = vm_map_pmap(kernel_map);
     pa = pmap_extract(pmap, va);
     /* kqemu_log("kqemu_alloc_zeroed_page: %08x\n", pa); */
     *ppage_index = pa >> PAGE_SHIFT;
     return (struct kqemu_page *)va;
@@ -125,7 +137,11 @@
     if (kqemu_debug > 0)
        kqemu_log("kqemu_free_page(%p)\n", page);
+#if __FreeBSD_version >= 1000030
+    kmem_free(kernel_arena, (vm_offset_t) page, PAGE_SIZE);
     kmem_free(kernel_map, (vm_offset_t) page, PAGE_SIZE);
 /* return kernel address of the physical page page_index */
freebsd-virtualization@freebsd.org mailing list
To unsubscribe, send any mail to 

Reply via email to