All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm-kmod: fix build on kernels with kvm trace set
@ 2009-04-28 12:22 Michael S. Tsirkin
  2009-04-30 11:52 ` Avi Kivity
  2009-05-04  9:24 ` Avi Kivity
  0 siblings, 2 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2009-04-28 12:22 UTC (permalink / raw)
  To: avi, kvm

CONFIG_KVM_TRACE in kernel conflicts with the definition
in external module. external-module-compat-comm.h tried
to work around this, but this didn't work as some
code still does #include <linux/autoconf.h>
directly.

Solve this differently by s/CONFIG_KVM_TRACE/CONFIG_KMOD_KVM_TRACE/
in awk. Had to tighten regular expressions in hack-module.awk
so that they don't trigger on kvm_host.h .

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 Makefile                      |    5 +++--
 configure                     |    2 +-
 external-module-compat-comm.h |    7 -------
 x86/Kbuild                    |    2 +-
 x86/hack-module.awk           |    8 +++++---
 5 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/Makefile b/Makefile
index f2ef811..9cdc0af 100644
--- a/Makefile
+++ b/Makefile
@@ -34,8 +34,8 @@ hack-files-ia64 = kvm_main.c kvm_fw.c kvm_lib.c kvm-ia64.c
 
 hack-files = $(hack-files-$(ARCH_DIR))
 
-ifeq ($(EXT_CONFIG_KVM_TRACE),y)
-module_defines += -DEXT_CONFIG_KVM_TRACE=y
+ifeq ($(CONFIG_KMOD_KVM_TRACE),y)
+module_defines += -DCONFIG_KMOD_KVM_TRACE=1
 endif
 
 all:: prerequisite
@@ -72,6 +72,7 @@ header-sync:
 	for i in $$(find $T -name '*.h'); do \
 		$(call unifdef,$$i); done
 	$(call hack, include/linux/kvm.h)
+	$(call hack, include/linux/kvm_host.h)
 	$(call hack, include/asm-$(ARCH_DIR)/kvm.h)
 	set -e && for i in $$(find $T -type f -printf '%P '); \
 		do mkdir -p $$(dirname $$i); cmp -s $$i $T/$$i || cp $T/$$i $$i; done
diff --git a/configure b/configure
index 30af6e7..6e12bb1 100755
--- a/configure
+++ b/configure
@@ -122,5 +122,5 @@ DEPMOD_VERSION=$depmod_version
 EOF
 
 cat <<EOF > config.kbuild
-EXT_CONFIG_KVM_TRACE=$kvm_trace
+CONFIG_KMOD_KVM_TRACE=$kvm_trace
 EOF
diff --git a/external-module-compat-comm.h b/external-module-compat-comm.h
index c955927..e561448 100644
--- a/external-module-compat-comm.h
+++ b/external-module-compat-comm.h
@@ -18,13 +18,6 @@
 #include <linux/hrtimer.h>
 #include <asm/bitops.h>
 
-/* Override CONFIG_KVM_TRACE */
-#ifdef EXT_CONFIG_KVM_TRACE
-#  define CONFIG_KVM_TRACE 1
-#else
-#  undef CONFIG_KVM_TRACE
-#endif
-
 /*
  * 2.6.16 does not have GFP_NOWAIT
  */
diff --git a/x86/Kbuild b/x86/Kbuild
index d3aca00..fbdb28b 100644
--- a/x86/Kbuild
+++ b/x86/Kbuild
@@ -7,7 +7,7 @@ kvm-objs := kvm_main.o x86.o mmu.o x86_emulate.o ../anon_inodes.o irq.o i8259.o
 	 lapic.o ioapic.o preempt.o i8254.o coalesced_mmio.o irq_comm.o \
 	 timer.o \
 	 ../external-module-compat.o
-ifeq ($(EXT_CONFIG_KVM_TRACE),y)
+ifeq ($(CONFIG_KMOD_KVM_TRACE),y)
 kvm-objs += kvm_trace.o
 endif
 ifeq ($(CONFIG_IOMMU_API),y)
diff --git a/x86/hack-module.awk b/x86/hack-module.awk
index 260eeef..f3d95be 100644
--- a/x86/hack-module.awk
+++ b/x86/hack-module.awk
@@ -4,7 +4,7 @@ BEGIN { split("INIT_WORK desc_struct ldttss_desc64 desc_ptr " \
 	      "hrtimer_expires_remaining " \
 	      "on_each_cpu relay_open request_irq" , compat_apis); }
 
-/^int kvm_init\(/ { anon_inodes = 1 }
+/^int kvm_init\([^)]*\)$/ { anon_inodes = 1 }
 
 /return 0;/ && anon_inodes {
     print "\tr = kvm_init_anon_inodes();";
@@ -17,7 +17,7 @@ BEGIN { split("INIT_WORK desc_struct ldttss_desc64 desc_ptr " \
     anon_inodes = 0
 }
 
-/^void kvm_exit/ { anon_inodes_exit = 1 }
+/^void kvm_exit[^)]*\)$/ { anon_inodes_exit = 1 }
 
 /\}/ && anon_inodes_exit {
     print "\tkvm_exit_anon_inodes();";
@@ -25,7 +25,7 @@ BEGIN { split("INIT_WORK desc_struct ldttss_desc64 desc_ptr " \
     anon_inodes_exit = 0
 }
 
-/^int kvm_arch_init/ { kvm_arch_init = 1 }
+/^int kvm_arch_init[^)])$/ { kvm_arch_init = 1 }
 /\<tsc_khz\>/ && kvm_arch_init { sub("\\<tsc_khz\\>", "kvm_tsc_khz") }
 /^}/ { kvm_arch_init = 0 }
 
@@ -85,6 +85,8 @@ BEGIN { split("INIT_WORK desc_struct ldttss_desc64 desc_ptr " \
 
 /\kvm_.*_fops\.owner = module;/ { $0 = "IF_ANON_INODES_DOES_REFCOUNTS(" $0 ")" }
 
+{ sub(/\<CONFIG_KVM_TRACE\>/, "CONFIG_KMOD_KVM_TRACE") }
+
 { print }
 
 /unsigned long flags;/ &&  vmx_load_host_state {
-- 
1.6.3.rc3.dirty

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] kvm-kmod: fix build on kernels with kvm trace set
  2009-04-28 12:22 [PATCH] kvm-kmod: fix build on kernels with kvm trace set Michael S. Tsirkin
@ 2009-04-30 11:52 ` Avi Kivity
  2009-05-04  0:58   ` Zhang, Xiantao
  2009-05-04  9:24 ` Avi Kivity
  1 sibling, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2009-04-30 11:52 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: kvm, Zhang, Xiantao

Michael S. Tsirkin wrote:
> CONFIG_KVM_TRACE in kernel conflicts with the definition
> in external module. external-module-compat-comm.h tried
> to work around this, but this didn't work as some
> code still does #include <linux/autoconf.h>
> directly.
>
> Solve this differently by s/CONFIG_KVM_TRACE/CONFIG_KMOD_KVM_TRACE/
> in awk. Had to tighten regular expressions in hack-module.awk
> so that they don't trigger on kvm_host.h .
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  Makefile                      |    5 +++--
>  configure                     |    2 +-
>  external-module-compat-comm.h |    7 -------
>  x86/Kbuild                    |    2 +-
>  x86/hack-module.awk           |    8 +++++---
>  5 files changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index f2ef811..9cdc0af 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -34,8 +34,8 @@ hack-files-ia64 = kvm_main.c kvm_fw.c kvm_lib.c kvm-ia64.c
>  
>  hack-files = $(hack-files-$(ARCH_DIR))
>  
> -ifeq ($(EXT_CONFIG_KVM_TRACE),y)
> -module_defines += -DEXT_CONFIG_KVM_TRACE=y
> +ifeq ($(CONFIG_KMOD_KVM_TRACE),y)
> +module_defines += -DCONFIG_KMOD_KVM_TRACE=1
>  endif
>  
>  all:: prerequisite
> @@ -72,6 +72,7 @@ header-sync:
>  	for i in $$(find $T -name '*.h'); do \
>  		$(call unifdef,$$i); done
>  	$(call hack, include/linux/kvm.h)
> +	$(call hack, include/linux/kvm_host.h)
>  	$(call hack, include/asm-$(ARCH_DIR)/kvm.h)
>  	set -e && for i in $$(find $T -type f -printf '%P '); \
>  		do mkdir -p $$(dirname $$i); cmp -s $$i $T/$$i || cp $T/$$i $$i; done
> diff --git a/configure b/configure
> index 30af6e7..6e12bb1 100755
> --- a/configure
> +++ b/configure
> @@ -122,5 +122,5 @@ DEPMOD_VERSION=$depmod_version
>  EOF
>  
>  cat <<EOF > config.kbuild
> -EXT_CONFIG_KVM_TRACE=$kvm_trace
> +CONFIG_KMOD_KVM_TRACE=$kvm_trace
>  EOF
> diff --git a/external-module-compat-comm.h b/external-module-compat-comm.h
> index c955927..e561448 100644
> --- a/external-module-compat-comm.h
> +++ b/external-module-compat-comm.h
> @@ -18,13 +18,6 @@
>  #include <linux/hrtimer.h>
>  #include <asm/bitops.h>
>  
> -/* Override CONFIG_KVM_TRACE */
> -#ifdef EXT_CONFIG_KVM_TRACE
> -#  define CONFIG_KVM_TRACE 1
> -#else
> -#  undef CONFIG_KVM_TRACE
> -#endif
> -
>  /*
>   * 2.6.16 does not have GFP_NOWAIT
>   */
> diff --git a/x86/Kbuild b/x86/Kbuild
> index d3aca00..fbdb28b 100644
> --- a/x86/Kbuild
> +++ b/x86/Kbuild
> @@ -7,7 +7,7 @@ kvm-objs := kvm_main.o x86.o mmu.o x86_emulate.o ../anon_inodes.o irq.o i8259.o
>  	 lapic.o ioapic.o preempt.o i8254.o coalesced_mmio.o irq_comm.o \
>  	 timer.o \
>  	 ../external-module-compat.o
> -ifeq ($(EXT_CONFIG_KVM_TRACE),y)
> +ifeq ($(CONFIG_KMOD_KVM_TRACE),y)
>  kvm-objs += kvm_trace.o
>  endif
>  ifeq ($(CONFIG_IOMMU_API),y)
> diff --git a/x86/hack-module.awk b/x86/hack-module.awk
> index 260eeef..f3d95be 100644
> --- a/x86/hack-module.awk
> +++ b/x86/hack-module.awk
> @@ -4,7 +4,7 @@ BEGIN { split("INIT_WORK desc_struct ldttss_desc64 desc_ptr " \
>  	      "hrtimer_expires_remaining " \
>  	      "on_each_cpu relay_open request_irq" , compat_apis); }
>  
> -/^int kvm_init\(/ { anon_inodes = 1 }
> +/^int kvm_init\([^)]*\)$/ { anon_inodes = 1 }
>  
>  /return 0;/ && anon_inodes {
>      print "\tr = kvm_init_anon_inodes();";
> @@ -17,7 +17,7 @@ BEGIN { split("INIT_WORK desc_struct ldttss_desc64 desc_ptr " \
>      anon_inodes = 0
>  }
>  
> -/^void kvm_exit/ { anon_inodes_exit = 1 }
> +/^void kvm_exit[^)]*\)$/ { anon_inodes_exit = 1 }
>  
>  /\}/ && anon_inodes_exit {
>      print "\tkvm_exit_anon_inodes();";
> @@ -25,7 +25,7 @@ BEGIN { split("INIT_WORK desc_struct ldttss_desc64 desc_ptr " \
>      anon_inodes_exit = 0
>  }
>  
> -/^int kvm_arch_init/ { kvm_arch_init = 1 }
> +/^int kvm_arch_init[^)])$/ { kvm_arch_init = 1 }
>  /\<tsc_khz\>/ && kvm_arch_init { sub("\\<tsc_khz\\>", "kvm_tsc_khz") }
>  /^}/ { kvm_arch_init = 0 }
>  
> @@ -85,6 +85,8 @@ BEGIN { split("INIT_WORK desc_struct ldttss_desc64 desc_ptr " \
>  
>  /\kvm_.*_fops\.owner = module;/ { $0 = "IF_ANON_INODES_DOES_REFCOUNTS(" $0 ")" }
>  
> +{ sub(/\<CONFIG_KVM_TRACE\>/, "CONFIG_KMOD_KVM_TRACE") }
> +
>  { print }
>  
>  /unsigned long flags;/ &&  vmx_load_host_state {
>   

Xiantao, do we need to change this for ia64?

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] kvm-kmod: fix build on kernels with kvm trace set
  2009-04-30 11:52 ` Avi Kivity
@ 2009-05-04  0:58   ` Zhang, Xiantao
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Xiantao @ 2009-05-04  0:58 UTC (permalink / raw)
  To: Avi Kivity, Michael S. Tsirkin; +Cc: kvm

Avi Kivity wrote:
> Michael S. Tsirkin wrote:
>> CONFIG_KVM_TRACE in kernel conflicts with the definition
>> in external module. external-module-compat-comm.h tried
>> to work around this, but this didn't work as some
>> code still does #include <linux/autoconf.h>
>> directly.
>> 
>> Solve this differently by s/CONFIG_KVM_TRACE/CONFIG_KMOD_KVM_TRACE/
>> in awk. Had to tighten regular expressions in hack-module.awk
>> so that they don't trigger on kvm_host.h .
>> 
>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>> ---
>>  Makefile                      |    5 +++--
>>  configure                     |    2 +-
>>  external-module-compat-comm.h |    7 -------
>>  x86/Kbuild                    |    2 +-
>>  x86/hack-module.awk           |    8 +++++---
>>  5 files changed, 10 insertions(+), 14 deletions(-)
>> 
>> diff --git a/Makefile b/Makefile
>> index f2ef811..9cdc0af 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -34,8 +34,8 @@ hack-files-ia64 = kvm_main.c kvm_fw.c kvm_lib.c
>> kvm-ia64.c 
>> 
>>  hack-files = $(hack-files-$(ARCH_DIR))
>> 
>> -ifeq ($(EXT_CONFIG_KVM_TRACE),y)
>> -module_defines += -DEXT_CONFIG_KVM_TRACE=y
>> +ifeq ($(CONFIG_KMOD_KVM_TRACE),y)
>> +module_defines += -DCONFIG_KMOD_KVM_TRACE=1
>>  endif
>> 
>>  all:: prerequisite
>> @@ -72,6 +72,7 @@ header-sync:
>>  	for i in $$(find $T -name '*.h'); do \
>>  		$(call unifdef,$$i); done
>>  	$(call hack, include/linux/kvm.h)
>> +	$(call hack, include/linux/kvm_host.h)
>>  	$(call hack, include/asm-$(ARCH_DIR)/kvm.h)
>>  	set -e && for i in $$(find $T -type f -printf '%P '); \
>>  		do mkdir -p $$(dirname $$i); cmp -s $$i $T/$$i || cp $T/$$i $$i;
>> done 
>> diff --git a/configure b/configure
>> index 30af6e7..6e12bb1 100755
>> --- a/configure
>> +++ b/configure
>> @@ -122,5 +122,5 @@ DEPMOD_VERSION=$depmod_version
>>  EOF
>> 
>>  cat <<EOF > config.kbuild
>> -EXT_CONFIG_KVM_TRACE=$kvm_trace
>> +CONFIG_KMOD_KVM_TRACE=$kvm_trace
>>  EOF
>> diff --git a/external-module-compat-comm.h
>> b/external-module-compat-comm.h 
>> index c955927..e561448 100644
>> --- a/external-module-compat-comm.h
>> +++ b/external-module-compat-comm.h
>> @@ -18,13 +18,6 @@
>>  #include <linux/hrtimer.h>
>>  #include <asm/bitops.h>
>> 
>> -/* Override CONFIG_KVM_TRACE */
>> -#ifdef EXT_CONFIG_KVM_TRACE
>> -#  define CONFIG_KVM_TRACE 1
>> -#else
>> -#  undef CONFIG_KVM_TRACE
>> -#endif
>> -
>>  /*
>>   * 2.6.16 does not have GFP_NOWAIT
>>   */
>> diff --git a/x86/Kbuild b/x86/Kbuild
>> index d3aca00..fbdb28b 100644
>> --- a/x86/Kbuild
>> +++ b/x86/Kbuild
>> @@ -7,7 +7,7 @@ kvm-objs := kvm_main.o x86.o mmu.o x86_emulate.o
>>  	 ../anon_inodes.o irq.o i8259.o lapic.o ioapic.o preempt.o i8254.o
>>  	 coalesced_mmio.o irq_comm.o \  	 timer.o \
>> ../external-module-compat.o -ifeq ($(EXT_CONFIG_KVM_TRACE),y)
>> +ifeq ($(CONFIG_KMOD_KVM_TRACE),y)
>>  kvm-objs += kvm_trace.o
>>  endif
>>  ifeq ($(CONFIG_IOMMU_API),y)
>> diff --git a/x86/hack-module.awk b/x86/hack-module.awk
>> index 260eeef..f3d95be 100644
>> --- a/x86/hack-module.awk
>> +++ b/x86/hack-module.awk
>> @@ -4,7 +4,7 @@ BEGIN { split("INIT_WORK desc_struct ldttss_desc64
>>  	      desc_ptr " \ "hrtimer_expires_remaining " \
>>  	      "on_each_cpu relay_open request_irq" , compat_apis); }
>> 
>> -/^int kvm_init\(/ { anon_inodes = 1 }
>> +/^int kvm_init\([^)]*\)$/ { anon_inodes = 1 }
>> 
>>  /return 0;/ && anon_inodes {
>>      print "\tr = kvm_init_anon_inodes();";
>> @@ -17,7 +17,7 @@ BEGIN { split("INIT_WORK desc_struct ldttss_desc64
>>  desc_ptr " \      anon_inodes = 0 }
>> 
>> -/^void kvm_exit/ { anon_inodes_exit = 1 }
>> +/^void kvm_exit[^)]*\)$/ { anon_inodes_exit = 1 }
>> 
>>  /\}/ && anon_inodes_exit {
>>      print "\tkvm_exit_anon_inodes();";
>> @@ -25,7 +25,7 @@ BEGIN { split("INIT_WORK desc_struct ldttss_desc64
>>  desc_ptr " \      anon_inodes_exit = 0 }
>> 
>> -/^int kvm_arch_init/ { kvm_arch_init = 1 }
>> +/^int kvm_arch_init[^)])$/ { kvm_arch_init = 1 }
>>  /\<tsc_khz\>/ && kvm_arch_init { sub("\\<tsc_khz\\>",
>> "kvm_tsc_khz") }  /^}/ { kvm_arch_init = 0 } 
>> 
>> @@ -85,6 +85,8 @@ BEGIN { split("INIT_WORK desc_struct ldttss_desc64
>> desc_ptr " \ 
>> 
>>  /\kvm_.*_fops\.owner = module;/ { $0 =
>> "IF_ANON_INODES_DOES_REFCOUNTS(" $0 ")" } 
>> 
>> +{ sub(/\<CONFIG_KVM_TRACE\>/, "CONFIG_KMOD_KVM_TRACE") } +
>>  { print }
>> 
>>  /unsigned long flags;/ &&  vmx_load_host_state {
>> 
> 
> Xiantao, do we need to change this for ia64?

IA64 didn't support kvm trace, so doesn't need these changes , thanks! :)
Xiantao

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kvm-kmod: fix build on kernels with kvm trace set
  2009-04-28 12:22 [PATCH] kvm-kmod: fix build on kernels with kvm trace set Michael S. Tsirkin
  2009-04-30 11:52 ` Avi Kivity
@ 2009-05-04  9:24 ` Avi Kivity
  1 sibling, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2009-05-04  9:24 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: kvm

Michael S. Tsirkin wrote:
> CONFIG_KVM_TRACE in kernel conflicts with the definition
> in external module. external-module-compat-comm.h tried
> to work around this, but this didn't work as some
> code still does #include <linux/autoconf.h>
> directly.
>
> Solve this differently by s/CONFIG_KVM_TRACE/CONFIG_KMOD_KVM_TRACE/
> in awk. Had to tighten regular expressions in hack-module.awk
> so that they don't trigger on kvm_host.h .
>   

Applied, thanks.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-05-04  9:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-28 12:22 [PATCH] kvm-kmod: fix build on kernels with kvm trace set Michael S. Tsirkin
2009-04-30 11:52 ` Avi Kivity
2009-05-04  0:58   ` Zhang, Xiantao
2009-05-04  9:24 ` Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.