David Woodhouse
2022-Feb-22 07:58 UTC
[PATCH] tools/virtio: Test virtual address range detection
On Tue, 2022-02-22 at 01:31 -0500, Michael S. Tsirkin wrote:> On Mon, Feb 21, 2022 at 05:18:48PM +0000, David Woodhouse wrote: > > > > [dwoodhou at i7 virtio]$ sudo ~/virtio_test > > Detected virtual address range 0x1000-0x7ffffffff000 > > spurious wakeups: 0x0 started=0x100000 completed=0x100000 > > > > Although in some circumstances I also see a different build failure: > > > > cc -g -O2 -Werror -Wno-maybe-uninitialized -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE -include ../../include/linux/kconfig.h -c -o vringh_test.o vringh_test.c > > In file included from ./linux/uio.h:3, > > from ./linux/../../../include/linux/vringh.h:15, > > from ./linux/vringh.h:1, > > from vringh_test.c:9: > > ./linux/../../../include/linux/uio.h:10:10: fatal error: linux/mm_types.h: No such file or directory > > 10 | #include <linux/mm_types.h> > > | ^~~~~~~~~~~~~~~~~~ > > compilation terminated. > > make: *** [<builtin>: vringh_test.o] Error 1 > > Which tree has this build failure? In mine linux/uio.h does not > include linux/mm_types.h.Strictly it's https://git.infradead.org/users/dwmw2/linux.git/shortlog/refs/heads/xen-evtchn-kernel but I'm sure my part isn't relevant; it's just v5.17-rc5. $ git blame include/linux/uio.h | grep mm_types.h d9c19d32d86fa (Matthew Wilcox (Oracle) 2021-10-18 10:39:06 -0400 10) #include <linux/mm_types.h> $ git describe --tags d9c19d32d86fa v5.16-rc4-37-gd9c19d32d86f -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5965 bytes Desc: not available URL: <http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20220222/6e5efecc/attachment.p7s>
Matthew Wilcox
2022-Feb-22 23:18 UTC
[PATCH] tools/virtio: Test virtual address range detection
On Tue, Feb 22, 2022 at 07:58:33AM +0000, David Woodhouse wrote:> On Tue, 2022-02-22 at 01:31 -0500, Michael S. Tsirkin wrote: > > On Mon, Feb 21, 2022 at 05:18:48PM +0000, David Woodhouse wrote: > > > > > > [dwoodhou at i7 virtio]$ sudo ~/virtio_test > > > Detected virtual address range 0x1000-0x7ffffffff000 > > > spurious wakeups: 0x0 started=0x100000 completed=0x100000 > > > > > > Although in some circumstances I also see a different build failure: > > > > > > cc -g -O2 -Werror -Wno-maybe-uninitialized -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE -include ../../include/linux/kconfig.h -c -o vringh_test.o vringh_test.cTrying to test this myself ... $ cd tools/virtio/ $ make ... cc -lpthread virtio_test.o virtio_ring.o -o virtio_test /usr/bin/ld: virtio_ring.o: in function `spin_lock': /home/willy/kernel/folio/tools/virtio/./linux/spinlock.h:16: undefined reference to `pthread_spin_lock' So this is not the only problem here?> > > In file included from ./linux/uio.h:3, > > > from ./linux/../../../include/linux/vringh.h:15, > > > from ./linux/vringh.h:1, > > > from vringh_test.c:9: > > > ./linux/../../../include/linux/uio.h:10:10: fatal error: linux/mm_types.h: No such file or directory > > > 10 | #include <linux/mm_types.h> > > > | ^~~~~~~~~~~~~~~~~~ > > > compilation terminated. > > > make: *** [<builtin>: vringh_test.o] Error 1 > > > > Which tree has this build failure? In mine linux/uio.h does not > > include linux/mm_types.h. > > Strictly it's > https://git.infradead.org/users/dwmw2/linux.git/shortlog/refs/heads/xen-evtchn-kernel > but I'm sure my part isn't relevant; it's just v5.17-rc5. > > $ git blame include/linux/uio.h | grep mm_types.h > d9c19d32d86fa (Matthew Wilcox (Oracle) 2021-10-18 10:39:06 -0400 10) #include <linux/mm_types.h> > $ git describe --tags d9c19d32d86fa > v5.16-rc4-37-gd9c19d32d86fgrr. Originally, I had this doing a typebusting cast, but hch objected, so I had to include mm_types.h. This should fix it ... $ git diff diff --git a/tools/virtio/linux/mm_types.h b/tools/virtio/linux/mm_types.h new file mode 100644 index 000000000000..3b0fc9bc5b8f --- /dev/null +++ b/tools/virtio/linux/mm_types.h @@ -0,0 +1,3 @@ +struct folio { + struct page page; +}; At least, it makes it compile for me.
Matthew Wilcox
2022-Mar-16 14:41 UTC
[PATCH] tools/virtio: Test virtual address range detection
On Tue, Feb 22, 2022 at 11:18:18PM +0000, Matthew Wilcox wrote:> On Tue, Feb 22, 2022 at 07:58:33AM +0000, David Woodhouse wrote: > > On Tue, 2022-02-22 at 01:31 -0500, Michael S. Tsirkin wrote: > > > On Mon, Feb 21, 2022 at 05:18:48PM +0000, David Woodhouse wrote: > > > > > > > > [dwoodhou at i7 virtio]$ sudo ~/virtio_test > > > > Detected virtual address range 0x1000-0x7ffffffff000 > > > > spurious wakeups: 0x0 started=0x100000 completed=0x100000 > > > > > > > > Although in some circumstances I also see a different build failure: > > > > > > > > cc -g -O2 -Werror -Wno-maybe-uninitialized -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE -include ../../include/linux/kconfig.h -c -o vringh_test.o vringh_test.c > > Trying to test this myself ... > > $ cd tools/virtio/ > $ make > ... > cc -lpthread virtio_test.o virtio_ring.o -o virtio_test > /usr/bin/ld: virtio_ring.o: in function `spin_lock': > /home/willy/kernel/folio/tools/virtio/./linux/spinlock.h:16: undefined reference to `pthread_spin_lock' > > So this is not the only problem here?FYI, this fixes it for me: diff --git a/tools/virtio/Makefile b/tools/virtio/Makefile index 0d7bbe49359d..83b6a522d0d2 100644 --- a/tools/virtio/Makefile +++ b/tools/virtio/Makefile @@ -5,7 +5,7 @@ virtio_test: virtio_ring.o virtio_test.o vringh_test: vringh_test.o vringh.o virtio_ring.o CFLAGS += -g -O2 -Werror -Wno-maybe-uninitialized -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE -include ../../include/linux/kconfig.h -LDFLAGS += -lpthread +LDFLAGS += -pthread vpath %.c ../../drivers/virtio ../../drivers/vhost mod: ${MAKE} -C `pwd`/../.. M=`pwd`/vhost_test V=${V}