From: Amos Kong <akong@redhat.com>
To: Pekka Enberg <penberg@kernel.org>
Cc: kvm@vger.kernel.org
Subject: kvm tools: about using virtio-console
Date: Sun, 10 Apr 2011 11:36:17 +0800 [thread overview]
Message-ID: <20110410033616.GA4899@t400> (raw)
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.
next reply other threads:[~2011-04-10 3:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-10 3:36 Amos Kong [this message]
2011-04-10 4:05 ` kvm tools: about using virtio-console Asias He
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=20110410033616.GA4899@t400 \
--to=akong@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=penberg@kernel.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.