tools/kvm/9p: Add encode/decode routines for protocol data
PATCH 1/1 tools/kvm/9p: Add encode/decode routines for protocol data
The protocol data is in little-endian format.
--- tools/kvm/Makefile | 1 + tools/kvm/include/kvm/virtio-9p.h | 81 ++++++- tools/kvm/virtio/9p-pdu.c | 237 ++++++++++++++++++ tools/kvm/virtio/9p.c | 479 ++++++++++++++++--------------------- 4 files changed, 527 insertions(+), 271 deletions(-) create mode 100644 tools/kvm/virtio/9p-pdu.c
tools/kvm/Makefile +1 -0
@@ -57,6 +57,7 @@ OBJS += util/parse-options.o OBJS += util/rbtree-interval.o OBJS += util/strbuf.o OBJS += virtio/9p.o +OBJS += virtio/9p-pdu.o OBJS += hw/vesa.o OBJS += hw/i8042.o
tools/kvm/include/kvm/virtio-9p.h +80 -1
88 lines not on this page · raw message
tools/kvm/virtio/9p-pdu.c new file +237 -0
237 lines not on this page · raw message
tools/kvm/virtio/9p.c +209 -270
686 lines not on this page · raw message
Signature · 1 line
1.7.4.1
This breaks 'make check':
./kvm run -d tests/boot/boot_test.iso -p "init=init"
Error: unknown switch `d'
usage: kvm run [<options>] [<kernel image>]
Basic options:
-0, make: *** [check] Segmentation fault
Quoted 11 lines · Pekka Enberg
This breaks 'make check':
./kvm run -d tests/boot/boot_test.iso -p "init=init"
Error: unknown switch `d'usage: kvm run [<options>] [<kernel image>]
Basic options:
-0, make: *** [check] Segmentation fault
I am able to reproduce this on debian x86_64. A simple test as below kvm run -sda will result in segfault. I am find the option array corrupt. Not yet sure why the patch would make a difference. Here is the gdb dump of the structure
====Not working dump====
(gdb) p *(opts)
$5 = {type = OPTION_GROUP, short_name = 0, long_name = 0x0, value = 0x0, argh = 0x0, help = 0x40f2b0 "Basic options:", flags = 0,
callback = 0, defval = 38654705664}
(gdb) p *(opts+1)
$6 = {type = 99, short_name = 4256447, long_name = 0x61551800000000 <Address 0x61551800000000 out of bounds>, value = 0x0,
argh = 0x40f2c400000000 <Address 0x40f2c400000000 out of bounds>, help = 0x0, flags = 0, callback = 0, defval = 468151435276}
(gdb)
==== Working dump ====
(gdb) p *(opts)
$4 = {type = OPTION_GROUP, short_name = 0, long_name = 0x0, value = 0x0, argh = 0x0, help = 0x40e9b0 "Basic options:", flags = 0,
callback = 0, defval = 0}
(gdb) p *(opts+1)
$5 = {type = OPTION_INTEGER, short_name = 99, long_name = 0x40e9bf "cpus", value = 0x6151c8, argh = 0x0, help = 0x40e9c4 "Number of CPUs",
flags = 0, callback = 0, defval = 0}
(gdb)
Quoted 28 lines · Aneesh Kumar K.V
Quoted 11 lines · Pekka Enberg
This breaks 'make check':
./kvm run -d tests/boot/boot_test.iso -p "init=init"
Error: unknown switch `d'usage: kvm run [<options>] [<kernel image>]
Basic options:
-0, make: *** [check] Segmentation faultI am able to reproduce this on debian
x86_64. A simple test as below kvm run -sda will result in segfault. I am find the option array corrupt. Not yet sure why the patch would make a difference. Here is the gdb dump of the structure====Not working dump====
(gdb) p *(opts)
$5 = {type =OPTION_GROUP,short_name= 0,long_name=0x0, value =0x0, argh =0x0, help =0x40f2b0"Basic options:", flags = 0,
callback = 0, defval = 38654705664}
(gdb) p *(opts+1)
$6 = {type = 99,short_name= 4256447,long_name=0x61551800000000<Address0x61551800000000out of bounds>, value =0x0,
argh =0x40f2c400000000<Address0x40f2c400000000out of bounds>, help =0x0, flags = 0, callback = 0, defval = 468151435276}
(gdb)
Quoted 8 lines
==== Working dump ====
(gdb) p *(opts)
$4 = {type =OPTION_GROUP,short_name= 0,long_name=0x0, value =0x0, argh =0x0, help =0x40e9b0"Basic options:", flags = 0,
callback = 0, defval = 0}
(gdb) p *(opts+1)
$5 = {type =OPTION_INTEGER,short_name= 99,long_name=0x40e9bf"cpus", value =0x6151c8, argh =0x0, help =0x40e9c4"Number of CPUs",
flags = 0, callback = 0, defval = 0}
(gdb)
net/9p/9p.h had
#pragma pack(1)
Moved the include into .c files. that fixed the issue
-aneesh