Skip to contentSkip to conversation

Use CONFIG_PREEMPT_NOTIFIERS around struct preempt_notifier

PATCH Applied Hollis Blanchard 3 participants 7 messages Jan 28, 2008 – Jan 30, 2008 2 messages not in the archive KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Use CONFIG_PREEMPT_NOTIFIERS around struct preempt_notifier

# HG changeset patch
# User Hollis Blanchard <hollisb-r/[email protected]> # Date 1201563731 21600
# Node ID 6a2f4869cf5da00fa0ccacc9188ea493459ce4cb
# Parent a6dd6b5a597903a069cb9711f73ea1b5c4f0b764
This allows kvm_host.h to be #included even when struct preempt_notifier is undefined. This is needed to build asm-offsets.h.

---

1 file changed, 2 insertions(+)

include/linux/kvm_host.h | 2 ++

include/linux/kvm_host.h +2 -0
@@ -67,7 +67,9 @@ void kvm_io_bus_register_dev(struct kvm_
 
 struct kvm_vcpu {
 	struct kvm *kvm;
+#ifdef CONFIG_PREEMPT_NOTIFIERS
 	struct preempt_notifier preempt_notifier;
+#endif
 	int vcpu_id;
 	struct mutex mutex;
 	int   cpu;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Applied
#1 lore raw
Quoted 4 lines · Hollis Blanchard

This allows kvm_host.h to be #included even when struct preempt_notifier is undefined. This is needed to build asm-offsets.h.

Applied, thanks.

Signature · 7 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
#2 lore raw
In reply to Hollis Blanchard

include/linux/kvm_host.h void kvm_io_bus_register_dev(struct kvm_ · line 75

Quoted 13 lines · Hollis Blanchard
include/linux/kvm_host.h +2 -0
@@ -67,7 +67,9 @@ void kvm_io_bus_register_dev(struct kvm_
 
 struct kvm_vcpu {
 	struct kvm *kvm;
+#ifdef CONFIG_PREEMPT_NOTIFIERS
 	struct preempt_notifier preempt_notifier;
+#endif
 	int vcpu_id;
 	struct mutex mutex;
 	int   cpu;

Hm, this causes my build to fail on x86_64:

make -C /lib/modules/2.6.23.8-63.fc8/build M=pwd "$@" make[2]: Entering directory `/usr/src/kernels/2.6.23.8-63.fc8-x86_64'

  LD      /tmp/kvm-userspace/kernel/built-in.o
  CC [M]  /tmp/kvm-userspace/kernel/svm.o
  CC [M]  /tmp/kvm-userspace/kernel/vmx.o
  CC [M]  /tmp/kvm-userspace/kernel/vmx-debug.o
  CC [M]  /tmp/kvm-userspace/kernel/kvm_main.o

/tmp/kvm-userspace/kernel/kvm_main.c: In function ‘vcpu_load’:
/tmp/kvm-userspace/kernel/kvm_main.c:82: error: ‘struct kvm_vcpu’ has no member named ‘preempt_notifier’
/tmp/kvm-userspace/kernel/kvm_main.c: In function ‘vcpu_put’:
/tmp/kvm-userspace/kernel/kvm_main.c:91: error: ‘struct kvm_vcpu’ has no member named ‘preempt_notifier’
/tmp/kvm-userspace/kernel/kvm_main.c: In function ‘kvm_vm_ioctl_create_vcpu’:
/tmp/kvm-userspace/kernel/kvm_main.c:749: error: ‘struct kvm_vcpu’ has no member named ‘preempt_notifier’
/tmp/kvm-userspace/kernel/kvm_main.c: In function ‘preempt_notifier_to_vcpu’:
/tmp/kvm-userspace/kernel/kvm_main.c:1284: error: ‘struct kvm_vcpu’ has no member named ‘preempt_notifier’ /tmp/kvm-userspace/kernel/kvm_main.c:1284: warning: type defaults to ‘int’ in declaration of ‘__mptr’
/tmp/kvm-userspace/kernel/kvm_main.c:1284: warning: initialization from incompatible pointer type /tmp/kvm-userspace/kernel/kvm_main.c:1284: error: ‘struct kvm_vcpu’ has no member named ‘preempt_notifier’
make[3]: *** [/tmp/kvm-userspace/kernel/kvm_main.o] Error 1 make[2]: *** [_module_/tmp/kvm-userspace/kernel] Error 2
make[2]: Leaving directory `/usr/src/kernels/2.6.23.8-63.fc8-x86_64' make[1]: *** [all] Error 2
make[1]: Leaving directory `/tmp/kvm-userspace/kernel'
make: *** [kernel] Error 2

Reverting this patch makes the build succeed again.

Chris Lalancette

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 40 lines · Chris Lalancette

include/linux/kvm_host.h void kvm_io_bus_register_dev(struct kvm_ · line 75

Quoted 13 lines · Hollis Blanchard
include/linux/kvm_host.h +2 -0
@@ -67,7 +67,9 @@ void kvm_io_bus_register_dev(struct kvm_
 
 struct kvm_vcpu {
 	struct kvm *kvm;
+#ifdef CONFIG_PREEMPT_NOTIFIERS
 	struct preempt_notifier preempt_notifier;
+#endif
 	int vcpu_id;
 	struct mutex mutex;
 	int   cpu;

Hm, this causes my build to fail on x86_64:

make -C /lib/modules/2.6.23.8-63.fc8/build M=pwd "$@" make[2]: Entering directory `/usr/src/kernels/2.6.23.8-63.fc8-x86_64'

  LD      /tmp/kvm-userspace/kernel/built-in.o
  CC [M]  /tmp/kvm-userspace/kernel/svm.o
  CC [M]  /tmp/kvm-userspace/kernel/vmx.o
  CC [M]  /tmp/kvm-userspace/kernel/vmx-debug.o
  CC [M]  /tmp/kvm-userspace/kernel/kvm_main.o

/tmp/kvm-userspace/kernel/kvm_main.c: In function ‘vcpu_load’:
/tmp/kvm-userspace/kernel/kvm_main.c:82: error: ‘struct kvm_vcpu’ has no member named ‘preempt_notifier’
/tmp/kvm-userspace/kernel/kvm_main.c: In function ‘vcpu_put’:
/tmp/kvm-userspace/kernel/kvm_main.c:91: error: ‘struct kvm_vcpu’ has no member named ‘preempt_notifier’
/tmp/kvm-userspace/kernel/kvm_main.c: In function ‘kvm_vm_ioctl_create_vcpu’:
/tmp/kvm-userspace/kernel/kvm_main.c:749: error: ‘struct kvm_vcpu’ has no member named ‘preempt_notifier’
/tmp/kvm-userspace/kernel/kvm_main.c: In function ‘preempt_notifier_to_vcpu’:
/tmp/kvm-userspace/kernel/kvm_main.c:1284: error: ‘struct kvm_vcpu’ has no member named ‘preempt_notifier’ /tmp/kvm-userspace/kernel/kvm_main.c:1284: warning: type defaults to ‘int’ in declaration of ‘__mptr’
/tmp/kvm-userspace/kernel/kvm_main.c:1284: warning: initialization from incompatible pointer type

Quoted 8 lines

/tmp/kvm-userspace/kernel/kvm_main.c:1284: error: ‘struct kvm_vcpu’ has no member named ‘preempt_notifier’
make[3]: *** [/tmp/kvm-userspace/kernel/kvm_main.o] Error 1 make[2]: *** [_module_/tmp/kvm-userspace/kernel] Error 2 make[2]: Leaving directory `/usr/src/kernels/2.6.23.8-63.fc8-x86_64' make[1]: *** [all] Error 2
make[1]: Leaving directory `/tmp/kvm-userspace/kernel'
make: *** [kernel] Error 2

This seems to be an artifact of the hackage in external-module-compat.h, since you're building with a pre-PREEMPT_NOTIFIERS kernel.

Maybe adding

        #define CONFIG_PREEMPT_NOTIFIERS
after
        #ifndef CONFIG_PREEMPT_NOTIFIERS

in external-module-compat.h would "fix" it, since kvm_host.h would pick up the define when it's included later.

The other hackful alternative would be this in kvm_host.h:

        #ifdef CONFIG_PREEMPT_NOTIFIERS
        struct preempt_notifier preempt_notifier;
        #else
        long preempt_notifier;
        #endif
Signature · 12 lines
Hollis Blanchard
IBM Linux Technology Center


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel
#5 lore raw
In reply to a message not in the archive
Quoted 49 lines · Chris Lalancette

include/linux/kvm_host.h void kvm_io_bus_register_dev(struct kvm_ · line 75

Quoted 13 lines · Hollis Blanchard
include/linux/kvm_host.h +2 -0
@@ -67,7 +67,9 @@ void kvm_io_bus_register_dev(struct kvm_
 
 struct kvm_vcpu {
 	struct kvm *kvm;
+#ifdef CONFIG_PREEMPT_NOTIFIERS
 	struct preempt_notifier preempt_notifier;
+#endif
 	int vcpu_id;
 	struct mutex mutex;
 	int   cpu;

Hm, this causes my build to fail on x86_64:

make -C /lib/modules/2.6.23.8-63.fc8/build M=pwd "$@" make[2]: Entering directory `/usr/src/kernels/2.6.23.8-63.fc8-x86_64'

  LD      /tmp/kvm-userspace/kernel/built-in.o
  CC [M]  /tmp/kvm-userspace/kernel/svm.o
  CC [M]  /tmp/kvm-userspace/kernel/vmx.o
  CC [M]  /tmp/kvm-userspace/kernel/vmx-debug.o
  CC [M]  /tmp/kvm-userspace/kernel/kvm_main.o

/tmp/kvm-userspace/kernel/kvm_main.c: In function ‘vcpu_load’:
/tmp/kvm-userspace/kernel/kvm_main.c:82: error: ‘struct kvm_vcpu’ has no member named ‘preempt_notifier’
/tmp/kvm-userspace/kernel/kvm_main.c: In function ‘vcpu_put’:
/tmp/kvm-userspace/kernel/kvm_main.c:91: error: ‘struct kvm_vcpu’ has no member named ‘preempt_notifier’
/tmp/kvm-userspace/kernel/kvm_main.c: In function ‘kvm_vm_ioctl_create_vcpu’:
/tmp/kvm-userspace/kernel/kvm_main.c:749: error: ‘struct kvm_vcpu’ has no member named ‘preempt_notifier’
/tmp/kvm-userspace/kernel/kvm_main.c: In function ‘preempt_notifier_to_vcpu’:
/tmp/kvm-userspace/kernel/kvm_main.c:1284: error: ‘struct kvm_vcpu’ has no member named ‘preempt_notifier’ /tmp/kvm-userspace/kernel/kvm_main.c:1284: warning: type defaults to ‘int’ in declaration of ‘__mptr’
/tmp/kvm-userspace/kernel/kvm_main.c:1284: warning: initialization from incompatible pointer type /tmp/kvm-userspace/kernel/kvm_main.c:1284: error: ‘struct kvm_vcpu’ has no member named ‘preempt_notifier’
make[3]: *** [/tmp/kvm-userspace/kernel/kvm_main.o] Error 1 make[2]: *** [_module_/tmp/kvm-userspace/kernel] Error 2
make[2]: Leaving directory `/usr/src/kernels/2.6.23.8-63.fc8-x86_64' make[1]: *** [all] Error 2
make[1]: Leaving directory `/tmp/kvm-userspace/kernel'
make: *** [kernel] Error 2

Quoted 3 lines

Reverting this patch makes the build succeed again.

Chris Lalancette

Actually, I think this should do the trick:

Always use CONFIG_PREEMPT_NOTIFIERS in the external module hack.

kernel/hack-module.awk +2 -0
@@ -42,6 +42,8 @@
 
 { sub(/linux\/mm_types\.h/, "linux/mm.h") }
 
+/#ifdef CONFIG_PREEMPT_NOTIFIERS/ { $0 = "#if 1" }
+
 { print }
 
 /kvm_x86_ops->run/ {
Signature · 12 lines
Hollis Blanchard
IBM Linux Technology Center


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel
#6 lore raw
In reply to a message not in the archive
Quoted 7 lines · Chris Lalancette
Quoted 5 lines · Hollis Blanchard
include/linux/kvm_host.h +0 -0
@@ -67,7 +67,9 @@ void kvm_io_bus_register_dev(struct kvm_
 
Quoted 13 lines

include/linux/kvm_host.h void kvm_io_bus_register_dev(struct kvm_ · line 75

Quoted 9 lines
include/linux/kvm_host.h +2 -0
 struct kvm_vcpu {
 	struct kvm *kvm;
+#ifdef CONFIG_PREEMPT_NOTIFIERS
 	struct preempt_notifier preempt_notifier;
+#endif
 	int vcpu_id;
 	struct mutex mutex;
 	int   cpu;

Hm, this causes my build to fail on x86_64:

I pushed a fix for this.

Signature · 7 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

A message that is not in the archive (sent off-list or not yet received): 47A049A6.6070007-atKUWr5tajBWk0Htik3J/[email protected]

#8 lore raw
Quoted 6 lines · Avi Kivity
Quoted 3 lines

Hm, this causes my build to fail on x86_64:

I pushed a fix for this.

Yep, that does it. Thanks!

Chris Lalancette

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/