* KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD
@ 2007-07-14 17:06 Aurelien Jarno
[not found] ` <20070714170618.GB6527-OqXK5JiLQY5aJl8KAwiEcA@public.gmane.org>
0 siblings, 1 reply; 13+ messages in thread
From: Aurelien Jarno @ 2007-07-14 17:06 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Hi,
I have just updated my system from kvm 28 to kvm 29, and a GNU/kFreeBSD
amd64 system fails to boot with the following error:
Fatal trap 12 with interrupts disabled
Fatal trap 12: page fault while in kernel mode
fault virtual address = 0x7aa93e0
fault code = supervisor read, page not present
instruction pointer = 0x8:0xffffffff80598b36
stack pointer = 0x10:0xffffffff87c556b0
frame pointer = 0x10:0xffffff0007aa9260
code segment = base 0x00, lmit 0xfffff, type 0x1b
= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags = resume, IOPL = 0
current process = 1 (init)
trap number = 12
panic: page fault
This is on an machine with an Athlon64 X2 CPU.
As it was running fine with kvm 28, I tried to mix kvm 28 and kvm 29. It
fails when using modules from kvm 29, whatever the version of the
userland part. This looks like a problem in the kernel modules.
Please also note that GNU/kFreeBSD i386 is working fine with kvm 29 on
the same machine.
Please tell me what I can do to help debugging this problem.
Alternatively I have uploaded an image to reproduce the problem here:
http://temp.aurel32.net/kfreebsd-amd64.img.gz
Thanks,
Aurelien
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org | aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org
`- people.debian.org/~aurel32 | www.aurel32.net
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD
[not found] ` <20070714170618.GB6527-OqXK5JiLQY5aJl8KAwiEcA@public.gmane.org>
@ 2007-07-15 6:23 ` Avi Kivity
[not found] ` <4699BD63.8010904-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-18 7:46 ` Aurelien Jarno
2007-07-20 6:50 ` Avi Kivity
2 siblings, 1 reply; 13+ messages in thread
From: Avi Kivity @ 2007-07-15 6:23 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Aurelien Jarno wrote:
> Hi,
>
> I have just updated my system from kvm 28 to kvm 29, and a GNU/kFreeBSD
> amd64 system fails to boot with the following error:
>
> Fatal trap 12 with interrupts disabled
>
>
> Fatal trap 12: page fault while in kernel mode
> fault virtual address = 0x7aa93e0
> fault code = supervisor read, page not present
> instruction pointer = 0x8:0xffffffff80598b36
> stack pointer = 0x10:0xffffffff87c556b0
> frame pointer = 0x10:0xffffff0007aa9260
> code segment = base 0x00, lmit 0xfffff, type 0x1b
> = DPL 0, pres 1, long 1, def32 0, gran 1
> processor eflags = resume, IOPL = 0
> current process = 1 (init)
> trap number = 12
> panic: page fault
>
>
> This is on an machine with an Athlon64 X2 CPU.
>
> As it was running fine with kvm 28, I tried to mix kvm 28 and kvm 29. It
> fails when using modules from kvm 29, whatever the version of the
> userland part. This looks like a problem in the kernel modules.
>
> Please also note that GNU/kFreeBSD i386 is working fine with kvm 29 on
> the same machine.
>
> Please tell me what I can do to help debugging this problem.
> Alternatively I have uploaded an image to reproduce the problem here:
> http://temp.aurel32.net/kfreebsd-amd64.img.gz
>
>
Can you bisect kvm to find the offending commit? Basically, you do a
git clone git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git
cd kvm
git bisect start drivers/kvm/
bit bisect bad kvm-29
git bisect good kvm-28
git will check out a test candidate; go to your kvm userspace directory
and do
make -C kernel sync LINUX=/path/to/the/kvm/git/directory
make -C kernel
sudo make -C kernel install
reload the module, test, and issue 'git bisect good' or 'git bisect bad'
according to the result. As there are only 25 commits you should be
done in 5 cycles.
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD
[not found] ` <4699BD63.8010904-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-07-15 12:11 ` Aurelien Jarno
[not found] ` <20070715121159.GO3941-OqXK5JiLQY5aJl8KAwiEcA@public.gmane.org>
0 siblings, 1 reply; 13+ messages in thread
From: Aurelien Jarno @ 2007-07-15 12:11 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Sun, Jul 15, 2007 at 09:23:31AM +0300, Avi Kivity wrote:
> Can you bisect kvm to find the offending commit? Basically, you do a
>
> git clone git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git
> cd kvm
> git bisect start drivers/kvm/
> bit bisect bad kvm-29
> git bisect good kvm-28
>
> git will check out a test candidate; go to your kvm userspace directory
> and do
>
> make -C kernel sync LINUX=/path/to/the/kvm/git/directory
> make -C kernel
> sudo make -C kernel install
>
> reload the module, test, and issue 'git bisect good' or 'git bisect bad'
> according to the result. As there are only 25 commits you should be
> done in 5 cycles.
>
And the result is:
commit ba9c20c048726037664d303362b688759fdf6e9d
Author: Luca Tettamanti <kronos.it-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Tue Jun 19 22:41:20 2007 +0200
KVM: Fix x86 emulator writeback
When the old value and new one are the same the emulator skips the
write; this is undesirable when the destination is a MMIO area and the
write shall be performed regardless of the previous value. This
optimization breaks e.g. a Linux guest APIC compiled without
X86_GOOD_APIC.
Remove the check and perform the writeback stage in the emulation unless
it's explicitly disabled (currently push and some 2 bytes instructions
may disable the writeback).
Signed-Off-By: Luca Tettamanti <kronos.it-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
I have tried to revert this patch directly into kvm-29, and it also
fixes the problem.
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org | aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org
`- people.debian.org/~aurel32 | www.aurel32.net
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD
[not found] ` <20070715121159.GO3941-OqXK5JiLQY5aJl8KAwiEcA@public.gmane.org>
@ 2007-07-15 12:30 ` Avi Kivity
[not found] ` <469A1373.5090904-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 13+ messages in thread
From: Avi Kivity @ 2007-07-15 12:30 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]
Aurelien Jarno wrote:
> On Sun, Jul 15, 2007 at 09:23:31AM +0300, Avi Kivity wrote:
>
>> Can you bisect kvm to find the offending commit? Basically, you do a
>>
>> git clone git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git
>> cd kvm
>> git bisect start drivers/kvm/
>> bit bisect bad kvm-29
>> git bisect good kvm-28
>>
>> git will check out a test candidate; go to your kvm userspace directory
>> and do
>>
>> make -C kernel sync LINUX=/path/to/the/kvm/git/directory
>> make -C kernel
>> sudo make -C kernel install
>>
>> reload the module, test, and issue 'git bisect good' or 'git bisect bad'
>> according to the result. As there are only 25 commits you should be
>> done in 5 cycles.
>>
>>
>
> And the result is:
>
> commit ba9c20c048726037664d303362b688759fdf6e9d
> Author: Luca Tettamanti <kronos.it-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Date: Tue Jun 19 22:41:20 2007 +0200
>
> KVM: Fix x86 emulator writeback
>
> When the old value and new one are the same the emulator skips the
> write; this is undesirable when the destination is a MMIO area and the
> write shall be performed regardless of the previous value. This
> optimization breaks e.g. a Linux guest APIC compiled without
> X86_GOOD_APIC.
>
> Remove the check and perform the writeback stage in the emulation unless
> it's explicitly disabled (currently push and some 2 bytes instructions
> may disable the writeback).
>
> Signed-Off-By: Luca Tettamanti <kronos.it-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
>
>
> I have tried to revert this patch directly into kvm-29, and it also
> fixes the problem.
>
>
From a cursory inspection, looks like the cmov instructions were broken
by the patch. Can you try the attached patch on top of kvm-29?
--
error compiling committee.c: too many arguments to function
[-- Attachment #2: cmov.patch --]
[-- Type: text/x-patch, Size: 1731 bytes --]
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index f60012d..7974012 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -1225,40 +1225,40 @@ twobyte_insn:
break;
case 0x40 ... 0x4f: /* cmov */
dst.val = dst.orig_val = src.val;
- d &= ~Mov; /* default to no move */
+ no_wb = 1; /* default to no move */
/*
* First, assume we're decoding an even cmov opcode
* (lsb == 0).
*/
switch ((b & 15) >> 1) {
case 0: /* cmovo */
- d |= (_eflags & EFLG_OF) ? Mov : 0;
+ no_wb &= (_eflags & EFLG_OF) ? 0 : 1;
break;
case 1: /* cmovb/cmovc/cmovnae */
- d |= (_eflags & EFLG_CF) ? Mov : 0;
+ no_wb &= (_eflags & EFLG_CF) ? 0 : 1;
break;
case 2: /* cmovz/cmove */
- d |= (_eflags & EFLG_ZF) ? Mov : 0;
+ no_wb &= (_eflags & EFLG_ZF) ? 0 : 1;
break;
case 3: /* cmovbe/cmovna */
- d |= (_eflags & (EFLG_CF | EFLG_ZF)) ? Mov : 0;
+ no_wb &= (_eflags & (EFLG_CF | EFLG_ZF)) ? 0 : 1;
break;
case 4: /* cmovs */
- d |= (_eflags & EFLG_SF) ? Mov : 0;
+ no_wb &= (_eflags & EFLG_SF) ? 0 : 1;
break;
case 5: /* cmovp/cmovpe */
- d |= (_eflags & EFLG_PF) ? Mov : 0;
+ no_wb &= (_eflags & EFLG_PF) ? 0 : 1;
break;
case 7: /* cmovle/cmovng */
- d |= (_eflags & EFLG_ZF) ? Mov : 0;
+ no_wb &= (_eflags & EFLG_ZF) ? 0 : 1;
/* fall through */
case 6: /* cmovl/cmovnge */
- d |= (!(_eflags & EFLG_SF) !=
- !(_eflags & EFLG_OF)) ? Mov : 0;
+ no_wb &= (!(_eflags & EFLG_SF) !=
+ !(_eflags & EFLG_OF)) ? 0 : 1;
break;
}
/* Odd cmov opcodes (lsb == 1) have inverted sense. */
- d ^= (b & 1) ? Mov : 0;
+ no_wb ^= (b & 1) ? 1 : 0;
break;
case 0xb0 ... 0xb1: /* cmpxchg */
/*
[-- Attachment #3: Type: text/plain, Size: 286 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
[-- Attachment #4: Type: text/plain, Size: 186 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD
[not found] ` <469A1373.5090904-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-07-15 13:11 ` Aurelien Jarno
0 siblings, 0 replies; 13+ messages in thread
From: Aurelien Jarno @ 2007-07-15 13:11 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Sun, Jul 15, 2007 at 03:30:43PM +0300, Avi Kivity wrote:
> Aurelien Jarno wrote:
> >On Sun, Jul 15, 2007 at 09:23:31AM +0300, Avi Kivity wrote:
> >
> >>Can you bisect kvm to find the offending commit? Basically, you do a
> >>
> >> git clone git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git
> >> cd kvm
> >> git bisect start drivers/kvm/
> >> bit bisect bad kvm-29
> >> git bisect good kvm-28
> >>
> >>git will check out a test candidate; go to your kvm userspace directory
> >>and do
> >>
> >> make -C kernel sync LINUX=/path/to/the/kvm/git/directory
> >> make -C kernel
> >> sudo make -C kernel install
> >>
> >>reload the module, test, and issue 'git bisect good' or 'git bisect bad'
> >>according to the result. As there are only 25 commits you should be
> >>done in 5 cycles.
> >>
> >>
> >
> >And the result is:
> >
> >commit ba9c20c048726037664d303362b688759fdf6e9d
> >Author: Luca Tettamanti <kronos.it-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> >Date: Tue Jun 19 22:41:20 2007 +0200
> >
> > KVM: Fix x86 emulator writeback
> >
> > When the old value and new one are the same the emulator skips the
> > write; this is undesirable when the destination is a MMIO area and the
> > write shall be performed regardless of the previous value. This
> > optimization breaks e.g. a Linux guest APIC compiled without
> > X86_GOOD_APIC.
> >
> > Remove the check and perform the writeback stage in the emulation
> > unless
> > it's explicitly disabled (currently push and some 2 bytes instructions
> > may disable the writeback).
> >
> > Signed-Off-By: Luca Tettamanti <kronos.it-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
> >
> >
> >I have tried to revert this patch directly into kvm-29, and it also
> >fixes the problem.
> >
> >
>
> From a cursory inspection, looks like the cmov instructions were broken
> by the patch. Can you try the attached patch on top of kvm-29?
>
Unfortunately this does not fix the problem.
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org | aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org
`- people.debian.org/~aurel32 | www.aurel32.net
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD
[not found] ` <20070714170618.GB6527-OqXK5JiLQY5aJl8KAwiEcA@public.gmane.org>
2007-07-15 6:23 ` Avi Kivity
@ 2007-07-18 7:46 ` Aurelien Jarno
2007-07-20 6:50 ` Avi Kivity
2 siblings, 0 replies; 13+ messages in thread
From: Aurelien Jarno @ 2007-07-18 7:46 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Sat, Jul 14, 2007 at 07:06:18PM +0200, Aurelien Jarno wrote:
> Hi,
>
> I have just updated my system from kvm 28 to kvm 29, and a GNU/kFreeBSD
> amd64 system fails to boot with the following error:
>
> Fatal trap 12 with interrupts disabled
>
>
> Fatal trap 12: page fault while in kernel mode
> fault virtual address = 0x7aa93e0
> fault code = supervisor read, page not present
> instruction pointer = 0x8:0xffffffff80598b36
> stack pointer = 0x10:0xffffffff87c556b0
> frame pointer = 0x10:0xffffff0007aa9260
> code segment = base 0x00, lmit 0xfffff, type 0x1b
> = DPL 0, pres 1, long 1, def32 0, gran 1
> processor eflags = resume, IOPL = 0
> current process = 1 (init)
> trap number = 12
> panic: page fault
>
>
> This is on an machine with an Athlon64 X2 CPU.
>
> As it was running fine with kvm 28, I tried to mix kvm 28 and kvm 29. It
> fails when using modules from kvm 29, whatever the version of the
> userland part. This looks like a problem in the kernel modules.
>
> Please also note that GNU/kFreeBSD i386 is working fine with kvm 29 on
> the same machine.
>
I have just seen the same failure on an i386 guest. It seems the failure
happens very rarely, but it happens.
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org | aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org
`- people.debian.org/~aurel32 | www.aurel32.net
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD
[not found] ` <20070714170618.GB6527-OqXK5JiLQY5aJl8KAwiEcA@public.gmane.org>
2007-07-15 6:23 ` Avi Kivity
2007-07-18 7:46 ` Aurelien Jarno
@ 2007-07-20 6:50 ` Avi Kivity
[not found] ` <46A05B23.50409-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2 siblings, 1 reply; 13+ messages in thread
From: Avi Kivity @ 2007-07-20 6:50 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Aurelien Jarno wrote:
> Hi,
>
> I have just updated my system from kvm 28 to kvm 29, and a GNU/kFreeBSD
> amd64 system fails to boot with the following error:
>
> Fatal trap 12 with interrupts disabled
>
>
> Fatal trap 12: page fault while in kernel mode
> fault virtual address = 0x7aa93e0
> fault code = supervisor read, page not present
> instruction pointer = 0x8:0xffffffff80598b36
> stack pointer = 0x10:0xffffffff87c556b0
> frame pointer = 0x10:0xffffff0007aa9260
> code segment = base 0x00, lmit 0xfffff, type 0x1b
> = DPL 0, pres 1, long 1, def32 0, gran 1
> processor eflags = resume, IOPL = 0
> current process = 1 (init)
> trap number = 12
> panic: page fault
>
>
> This is on an machine with an Athlon64 X2 CPU.
>
> As it was running fine with kvm 28, I tried to mix kvm 28 and kvm 29. It
> fails when using modules from kvm 29, whatever the version of the
> userland part. This looks like a problem in the kernel modules.
>
> Please also note that GNU/kFreeBSD i386 is working fine with kvm 29 on
> the same machine.
>
> Please tell me what I can do to help debugging this problem.
> Alternatively I have uploaded an image to reproduce the problem here:
> http://temp.aurel32.net/kfreebsd-amd64.img.g
I've downloaded the image and booted it three times using kvm HEAD.
Each time I got to the login prompt.
Is this always reproducible? Can you check with kvm HEAD (not that I
think of anything that could have fixed this).
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD
[not found] ` <46A05B23.50409-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-07-20 6:57 ` Avi Kivity
[not found] ` <46A05CF3.1070900-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 13+ messages in thread
From: Avi Kivity @ 2007-07-20 6:57 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Avi Kivity wrote:
>> Please tell me what I can do to help debugging this problem.
>> Alternatively I have uploaded an image to reproduce the problem here:
>> http://temp.aurel32.net/kfreebsd-amd64.img.g
>>
>
> I've downloaded the image and booted it three times using kvm HEAD.
> Each time I got to the login prompt.
>
> Is this always reproducible? Can you check with kvm HEAD (not that I
> think of anything that could have fixed this).
>
>
Sorry, that was on Intel. It reproduces easily on AMD.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD
[not found] ` <46A05CF3.1070900-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-07-20 22:20 ` Aurelien Jarno
2007-07-24 23:17 ` Aurelien Jarno
1 sibling, 0 replies; 13+ messages in thread
From: Aurelien Jarno @ 2007-07-20 22:20 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Fri, Jul 20, 2007 at 09:57:55AM +0300, Avi Kivity wrote:
> Avi Kivity wrote:
> >> Please tell me what I can do to help debugging this problem.
> >> Alternatively I have uploaded an image to reproduce the problem here:
> >> http://temp.aurel32.net/kfreebsd-amd64.img.g
> >>
> >
> > I've downloaded the image and booted it three times using kvm HEAD.
> > Each time I got to the login prompt.
> >
> > Is this always reproducible? Can you check with kvm HEAD (not that I
> > think of anything that could have fixed this).
> >
> >
>
> Sorry, that was on Intel. It reproduces easily on AMD.
>
Yep, I have just been able to test it on a Core 2 CPU, and everything
works nicely.
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org | aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org
`- people.debian.org/~aurel32 | www.aurel32.net
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD
[not found] ` <46A05CF3.1070900-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-20 22:20 ` Aurelien Jarno
@ 2007-07-24 23:17 ` Aurelien Jarno
[not found] ` <20070724231700.GD28101-OqXK5JiLQY5aJl8KAwiEcA@public.gmane.org>
1 sibling, 1 reply; 13+ messages in thread
From: Aurelien Jarno @ 2007-07-24 23:17 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Fri, Jul 20, 2007 at 09:57:55AM +0300, Avi Kivity wrote:
> Avi Kivity wrote:
> >> Please tell me what I can do to help debugging this problem.
> >> Alternatively I have uploaded an image to reproduce the problem here:
> >> http://temp.aurel32.net/kfreebsd-amd64.img.g
> >>
> >
> > I've downloaded the image and booted it three times using kvm HEAD.
> > Each time I got to the login prompt.
> >
> > Is this always reproducible? Can you check with kvm HEAD (not that I
> > think of anything that could have fixed this).
> >
> >
>
> Sorry, that was on Intel. It reproduces easily on AMD.
By comparing the cases were the old and the new condition are different,
I have found that the problem occurs for the lmsw and smsw instructions.
The patch below is very ugly, but it workarounds the problem.
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index 21ce977..6c1523f 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -1206,11 +1206,13 @@ twobyte_insn:
goto cannot_emulate;
*(u16 *)&_regs[modrm_rm]
= realmode_get_cr(ctxt->vcpu, 0);
+ no_wb = 1;
break;
case 6: /* lmsw */
if (modrm_mod != 3)
goto cannot_emulate;
realmode_lmsw(ctxt->vcpu, (u16)modrm_val, &_eflags);
+ no_wb = 1;
break;
case 7: /* invlpg*/
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org | aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org
`- people.debian.org/~aurel32 | www.aurel32.net
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD
[not found] ` <20070724231700.GD28101-OqXK5JiLQY5aJl8KAwiEcA@public.gmane.org>
@ 2007-07-25 3:14 ` Avi Kivity
[not found] ` <46A6C00C.8030609-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 13+ messages in thread
From: Avi Kivity @ 2007-07-25 3:14 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Aurelien Jarno wrote:
> On Fri, Jul 20, 2007 at 09:57:55AM +0300, Avi Kivity wrote:
>
>> Avi Kivity wrote:
>>
>>>> Please tell me what I can do to help debugging this problem.
>>>> Alternatively I have uploaded an image to reproduce the problem here:
>>>> http://temp.aurel32.net/kfreebsd-amd64.img.g
>>>>
>>>>
>>> I've downloaded the image and booted it three times using kvm HEAD.
>>> Each time I got to the login prompt.
>>>
>>> Is this always reproducible? Can you check with kvm HEAD (not that I
>>> think of anything that could have fixed this).
>>>
>>>
>>>
>> Sorry, that was on Intel. It reproduces easily on AMD.
>>
>
> By comparing the cases were the old and the new condition are different,
> I have found that the problem occurs for the lmsw and smsw instructions.
>
Ah, I was looking at amd-specific instructions (vmx decodes lmsw) but
missed these two. Good work.
> The patch below is very ugly, but it workarounds the problem.
>
It's not ugly, it just lives in an ugly function. But it does lack a
changelog and a signoff.
As to the ugliness, prehaps no_wb should be part of the opcode
descriptor bitmask (opcode_table and friend).
> diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
> index 21ce977..6c1523f 100644
> --- a/drivers/kvm/x86_emulate.c
> +++ b/drivers/kvm/x86_emulate.c
> @@ -1206,11 +1206,13 @@ twobyte_insn:
> goto cannot_emulate;
> *(u16 *)&_regs[modrm_rm]
> = realmode_get_cr(ctxt->vcpu, 0);
> + no_wb = 1;
> break;
> case 6: /* lmsw */
> if (modrm_mod != 3)
> goto cannot_emulate;
> realmode_lmsw(ctxt->vcpu, (u16)modrm_val, &_eflags);
> + no_wb = 1;
> break;
> case 7: /* invlpg*/
>
>
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD
[not found] ` <46A6C00C.8030609-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-07-25 8:19 ` Aurelien Jarno
[not found] ` <20070725081954.GA14103-OqXK5JiLQY5aJl8KAwiEcA@public.gmane.org>
0 siblings, 1 reply; 13+ messages in thread
From: Aurelien Jarno @ 2007-07-25 8:19 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Wed, Jul 25, 2007 at 06:14:20AM +0300, Avi Kivity wrote:
> Aurelien Jarno wrote:
> > On Fri, Jul 20, 2007 at 09:57:55AM +0300, Avi Kivity wrote:
> >
> >> Avi Kivity wrote:
> >>
> >>>> Please tell me what I can do to help debugging this problem.
> >>>> Alternatively I have uploaded an image to reproduce the problem here:
> >>>> http://temp.aurel32.net/kfreebsd-amd64.img.g
> >>>>
> >>>>
> >>> I've downloaded the image and booted it three times using kvm HEAD.
> >>> Each time I got to the login prompt.
> >>>
> >>> Is this always reproducible? Can you check with kvm HEAD (not that I
> >>> think of anything that could have fixed this).
> >>>
> >>>
> >>>
> >> Sorry, that was on Intel. It reproduces easily on AMD.
> >>
> >
> > By comparing the cases were the old and the new condition are different,
> > I have found that the problem occurs for the lmsw and smsw instructions.
> >
>
> Ah, I was looking at amd-specific instructions (vmx decodes lmsw) but
> missed these two. Good work.
>
> > The patch below is very ugly, but it workarounds the problem.
> >
>
> It's not ugly, it just lives in an ugly function. But it does lack a
> changelog and a signoff.
>
After a short discussion on IRC, it seems that all 0x02 0x01
instructions do not use the writeback. Please find an updated and
signedoff patch below.
KVM: disable writeback for 0x02 0x01 instructions.
0x02 0x01 instructions (ie lgdt, lidt, smsw, lmsw and invlpg) does
not use writeback. This patch set no_wb=1 when emulating those
instructions.
Signed-off-by: Aurelien Jarno <aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org>
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index 21ce977..cbbb9c5 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -1183,6 +1183,8 @@ pop_instruction:
twobyte_insn:
switch (b) {
case 0x01: /* lgdt, lidt, lmsw */
+ /* Disable writeback. */
+ no_wb = 1;
switch (modrm_reg) {
u16 size;
unsigned long address;
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org | aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org
`- people.debian.org/~aurel32 | www.aurel32.net
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD
[not found] ` <20070725081954.GA14103-OqXK5JiLQY5aJl8KAwiEcA@public.gmane.org>
@ 2007-07-25 8:27 ` Avi Kivity
0 siblings, 0 replies; 13+ messages in thread
From: Avi Kivity @ 2007-07-25 8:27 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Aurelien Jarno wrote:
> After a short discussion on IRC, it seems that all 0x02 0x01
> instructions do not use the writeback. Please find an updated and
> signedoff patch below.
>
> KVM: disable writeback for 0x02 0x01 instructions.
>
> 0x02 0x01 instructions (ie lgdt, lidt, smsw, lmsw and invlpg) does
> not use writeback. This patch set no_wb=1 when emulating those
> instructions.
>
> Signed-off-by: Aurelien Jarno <aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org>
>
It's in, thanks.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2007-07-25 8:27 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-14 17:06 KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD Aurelien Jarno
[not found] ` <20070714170618.GB6527-OqXK5JiLQY5aJl8KAwiEcA@public.gmane.org>
2007-07-15 6:23 ` Avi Kivity
[not found] ` <4699BD63.8010904-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-15 12:11 ` Aurelien Jarno
[not found] ` <20070715121159.GO3941-OqXK5JiLQY5aJl8KAwiEcA@public.gmane.org>
2007-07-15 12:30 ` Avi Kivity
[not found] ` <469A1373.5090904-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-15 13:11 ` Aurelien Jarno
2007-07-18 7:46 ` Aurelien Jarno
2007-07-20 6:50 ` Avi Kivity
[not found] ` <46A05B23.50409-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-20 6:57 ` Avi Kivity
[not found] ` <46A05CF3.1070900-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-20 22:20 ` Aurelien Jarno
2007-07-24 23:17 ` Aurelien Jarno
[not found] ` <20070724231700.GD28101-OqXK5JiLQY5aJl8KAwiEcA@public.gmane.org>
2007-07-25 3:14 ` Avi Kivity
[not found] ` <46A6C00C.8030609-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-25 8:19 ` Aurelien Jarno
[not found] ` <20070725081954.GA14103-OqXK5JiLQY5aJl8KAwiEcA@public.gmane.org>
2007-07-25 8:27 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox