2012-02-20 18:20:21

by Jörg Sommer

[permalink] [raw]
Subject: Re: Current kernel fails to compile with KVM on PowerPC

Hello Alexander,

Alexander Graf hat am Tue 22. Nov, 22:29 (+0100) geschrieben:
> On 22.11.2011, at 21:04, Jörg Sommer wrote:
> > Jörg Sommer hat am Mon 07. Nov, 20:48 (+0100) geschrieben:
> >> I'm trying to build the kernel with the git commit-id
> >> 31555213f03bca37d2c02e10946296052f4ecfcd, but it fails
> >>
> >> CHK include/linux/version.h
> >> HOSTCC scripts/mod/modpost.o
> >> CHK include/generated/utsrelease.h
> >> UPD include/generated/utsrelease.h
> >> HOSTLD scripts/mod/modpost
> >> GEN include/generated/bounds.h
> >> CC arch/powerpc/kernel/asm-offsets.s
> >> In file included from arch/powerpc/kernel/asm-offsets.c:59:0:
> >> /home/joerg/git/linux/arch/powerpc/include/asm/kvm_book3s.h: In function ‘compute_tlbie_rb’:
> >> /home/joerg/git/linux/arch/powerpc/include/asm/kvm_book3s.h:393:10: error: ‘HPTE_V_SECONDARY’ undeclared (first use in this function)
> >> /home/joerg/git/linux/arch/powerpc/include/asm/kvm_book3s.h:393:10: note: each undeclared identifier is reported only once for each function it appears in
> >> /home/joerg/git/linux/arch/powerpc/include/asm/kvm_book3s.h:396:12: error: ‘HPTE_V_1TB_SEG’ undeclared (first use in this function)
> >> /home/joerg/git/linux/arch/powerpc/include/asm/kvm_book3s.h:401:10: error: ‘HPTE_V_LARGE’ undeclared (first use in this function)
> >> /home/joerg/git/linux/arch/powerpc/include/asm/kvm_book3s.h:415:2: warning: right shift count >= width of type [enabled by default]
> >> make[3]: *** [arch/powerpc/kernel/asm-offsets.s] Fehler 1
> >> make[2]: *** [prepare0] Fehler 2
> >> make[1]: *** [deb-pkg] Fehler 2
> >> make: *** [deb-pkg] Fehler 2
> >
> > I'm still having this problem. I can' build
> > 6fe4c6d466e95d31164f14b1ac4aefb51f0f4f82. Are there any patches to
> > make the kernel builds and do not oops [1] on PowerPC?
>
> The failures above should be fixed by now.
>
> > [1] »kernel BUG at include/linux/kvm_host.h:603!«
> > http://www.mail-archive.com/[email protected]/msg61433.html
>
> This is unfortunately still there. It's because of preemption being
> enabled. Please just use CONFIG_PREEMPT_NONE for the time being

This doesn't help. I've build with CONFIG_PREEMPT_NONE, but I'm getting
this Oops, when I start qemu.

% uname -a
Linux ibook 3.3.0-rc3-00279-g8e4baad #74 Sun Feb 19 03:57:54 CET 2012 ppc GNU/Linux

% cat /proc/cpuinfo
processor : 0
cpu : 7455, altivec supported
clock : 606.000000MHz
revision : 3.3 (pvr 8001 0303)
bogomips : 36.86
timebase : 18432000
platform : PowerMac
model : PowerBook6,3
machine : PowerBook6,3
motherboard : PowerBook6,3 MacRISC3 Power Macintosh
detected as : 287 (iBook G4)
pmac flags : 0000001b
L2 cache : 256K unified
pmac-generation : NewWorld
Memory : 640 MB

% grep PREEM /boot/config-$(uname -r)
# CONFIG_PREEMPT_RCU is not set
CONFIG_PREEMPT_NOTIFIERS=y
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
CONFIG_PREEMPT_COUNT=y

% qemu-system-ppc --version
QEMU emulator version 1.0 (Debian 1.0+dfsg-3), Copyright (c) 2003-2008 Fabrice Bellard

% qemu-system-ppc -M mac99 -cpu 7400 -prom-env 'auto-boot?=false' -k de -enable-kvm

[ 4205.444343] ------------[ cut here ]------------
[ 4205.444373] kernel BUG at include/linux/kvm_host.h:634!
[ 4205.444407] Oops: Exception in kernel mode, sig: 5 [#1]
[ 4205.444418] PowerMac
[ 4205.444426] Modules linked in: kvm ppp_async crc_ccitt ppp_generic slhc ipv6 fuse snd_powermac option usb_wwan
[ 4205.444562] NIP: ea823c34 LR: ea823bcc CTR: 00000000
[ 4205.444579] REGS: e3617a10 TRAP: 0700 Not tainted (3.3.0-rc3-00279-g8e4baad)
[ 4205.444590] MSR: 00029032 <EE,ME,IR,DR,RI> CR: 28002462 XER: 00000000
[ 4205.444624] TASK = e3405bc0[4169] 'qemu-system-ppc' THREAD: e3616000
[ 4205.444634] GPR00: 00000001 e3617ac0 e3405bc0 e3617be0 e34060fc 00000000 e3617ddc 00000000
[ 4205.444664] GPR08: 00000000 00000000 00000000 00000000 00000000 1036c490 103051b8 10304e48
[ 4205.444693] GPR16: 48048000 10e2a5c0 10e2ada8 1014662c 00000007 48021018 00400000 0000d032
[ 4205.444723] GPR24: 00000000 00000900 ffffffff e362f000 00000001 e3405bc0 ea83b000 e3617ac0
[ 4205.444817] NIP [ea823c34] kvmppc_vcpu_run+0x138/0x210 [kvm]
[ 4205.444843] LR [ea823bcc] kvmppc_vcpu_run+0xd0/0x210 [kvm]
[ 4205.444853] Call Trace:
[ 4205.444876] [e3617ac0] [e3616000] 0xe3616000 (unreliable)
[ 4205.444909] [e3617e20] [ea81e12c] kvm_arch_vcpu_ioctl_run+0x350/0x37c [kvm]
[ 4205.444940] [e3617e50] [ea817c98] kvm_vcpu_ioctl+0x158/0x888 [kvm]
[ 4205.444967] [e3617ea0] [c0129020] do_vfs_ioctl+0x714/0x78c
[ 4205.444984] [e3617f10] [c0129100] sys_ioctl+0x68/0x8c
[ 4205.445004] [e3617f40] [c0013b70] ret_from_syscall+0x0/0x38
[ 4205.445022] --- Exception: c01 at 0xf4efa98
[ 4205.445028] LR = 0xf4ef9fc
[ 4205.445036] Instruction dump:
[ 4205.445049] 41a20014 7fc3f378 38800800 38a02000 4bffe929 54290024 38000000 8129000c
[ 4205.445080] 2f890000 409e000c 7c0000a6 54008ffe <0f000000> 8002000c 7f63db78 7fc4f378
[ 4205.445119] ---[ end trace 03417e90b5c8db01 ]---
[ 4205.445129]
[ 4205.445141] BUG: sleeping function called from invalid context at kernel/rwsem.c:21
[ 4205.445156] in_atomic(): 0, irqs_disabled(): 1, pid: 4169, name: qemu-system-ppc
[ 4205.445168] Call Trace:
[ 4205.445182] [e36177c0] [c000bc44] show_stack+0xbc/0x194 (unreliable)
[ 4205.445214] [e3617810] [c047bbd4] dump_stack+0x30/0x38
[ 4205.445237] [e3617820] [c0062010] __might_sleep+0xf8/0x100
[ 4205.445253] [e3617830] [c0473324] down_read+0x38/0x60
[ 4205.445278] [e3617840] [c004621c] exit_signals+0x30/0x16c
[ 4205.445300] [e3617870] [c0034ec8] do_exit+0x100/0x74c
[ 4205.445319] [e36178c0] [c000ee6c] die+0x270/0x278
[ 4205.445336] [e36178f0] [c000ef34] _exception+0x64/0x104
[ 4205.445354] [e36179e0] [c0474f70] program_check_exception+0x1dc/0x1e4
[ 4205.445371] [e3617a00] [c00141d0] ret_from_except_full+0x0/0x4c
[ 4205.445421] --- Exception: 700 at kvmppc_vcpu_run+0x138/0x210 [kvm]
[ 4205.445428] LR = kvmppc_vcpu_run+0xd0/0x210 [kvm]
[ 4205.445446] [e3617ac0] [e3616000] 0xe3616000 (unreliable)
[ 4205.445477] [e3617e20] [ea81e12c] kvm_arch_vcpu_ioctl_run+0x350/0x37c [kvm]
[ 4205.445508] [e3617e50] [ea817c98] kvm_vcpu_ioctl+0x158/0x888 [kvm]
[ 4205.445526] [e3617ea0] [c0129020] do_vfs_ioctl+0x714/0x78c
[ 4205.445543] [e3617f10] [c0129100] sys_ioctl+0x68/0x8c
[ 4205.445558] [e3617f40] [c0013b70] ret_from_syscall+0x0/0x38
[ 4205.445577] --- Exception: c01 at 0xf4efa98
[ 4205.445583] LR = 0xf4ef9fc

Bye, Jörg.
--
Man soll Denken lehren, nicht Gedachtes.


Attachments:
(No filename) (6.37 kB)
signature.asc (198.00 B)
Digital signature http://en.wikipedia.org/wiki/OpenPGP
Download all attachments

2012-02-20 21:27:16

by Alexander Graf

[permalink] [raw]
Subject: Re: Current kernel fails to compile with KVM on PowerPC


On 20.02.2012, at 18:38, J?rg Sommer wrote:

> Hello Alexander,
>
> Alexander Graf hat am Tue 22. Nov, 22:29 (+0100) geschrieben:
>> On 22.11.2011, at 21:04, J?rg Sommer wrote:
>>> J?rg Sommer hat am Mon 07. Nov, 20:48 (+0100) geschrieben:
>>>> I'm trying to build the kernel with the git commit-id
>>>> 31555213f03bca37d2c02e10946296052f4ecfcd, but it fails
>>>>
>>>> CHK include/linux/version.h
>>>> HOSTCC scripts/mod/modpost.o
>>>> CHK include/generated/utsrelease.h
>>>> UPD include/generated/utsrelease.h
>>>> HOSTLD scripts/mod/modpost
>>>> GEN include/generated/bounds.h
>>>> CC arch/powerpc/kernel/asm-offsets.s
>>>> In file included from arch/powerpc/kernel/asm-offsets.c:59:0:
>>>> /home/joerg/git/linux/arch/powerpc/include/asm/kvm_book3s.h: In function ?compute_tlbie_rb?:
>>>> /home/joerg/git/linux/arch/powerpc/include/asm/kvm_book3s.h:393:10: error: ?HPTE_V_SECONDARY? undeclared (first use in this function)
>>>> /home/joerg/git/linux/arch/powerpc/include/asm/kvm_book3s.h:393:10: note: each undeclared identifier is reported only once for each function it appears in
>>>> /home/joerg/git/linux/arch/powerpc/include/asm/kvm_book3s.h:396:12: error: ?HPTE_V_1TB_SEG? undeclared (first use in this function)
>>>> /home/joerg/git/linux/arch/powerpc/include/asm/kvm_book3s.h:401:10: error: ?HPTE_V_LARGE? undeclared (first use in this function)
>>>> /home/joerg/git/linux/arch/powerpc/include/asm/kvm_book3s.h:415:2: warning: right shift count >= width of type [enabled by default]
>>>> make[3]: *** [arch/powerpc/kernel/asm-offsets.s] Fehler 1
>>>> make[2]: *** [prepare0] Fehler 2
>>>> make[1]: *** [deb-pkg] Fehler 2
>>>> make: *** [deb-pkg] Fehler 2
>>>
>>> I'm still having this problem. I can' build
>>> 6fe4c6d466e95d31164f14b1ac4aefb51f0f4f82. Are there any patches to
>>> make the kernel builds and do not oops [1] on PowerPC?
>>
>> The failures above should be fixed by now.
>>
>>> [1] ?kernel BUG at include/linux/kvm_host.h:603!?
>>> http://www.mail-archive.com/[email protected]/msg61433.html
>>
>> This is unfortunately still there. It's because of preemption being
>> enabled. Please just use CONFIG_PREEMPT_NONE for the time being
>
> This doesn't help. I've build with CONFIG_PREEMPT_NONE, but I'm getting
> this Oops, when I start qemu.

Could you please try git://git.kernel.org/pub/scm/virt/kvm/kvm.git? I fixed a bunch of things with preemption since then and it definitely worked for me. If it still fails in that tree, I can try again to reproduce it :).


Alex

2012-02-21 08:34:37

by Jörg Sommer

[permalink] [raw]
Subject: Re: Current kernel fails to compile with KVM on PowerPC

Alexander Graf hat am Mon 20. Feb, 22:27 (+0100) geschrieben:
> On 20.02.2012, at 18:38, Jörg Sommer wrote:
> > Alexander Graf hat am Tue 22. Nov, 22:29 (+0100) geschrieben:
> >> On 22.11.2011, at 21:04, Jörg Sommer wrote:
> >>> [1] »kernel BUG at include/linux/kvm_host.h:603!«
> >>> http://www.mail-archive.com/[email protected]/msg61433.html
> >>
> >> This is unfortunately still there. It's because of preemption being
> >> enabled. Please just use CONFIG_PREEMPT_NONE for the time being
> >
> > This doesn't help. I've build with CONFIG_PREEMPT_NONE, but I'm getting
> > this Oops, when I start qemu.
>
> Could you please try git://git.kernel.org/pub/scm/virt/kvm/kvm.git? I
> fixed a bunch of things with preemption since then and it definitely
> worked for me. If it still fails in that tree, I can try again to
> reproduce it :).

This kernel (e9badff4b38a3f8b2c20aa8a30db210caf85a497) fails to build:

CC [M] arch/powerpc/kvm/book3s_pr.o
arch/powerpc/kvm/book3s_pr.c: In function ‘kvm_vcpu_ioctl_get_one_reg’:
arch/powerpc/kvm/book3s_pr.c:883:45: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c:883:80: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c:883:284: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c:883:327: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c:883:459: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c:883:748: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c:883:1112: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c:883:1476: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c:883:1867: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c: In function ‘kvm_vcpu_ioctl_set_one_reg’:
arch/powerpc/kvm/book3s_pr.c:898:79: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c:898:114: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c:898:319: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c:898:364: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c:898:502: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c:898:591: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c:898:2061: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
cc1: all warnings being treated as errors
make[3]: *** [arch/powerpc/kvm/book3s_pr.o] Fehler 1
make[2]: *** [arch/powerpc/kvm] Fehler 2
make[2]: *** Warte auf noch nicht beendete Prozesse...

Schöne Grüße, Jörg.
--
Manchmal denke ich, das sicherste Indiz dafür, daß anderswo im Universum
intelligentes Leben existiert, ist, daß niemand versucht hat, mit uns
Kontakt aufzunehmen. (Calvin und Hobbes)


Attachments:
(No filename) (3.42 kB)
signature.asc (198.00 B)
Digital signature http://en.wikipedia.org/wiki/OpenPGP
Download all attachments

2012-02-25 18:30:13

by Jörg Sommer

[permalink] [raw]
Subject: Re: Current kernel fails to compile with KVM on PowerPC

Jörg Sommer hat am Tue 21. Feb, 09:32 (+0100) geschrieben:
> Alexander Graf hat am Mon 20. Feb, 22:27 (+0100) geschrieben:
> > On 20.02.2012, at 18:38, Jörg Sommer wrote:
> > > Alexander Graf hat am Tue 22. Nov, 22:29 (+0100) geschrieben:
> > >> On 22.11.2011, at 21:04, Jörg Sommer wrote:
> > >>> [1] »kernel BUG at include/linux/kvm_host.h:603!«
> > >>> http://www.mail-archive.com/[email protected]/msg61433.html
> > >>
> > >> This is unfortunately still there. It's because of preemption being
> > >> enabled. Please just use CONFIG_PREEMPT_NONE for the time being
> > >
> > > This doesn't help. I've build with CONFIG_PREEMPT_NONE, but I'm getting
> > > this Oops, when I start qemu.
> >
> > Could you please try git://git.kernel.org/pub/scm/virt/kvm/kvm.git? I
> > fixed a bunch of things with preemption since then and it definitely
> > worked for me. If it still fails in that tree, I can try again to
> > reproduce it :).
>
> This kernel (e9badff4b38a3f8b2c20aa8a30db210caf85a497) fails to build:
>
> CC [M] arch/powerpc/kvm/book3s_pr.o
> arch/powerpc/kvm/book3s_pr.c: In function ‘kvm_vcpu_ioctl_get_one_reg’:
> arch/powerpc/kvm/book3s_pr.c:883:45: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> arch/powerpc/kvm/book3s_pr.c:883:80: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> arch/powerpc/kvm/book3s_pr.c:883:284: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> arch/powerpc/kvm/book3s_pr.c:883:327: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> arch/powerpc/kvm/book3s_pr.c:883:459: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> arch/powerpc/kvm/book3s_pr.c:883:748: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> arch/powerpc/kvm/book3s_pr.c:883:1112: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> arch/powerpc/kvm/book3s_pr.c:883:1476: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> arch/powerpc/kvm/book3s_pr.c:883:1867: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> arch/powerpc/kvm/book3s_pr.c: In function ‘kvm_vcpu_ioctl_set_one_reg’:
> arch/powerpc/kvm/book3s_pr.c:898:79: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> arch/powerpc/kvm/book3s_pr.c:898:114: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> arch/powerpc/kvm/book3s_pr.c:898:319: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> arch/powerpc/kvm/book3s_pr.c:898:364: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> arch/powerpc/kvm/book3s_pr.c:898:502: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> arch/powerpc/kvm/book3s_pr.c:898:591: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> arch/powerpc/kvm/book3s_pr.c:898:2061: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> cc1: all warnings being treated as errors
> make[3]: *** [arch/powerpc/kvm/book3s_pr.o] Fehler 1
> make[2]: *** [arch/powerpc/kvm] Fehler 2
> make[2]: *** Warte auf noch nicht beendete Prozesse...

The culprit is this patch:

commit 784f1782e3c9cab310d6c513df966c547c3f17aa
Author: Alexander Graf <[email protected]>
Date: Wed Sep 14 21:45:23 2011 +0200

KVM: PPC: Add support for explicit HIOR setting

Until now, we always set HIOR based on the PVR, but this is just wrong.
Instead, we should be setting HIOR explicitly, so user space can decide
what the initial HIOR value is - just like on real hardware.

We keep the old PVR based way around for backwards compatibility, but
once user space uses the SET_ONE_REG based method, we drop the PVR logic.

Signed-off-by: Alexander Graf <[email protected]>

diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 089c61b..5985209 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -212,6 +212,7 @@ int kvm_dev_ioctl_check_extension(long ext)
case KVM_CAP_PPC_BOOKE_SREGS:
#else
case KVM_CAP_PPC_SEGSTATE:
+ case KVM_CAP_PPC_HIOR:
case KVM_CAP_PPC_PAPR:
#endif
case KVM_CAP_PPC_UNSET_IRQ:
@@ -652,6 +653,11 @@ static int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu,
int r = -EINVAL;

switch (reg->id) {
+#ifdef CONFIG_PPC_BOOK3S
+ case KVM_REG_PPC_HIOR:
+ r = put_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr);
+ break;
+#endif
default:
break;
}
@@ -665,6 +671,13 @@ static int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu,
int r = -EINVAL;

switch (reg->id) {
+#ifdef CONFIG_PPC_BOOK3S
+ case KVM_ONE_REG_PPC_HIOR:
+ r = get_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr);
+ if (!r)
+ to_book3s(vcpu)->hior_explicit = true;
+ break;
+#endif
default:
break;
}

Later, this code was moved to arch/powerpc/kvm/book3s_pr.c by

commit c6afb78d175ae6cf99f4191fbb258e54478b0371
Author: Paul Mackerras <[email protected]>
Date: Mon Dec 12 12:26:50 2011 +0000

KVM: PPC: Move kvm_vcpu_ioctl_[gs]et_one_reg down to platform-specific code

Regards, Jörg.
--
Es gibt nichts schöneres als dem Schweigen eines Dummkopfes zuzuhören.
(Helmut Quatlinger)


Attachments:
(No filename) (5.56 kB)
signature.asc (198.00 B)
Digital signature http://en.wikipedia.org/wiki/OpenPGP
Download all attachments

2012-02-26 11:43:55

by Alexander Graf

[permalink] [raw]
Subject: Re: Current kernel fails to compile with KVM on PowerPC


On 25.02.2012, at 15:51, J?rg Sommer wrote:

> J?rg Sommer hat am Tue 21. Feb, 09:32 (+0100) geschrieben:
>> Alexander Graf hat am Mon 20. Feb, 22:27 (+0100) geschrieben:
>>> On 20.02.2012, at 18:38, J?rg Sommer wrote:
>>>> Alexander Graf hat am Tue 22. Nov, 22:29 (+0100) geschrieben:
>>>>> On 22.11.2011, at 21:04, J?rg Sommer wrote:
>>>>>> [1] ?kernel BUG at include/linux/kvm_host.h:603!?
>>>>>> http://www.mail-archive.com/[email protected]/msg61433.html
>>>>>
>>>>> This is unfortunately still there. It's because of preemption being
>>>>> enabled. Please just use CONFIG_PREEMPT_NONE for the time being
>>>>
>>>> This doesn't help. I've build with CONFIG_PREEMPT_NONE, but I'm getting
>>>> this Oops, when I start qemu.
>>>
>>> Could you please try git://git.kernel.org/pub/scm/virt/kvm/kvm.git? I
>>> fixed a bunch of things with preemption since then and it definitely
>>> worked for me. If it still fails in that tree, I can try again to
>>> reproduce it :).
>>
>> This kernel (e9badff4b38a3f8b2c20aa8a30db210caf85a497) fails to build:
>>
>> CC [M] arch/powerpc/kvm/book3s_pr.o
>> arch/powerpc/kvm/book3s_pr.c: In function ?kvm_vcpu_ioctl_get_one_reg?:
>> arch/powerpc/kvm/book3s_pr.c:883:45: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> arch/powerpc/kvm/book3s_pr.c:883:80: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> arch/powerpc/kvm/book3s_pr.c:883:284: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> arch/powerpc/kvm/book3s_pr.c:883:327: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> arch/powerpc/kvm/book3s_pr.c:883:459: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> arch/powerpc/kvm/book3s_pr.c:883:748: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> arch/powerpc/kvm/book3s_pr.c:883:1112: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> arch/powerpc/kvm/book3s_pr.c:883:1476: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> arch/powerpc/kvm/book3s_pr.c:883:1867: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> arch/powerpc/kvm/book3s_pr.c: In function ?kvm_vcpu_ioctl_set_one_reg?:
>> arch/powerpc/kvm/book3s_pr.c:898:79: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> arch/powerpc/kvm/book3s_pr.c:898:114: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> arch/powerpc/kvm/book3s_pr.c:898:319: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> arch/powerpc/kvm/book3s_pr.c:898:364: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> arch/powerpc/kvm/book3s_pr.c:898:502: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> arch/powerpc/kvm/book3s_pr.c:898:591: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> arch/powerpc/kvm/book3s_pr.c:898:2061: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> cc1: all warnings being treated as errors
>> make[3]: *** [arch/powerpc/kvm/book3s_pr.o] Fehler 1
>> make[2]: *** [arch/powerpc/kvm] Fehler 2
>> make[2]: *** Warte auf noch nicht beendete Prozesse...
>
> The culprit is this patch:
>
> commit 784f1782e3c9cab310d6c513df966c547c3f17aa
> Author: Alexander Graf <[email protected]>
> Date: Wed Sep 14 21:45:23 2011 +0200
>
> KVM: PPC: Add support for explicit HIOR setting
>
> Until now, we always set HIOR based on the PVR, but this is just wrong.
> Instead, we should be setting HIOR explicitly, so user space can decide
> what the initial HIOR value is - just like on real hardware.
>
> We keep the old PVR based way around for backwards compatibility, but
> once user space uses the SET_ONE_REG based method, we drop the PVR logic.
>
> Signed-off-by: Alexander Graf <[email protected]>
>
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index 089c61b..5985209 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -212,6 +212,7 @@ int kvm_dev_ioctl_check_extension(long ext)
> case KVM_CAP_PPC_BOOKE_SREGS:
> #else
> case KVM_CAP_PPC_SEGSTATE:
> + case KVM_CAP_PPC_HIOR:
> case KVM_CAP_PPC_PAPR:
> #endif
> case KVM_CAP_PPC_UNSET_IRQ:
> @@ -652,6 +653,11 @@ static int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu,
> int r = -EINVAL;
>
> switch (reg->id) {
> +#ifdef CONFIG_PPC_BOOK3S
> + case KVM_REG_PPC_HIOR:
> + r = put_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr);
> + break;
> +#endif
> default:
> break;
> }
> @@ -665,6 +671,13 @@ static int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu,
> int r = -EINVAL;
>
> switch (reg->id) {
> +#ifdef CONFIG_PPC_BOOK3S
> + case KVM_ONE_REG_PPC_HIOR:
> + r = get_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr);
> + if (!r)
> + to_book3s(vcpu)->hior_explicit = true;
> + break;
> +#endif
> default:
> break;
> }
>
> Later, this code was moved to arch/powerpc/kvm/book3s_pr.c by
>
> commit c6afb78d175ae6cf99f4191fbb258e54478b0371
> Author: Paul Mackerras <[email protected]>
> Date: Mon Dec 12 12:26:50 2011 +0000
>
> KVM: PPC: Move kvm_vcpu_ioctl_[gs]et_one_reg down to platform-specific code

Yikes. Does this patch work for you?



diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index ee222ec..f329eae 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -880,7 +880,8 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)

switch (reg->id) {
case KVM_REG_PPC_HIOR:
- r = put_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr);
+ r = put_user(to_book3s(vcpu)->hior,
+ (u64 __user *)(long)reg->addr);
break;
default:
break;
@@ -895,7 +896,8 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)

switch (reg->id) {
case KVM_REG_PPC_HIOR:
- r = get_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr);
+ r = get_user(to_book3s(vcpu)->hior,
+ (u64 __user *)(long)reg->addr);
if (!r)
to_book3s(vcpu)->hior_explicit = true;
break;

2012-02-26 23:45:13

by Jörg Sommer

[permalink] [raw]
Subject: Re: Current kernel fails to compile with KVM on PowerPC

Jörg Sommer hat am Sat 25. Feb, 15:51 (+0100) geschrieben:
> Jörg Sommer hat am Tue 21. Feb, 09:32 (+0100) geschrieben:
> > Alexander Graf hat am Mon 20. Feb, 22:27 (+0100) geschrieben:
> > > On 20.02.2012, at 18:38, Jörg Sommer wrote:
> > > > Alexander Graf hat am Tue 22. Nov, 22:29 (+0100) geschrieben:
> > > >> On 22.11.2011, at 21:04, Jörg Sommer wrote:
> > > >>> [1] »kernel BUG at include/linux/kvm_host.h:603!«
> > > >>> http://www.mail-archive.com/[email protected]/msg61433.html
> > > >>
> > > >> This is unfortunately still there. It's because of preemption being
> > > >> enabled. Please just use CONFIG_PREEMPT_NONE for the time being
> > > >
> > > > This doesn't help. I've build with CONFIG_PREEMPT_NONE, but I'm getting
> > > > this Oops, when I start qemu.
> > >
> > > Could you please try git://git.kernel.org/pub/scm/virt/kvm/kvm.git? I
> > > fixed a bunch of things with preemption since then and it definitely
> > > worked for me. If it still fails in that tree, I can try again to
> > > reproduce it :).
> >
> > This kernel (e9badff4b38a3f8b2c20aa8a30db210caf85a497) fails to build:
> >
> > CC [M] arch/powerpc/kvm/book3s_pr.o
> > arch/powerpc/kvm/book3s_pr.c: In function ‘kvm_vcpu_ioctl_get_one_reg’:
> > arch/powerpc/kvm/book3s_pr.c:883:45: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> > arch/powerpc/kvm/book3s_pr.c:883:80: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> > arch/powerpc/kvm/book3s_pr.c:883:284: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> > arch/powerpc/kvm/book3s_pr.c:883:327: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> > arch/powerpc/kvm/book3s_pr.c:883:459: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> > arch/powerpc/kvm/book3s_pr.c:883:748: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> > arch/powerpc/kvm/book3s_pr.c:883:1112: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> > arch/powerpc/kvm/book3s_pr.c:883:1476: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> > arch/powerpc/kvm/book3s_pr.c:883:1867: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

> @@ -652,6 +653,11 @@ static int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu,
> int r = -EINVAL;
>
> switch (reg->id) {
> +#ifdef CONFIG_PPC_BOOK3S
> + case KVM_REG_PPC_HIOR:
> + r = put_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr);
> + break;
> +#endif
> default:
> break;
> }

Is this the right fix for this code?

diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index ee222ec..a5d061c 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -880,7 +880,7 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)

switch (reg->id) {
case KVM_REG_PPC_HIOR:
- r = put_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr);
+ r = put_user(to_book3s(vcpu)->hior, (u64 __user *)&reg->addr);
break;
default:
break;
@@ -895,7 +895,7 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)

switch (reg->id) {
case KVM_REG_PPC_HIOR:
- r = get_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr);
+ r = get_user(to_book3s(vcpu)->hior, (u64 __user *)&reg->addr);
if (!r)
to_book3s(vcpu)->hior_explicit = true;
break;

Bye, Jörg.
--
If Java had true garbage collection, most programs would delete
themselves upon execution


Attachments:
(No filename) (3.79 kB)
signature.asc (198.00 B)
Digital signature http://en.wikipedia.org/wiki/OpenPGP
Download all attachments

2012-02-26 23:54:48

by Alexander Graf

[permalink] [raw]
Subject: Re: Current kernel fails to compile with KVM on PowerPC


On 26.02.2012, at 01:06, J?rg Sommer wrote:

> J?rg Sommer hat am Sat 25. Feb, 15:51 (+0100) geschrieben:
>> J?rg Sommer hat am Tue 21. Feb, 09:32 (+0100) geschrieben:
>>> Alexander Graf hat am Mon 20. Feb, 22:27 (+0100) geschrieben:
>>>> On 20.02.2012, at 18:38, J?rg Sommer wrote:
>>>>> Alexander Graf hat am Tue 22. Nov, 22:29 (+0100) geschrieben:
>>>>>> On 22.11.2011, at 21:04, J?rg Sommer wrote:
>>>>>>> [1] ?kernel BUG at include/linux/kvm_host.h:603!?
>>>>>>> http://www.mail-archive.com/[email protected]/msg61433.html
>>>>>>
>>>>>> This is unfortunately still there. It's because of preemption being
>>>>>> enabled. Please just use CONFIG_PREEMPT_NONE for the time being
>>>>>
>>>>> This doesn't help. I've build with CONFIG_PREEMPT_NONE, but I'm getting
>>>>> this Oops, when I start qemu.
>>>>
>>>> Could you please try git://git.kernel.org/pub/scm/virt/kvm/kvm.git? I
>>>> fixed a bunch of things with preemption since then and it definitely
>>>> worked for me. If it still fails in that tree, I can try again to
>>>> reproduce it :).
>>>
>>> This kernel (e9badff4b38a3f8b2c20aa8a30db210caf85a497) fails to build:
>>>
>>> CC [M] arch/powerpc/kvm/book3s_pr.o
>>> arch/powerpc/kvm/book3s_pr.c: In function ?kvm_vcpu_ioctl_get_one_reg?:
>>> arch/powerpc/kvm/book3s_pr.c:883:45: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>>> arch/powerpc/kvm/book3s_pr.c:883:80: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>>> arch/powerpc/kvm/book3s_pr.c:883:284: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>>> arch/powerpc/kvm/book3s_pr.c:883:327: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>>> arch/powerpc/kvm/book3s_pr.c:883:459: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>>> arch/powerpc/kvm/book3s_pr.c:883:748: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>>> arch/powerpc/kvm/book3s_pr.c:883:1112: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>>> arch/powerpc/kvm/book3s_pr.c:883:1476: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>>> arch/powerpc/kvm/book3s_pr.c:883:1867: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>
>> @@ -652,6 +653,11 @@ static int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu,
>> int r = -EINVAL;
>>
>> switch (reg->id) {
>> +#ifdef CONFIG_PPC_BOOK3S
>> + case KVM_REG_PPC_HIOR:
>> + r = put_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr);
>> + break;
>> +#endif
>> default:
>> break;
>> }
>
> Is this the right fix for this code?

The idea of the put/get_user is to access memory that is at the address "reg->addr". The code works as expected on book3s_64 for me too, where sizeof(u64) == sizeof(ulong). On book3s_32 however, sizeof(ulong) is 4, which is not the same as the size of reg->addr, which is u64, thus 8.

So we need to tell the compiler to cut off the high 32 bits (because we can't access them anyways) and instead take the lower 32 bits as the pointer at which address we want to access things. That's basically what the patch I sent out earlier today did :).


Alex

2012-02-27 00:17:43

by Jörg Sommer

[permalink] [raw]
Subject: Re: Current kernel fails to compile with KVM on PowerPC

Alexander Graf hat am Sun 26. Feb, 12:43 (+0100) geschrieben:
> On 25.02.2012, at 15:51, Jörg Sommer wrote:
> > Jörg Sommer hat am Tue 21. Feb, 09:32 (+0100) geschrieben:
> >> Alexander Graf hat am Mon 20. Feb, 22:27 (+0100) geschrieben:
> >>> On 20.02.2012, at 18:38, Jörg Sommer wrote:
> >>>> Alexander Graf hat am Tue 22. Nov, 22:29 (+0100) geschrieben:
> >>>>> On 22.11.2011, at 21:04, Jörg Sommer wrote:
> >>>>>> [1] »kernel BUG at include/linux/kvm_host.h:603!«
> >>>>>> http://www.mail-archive.com/[email protected]/msg61433.html
> >>>>>
> >>>>> This is unfortunately still there. It's because of preemption being
> >>>>> enabled. Please just use CONFIG_PREEMPT_NONE for the time being
> >>>>
> >>>> This doesn't help. I've build with CONFIG_PREEMPT_NONE, but I'm getting
> >>>> this Oops, when I start qemu.
> >>>
> >>> Could you please try git://git.kernel.org/pub/scm/virt/kvm/kvm.git? I
> >>> fixed a bunch of things with preemption since then and it definitely
> >>> worked for me. If it still fails in that tree, I can try again to
> >>> reproduce it :).
> >>
> >> This kernel (e9badff4b38a3f8b2c20aa8a30db210caf85a497) fails to build:
> >>
> >> CC [M] arch/powerpc/kvm/book3s_pr.o
> >> arch/powerpc/kvm/book3s_pr.c: In function ‘kvm_vcpu_ioctl_get_one_reg’:
> >> arch/powerpc/kvm/book3s_pr.c:883:45: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> >> arch/powerpc/kvm/book3s_pr.c:883:80: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

> Yikes. Does this patch work for you?

> diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
> index ee222ec..f329eae 100644
> --- a/arch/powerpc/kvm/book3s_pr.c
> +++ b/arch/powerpc/kvm/book3s_pr.c
> @@ -880,7 +880,8 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
>
> switch (reg->id) {
> case KVM_REG_PPC_HIOR:
> - r = put_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr);
> + r = put_user(to_book3s(vcpu)->hior,
> + (u64 __user *)(long)reg->addr);

Yes and no. It brings me a step further, but not to a working kernel.

CHK include/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CC [M] arch/powerpc/kvm/book3s_pr.o
LD [M] arch/powerpc/kvm/kvm.o
Building modules, stage 2.
MODPOST 227 modules
ERROR: "__get_user_bad" [arch/powerpc/kvm/kvm.ko] undefined!
make[1]: *** [__modpost] Fehler 1
make: *** [modules] Fehler 2
--
Der Wille und nicht die Gabe macht den Geber.


Attachments:
(No filename) (2.55 kB)
signature.asc (198.00 B)
Digital signature http://en.wikipedia.org/wiki/OpenPGP
Download all attachments

2012-02-27 00:31:03

by Alexander Graf

[permalink] [raw]
Subject: Re: Current kernel fails to compile with KVM on PowerPC


On 27.02.2012, at 01:08, J?rg Sommer wrote:

> Alexander Graf hat am Sun 26. Feb, 12:43 (+0100) geschrieben:
>> On 25.02.2012, at 15:51, J?rg Sommer wrote:
>>> J?rg Sommer hat am Tue 21. Feb, 09:32 (+0100) geschrieben:
>>>> Alexander Graf hat am Mon 20. Feb, 22:27 (+0100) geschrieben:
>>>>> On 20.02.2012, at 18:38, J?rg Sommer wrote:
>>>>>> Alexander Graf hat am Tue 22. Nov, 22:29 (+0100) geschrieben:
>>>>>>> On 22.11.2011, at 21:04, J?rg Sommer wrote:
>>>>>>>> [1] ?kernel BUG at include/linux/kvm_host.h:603!?
>>>>>>>> http://www.mail-archive.com/[email protected]/msg61433.html
>>>>>>>
>>>>>>> This is unfortunately still there. It's because of preemption being
>>>>>>> enabled. Please just use CONFIG_PREEMPT_NONE for the time being
>>>>>>
>>>>>> This doesn't help. I've build with CONFIG_PREEMPT_NONE, but I'm getting
>>>>>> this Oops, when I start qemu.
>>>>>
>>>>> Could you please try git://git.kernel.org/pub/scm/virt/kvm/kvm.git? I
>>>>> fixed a bunch of things with preemption since then and it definitely
>>>>> worked for me. If it still fails in that tree, I can try again to
>>>>> reproduce it :).
>>>>
>>>> This kernel (e9badff4b38a3f8b2c20aa8a30db210caf85a497) fails to build:
>>>>
>>>> CC [M] arch/powerpc/kvm/book3s_pr.o
>>>> arch/powerpc/kvm/book3s_pr.c: In function ?kvm_vcpu_ioctl_get_one_reg?:
>>>> arch/powerpc/kvm/book3s_pr.c:883:45: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>>>> arch/powerpc/kvm/book3s_pr.c:883:80: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>
>> Yikes. Does this patch work for you?
>
>> diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
>> index ee222ec..f329eae 100644
>> --- a/arch/powerpc/kvm/book3s_pr.c
>> +++ b/arch/powerpc/kvm/book3s_pr.c
>> @@ -880,7 +880,8 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
>>
>> switch (reg->id) {
>> case KVM_REG_PPC_HIOR:
>> - r = put_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr);
>> + r = put_user(to_book3s(vcpu)->hior,
>> + (u64 __user *)(long)reg->addr);
>
> Yes and no. It brings me a step further, but not to a working kernel.
>
> CHK include/linux/version.h
> CHK include/generated/utsrelease.h
> CALL scripts/checksyscalls.sh
> CC [M] arch/powerpc/kvm/book3s_pr.o
> LD [M] arch/powerpc/kvm/kvm.o
> Building modules, stage 2.
> MODPOST 227 modules
> ERROR: "__get_user_bad" [arch/powerpc/kvm/kvm.ko] undefined!

Ah, because you can't get_user u64s I suppose. Sigh. As a quick hack, just comment out the get/put_user lines - you don't care about configuring HIOR on ppc32 anyways. I'll try to come up with something :)


Alex

2012-02-27 11:32:57

by Jörg Sommer

[permalink] [raw]
Subject: Re: Current kernel fails to compile with KVM on PowerPC

Alexander Graf hat am Mon 27. Feb, 01:30 (+0100) geschrieben:
> On 27.02.2012, at 01:08, Jörg Sommer wrote:
>
> > Alexander Graf hat am Sun 26. Feb, 12:43 (+0100) geschrieben:
> >> On 25.02.2012, at 15:51, Jörg Sommer wrote:
> >>> Jörg Sommer hat am Tue 21. Feb, 09:32 (+0100) geschrieben:
> >>>> Alexander Graf hat am Mon 20. Feb, 22:27 (+0100) geschrieben:
> >>>>> On 20.02.2012, at 18:38, Jörg Sommer wrote:
> >>>>>> Alexander Graf hat am Tue 22. Nov, 22:29 (+0100) geschrieben:
> >>>>>>> On 22.11.2011, at 21:04, Jörg Sommer wrote:
> >>>>>>>> [1] »kernel BUG at include/linux/kvm_host.h:603!«
> >>>>>>>> http://www.mail-archive.com/[email protected]/msg61433.html
> >>>>>>>
> >>>>>>> This is unfortunately still there. It's because of preemption being
> >>>>>>> enabled. Please just use CONFIG_PREEMPT_NONE for the time being
> >>>>>>
> >>>>>> This doesn't help. I've build with CONFIG_PREEMPT_NONE, but I'm getting
> >>>>>> this Oops, when I start qemu.
> >>>>>
> >>>>> Could you please try git://git.kernel.org/pub/scm/virt/kvm/kvm.git? I
> >>>>> fixed a bunch of things with preemption since then and it definitely
> >>>>> worked for me. If it still fails in that tree, I can try again to
> >>>>> reproduce it :).
> >>>>
> >>>> This kernel (e9badff4b38a3f8b2c20aa8a30db210caf85a497) fails to build:
> >>>>
> >>>> CC [M] arch/powerpc/kvm/book3s_pr.o
> >>>> arch/powerpc/kvm/book3s_pr.c: In function ‘kvm_vcpu_ioctl_get_one_reg’:
> >>>> arch/powerpc/kvm/book3s_pr.c:883:45: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> >>>> arch/powerpc/kvm/book3s_pr.c:883:80: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> >
> >> Yikes. Does this patch work for you?
> >
> >> diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
> >> index ee222ec..f329eae 100644
> >> --- a/arch/powerpc/kvm/book3s_pr.c
> >> +++ b/arch/powerpc/kvm/book3s_pr.c
> >> @@ -880,7 +880,8 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
> >>
> >> switch (reg->id) {
> >> case KVM_REG_PPC_HIOR:
> >> - r = put_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr);
> >> + r = put_user(to_book3s(vcpu)->hior,
> >> + (u64 __user *)(long)reg->addr);
> >
> > Yes and no. It brings me a step further, but not to a working kernel.
> >
> > CHK include/linux/version.h
> > CHK include/generated/utsrelease.h
> > CALL scripts/checksyscalls.sh
> > CC [M] arch/powerpc/kvm/book3s_pr.o
> > LD [M] arch/powerpc/kvm/kvm.o
> > Building modules, stage 2.
> > MODPOST 227 modules
> > ERROR: "__get_user_bad" [arch/powerpc/kvm/kvm.ko] undefined!
>
> Ah, because you can't get_user u64s I suppose. Sigh. As a quick hack,
> just comment out the get/put_user lines - you don't care about
> configuring HIOR on ppc32 anyways. I'll try to come up with something
> :)

I've removed these lines and got a kernel. But it crashes:

# modprobe kvm
# qemu-system-ppc -enable-kvm -curses
[ 155.982144] BUG: sleeping function called from invalid context at arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:1078
[ 155.982552] in_atomic(): 0, irqs_disabled(): 1, pid: 1727, name: qemu-system-ppc
[ 155.982807] Call Trace:
[ 155.982916] [e31ad820] [c000bc44] show_stack+0xbc/0x194 (unreliable)
[ 155.983175] [e31ad870] [c047bc2c] dump_stack+0x30/0x38
[ 155.983372] [e31ad880] [c0062070] __might_sleep+0xf8/0x100
[ 155.983620] [e31ad890] [ea6c1830] hva_to_pfn.isra.41+0xc0/0x340 [kvm]
[ 155.983869] [e31ad8d0] [ea6c1b6c] __gfn_to_pfn+0xbc/0xc4 [kvm]
[ 155.984110] [e31ad8f0] [ea6c1bec] gfn_to_pfn+0x38/0x40 [kvm]
[ 155.984335] [e31ad900] [ea6c9f60] kvmppc_gfn_to_pfn+0xb8/0xc8 [kvm]
[ 155.984571] [e31ad920] [ea6ce454] kvmppc_mmu_map_page+0x3c/0x274 [kvm]
[ 155.984817] [e31ad970] [ea6cadc4] kvmppc_handle_pagefault+0x264/0x3d0 [kvm]
[ 155.985083] [e31ad9c0] [ea6cb22c] kvmppc_handle_exit+0x18c/0x800 [kvm]
[ 155.985329] [e31ada00] [ea6cd18c] kvmppc_handler_highmem+0x5c/0x6c [kvm]
[ 155.985580] [e31adac0] [ea6cbebc] kvmppc_vcpu_run+0x184/0x244 [kvm]
[ 155.985817] [e31ade20] [ea6c6170] kvm_arch_vcpu_ioctl_run+0x348/0x374 [kvm]
[ 155.986080] [e31ade50] [ea6bfc70] kvm_vcpu_ioctl+0x158/0x888 [kvm]
[ 155.986308] [e31adea0] [c0129080] do_vfs_ioctl+0x714/0x78c
[ 155.986506] [e31adf10] [c0129160] sys_ioctl+0x68/0x8c
[ 155.986693] [e31adf40] [c0013b70] ret_from_syscall+0x0/0x38
[ 155.986915] --- Exception: c01 at 0xf4eda98
[ 155.986921] LR = 0xf4ed9fc
[ 155.992590] Page fault in user mode with in_atomic() = 1 mm = e3021e00
[ 155.992869] NIP = 1017551c MSR = d032
[ 155.993273] PowerMac
[ 155.993357] Modules linked in: kvm ipv6 fuse option usb_wwan usbserial snd_powermac b43 mac80211 cfg80211 snd_aoa_i2sbus usb_storage snd_pcm_oss snd_mixer_oss snd_pcm snd_page_alloc snd_seq snd_timer snd_seq_d
[ 155.994742] NIP: 1017551c LR: 10175514 CTR: 0f5a3420
[ 155.994920] REGS: e31adf50 TRAP: 0301 Not tainted (3.3.0-rc3-04608-ge9badff4-dirty)
[ 155.995186] MSR: 0000d032 <EE,PR,ME,IR,DR,RI> CR: 28002464 XER: 20000000
[ 155.995516] DAR: 48023008, DSISR: 40000000
[ 155.995663] TASK = e33322b0[1727] 'qemu-system-ppc' THREAD: e31ac000
10175514 48847c60 4884f8e0 10cadd08 48023000 28002464 00000002 0f4eda98
0000d032 00000000 00001032 00000001 e31ac000
[ 155.996535] NIP [1017551c] 0x1017551c
[ 155.996668] LR [10175514] 0x10175514
[ 155.996793] Call Trace:
[ 155.997049]
[ 156.974149] Kernel panic - not syncing: Fatal exception in interrupt
[ 156.974390] Rebooting in 180 seconds..
--
Prof: Ist etwas an der Tafel nicht zu lesen? Sie schauen so komisch.
Studentin: Nein, es ist alles in Ordnung.
Prof: Aber ihr Gesicht sieht überhaupt nicht in Ordnung aus.


Attachments:
(No filename) (5.65 kB)
signature.asc (198.00 B)
Digital signature http://en.wikipedia.org/wiki/OpenPGP
Download all attachments