Re: compilation on ubuntu 32 bit host?

Gildas
2006-11-10T16:14:13Z

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

2006/11/10, Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>:
> Gildas wrote:
> > Hi,
> >
> > Has anyone managed to compile kvm on an ubuntu 32 bit host? (using the
> > tarball kvm-2 available on sourceforge)
> >
> >
>
>
> [...]
>
> > gn1@mbp18006i:~/install/kvm-2$ make
> > make -C kernel
> > make[1]: Entering directory `/home/gn1/install/kvm-2/kernel'
> > make -C /lib/modules/`uname -r`/build M=`pwd` "$@"
> > make[2]: Entering directory `/usr/src/linux-headers-2.6.15-27-686'
> > CC [M] /home/gn1/install/kvm-2/kernel/kvm_main.o
> > In file included from /home/gn1/install/kvm-2/kernel/kvm_main.c:18:
> > /home/gn1/install/kvm-2/kernel/kvm.h:11:25: error: linux/mutex.h: No
> > such file or directory
> >
> Linux 2.6.15 is pre 'struct mutex'. That turned up in Linux 2.6.16.
>
> If Ubuntu has a kernel update for 2.6.16 or later, you should try that.
> If not, you can convert the mutex to a semaphore:
>
> #include <linux/mutex.h> -> #include <asm/semaphore.h>
> 'struct mutex' -> 'struct semaphore'
> 'mutex_init()' -> 'init_MUTEX()'
> 'mutex_lock()' -> 'down()'
> 'mutex_unlock()' -> 'up()'

Done, I include a patch with the modifications for those ubuntu users
out there :)

> Looks like 'struct page::private' has also been renamed.

Yes...

gn1@mbp18006i:~/install/kvm-2$ make
make -C kernel
make[1]: Entering directory `/home/gn1/install/kvm-2/kernel'
make -C /lib/modules/`uname -r`/build M=`pwd` "$@"
make[2]: Entering directory `/usr/src/linux-headers-2.6.15-27-686'
CC [M] /home/gn1/install/kvm-2/kernel/kvm_main.o
In file included from /home/gn1/install/kvm-2/kernel/kvm_main.c:18:
/home/gn1/install/kvm-2/kernel/kvm.h: In function 'page_header':
/home/gn1/install/kvm-2/kernel/kvm.h:377: error: 'struct page' has no
member named 'private'
make[3]: *** [/home/gn1/install/kvm-2/kernel/kvm_main.o] Error 1
make[2]: *** [_module_/home/gn1/install/kvm-2/kernel] Error 2
make[2]: Leaving directory `/usr/src/linux-headers-2.6.15-27-686'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/gn1/install/kvm-2/kernel'
make: *** [kernel] Error 2

What should I change?

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: mutex_ubuntu.patch --]
[-- Type: text/x-patch; name="mutex_ubuntu.patch", Size: 1655 bytes --]

--- kernel/kvm.h.orig 2006-11-09 11:04:41.000000000 +0000
+++ kernel/kvm.h 2006-11-10 16:07:46.000000000 +0000
@@ -8,7 +8,7 @@

#include <linux/types.h>
#include <linux/list.h>
-#include <linux/mutex.h>
+#include <asm/semaphore.h>
#include <linux/spinlock.h>
#include <linux/mm.h>

@@ -160,7 +160,7 @@
struct kvm_vcpu {
struct kvm *kvm;
struct vmcs *vmcs;
- struct mutex mutex;
+ struct semaphore mutex;
int cpu;
int launched;
unsigned long irq_summary; /* bit vector: 1 per word in irq_pending */
--- kernel/kvm_main.c.orig 2006-11-09 11:16:43.000000000 +0000
+++ kernel/kvm_main.c 2006-11-10 16:09:46.000000000 +0000
@@ -446,9 +446,9 @@
{
struct kvm_vcpu *vcpu = &kvm->vcpus[vcpu_slot];

- mutex_lock(&vcpu->mutex);
+ down(&vcpu->mutex);
if (unlikely(!vcpu->vmcs)) {
- mutex_unlock(&vcpu->mutex);
+ up(&vcpu->mutex);
return 0;
}
return __vcpu_load(vcpu);
@@ -457,7 +457,7 @@
static void vcpu_put(struct kvm_vcpu *vcpu)
{
put_cpu();
- mutex_unlock(&vcpu->mutex);
+ up(&vcpu->mutex);
}

@@ -558,7 +558,7 @@
for (i = 0; i < KVM_MAX_VCPUS; ++i) {
struct kvm_vcpu *vcpu = &kvm->vcpus[i];

- mutex_init(&vcpu->mutex);
+ init_MUTEX(&vcpu->mutex);
vcpu->mmu.root_hpa = INVALID_PAGE;
INIT_LIST_HEAD(&vcpu->free_pages);
}
@@ -1352,10 +1352,10 @@

vcpu = &kvm->vcpus[n];

- mutex_lock(&vcpu->mutex);
+ down(&vcpu->mutex);

if (vcpu->vmcs) {
- mutex_unlock(&vcpu->mutex);
+ up(&vcpu->mutex);
return -EEXIST;
}

@@ -1367,7 +1367,7 @@
vcpu->kvm = kvm;
vmcs = alloc_vmcs();
if (!vmcs) {
- mutex_unlock(&vcpu->mutex);
+ up(&vcpu->mutex);
goto out_free_vcpus;
}
vmcs_clear(vmcs);

[-- Attachment #3: Type: text/plain, Size: 373 bytes --]

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org