Skip to contentSkip to conversation

s390: Include kvm_host.h header only if KVM is enabled

PATCH In review Pranith Kumar 3 participants 4 messages Dec 8, 2014 – Dec 9, 2014 s390

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390: Include kvm_host.h header only if KVM is enabled

KVM uses srcu structures because of which CONFIG_KVM selects CONFIG_SRCU. In asm-offsets.c, we are including kvm_host.h unconditionally even though CONFIG_KVM is not enabled because of which we get errors like follows:

In file included from arch/s390/kernel/asm-offsets.c:10:0:

Quoted 1 line
Quoted 1 line

include/linux/kvm_host.h:363:21: error: field 'srcu' has incomplete type

      struct srcu_struct srcu;
                         ^
Quoted 1 line
Quoted 1 line

include/linux/kvm_host.h:364:21: error: field 'irq_srcu' has incomplete type

      struct srcu_struct irq_srcu;
                         ^
    make[2]: *** [arch/s390/kernel/asm-offsets.s] Error 1
    make[2]: Target '__build' not remade because of errors.
    make[1]: *** [prepare0] Error 2
    make[1]: Target 'prepare' not remade because of errors.
    make: *** [sub-make] Error 2 

This patch fixes these by including kvm_host.h conditionally on CONFIG_KVM.

---
 arch/s390/kernel/asm-offsets.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/s390/kernel/asm-offsets.c +6 -1
index ef279a1..055334d 100644
@@ -7,12 +7,15 @@
 #define ASM_OFFSETS_C
 
 #include <linux/kbuild.h>
-#include <linux/kvm_host.h>
 #include <linux/sched.h>
 #include <asm/idle.h>
 #include <asm/vdso.h>
 #include <asm/pgtable.h>
 
+#ifdef CONFIG_KVM
+#include <linux/kvm_host.h>
+#endif
+
 /*
  * Make sure that the compiler is new enough. We want a compiler that
  * is known to work with the "Q" assembler constraint.
@@ -182,8 +185,10 @@ int main(void)
 	DEFINE(__LC_PGM_TDB, offsetof(struct _lowcore, pgm_tdb));
 	DEFINE(__THREAD_trap_tdb, offsetof(struct task_struct, thread.trap_tdb));
 	DEFINE(__GMAP_ASCE, offsetof(struct gmap, asce));
+#ifdef CONFIG_KVM
 	DEFINE(__SIE_PROG0C, offsetof(struct kvm_s390_sie_block, prog0c));
 	DEFINE(__SIE_PROG20, offsetof(struct kvm_s390_sie_block, prog20));
+#endif /* CONFIG_KVM */
 #endif /* CONFIG_32BIT */
 	return 0;
 }
Signature · 1 line
1.9.1
#1 lore raw
Quoted 17 lines · Pranith Kumar

KVM uses srcu structures because of which CONFIG_KVM selects CONFIG_SRCU. In asm-offsets.c, we are including kvm_host.h unconditionally even though CONFIG_KVM is not enabled because of which we get errors like follows:

In file included from arch/s390/kernel/asm-offsets.c:10:0:

Quoted 1 line
Quoted 1 line

include/linux/kvm_host.h:363:21: error: field 'srcu' has incomplete type

      struct srcu_struct srcu;
                         ^
Quoted 1 line
Quoted 1 line

include/linux/kvm_host.h:364:21: error: field 'irq_srcu' has incomplete type

      struct srcu_struct irq_srcu;
                         ^
    make[2]: *** [arch/s390/kernel/asm-offsets.s] Error 1
    make[2]: Target '__build' not remade because of errors.
    make[1]: *** [prepare0] Error 2
    make[1]: Target 'prepare' not remade because of errors.
    make: *** [sub-make] Error 2 
Quoted 3 lines

This patch fixes these by including kvm_host.h conditionally on CONFIG_KVM.

To make the commits bisectable, we need to combine these two patches, correct?

Thanx, Paul

Quoted 39 lines
---
 arch/s390/kernel/asm-offsets.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/s390/kernel/asm-offsets.c +6 -1
index ef279a1..055334d 100644
@@ -7,12 +7,15 @@
 #define ASM_OFFSETS_C
 
 #include <linux/kbuild.h>
-#include <linux/kvm_host.h>
 #include <linux/sched.h>
 #include <asm/idle.h>
 #include <asm/vdso.h>
 #include <asm/pgtable.h>
 
+#ifdef CONFIG_KVM
+#include <linux/kvm_host.h>
+#endif
+
 /*
  * Make sure that the compiler is new enough. We want a compiler that
  * is known to work with the "Q" assembler constraint.
@@ -182,8 +185,10 @@ int main(void)
 	DEFINE(__LC_PGM_TDB, offsetof(struct _lowcore, pgm_tdb));
 	DEFINE(__THREAD_trap_tdb, offsetof(struct task_struct, thread.trap_tdb));
 	DEFINE(__GMAP_ASCE, offsetof(struct gmap, asce));
+#ifdef CONFIG_KVM
 	DEFINE(__SIE_PROG0C, offsetof(struct kvm_s390_sie_block, prog0c));
 	DEFINE(__SIE_PROG20, offsetof(struct kvm_s390_sie_block, prog20));
+#endif /* CONFIG_KVM */
 #endif /* CONFIG_32BIT */
 	return 0;
 }
Signature · 1 line
1.9.1
#2 lore raw
Quoted 18 lines · Paul E. McKenney
Quoted 17 lines · Pranith Kumar

KVM uses srcu structures because of which CONFIG_KVM selects CONFIG_SRCU. In asm-offsets.c, we are including kvm_host.h unconditionally even though CONFIG_KVM is not enabled because of which we get errors like follows:

In file included from arch/s390/kernel/asm-offsets.c:10:0:

Quoted 1 line
Quoted 1 line

include/linux/kvm_host.h:363:21: error: field 'srcu' has incomplete type

      struct srcu_struct srcu;
                         ^
Quoted 1 line
Quoted 1 line

include/linux/kvm_host.h:364:21: error: field 'irq_srcu' has incomplete type

      struct srcu_struct irq_srcu;
                         ^
    make[2]: *** [arch/s390/kernel/asm-offsets.s] Error 1
    make[2]: Target '__build' not remade because of errors.
    make[1]: *** [prepare0] Error 2
    make[1]: Target 'prepare' not remade because of errors.
    make: *** [sub-make] Error 2
Quoted 7 lines
Quoted 3 lines

This patch fixes these by including kvm_host.h conditionally on CONFIG_KVM.

To make the commits bisectable, we need to combine these two patches, correct?

Yes, if the s390 maintainers raise no objections, I will combine this with the other patch and send it.

Thanks!

Quoted 40 lines
Quoted 39 lines
---
 arch/s390/kernel/asm-offsets.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/s390/kernel/asm-offsets.c +6 -2
index ef279a1..055334d 100644
@@ -7,12 +7,15 @@
 #define ASM_OFFSETS_C
 
 #include <linux/kbuild.h>
-#include <linux/kvm_host.h>
 #include <linux/sched.h>
 #include <asm/idle.h>
 #include <asm/vdso.h>
 #include <asm/pgtable.h>
 
+#ifdef CONFIG_KVM
+#include <linux/kvm_host.h>
+#endif
+
 /*
  * Make sure that the compiler is new enough. We want a compiler that
  * is known to work with the "Q" assembler constraint.
@@ -182,8 +185,10 @@ int main(void)
      DEFINE(__LC_PGM_TDB, offsetof(struct _lowcore, pgm_tdb));
      DEFINE(__THREAD_trap_tdb, offsetof(struct task_struct, thread.trap_tdb));
      DEFINE(__GMAP_ASCE, offsetof(struct gmap, asce));
+#ifdef CONFIG_KVM
      DEFINE(__SIE_PROG0C, offsetof(struct kvm_s390_sie_block, prog0c));
      DEFINE(__SIE_PROG20, offsetof(struct kvm_s390_sie_block, prog20));
+#endif /* CONFIG_KVM */
 #endif /* CONFIG_32BIT */
      return 0;
 }
--

1.9.1

Signature · 1 line
Pranith
#3 lore raw
Quoted 22 lines · Pranith Kumar
Quoted 20 lines · Paul E. McKenney
Quoted 19 lines · Pranith Kumar

KVM uses srcu structures because of which CONFIG_KVM selects CONFIG_SRCU. In asm-offsets.c, we are including kvm_host.h unconditionally even though CONFIG_KVM is not enabled because of which we get errors like follows:

In file included from arch/s390/kernel/asm-offsets.c:10:0:

Quoted 1 line
Quoted 1 line

include/linux/kvm_host.h:363:21: error: field 'srcu' has incomplete type

      struct srcu_struct srcu;
                         ^
Quoted 1 line
Quoted 1 line

include/linux/kvm_host.h:364:21: error: field 'irq_srcu' has incomplete type

      struct srcu_struct irq_srcu;
                         ^
    make[2]: *** [arch/s390/kernel/asm-offsets.s] Error 1
    make[2]: Target '__build' not remade because of errors.
    make[1]: *** [prepare0] Error 2
    make[1]: Target 'prepare' not remade because of errors.
    make: *** [sub-make] Error 2

This patch fixes these by including kvm_host.h conditionally on CONFIG_KVM.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

To make the commits bisectable, we need to combine these two patches, correct?

Yes, if the s390 maintainers raise no objections, I will combine this with the other patch and send it.

That's fine with me.

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
 arch/s390/kernel/asm-offsets.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/s390/kernel/asm-offsets.c +0 -1
index ef279a1..055334d 100644
@@ -7,12 +7,15 @@
 #define ASM_OFFSETS_C
 
 #include <linux/kbuild.h>
-#include <linux/kvm_host.h>
 #include <linux/sched.h>
 #include <asm/idle.h>
 #include <asm/vdso.h>
 #include <asm/pgtable.h>
 
Quoted 4 lines
Quoted 4 lines

arch/s390/kernel/asm-offsets.c line 18

Quoted 4 lines
arch/s390/kernel/asm-offsets.c +4 -0
+#ifdef CONFIG_KVM
+#include <linux/kvm_host.h>
+#endif
+

Even though I'm wondering why linux/kvm_host.h doesn't have such an #ifdef included. Not that it would help in this case, but it would help to omit the #ifdef around the #include statement here.

Looking a bit further.. so arch/s390/include/asm/kvm_host.h includes include/linux/kvm_host.h and vice versa. Nice ;)