2021-07-06 14:41:18

by Eugenio Perez Martin

[permalink] [raw]
Subject: [PATCH 0/2] 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



--

2.27.0





2021-07-06 14:43:15

by Eugenio Perez Martin

[permalink] [raw]
Subject: [PATCH 2/2] vringh: Include spinlock.h

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")

Signed-off-by: Eugenio Pérez <[email protected]>
---
include/linux/vringh.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/linux/vringh.h b/include/linux/vringh.h
index 84db7b8f912f..212892cf9822 100644
--- a/include/linux/vringh.h
+++ b/include/linux/vringh.h
@@ -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>
--
2.27.0

2021-07-06 14:43:16

by Eugenio Perez Martin

[permalink] [raw]
Subject: [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.

Signed-off-by: Eugenio Pérez <[email protected]>
---
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

diff --git a/tools/include/linux/spinlock.h b/tools/include/linux/spinlock.h
index c934572d935c..622266b197d0 100644
--- a/tools/include/linux/spinlock.h
+++ b/tools/include/linux/spinlock.h
@@ -37,6 +37,4 @@ static inline bool arch_spin_is_locked(arch_spinlock_t *mutex)
return true;
}

-#include <linux/lockdep.h>
-
#endif
diff --git a/tools/testing/radix-tree/linux/lockdep.h b/tools/testing/radix-tree/linux/lockdep.h
deleted file mode 100644
index 565fccdfe6e9..000000000000
--- a/tools/testing/radix-tree/linux/lockdep.h
+++ /dev/null
@@ -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 */
--
2.27.0

2021-07-06 14:45:46

by Matthew Wilcox

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

On Tue, Jul 06, 2021 at 04:26:31PM +0200, Eugenio P?rez wrote:
> 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.
>
> Signed-off-by: Eugenio P?rez <[email protected]>

Reviewed-by: Matthew Wilcox (Oracle) <[email protected]>

2021-07-06 14:46:17

by Stefano Garzarella

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

On Tue, Jul 06, 2021 at 04:26:32PM +0200, Eugenio P?rez wrote:
>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")
>
>Signed-off-by: Eugenio P?rez <[email protected]>
>---
> include/linux/vringh.h | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/include/linux/vringh.h b/include/linux/vringh.h
>index 84db7b8f912f..212892cf9822 100644
>--- a/include/linux/vringh.h
>+++ b/include/linux/vringh.h
>@@ -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>
>--
>2.27.0
>

Ooops, thanks for fixing this!

Reviewed-by: Stefano Garzarella <[email protected]>

2021-07-07 03:20:01

by Yunsheng Lin

[permalink] [raw]
Subject: Re: [PATCH 0/2] tools/virtio: fix compilation

On 2021/7/6 22:26, Eugenio Pérez wrote:
> 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.

>
>
>
> 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
>
>
>