kvm tools: about using virtio-console

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

 



Hi pekka,

Does virtio-console work with kvm-tools?
It seems that virtio-console.vps[] is not initialized in virtio-console.c


(gdb) r run -i linux-0.2.img -k ./vmlinuz-2.6.38-rc6+ -r ./initrd.img-2.6.38-rc6+ -p=init=1 -m 500 -c
Starting program: /project/rh/kvm-tools/tools/kvm/kvm run -i linux-0.2.img -k ./vmlinuz-2.6.38-rc6+ -r ./initrd.img-2.6.38-rc6+ -p=init=1 -m 500 -c
[Thread debugging using libthread_db enabled]
[New Thread 0x7fffd6e2d700 (LWP 19280)]
  Warning: request type 8

Program received signal SIGSEGV, Segmentation fault.
0x00000000004026ca in virt_queue__available (vq=0x60d3c8) at include/kvm/virtio.h:31
31              return vq->vring.avail->idx !=  vq->last_avail_idx;
(gdb)
(gdb) bt
#0  0x00000000004026ca in virt_queue__available (vq=0x60d3c8) at include/kvm/virtio.h:31
#1  0x00000000004027f7 in virtio_console__inject_interrupt (self=0x68f010) at virtio-console.c:71
#2  0x00000000004083b2 in handle_sigalrm (sig=14) at kvm-run.c:51
#3  <signal handler called>
#4  0x00007ffff79bf283 in pthread_join () from /lib/libpthread.so.0
#5  0x00000000004088bb in kvm_cmd_run (argc=0, argv=0x7fffffffdd18, prefix=0x0) at kvm-run.c:216
#6  0x000000000040834e in handle_command (command=0x7fffffffdbb0, argc=11, argv=0x7fffffffdd10) at kvm-cmd.c:55
#7  0x0000000000405bd5 in handle_kvm_command (argc=11, argv=0x7fffffffdd10) at main.c:16
#8  0x0000000000405bfe in main (argc=12, argv=0x7fffffffdd08) at main.c:21
(gdb) p *vq
$2 = {vring = {num = 0, desc = 0x0, avail = 0x0, used = 0x0}, pfn = 0, last_avail_idx = 0}

-------

I added the check of vq->vring.avail in virt_queue__available(), but it also failed.

diff --git a/tools/kvm/include/kvm/virtio.h b/tools/kvm/include/kvm/virtio.h
index 9f892a1..d3622b1 100644
--- a/tools/kvm/include/kvm/virtio.h
+++ b/tools/kvm/include/kvm/virtio.h
@@ -28,6 +28,8 @@ static inline struct vring_desc *virt_queue__get_desc(struct virt_queue *queue,

 static inline bool virt_queue__available(struct virt_queue *vq)
 {
+        if (!vq->vring.avail)
+                return -1;
        return vq->vring.avail->idx !=  vq->last_avail_idx;
 }

(gdb) r run -i linux-0.2.img -k ./vmlinuz-2.6.38-rc6+ -r ./initrd.img-2.6.38-rc6+ -p=init=1 -m 500 -c
Starting program: /project/rh/kvm-tools/tools/kvm/kvm run -i linux-0.2.img -k ./vmlinuz-2.6.38-rc6+ -r ./initrd.img-2.6.38-rc6+ -p=init=1 -m 500 -c
[Thread debugging using libthread_db enabled]
[New Thread 0x7fffd6e2d700 (LWP 19434)]
  Warning: request type 8

Program received signal SIGFPE, Arithmetic exception.
0x00000000004066cd in virt_queue__pop (queue=0x60d3c8) at include/kvm/virtio.h:21
21              return queue->vring.avail->ring[queue->last_avail_idx++ % queue->vring.num];
(gdb) bt
#0  0x00000000004066cd in virt_queue__pop (queue=0x60d3c8) at include/kvm/virtio.h:21
#1  0x000000000040679c in virt_queue__get_iov (queue=0x60d3c8, iov=0x7fffffffcda0, out=0x7fffffffd5be, in=0x7fffffffd5bc, kvm=0x68f010) at virtio.c:21
#2  0x000000000040284b in virtio_console__inject_interrupt (self=0x68f010) at virtio-console.c:72
#3  0x00000000004083da in handle_sigalrm (sig=14) at kvm-run.c:51
#4  <signal handler called>
#5  0x00007ffff79bf283 in pthread_join () from /lib/libpthread.so.0
#6  0x00000000004088e3 in kvm_cmd_run (argc=0, argv=0x7fffffffdd18, prefix=0x0) at kvm-run.c:216
#7  0x0000000000408376 in handle_command (command=0x7fffffffdbb0, argc=11, argv=0x7fffffffdd10) at kvm-cmd.c:55
#8  0x0000000000405bfd in handle_kvm_command (argc=11, argv=0x7fffffffdd10) at main.c:16
#9  0x0000000000405c26 in main (argc=12, argv=0x7fffffffdd08) at main.c:21
(gdb) p *queue
$2 = {vring = {num = 0, desc = 0x0, avail = 0x0, used = 0x0}, pfn = 0, last_avail_idx = 0}


Amos.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux