All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Aurelien Jarno <aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD
Date: Sun, 15 Jul 2007 15:30:43 +0300	[thread overview]
Message-ID: <469A1373.5090904@qumranet.com> (raw)
In-Reply-To: <20070715121159.GO3941-OqXK5JiLQY5aJl8KAwiEcA@public.gmane.org>

[-- 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

  parent reply	other threads:[~2007-07-15 12:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=469A1373.5090904@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.