From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aurelien Jarno Subject: Re: KVM 29: Page fault in kernel mode while booting GNU/kFreeBSD Date: Wed, 25 Jul 2007 10:19:54 +0200 Message-ID: <20070725081954.GA14103@hall.aurel32.net> References: <20070714170618.GB6527@hall.aurel32.net> <46A05B23.50409@qumranet.com> <46A05CF3.1070900@qumranet.com> <20070724231700.GD28101@hall.aurel32.net> <46A6C00C.8030609@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Avi Kivity Return-path: Content-Disposition: inline In-Reply-To: <46A6C00C.8030609-atKUWr5tajBWk0Htik3J/w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org 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 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/