Asias He <asias@xxxxxxxxxx> writes: > On 01/23/2013 07:03 AM, Rusty Russell wrote: >> Asias He <asias@xxxxxxxxxx> writes: >> >>> On 01/17/2013 06:29 PM, Rusty Russell wrote: >>>> This is mainly to test the drivers/vhost/vringh.c code, but it also >>>> uses the drivers/virtio/virtio_ring.c code for the guest side. >>> >>> vringh_test.c does not compile here: >>> (This series on top of 9a9284153d965a57edc7162a8e57c14c97f3a935) >>> >>> $ cd tools/virtio >>> $ make >>> cc -g -O2 -Wall -I. -I ../../usr/include/ -Wno-pointer-sign >>> -fno-strict-overflow -MMD vringh_test.c -o vringh_test >>> In file included from ./linux/vringh.h:1:0, >>> from ./../../drivers/vhost/vringh.c:6, >>> from vringh_test.c:7: >>> ./linux/../../../include/linux/vringh.h:27:28: fatal error: >>> uapi/linux/uio.h: No such file or directory >> >> Oops, I forgot to add the file... it's a one-liner: >> >> tools/virtio/uapi/linux/uio.h: >> #include <sys/uio.h> >> >> I'll make a new branch for this, called vringh. It'll probably rebase >> as I neaten things up, but I'll try not to go crazy... > > It compiles now. > > FYI, I got some warnings: > > ../../drivers/virtio/virtio_ring.c: In function ‘virtqueue_kick_prepare’: > ../../drivers/virtio/virtio_ring.c:309:3: warning: dereferencing > type-punned pointer will break strict-aliasing rules [-Wstrict-aliasin > g] Yes, we should compile the tests with -fno-strict-aliasing like the kernel does, and I should fix the printk formatting for 64-bit targets... vringh: fix warnings. Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx> diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c index 3bbdefe..734ba8c 100644 --- a/drivers/vhost/vringh.c +++ b/drivers/vhost/vringh.c @@ -111,7 +111,8 @@ static inline bool range_check(u64 addr, u32 *len, /* Otherwise, don't wrap. */ if (addr + *len < addr) { - vringh_bad("Wrapping descriptor %u@0x%llx", *len, addr); + vringh_bad("Wrapping descriptor %u@0x%llx", + *len, (unsigned long long)addr); return false; } @@ -570,7 +571,7 @@ int vringh_init_user(struct vringh *vrh, u32 features, { /* Sane power of 2 please! */ if (!num || num > 0xffff || (num & (num - 1))) { - vringh_bad("Bad ring size %zu", num); + vringh_bad("Bad ring size %u", num); return -EINVAL; } @@ -800,7 +801,7 @@ int vringh_init_kern(struct vringh *vrh, u32 features, { /* Sane power of 2 please! */ if (!num || num > 0xffff || (num & (num - 1))) { - vringh_bad("Bad ring size %zu", num); + vringh_bad("Bad ring size %u", num); return -EINVAL; } diff --git a/tools/virtio/Makefile b/tools/virtio/Makefile index b928c3e..e961545 100644 --- a/tools/virtio/Makefile +++ b/tools/virtio/Makefile @@ -1,7 +1,7 @@ all: test mod test: virtio_test vringh_test virtio_test: virtio_ring.o virtio_test.o -CFLAGS += -g -O2 -Wall -I. -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -MMD +CFLAGS += -g -O2 -Wall -I. -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -Wno-unused-result -MMD vpath %.c ../../drivers/virtio mod: ${MAKE} -C `pwd`/../.. M=`pwd`/vhost_test _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization