Skip to contentSkip to conversation

tools/virtio: fix compilation

PATCH In review Eugenio Pérez 4 participants 6 messages Jul 6, 2021 – Jul 7, 2021

Subsystems (2)
lore
Share & tools
lore

Eugenio Pérez

author maintainer
#0 lore raw

cover tools/virtio: fix compilation

Virtio testing tools cannot build. Fixing.

Comments are welcome, specially in case I missed use of stub lockdep.h.

I couldn't try some of the tools, that already did not compile on 5.13:
gpio, liblockdep, selftests, bpf, tracing.

Eugenio Pérez (2):
tools: Remove lockdep.h and its include from spinlock.h
vringh: Include spinlock.h

 include/linux/vringh.h                   |  1 +
 tools/include/linux/spinlock.h           |  2 --
 tools/testing/radix-tree/linux/lockdep.h | 11 -----------
 3 files changed, 1 insertion(+), 13 deletions(-)
 delete mode 100644 tools/testing/radix-tree/linux/lockdep.h
Signature · 1 line
2.27.0
author maintainer
#1 lore raw

PATCH 1/2 tools: Remove lockdep.h and its include from spinlock.h

Commit 58d6ea3085f2 ("xarray: Add XArray unconditional store operations") adds this file at the same time that xarray and xarray tests. However, xarray tests and other tools/ works with no problem without this file.

The motivation for the deletion is that vhost tests/tools need to use spinlock.h mock file, but at the moment it includes lockdep.h that is only available under tools/testing/radix-tree.

---
 tools/include/linux/spinlock.h           |  2 --
 tools/testing/radix-tree/linux/lockdep.h | 11 -----------
 2 files changed, 13 deletions(-)
 delete mode 100644 tools/testing/radix-tree/linux/lockdep.h
tools/include/linux/spinlock.h +0 -2
index c934572d935c..622266b197d0 100644
@@ -37,6 +37,4 @@ static inline bool arch_spin_is_locked(arch_spinlock_t *mutex)
 	return true;
 }
 
-#include <linux/lockdep.h>
-
 #endif
tools/testing/radix-tree/linux/lockdep.h deleted +0 -11
deleted file mode 100644
index 565fccdfe6e9..000000000000
@@ -1,11 +0,0 @@
-#ifndef _LINUX_LOCKDEP_H
-#define _LINUX_LOCKDEP_H
-struct lock_class_key {
-	unsigned int a;
-};
-
-static inline void lockdep_set_class(spinlock_t *lock,
-					struct lock_class_key *key)
-{
-}
-#endif /* _LINUX_LOCKDEP_H */
Signature · 1 line
2.27.0
maintainer Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] tools: Remove lockdep.h and its include from spinlock.h

Quoted 10 lines · Eugenio Pérez

Commit 58d6ea3085f2 ("xarray: Add XArray unconditional store operations") adds this file at the same time that xarray and xarray tests. However, xarray tests and other tools/ works with no problem without this file.

The motivation for the deletion is that vhost tests/tools need to use spinlock.h mock file, but at the moment it includes lockdep.h that is only available under tools/testing/radix-tree.

author maintainer
#3 lore raw

PATCH 2/2 vringh: Include spinlock.h

In reply to Eugenio Pérez

Commit f53d9910d009 ("vringh: add 'iotlb_lock' to synchronize iotlb accesses") introduces this dependency, but does not include spinlock.h. While kernel seems to compile as usual, tools/virtio cannot do the same.

Fixes f53d9910d009 ("vringh: add 'iotlb_lock' to synchronize iotlb accesses")
---
 include/linux/vringh.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/vringh.h +1 -0
index 84db7b8f912f..212892cf9822 100644
@@ -14,6 +14,7 @@
 #include <linux/virtio_byteorder.h>
 #include <linux/uio.h>
 #include <linux/slab.h>
+#include <linux/spinlock.h>
 #if IS_REACHABLE(CONFIG_VHOST_IOTLB)
 #include <linux/dma-direction.h>
 #include <linux/vhost_iotlb.h>
Signature · 1 line
2.27.0
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] vringh: Include spinlock.h

Quoted 27 lines · Eugenio Pérez

Commit f53d9910d009 ("vringh: add 'iotlb_lock' to synchronize iotlb accesses") introduces this dependency, but does not include spinlock.h. While kernel seems to compile as usual, tools/virtio cannot do the same.

Fixes f53d9910d009 ("vringh: add 'iotlb_lock' to synchronize iotlb accesses")

---
include/linux/vringh.h | 1 +

1 file changed, 1 insertion(+)
include/linux/vringh.h +1 -0
index 84db7b8f912f..212892cf9822 100644
@@ -14,6 +14,7 @@
 #include <linux/virtio_byteorder.h>
 #include <linux/uio.h>
 #include <linux/slab.h>
+#include <linux/spinlock.h>
 #if IS_REACHABLE(CONFIG_VHOST_IOTLB)
 #include <linux/dma-direction.h>
 #include <linux/vhost_iotlb.h>
Signature · 1 line
2.27.0

Ooops, thanks for fixing this!

#5 lore raw
In reply to Eugenio Pérez
Quoted 11 lines · Eugenio Pérez

Virtio testing tools cannot build. Fixing.

Comments are welcome, specially in case I missed use of stub lockdep.h.

I couldn't try some of the tools, that already did not compile on 5.13:

gpio, liblockdep, selftests, bpf, tracing.

This patchset fixes the compilation error explicitly. My previous refactor patchset seems to fixes the compilation error accidentally too.

Anyway it seems better to fix the compilation error explicitly.

Quoted 23 lines

Eugenio Pérez (2):

tools: Remove lockdep.h and its include from spinlock.h

vringh: Include spinlock.h

 include/linux/vringh.h                   |  1 +
 tools/include/linux/spinlock.h           |  2 --
 tools/testing/radix-tree/linux/lockdep.h | 11 -----------
 3 files changed, 1 insertion(+), 13 deletions(-)
 delete mode 100644 tools/testing/radix-tree/linux/lockdep.h