public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm: fix irqfd build failure discovered in linux-next
       [not found] <20090521172122.bb12027c.sfr@canb.auug.org.au>
@ 2009-05-21 13:04 ` Gregory Haskins
  2009-05-21 13:10   ` Avi Kivity
  2009-05-21 13:28 ` [PATCH v2] " Gregory Haskins
  1 sibling, 1 reply; 7+ messages in thread
From: Gregory Haskins @ 2009-05-21 13:04 UTC (permalink / raw)
  To: avi; +Cc: linux-next, linux-kernel, sfr, kvm

Stephen Rothwell noted a build failure in arch != x86 in last nights
linux-next tree, as noted here:

http://lkml.org/lkml/2009/5/21/32

This patch corrects the build issue by requiring explicit support for
IRQFD to be defined, and only defining it on x86 (the only arch fully
supported).  The code itself isnt architecture dependent, but we need
to add a new file to each makefile, advertise the capability, and
of course, test that it works for each supported arch.  We will submit
patches against each relevant arch at a later time to enable support
there as well.

Signed-off-by: Gregory Haskins <ghaskins@novell.com>
---

 arch/x86/kvm/Makefile    |    1 +
 include/linux/kvm_host.h |   17 +++++++++++++++++
 virt/kvm/eventfd.c       |    6 ++++++
 virt/kvm/kvm_main.c      |    2 +-
 4 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
index 01e3c61..e5ce95e 100644
--- a/arch/x86/kvm/Makefile
+++ b/arch/x86/kvm/Makefile
@@ -1,5 +1,6 @@
 
 EXTRA_CFLAGS += -Ivirt/kvm -Iarch/x86/kvm
+EXTRA_CFLAGS += -DKVM_HAVE_EVENTFD
 
 kvm-y			+= $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \
 				coalesced_mmio.o irq_comm.o eventfd.o)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 3b6caf5..8600473 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -134,7 +134,9 @@ struct kvm {
 	struct list_head vm_list;
 	struct kvm_io_bus mmio_bus;
 	struct kvm_io_bus pio_bus;
+#ifdef KVM_HAVE_EVENTFD
 	struct list_head irqfds;
+#endif
 	struct kvm_vm_stat stat;
 	struct kvm_arch arch;
 	atomic_t users_count;
@@ -529,7 +531,22 @@ static inline void kvm_free_irq_routing(struct kvm *kvm) {}
 
 #endif
 
+#ifdef KVM_HAVE_EVENTFD
+
+void kvm_irqfd_init(struct kvm *kvm);
 int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags);
 void kvm_irqfd_release(struct kvm *kvm);
 
+#else
+
+static inline void kvm_irqfd_init(struct kvm *kvm) {}
+static inline int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags)
+{
+	return -EINVAL;
+}
+
+static inline void kvm_irqfd_release(struct kvm *kvm) {}
+
+#endif /* KVM_HAVE_EVENTFD */
+
 #endif
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 72a282e..c63ff6a 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -206,6 +206,12 @@ kvm_deassign_irqfd(struct kvm *kvm, int fd, int gsi)
 	return count ? count : -ENOENT;
 }
 
+void
+kvm_irqfd_init(struct kvm *kvm)
+{
+	INIT_LIST_HEAD(&kvm->irqfds);
+}
+
 int
 kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags)
 {
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index b58837d..de042cb 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -983,7 +983,7 @@ static struct kvm *kvm_create_vm(void)
 	atomic_inc(&kvm->mm->mm_count);
 	spin_lock_init(&kvm->mmu_lock);
 	kvm_io_bus_init(&kvm->pio_bus);
-	INIT_LIST_HEAD(&kvm->irqfds);
+	kvm_irqfd_init(kvm);
 	mutex_init(&kvm->lock);
 	kvm_io_bus_init(&kvm->mmio_bus);
 	init_rwsem(&kvm->slots_lock);

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

* Re: [PATCH] kvm: fix irqfd build failure discovered in linux-next
  2009-05-21 13:04 ` [PATCH] kvm: fix irqfd build failure discovered in linux-next Gregory Haskins
@ 2009-05-21 13:10   ` Avi Kivity
  2009-05-21 13:26     ` Gregory Haskins
  0 siblings, 1 reply; 7+ messages in thread
From: Avi Kivity @ 2009-05-21 13:10 UTC (permalink / raw)
  To: Gregory Haskins; +Cc: linux-next, linux-kernel, sfr, kvm

Gregory Haskins wrote:
> Stephen Rothwell noted a build failure in arch != x86 in last nights
> linux-next tree, as noted here:
>
> http://lkml.org/lkml/2009/5/21/32
>
> This patch corrects the build issue by requiring explicit support for
> IRQFD to be defined, and only defining it on x86 (the only arch fully
> supported).  The code itself isnt architecture dependent, but we need
> to add a new file to each makefile, advertise the capability, and
> of course, test that it works for each supported arch.  We will submit
> patches against each relevant arch at a later time to enable support
> there as well.
>
> Signed-off-by: Gregory Haskins <ghaskins@novell.com>
> ---
>
>  arch/x86/kvm/Makefile    |    1 +
>  include/linux/kvm_host.h |   17 +++++++++++++++++
>  virt/kvm/eventfd.c       |    6 ++++++
>  virt/kvm/kvm_main.c      |    2 +-
>  4 files changed, 25 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
> index 01e3c61..e5ce95e 100644
> --- a/arch/x86/kvm/Makefile
> +++ b/arch/x86/kvm/Makefile
> @@ -1,5 +1,6 @@
>  
>  EXTRA_CFLAGS += -Ivirt/kvm -Iarch/x86/kvm
> +EXTRA_CFLAGS += -DKVM_HAVE_EVENTFD
>  
>   

The standard idiom for this is to use a Kconfig symbol; see for example 
HAVE_KVM_IRQCHIP in arch/*/kvm/Kconfig.


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


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

* Re: [PATCH] kvm: fix irqfd build failure discovered in linux-next
  2009-05-21 13:10   ` Avi Kivity
@ 2009-05-21 13:26     ` Gregory Haskins
  2009-05-21 13:29       ` Avi Kivity
  0 siblings, 1 reply; 7+ messages in thread
From: Gregory Haskins @ 2009-05-21 13:26 UTC (permalink / raw)
  To: Avi Kivity; +Cc: linux-next, linux-kernel, sfr, kvm

[-- Attachment #1: Type: text/plain, Size: 1655 bytes --]

Avi Kivity wrote:
> Gregory Haskins wrote:
>> Stephen Rothwell noted a build failure in arch != x86 in last nights
>> linux-next tree, as noted here:
>>
>> http://lkml.org/lkml/2009/5/21/32
>>
>> This patch corrects the build issue by requiring explicit support for
>> IRQFD to be defined, and only defining it on x86 (the only arch fully
>> supported).  The code itself isnt architecture dependent, but we need
>> to add a new file to each makefile, advertise the capability, and
>> of course, test that it works for each supported arch.  We will submit
>> patches against each relevant arch at a later time to enable support
>> there as well.
>>
>> Signed-off-by: Gregory Haskins <ghaskins@novell.com>
>> ---
>>
>>  arch/x86/kvm/Makefile    |    1 +
>>  include/linux/kvm_host.h |   17 +++++++++++++++++
>>  virt/kvm/eventfd.c       |    6 ++++++
>>  virt/kvm/kvm_main.c      |    2 +-
>>  4 files changed, 25 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
>> index 01e3c61..e5ce95e 100644
>> --- a/arch/x86/kvm/Makefile
>> +++ b/arch/x86/kvm/Makefile
>> @@ -1,5 +1,6 @@
>>  
>>  EXTRA_CFLAGS += -Ivirt/kvm -Iarch/x86/kvm
>> +EXTRA_CFLAGS += -DKVM_HAVE_EVENTFD
>>  
>>   
>
> The standard idiom for this is to use a Kconfig symbol; see for
> example HAVE_KVM_IRQCHIP in arch/*/kvm/Kconfig.

Ah, I didn't realize I could do this in such a contained manner.  I was
afraid of polluting the top level arch/Kconfig, which is why I went this
other route.   But I see from your example that this is not the case.  I
will make a v2 with this change.

-Greg

>
>



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 266 bytes --]

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

* [PATCH v2] kvm: fix irqfd build failure discovered in linux-next
       [not found] <20090521172122.bb12027c.sfr@canb.auug.org.au>
  2009-05-21 13:04 ` [PATCH] kvm: fix irqfd build failure discovered in linux-next Gregory Haskins
@ 2009-05-21 13:28 ` Gregory Haskins
  2009-05-21 13:52   ` Avi Kivity
  1 sibling, 1 reply; 7+ messages in thread
From: Gregory Haskins @ 2009-05-21 13:28 UTC (permalink / raw)
  To: avi; +Cc: linux-next, linux-kernel, sfr, kvm

Stephen Rothwell noted a build failure in arch != x86 in last nights
linux-next tree, as noted here:

http://lkml.org/lkml/2009/5/21/32

This patch corrects the build issue by requiring explicit support for
IRQFD to be defined, and only defining it on x86 (the only arch fully
supported).  The code itself isnt architecture dependent, but we need
to add a new file to each makefile, advertise the capability, and
of course, test that it works for each supported arch.  We will submit
patches against each relevant arch at a later time to enable support
there as well.

Signed-off-by: Gregory Haskins <ghaskins@novell.com>
---

 arch/x86/kvm/Kconfig     |    4 ++++
 include/linux/kvm_host.h |   17 +++++++++++++++++
 virt/kvm/eventfd.c       |    6 ++++++
 virt/kvm/kvm_main.c      |    2 +-
 4 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index 8600a09..6460091 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -8,6 +8,10 @@ config HAVE_KVM_IRQCHIP
        bool
        default y
 
+config HAVE_KVM_EVENTFD
+       bool
+       default y
+
 menuconfig VIRTUALIZATION
 	bool "Virtualization"
 	depends on HAVE_KVM || X86
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 3b6caf5..28bd112 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -134,7 +134,9 @@ struct kvm {
 	struct list_head vm_list;
 	struct kvm_io_bus mmio_bus;
 	struct kvm_io_bus pio_bus;
+#ifdef CONFIG_HAVE_KVM_EVENTFD
 	struct list_head irqfds;
+#endif
 	struct kvm_vm_stat stat;
 	struct kvm_arch arch;
 	atomic_t users_count;
@@ -529,7 +531,22 @@ static inline void kvm_free_irq_routing(struct kvm *kvm) {}
 
 #endif
 
+#ifdef CONFIG_HAVE_KVM_EVENTFD
+
+void kvm_irqfd_init(struct kvm *kvm);
 int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags);
 void kvm_irqfd_release(struct kvm *kvm);
 
+#else
+
+static inline void kvm_irqfd_init(struct kvm *kvm) {}
+static inline int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags)
+{
+	return -EINVAL;
+}
+
+static inline void kvm_irqfd_release(struct kvm *kvm) {}
+
+#endif /* CONFIG_HAVE_KVM_EVENTFD */
+
 #endif
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 72a282e..c63ff6a 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -206,6 +206,12 @@ kvm_deassign_irqfd(struct kvm *kvm, int fd, int gsi)
 	return count ? count : -ENOENT;
 }
 
+void
+kvm_irqfd_init(struct kvm *kvm)
+{
+	INIT_LIST_HEAD(&kvm->irqfds);
+}
+
 int
 kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags)
 {
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index b58837d..de042cb 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -983,7 +983,7 @@ static struct kvm *kvm_create_vm(void)
 	atomic_inc(&kvm->mm->mm_count);
 	spin_lock_init(&kvm->mmu_lock);
 	kvm_io_bus_init(&kvm->pio_bus);
-	INIT_LIST_HEAD(&kvm->irqfds);
+	kvm_irqfd_init(kvm);
 	mutex_init(&kvm->lock);
 	kvm_io_bus_init(&kvm->mmio_bus);
 	init_rwsem(&kvm->slots_lock);

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

* Re: [PATCH] kvm: fix irqfd build failure discovered in linux-next
  2009-05-21 13:26     ` Gregory Haskins
@ 2009-05-21 13:29       ` Avi Kivity
  0 siblings, 0 replies; 7+ messages in thread
From: Avi Kivity @ 2009-05-21 13:29 UTC (permalink / raw)
  To: Gregory Haskins; +Cc: linux-next, linux-kernel, sfr, kvm

Gregory Haskins wrote:
>>>  EXTRA_CFLAGS += -Ivirt/kvm -Iarch/x86/kvm
>>> +EXTRA_CFLAGS += -DKVM_HAVE_EVENTFD
>>>  
>>>   
>>>       
>> The standard idiom for this is to use a Kconfig symbol; see for
>> example HAVE_KVM_IRQCHIP in arch/*/kvm/Kconfig.
>>     
>
> Ah, I didn't realize I could do this in such a contained manner.  I was
> afraid of polluting the top level arch/Kconfig, which is why I went this
> other route.   But I see from your example that this is not the case.  I
> will make a v2 with this change.
>   

Note the situation is not as good as it could be, as you have to 
replicate the Kconfig for each arch.  One day I'll set up 
virt/kvm/Kconfig which will set up defaults, so archs can override them.

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

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

* Re: [PATCH v2] kvm: fix irqfd build failure discovered in linux-next
  2009-05-21 13:28 ` [PATCH v2] " Gregory Haskins
@ 2009-05-21 13:52   ` Avi Kivity
  2009-05-21 14:04     ` Gregory Haskins
  0 siblings, 1 reply; 7+ messages in thread
From: Avi Kivity @ 2009-05-21 13:52 UTC (permalink / raw)
  To: Gregory Haskins; +Cc: linux-next, linux-kernel, sfr, kvm

Gregory Haskins wrote:
> Stephen Rothwell noted a build failure in arch != x86 in last nights
> linux-next tree, as noted here:
>
> http://lkml.org/lkml/2009/5/21/32
>
> This patch corrects the build issue by requiring explicit support for
> IRQFD to be defined, and only defining it on x86 (the only arch fully
> supported).  The code itself isnt architecture dependent, but we need
> to add a new file to each makefile, advertise the capability, and
> of course, test that it works for each supported arch.  We will submit
> patches against each relevant arch at a later time to enable support
> there as well.
>
>  
> +config HAVE_KVM_EVENTFD
> +       bool
> +       default y
> +
>   

The build system will complain if it sees a symbol used but not defined; 
so you have to define it for all four archs.  So I went ahead and did 
virt/kvm/Kconfig and adapted your patch to use it.


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

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

* Re: [PATCH v2] kvm: fix irqfd build failure discovered in linux-next
  2009-05-21 13:52   ` Avi Kivity
@ 2009-05-21 14:04     ` Gregory Haskins
  0 siblings, 0 replies; 7+ messages in thread
From: Gregory Haskins @ 2009-05-21 14:04 UTC (permalink / raw)
  To: Avi Kivity; +Cc: linux-next, linux-kernel, sfr, kvm

[-- Attachment #1: Type: text/plain, Size: 990 bytes --]

Avi Kivity wrote:
> Gregory Haskins wrote:
>> Stephen Rothwell noted a build failure in arch != x86 in last nights
>> linux-next tree, as noted here:
>>
>> http://lkml.org/lkml/2009/5/21/32
>>
>> This patch corrects the build issue by requiring explicit support for
>> IRQFD to be defined, and only defining it on x86 (the only arch fully
>> supported).  The code itself isnt architecture dependent, but we need
>> to add a new file to each makefile, advertise the capability, and
>> of course, test that it works for each supported arch.  We will submit
>> patches against each relevant arch at a later time to enable support
>> there as well.
>>
>>  
>> +config HAVE_KVM_EVENTFD
>> +       bool
>> +       default y
>> +
>>   
>
> The build system will complain if it sees a symbol used but not
> defined; so you have to define it for all four archs.  So I went ahead
> and did virt/kvm/Kconfig and adapted your patch to use it.
>
>

Cool, thanks!

-Greg


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 266 bytes --]

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

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

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20090521172122.bb12027c.sfr@canb.auug.org.au>
2009-05-21 13:04 ` [PATCH] kvm: fix irqfd build failure discovered in linux-next Gregory Haskins
2009-05-21 13:10   ` Avi Kivity
2009-05-21 13:26     ` Gregory Haskins
2009-05-21 13:29       ` Avi Kivity
2009-05-21 13:28 ` [PATCH v2] " Gregory Haskins
2009-05-21 13:52   ` Avi Kivity
2009-05-21 14:04     ` Gregory Haskins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox