Skip to contentSkip to conversation

kvm-kmod: x86: Drop duplicate external-module-compat objects

PATCH Superseded Jan Kiszka 3 participants 9 messages May 22, 2009 – May 25, 2009 KVM

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 kvm-kmod: x86: Drop duplicate external-module-compat objects

This redundancy breaks subtly when building against recent OpenSUSE kernels.

---

 x86/Kbuild |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
x86/Kbuild +2 -2
index e304c79..ade87fc 100644
@@ -13,7 +13,7 @@ endif
 ifeq ($(CONFIG_IOMMU_API),y)
 kvm-objs += iommu.o
 endif
-kvm-intel-objs := vmx.o vmx-debug.o ../external-module-compat.o
-kvm-amd-objs := svm.o ../external-module-compat.o
+kvm-intel-objs := vmx.o vmx-debug.o
+kvm-amd-objs := svm.o
 
 CFLAGS_kvm_main.o = -DKVM_MAIN
#1 lore raw
Quoted 2 lines · * Jan Kiszka ([email protected]) wrote:

This redundancy breaks subtly when building against recent OpenSUSE kernels.

What breaks?

author
#2 lore raw
Quoted 5 lines · Chris Wright
Quoted 2 lines · * Jan Kiszka ([email protected]) wrote:

This redundancy breaks subtly when building against recent OpenSUSE kernels.

What breaks?

When building external-module-compat.c, linux/scripts/basic/hash somehow gets called with a multi-word modname. It complains via its usage, and gcc then tries to compile files it derives from that output:

gcc -Wp,-MD,/data/kvm-kmod/x86/../.external-module-compat.o.d -nostdinc -isystem /usr/lib64/gcc/x86_64-suse-linux/4.3/include -D__KERNEL__ -I/data/kvm-kmod/include -Iinclude -Iinclude2 -I/lib/modules/2.6.27.21-0.1-default/source/include -Iarch/x86/include -I/data/kvm-kmod/include-compat -include include/linux/autoconf.h -include /data/kvm-kmod/x86/external-module-compat.h -I/data/kvm-kmod/x86 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Os -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -I/usr/src/linux-2.6.27.21-0.1/include/asm-x86/mach-default -Iinclude/asm-x86/mach-default -fno-stack-protector -fomit-frame-pointer -fasynchronous-unwind-tables -g -Wdeclaration-after-statement -Wno-pointer-sign -fwrapv -DMODULE -D"KBUILD_STR(
s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(external_module_compat)" -D"DEBUG_HASH=Usage: ./scripts/basic/hash <djb2|r5> <modname>" -D"DEBUG_HASH2=Usage: ./scripts/basic/hash <djb2|r5> <modname>" -c -o /data/kvm-kmod/x86/../.tmp_external-module-compat.o /data/kvm-kmod/x86/../external-module-compat.c
gcc: <djb2|r5>: Datei oder Verzeichnis nicht gefunden
gcc: <modname>: Datei oder Verzeichnis nicht gefunden
gcc: <djb2|r5>: Datei oder Verzeichnis nicht gefunden
gcc: <modname>: Datei oder Verzeichnis nicht gefunden

Jan

#6 lore raw
In reply to Jan Kiszka
Quoted 14 lines · Jan Kiszka

This redundancy breaks subtly when building against recent OpenSUSE kernels.

---

 x86/Kbuild |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
x86/Kbuild +0 -0
index e304c79..ade87fc 100644

x86/Kbuild endif · line 19

Quoted 9 lines
x86/Kbuild +2 -2
@@ -13,7 +13,7 @@ endif
 ifeq ($(CONFIG_IOMMU_API),y)
 kvm-objs += iommu.o
 endif
-kvm-intel-objs := vmx.o vmx-debug.o ../external-module-compat.o
-kvm-amd-objs := svm.o ../external-module-compat.o
+kvm-intel-objs := vmx.o vmx-debug.o
+kvm-amd-objs := svm.o
 
 

IIRC, for really old kernels, some symbols are defined in external-module-compat.c and needed by kvm-$arch.ko. So we'll have to export those symbols if we drop the double link (which is a good idea regardless of the build problem).

Signature · 1 line
error compiling committee.c: too many arguments to function
#3 lore raw
In reply to Jan Kiszka
Quoted 7 lines · Jan Kiszka
Quoted 5 lines · Chris Wright
Quoted 3 lines · * Jan Kiszka ([email protected]) wrote:

This redundancy breaks subtly when building against recent OpenSUSE kernels.

Quoted 8 lines
Quoted 2 lines

What breaks?

When building external-module-compat.c, linux/scripts/basic/hash somehow gets called with a multi-word modname. It complains via its usage, and gcc then tries to compile files it derives from that output:

gcc -Wp,-MD,/data/kvm-kmod/x86/../.external-module-compat.o.d -nostdinc -isystem /usr/lib64/gcc/x86_64-suse-linux/4.3/include -D__KERNEL__ -I/data/kvm-kmod/include -Iinclude -Iinclude2 -I/lib/modules/2.6.27.21-0.1-default/source/include -Iarch/x86/include -I/data/kvm-kmod/include-compat -include include/linux/autoconf.h -include /data/kvm-kmod/x86/external-module-compat.h -I/data/kvm-kmod/x86 -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Os -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -I/usr/src/linux-2.6.27.21-0.1/include/asm-x86/mach-

default -Iinclude/asm-x86/mach-default -fno-stack-protector -fomit-frame-pointer -fasynchronous-unwind-tables -g -Wdeclaration-after-statement -Wno-pointer-sign -fwrapv -DMODULE -D"KBUILD_STR(

Quoted 7 lines

s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(external_module_compat)" -D"DEBUG_HASH=Usage: ./scripts/basic/hash <djb2|r5> <modname>" -D"DEBUG_HASH2=Usage: ./scripts/basic/hash <djb2|r5> <modname>" -c -o /data/kvm-kmod/x86/../.tmp_external-module-compat.o /data/kvm-kmod/x86/../external-module-compat.c
gcc: <djb2|r5>: Datei oder Verzeichnis nicht gefunden
gcc: <modname>: Datei oder Verzeichnis nicht gefunden
gcc: <djb2|r5>: Datei oder Verzeichnis nicht gefunden
gcc: <modname>: Datei oder Verzeichnis nicht gefunden

Can you show the call to hash? It's more interesting than the aftermath of its failure.

Signature · 1 line
error compiling committee.c: too many arguments to function
author
#4 lore raw
Quoted 39 lines · Avi Kivity
Quoted 38 lines · Jan Kiszka
Quoted 7 lines · Chris Wright
Quoted 3 lines · * Jan Kiszka ([email protected]) wrote:

This redundancy breaks subtly when building against recent OpenSUSE kernels.

What breaks?

When building external-module-compat.c, linux/scripts/basic/hash somehow gets called with a multi-word modname. It complains via its usage, and gcc then tries to compile files it derives from that output:

gcc -Wp,-MD,/data/kvm-kmod/x86/../.external-module-compat.o.d

(quoted diff) +0 -4
-nostdinc -isystem /usr/lib64/gcc/x86_64-suse-linux/4.3/include
-D__KERNEL__ -I/data/kvm-kmod/include -Iinclude    -Iinclude2
-I/lib/modules/2.6.27.21-0.1-default/source/include 
-Iarch/x86/include -I/data/kvm-kmod/include-compat      -include

include/linux/autoconf.h -include
/data/kvm-kmod/x86/external-module-compat.h -I/data/kvm-kmod/x86

(quoted diff) +0 -11
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -Werror-implicit-function-declaration -Os -m64
-mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time
-maccumulate-outgoing-args -DCONFIG_AS_CFI=1
-DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -mno-sse
-mno-mmx -mno-sse2 -mno-3dnow
-I/usr/src/linux-2.6.27.21-0.1/include/asm-x86/mach-default
-Iinclude/asm-x86/mach-default -fno-stack-protector
-fomit-frame-pointer -fasynchronous-unwind-tables -g
-Wdeclaration-after-statement -Wno-pointer-sign -fwrapv -DMODULE
-D"KBUILD_STR(

s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(external_module_compat)"

(quoted diff) +0 -2
-D"DEBUG_HASH=Usage: ./scripts/basic/hash <djb2|r5> <modname>"
-D"DEBUG_HASH2=Usage: ./scripts/basic/hash <djb2|r5> <modname>" -c -o

/data/kvm-kmod/x86/../.tmp_external-module-compat.o /data/kvm-kmod/x86/../external-module-compat.c
gcc: <djb2|r5>: Datei oder Verzeichnis nicht gefunden

Quoted 9 lines
Quoted 5 lines

gcc: <modname>: Datei oder Verzeichnis nicht gefunden
gcc: <djb2|r5>: Datei oder Verzeichnis nicht gefunden
gcc: <modname>: Datei oder Verzeichnis nicht gefunden

Can you show the call to hash? It's more interesting than the aftermath of its failure.

strace said eg.:

execve("./scripts/basic/hash", ["./scripts/basic/hash", "djb2", "/data/kvm-kmod/x86/..kvm", "kvm-amd", "kvm-intel"], ...

Jan

author
#7 lore raw

PATCH v2 1/1 kvm-kmod: x86: Drop duplicate external-module-compat objects

In reply to Avi Kivity
Quoted 21 lines · Avi Kivity
Quoted 20 lines · Jan Kiszka

This redundancy breaks subtly when building against recent OpenSUSE kernels.

---

 x86/Kbuild |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
x86/Kbuild +1 -2
index e304c79..ade87fc 100644
@@ -13,7 +13,7 @@ endif
 ifeq ($(CONFIG_IOMMU_API),y)
 kvm-objs += iommu.o
 endif
-kvm-intel-objs := vmx.o vmx-debug.o ../external-module-compat.o
-kvm-amd-objs := svm.o ../external-module-compat.o
+kvm-intel-objs := vmx.o vmx-debug.o
Quoted 9 lines

x86/Kbuild endif · line 19

Quoted 3 lines
x86/Kbuild +1 -0
+kvm-amd-objs := svm.o
 
 

IIRC, for really old kernels, some symbols are defined in external-module-compat.c and needed by kvm-$arch.ko. So we'll have to export those symbols if we drop the double link (which is a good idea regardless of the build problem).

Checked against 2.6.18 (2.6.16 doesn't build build with my gcc-4.3 and x86/x86_emulate.o sends my gcc-3.3 into some stack overflow): We only need to export kvm_smp_call_function_single.

More patches to fix various old kernel build breakages are now also in my queue...

------------>

This redundancy breaks subtly when building against recent OpenSUSE kernels. Somehow scripts/basic/hash gets called with multiple modname arguments, causing it to fail and produce invalid output.

Changes in v2:
- export kvm_smp_call_function_single required by vendor module

---

 external-module-compat.c |    3 +++
 x86/Kbuild               |    4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)
external-module-compat.c +3 -0
index f6013f3..6b69127 100644
@@ -46,6 +46,7 @@ int kvm_smp_call_function_single(int cpu, void (*func)(void *info),
 	put_cpu();
 	return r;
 }
+EXPORT_SYMBOL_GPL(kvm_smp_call_function_single);
 
 #define smp_call_function_single kvm_smp_call_function_single
 
@@ -75,6 +76,7 @@ int kvm_smp_call_function_single(int cpu, void (*func)(void *info),
 	put_cpu();
 	return r;
 }
+EXPORT_SYMBOL_GPL(kvm_smp_call_function_single);
 
 #define smp_call_function_single kvm_smp_call_function_single
 
@@ -104,6 +106,7 @@ int kvm_smp_call_function_single(int cpu, void (*func)(void *info),
 
 }
 #endif /* !CONFIG_SMP */
+EXPORT_SYMBOL_GPL(kvm_smp_call_function_single);
 
 #define smp_call_function_single kvm_smp_call_function_single
 
x86/Kbuild +2 -2
index e304c79..ade87fc 100644
@@ -13,7 +13,7 @@ endif
 ifeq ($(CONFIG_IOMMU_API),y)
 kvm-objs += iommu.o
 endif
-kvm-intel-objs := vmx.o vmx-debug.o ../external-module-compat.o
-kvm-amd-objs := svm.o ../external-module-compat.o
+kvm-intel-objs := vmx.o vmx-debug.o
+kvm-amd-objs := svm.o
 
 CFLAGS_kvm_main.o = -DKVM_MAIN
Applied
#8 lore raw
Quoted 7 lines · Jan Kiszka

Checked against 2.6.18 (2.6.16 doesn't build build with my gcc-4.3 and x86/x86_emulate.o sends my gcc-3.3 into some stack overflow): We only need to export kvm_smp_call_function_single.

More patches to fix various old kernel build breakages are now also in my queue...

Quoted 9 lines

------------>

This redundancy breaks subtly when building against recent OpenSUSE kernels. Somehow scripts/basic/hash gets called with multiple modname arguments, causing it to fail and produce invalid output.

Changes in v2:
- export kvm_smp_call_function_single required by vendor module

Applied, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function
#5 lore raw
In reply to Jan Kiszka
Quoted 10 lines · Jan Kiszka
Quoted 4 lines

Can you show the call to hash? It's more interesting than the aftermath of its failure.

strace said eg.:

execve("./scripts/basic/hash", ["./scripts/basic/hash", "djb2", "/data/kvm-kmod/x86/..kvm", "kvm-amd", "kvm-intel"], ...

Tried to look what's going on. Never again.

Signature · 1 line
error compiling committee.c: too many arguments to function