2019-01-25 07:59:45

by Masahiro Yamada

[permalink] [raw]
Subject: [PATCH 0/3] KVM: arm/arm64: trivial header path sanitization

My main motivation is to get rid of crappy header search path manipulation
from Kbuild core.

Before that, I want to finish as many cleanup works as possible.

If you are interested in the big picture of this work,
the full patch set is available at:

git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git build-test



Masahiro Yamada (3):
KVM: arm/arm64: fix TRACE_INCLUDE_PATH
KVM: arm/arm64: remove -I. header search paths
KVM: arm/arm64: prefix header search paths with $(srctree)/

arch/arm/kvm/Makefile | 5 ++---
arch/arm64/kvm/Makefile | 4 +---
virt/kvm/arm/trace.h | 2 +-
3 files changed, 4 insertions(+), 7 deletions(-)

--
2.7.4



2019-01-25 07:58:59

by Masahiro Yamada

[permalink] [raw]
Subject: [PATCH 1/3] KVM: arm/arm64: fix TRACE_INCLUDE_PATH

As the comment block in include/trace/define_trace.h says,
TRACE_INCLUDE_PATH should be a relative path to the define_trace.h

../../virt/kvm/arm is the correct relative path.

../../../virt/kvm/arm is working by coincidence because the top
Makefile adds -I$(srctree)/arch/$(SRCARCH)/include as a header
search path, but we should not rely on it.

Signed-off-by: Masahiro Yamada <[email protected]>
---

virt/kvm/arm/trace.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virt/kvm/arm/trace.h b/virt/kvm/arm/trace.h
index 3828bea..853f3b1 100644
--- a/virt/kvm/arm/trace.h
+++ b/virt/kvm/arm/trace.h
@@ -265,7 +265,7 @@ TRACE_EVENT(kvm_timer_update_irq,
#endif /* _TRACE_KVM_H */

#undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH ../../../virt/kvm/arm
+#define TRACE_INCLUDE_PATH ../../virt/kvm/arm
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE trace

--
2.7.4


2019-01-25 07:59:16

by Masahiro Yamada

[permalink] [raw]
Subject: [PATCH 3/3] KVM: arm/arm64: prefix header search paths with $(srctree)/

Currently, the Kbuild core manipulates header search paths in a crazy
way [1].

To fix this mess, I want all Makefiles to add explicit $(srctree)/ to
the search paths in the srctree. Some Makefiles are already written in
that way, but not all. The goal of this work is to make the notation
consistent, and finally get rid of the gross hacks.

Having whitespaces after -I does not matter since commit 48f6e3cf5bc6
("kbuild: do not drop -I without parameter").

[1]: https://patchwork.kernel.org/patch/9632347/

Signed-off-by: Masahiro Yamada <[email protected]>
---

arch/arm/kvm/Makefile | 2 +-
arch/arm64/kvm/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
index bca775e..531e59f 100644
--- a/arch/arm/kvm/Makefile
+++ b/arch/arm/kvm/Makefile
@@ -8,7 +8,7 @@ ifeq ($(plus_virt),+virt)
plus_virt_def := -DREQUIRES_VIRT=1
endif

-ccflags-y += -Iarch/arm/kvm -Ivirt/kvm/arm/vgic
+ccflags-y += -I $(srctree)/$(src) -I $(srctree)/virt/kvm/arm/vgic
CFLAGS_arm.o := $(plus_virt_def)

AFLAGS_init.o := -Wa,-march=armv7-a$(plus_virt)
diff --git a/arch/arm64/kvm/Makefile b/arch/arm64/kvm/Makefile
index 3089b31..690e033 100644
--- a/arch/arm64/kvm/Makefile
+++ b/arch/arm64/kvm/Makefile
@@ -3,7 +3,7 @@
# Makefile for Kernel-based Virtual Machine module
#

-ccflags-y += -Iarch/arm64/kvm -Ivirt/kvm/arm/vgic
+ccflags-y += -I $(srctree)/$(src) -I $(srctree)/virt/kvm/arm/vgic

KVM=../../../virt/kvm

--
2.7.4


2019-01-25 08:00:21

by Masahiro Yamada

[permalink] [raw]
Subject: [PATCH 2/3] KVM: arm/arm64: remove -I. header search paths

The header search path -I. in kernel Makefiles is very suspicious;
it allows the compiler to search for headers in the top of $(srctree),
where obviously no header file exists.

I was able to build without these extra header search paths.

Signed-off-by: Masahiro Yamada <[email protected]>
---

arch/arm/kvm/Makefile | 3 +--
arch/arm64/kvm/Makefile | 2 --
2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
index 48de846..bca775e 100644
--- a/arch/arm/kvm/Makefile
+++ b/arch/arm/kvm/Makefile
@@ -9,8 +9,7 @@ ifeq ($(plus_virt),+virt)
endif

ccflags-y += -Iarch/arm/kvm -Ivirt/kvm/arm/vgic
-CFLAGS_arm.o := -I. $(plus_virt_def)
-CFLAGS_mmu.o := -I.
+CFLAGS_arm.o := $(plus_virt_def)

AFLAGS_init.o := -Wa,-march=armv7-a$(plus_virt)
AFLAGS_interrupts.o := -Wa,-march=armv7-a$(plus_virt)
diff --git a/arch/arm64/kvm/Makefile b/arch/arm64/kvm/Makefile
index 0f2a135..3089b31 100644
--- a/arch/arm64/kvm/Makefile
+++ b/arch/arm64/kvm/Makefile
@@ -4,8 +4,6 @@
#

ccflags-y += -Iarch/arm64/kvm -Ivirt/kvm/arm/vgic
-CFLAGS_arm.o := -I.
-CFLAGS_mmu.o := -I.

KVM=../../../virt/kvm

--
2.7.4


2019-01-25 12:07:10

by Christoffer Dall

[permalink] [raw]
Subject: Re: [PATCH 0/3] KVM: arm/arm64: trivial header path sanitization

On Fri, Jan 25, 2019 at 04:57:27PM +0900, Masahiro Yamada wrote:
> My main motivation is to get rid of crappy header search path manipulation
> from Kbuild core.
>
> Before that, I want to finish as many cleanup works as possible.
>
> If you are interested in the big picture of this work,
> the full patch set is available at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git build-test

Changes appear fine to me:

Acked-by: Christoffer Dall <[email protected]>

2019-02-08 15:45:14

by Marc Zyngier

[permalink] [raw]
Subject: Re: [PATCH 0/3] KVM: arm/arm64: trivial header path sanitization

On 25/01/2019 07:57, Masahiro Yamada wrote:
> My main motivation is to get rid of crappy header search path manipulation
> from Kbuild core.
>
> Before that, I want to finish as many cleanup works as possible.
>
> If you are interested in the big picture of this work,
> the full patch set is available at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git build-test
>
>
>
> Masahiro Yamada (3):
> KVM: arm/arm64: fix TRACE_INCLUDE_PATH
> KVM: arm/arm64: remove -I. header search paths
> KVM: arm/arm64: prefix header search paths with $(srctree)/
>
> arch/arm/kvm/Makefile | 5 ++---
> arch/arm64/kvm/Makefile | 4 +---
> virt/kvm/arm/trace.h | 2 +-
> 3 files changed, 4 insertions(+), 7 deletions(-)
>

I've applied these 3 patches to kvmarm/queue.

Thanks,

M.
--
Jazz is not dead. It just smells funny...