All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Yao <ryao@gentoo.org>
To: qemu-devel@nongnu.org
Cc: kernel@gentoo.org, v9fs-developer@lists.sourceforge.net,
	virtualization@lists.linux-foundation.org
Subject: Re: QEMU dies on any attempt to load a Linux kernel module when using a 9P rootfs
Date: Mon, 25 Nov 2013 16:50:26 -0500	[thread overview]
Message-ID: <5293C622.4070304@gentoo.org> (raw)
In-Reply-To: <5293718E.4090508@gentoo.org>


[-- Attachment #1.1: Type: text/plain, Size: 4430 bytes --]

I figured out the problem. There is zerocopy IO is being done via DMA to
a buffer allocated with valloc(). Right now, I am running a hack-fix
locally so I can get some other stuff done first. I will propose a
proper fix to the list in a few days.

On 11/25/2013 10:49 AM, Richard Yao wrote:
> I booted a Gentoo Linux installation in QEMU with a 9P rootfs as follows:
> 
> sudo qemu-kvm -cpu host -m 1024 -kernel
> /mnt/test/usr/src/linux-3.13-rc1/arch/x86/boot/bzImage -append
> 'root=/dev/root rootfstype=9p rootflags=trans=virtio,version=9p2000.L ro
> console=ttyS0' -serial stdio -fsdev
> local,id=root,path=/mnt/test,security_model=none -device
> virtio-9p-pci,fsdev=root,mount_tag=/dev/root
> 
> The system boots fine, but attempting to load any module will fail:
> 
> localhost ~ # modprobe crc32
> qemu-system-x86_64: virtio: trying to map MMIO memory
> 
> The behavior is consistent no matter what combination of things that I
> try. So far, I have tried Linux 3.10.7-gentoo (Gentoo patchset) and
> Linux 3.13-rc1. I have tried QEMU 1.4.2, QEMU 1.6.1 and QEMU HEAD. I
> have also tried booting without KVM, but the behavior is the same:
> 
> sudo qemu-kvm --no-kvm -m 1024 -kernel
> /mnt/test/usr/src/linux-3.13-rc1/arch/x86/boot/bzImage -append
> 'root=/dev/root rootfstype=9p rootflags=trans=virtio,version=9p2000.L ro
> console=ttyS0' -serial stdio -fsdev
> local,id=root,path=/mnt/test,security_model=none -device
> virtio-9p-pci,fsdev=root,mount_tag=/dev/root
> 
> Here is a backtrace of QEMU itself that I obtained using gdb:
> 
> Breakpoint 1, virtqueue_map_sg (sg=0x7f695b797b98, addr=0x7f695b793b98,
> num_sg=3, is_write=1) at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/hw/virtio/virtio.c:434
> 434                 error_report("virtio: trying to map MMIO memory");
> (gdb) bt
> #0  virtqueue_map_sg (sg=0x7f695b797b98, addr=0x7f695b793b98, num_sg=3,
> is_write=1) at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/hw/virtio/virtio.c:434
> #1  0x00000000006eb666 in virtqueue_pop (vq=0x1b23740,
> elem=0x7f695b793b88) at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/hw/virtio/virtio.c:500
> #2  0x00000000004a74ee in handle_9p_output (vdev=0x7f695b1fd910,
> vq=0x1b23740) at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/hw/9pfs/virtio-9p.c:3254
> #3  0x00000000006ec4b5 in virtio_queue_notify_vq (vq=0x1b23740) at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/hw/virtio/virtio.c:720
> #4  0x00000000006edf65 in virtio_queue_host_notifier_read (n=0x1b23790)
> at /usr/src/debug/app-emulation/qemu-9999/qemu-9999/hw/virtio/virtio.c:1116
> #5  0x00000000005d3c9c in qemu_iohandler_poll (pollfds=0x1aae200, ret=1)
> at /usr/src/debug/app-emulation/qemu-9999/qemu-9999/iohandler.c:143
> #6  0x00000000005d4702 in main_loop_wait (nonblocking=0) at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/main-loop.c:484
> #7  0x000000000066c583 in main_loop () at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/vl.c:2014
> #8  0x00000000006730d1 in main (argc=17, argv=0x7fffa93167c8,
> envp=0x7fffa9316858) at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/vl.c:4366
> 
> I spoke with Alexander Graf about this in IRC. He suggested that the
> guest is passing QEMU a bad address and gave me a small patch to use to
> get the VM to stop when this happens so that I could attach gdb and poke
> around. Sadly, I was on my way out to dinner when he gave that to me and
> I subsequently lost the patch to the Debian's paste bin's garbage
> collection. I have tried debugging without it by booting qemu with `-s
> -S`, setting break points for the kernel module initialization routines
> and running the system, but the breakpoints are not triggering.
> 
> If I could get another copy of the patch that Alexander gave me, I would
> be able to move forward. Unfortunately, he is not on IRC right now. I
> cannot debug any further with my current knowledge, so I am sending what
> I know so far to the relevant mailing lists. It would be greatly
> appreciated if someone would point me in the right direction (or even
> better, send me a patch to fix what is wrong).
> 
> P.S. As a side note, there appears to be regression between 3.10.7 and
> 3.13-rc1. In specific, the rootfs will fail to mount unless I use
> mount_tag=/dev/root and pass root=/dev/root. With 3.10.7, I could use an
> arbitrary name.
> 



[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

WARNING: multiple messages have this Message-ID (diff)
From: Richard Yao <ryao@gentoo.org>
To: qemu-devel@nongnu.org
Cc: kernel@gentoo.org, v9fs-developer@lists.sourceforge.net,
	agraf@suse.de, virtualization@lists.linux-foundation.org
Subject: Re: [Qemu-devel] QEMU dies on any attempt to load a Linux kernel module when using a 9P rootfs
Date: Mon, 25 Nov 2013 16:50:26 -0500	[thread overview]
Message-ID: <5293C622.4070304@gentoo.org> (raw)
In-Reply-To: <5293718E.4090508@gentoo.org>

[-- Attachment #1: Type: text/plain, Size: 4430 bytes --]

I figured out the problem. There is zerocopy IO is being done via DMA to
a buffer allocated with valloc(). Right now, I am running a hack-fix
locally so I can get some other stuff done first. I will propose a
proper fix to the list in a few days.

On 11/25/2013 10:49 AM, Richard Yao wrote:
> I booted a Gentoo Linux installation in QEMU with a 9P rootfs as follows:
> 
> sudo qemu-kvm -cpu host -m 1024 -kernel
> /mnt/test/usr/src/linux-3.13-rc1/arch/x86/boot/bzImage -append
> 'root=/dev/root rootfstype=9p rootflags=trans=virtio,version=9p2000.L ro
> console=ttyS0' -serial stdio -fsdev
> local,id=root,path=/mnt/test,security_model=none -device
> virtio-9p-pci,fsdev=root,mount_tag=/dev/root
> 
> The system boots fine, but attempting to load any module will fail:
> 
> localhost ~ # modprobe crc32
> qemu-system-x86_64: virtio: trying to map MMIO memory
> 
> The behavior is consistent no matter what combination of things that I
> try. So far, I have tried Linux 3.10.7-gentoo (Gentoo patchset) and
> Linux 3.13-rc1. I have tried QEMU 1.4.2, QEMU 1.6.1 and QEMU HEAD. I
> have also tried booting without KVM, but the behavior is the same:
> 
> sudo qemu-kvm --no-kvm -m 1024 -kernel
> /mnt/test/usr/src/linux-3.13-rc1/arch/x86/boot/bzImage -append
> 'root=/dev/root rootfstype=9p rootflags=trans=virtio,version=9p2000.L ro
> console=ttyS0' -serial stdio -fsdev
> local,id=root,path=/mnt/test,security_model=none -device
> virtio-9p-pci,fsdev=root,mount_tag=/dev/root
> 
> Here is a backtrace of QEMU itself that I obtained using gdb:
> 
> Breakpoint 1, virtqueue_map_sg (sg=0x7f695b797b98, addr=0x7f695b793b98,
> num_sg=3, is_write=1) at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/hw/virtio/virtio.c:434
> 434                 error_report("virtio: trying to map MMIO memory");
> (gdb) bt
> #0  virtqueue_map_sg (sg=0x7f695b797b98, addr=0x7f695b793b98, num_sg=3,
> is_write=1) at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/hw/virtio/virtio.c:434
> #1  0x00000000006eb666 in virtqueue_pop (vq=0x1b23740,
> elem=0x7f695b793b88) at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/hw/virtio/virtio.c:500
> #2  0x00000000004a74ee in handle_9p_output (vdev=0x7f695b1fd910,
> vq=0x1b23740) at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/hw/9pfs/virtio-9p.c:3254
> #3  0x00000000006ec4b5 in virtio_queue_notify_vq (vq=0x1b23740) at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/hw/virtio/virtio.c:720
> #4  0x00000000006edf65 in virtio_queue_host_notifier_read (n=0x1b23790)
> at /usr/src/debug/app-emulation/qemu-9999/qemu-9999/hw/virtio/virtio.c:1116
> #5  0x00000000005d3c9c in qemu_iohandler_poll (pollfds=0x1aae200, ret=1)
> at /usr/src/debug/app-emulation/qemu-9999/qemu-9999/iohandler.c:143
> #6  0x00000000005d4702 in main_loop_wait (nonblocking=0) at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/main-loop.c:484
> #7  0x000000000066c583 in main_loop () at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/vl.c:2014
> #8  0x00000000006730d1 in main (argc=17, argv=0x7fffa93167c8,
> envp=0x7fffa9316858) at
> /usr/src/debug/app-emulation/qemu-9999/qemu-9999/vl.c:4366
> 
> I spoke with Alexander Graf about this in IRC. He suggested that the
> guest is passing QEMU a bad address and gave me a small patch to use to
> get the VM to stop when this happens so that I could attach gdb and poke
> around. Sadly, I was on my way out to dinner when he gave that to me and
> I subsequently lost the patch to the Debian's paste bin's garbage
> collection. I have tried debugging without it by booting qemu with `-s
> -S`, setting break points for the kernel module initialization routines
> and running the system, but the breakpoints are not triggering.
> 
> If I could get another copy of the patch that Alexander gave me, I would
> be able to move forward. Unfortunately, he is not on IRC right now. I
> cannot debug any further with my current knowledge, so I am sending what
> I know so far to the relevant mailing lists. It would be greatly
> appreciated if someone would point me in the right direction (or even
> better, send me a patch to fix what is wrong).
> 
> P.S. As a side note, there appears to be regression between 3.10.7 and
> 3.13-rc1. In specific, the rootfs will fail to mount unless I use
> mount_tag=/dev/root and pass root=/dev/root. With 3.10.7, I could use an
> arbitrary name.
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

  reply	other threads:[~2013-11-25 21:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-25 15:49 [Qemu-devel] QEMU dies on any attempt to load a Linux kernel module when using a 9P rootfs Richard Yao
2013-11-25 21:50 ` Richard Yao [this message]
2013-11-25 21:50   ` Richard Yao
2013-11-26 15:16   ` Christopher Covington
2013-11-26 15:16     ` [Qemu-devel] " Christopher Covington
2013-11-26 15:38     ` Richard Yao
2013-11-26 15:38       ` [Qemu-devel] " Richard Yao
2013-11-26 15:47       ` Richard Yao
2013-11-26 15:47         ` [Qemu-devel] " Richard Yao
2014-08-21 19:50 ` Christopher Covington
2014-08-21 19:50   ` Christopher Covington
2014-08-22  3:00   ` Richard Yao
2014-08-22  3:00   ` Richard Yao
2014-08-22  6:27   ` [Qemu-devel] [V9fs-developer] " Dominique Martinet
2014-08-22 12:37     ` [V9fs-developer] [Qemu-devel] " Christopher Covington
2014-08-22 12:37       ` [Qemu-devel] [V9fs-developer] " Christopher Covington
2014-08-22 12:49       ` Dominique Martinet
2014-08-22 17:54         ` [V9fs-developer] [Qemu-devel] " Christopher Covington
2014-08-22 17:54           ` [Qemu-devel] [V9fs-developer] " Christopher Covington
  -- strict thread matches above, loose matches on Subject: below --
2013-11-25 15:49 Richard Yao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5293C622.4070304@gentoo.org \
    --to=ryao@gentoo.org \
    --cc=kernel@gentoo.org \
    --cc=qemu-devel@nongnu.org \
    --cc=v9fs-developer@lists.sourceforge.net \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.