From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH try #2] kvm-12 userland guest reboot fix Date: Thu, 01 Feb 2007 10:25:21 +0200 Message-ID: <45C1A3F1.1070803@qumranet.com> References: <20070131165830.GB8491@amd.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: Joerg Roedel Return-path: In-Reply-To: <20070131165830.GB8491-5C7GfCeVMHo@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 Joerg Roedel wrote: > From: Markus Rechberger > From: Joerg Roedel > > This patch fixes the initialization of the segment registers which > solves the triple fault and keyboard controller reset problems in > kvm/qemu guests as well as the slow grub menu interaction. The patch > should also work on Intel VMX now. > > diff -upr kvm-12/qemu/target-i386/helper2.c kvm-12-reboot-fixed/qemu/target-i386/helper2.c > --- kvm-12/qemu/target-i386/helper2.c 2006-12-31 14:31:38.000000000 +0100 > +++ kvm-12-reboot-fixed/qemu/target-i386/helper2.c 2007-01-23 20:24:42.265987000 +0100 > @@ -151,6 +151,9 @@ CPUX86State *cpu_x86_init(void) > void cpu_reset(CPUX86State *env) > { > int i; > + unsigned int flags = DESC_P_MASK | > + DESC_S_MASK | > + (2 << DESC_TYPE_SHIFT); > > memset(env, 0, offsetof(CPUX86State, breakpoints)); > > @@ -173,9 +176,9 @@ void cpu_reset(CPUX86State *env) > env->tr.flags = DESC_P_MASK; > > cpu_x86_load_seg_cache(env, R_CS, 0xf000, 0xffff0000, 0xffff, 0); > - cpu_x86_load_seg_cache(env, R_DS, 0, 0, 0xffff, 0); > - cpu_x86_load_seg_cache(env, R_ES, 0, 0, 0xffff, 0); > - cpu_x86_load_seg_cache(env, R_SS, 0, 0, 0xffff, 0); > + cpu_x86_load_seg_cache(env, R_DS, 0, 0, 0xffff, flags); > + cpu_x86_load_seg_cache(env, R_ES, 0, 0, 0xffff, flags); > + cpu_x86_load_seg_cache(env, R_SS, 0, 0, 0xffff, flags); > cpu_x86_load_seg_cache(env, R_FS, 0, 0, 0xffff, 0); > cpu_x86_load_seg_cache(env, R_GS, 0, 0, 0xffff, 0); > This changes core qemu code, which may make merging our code back to qemu more difficult. It also means we need to test with -no-kvm. Can you try making load_regs() in qemu-kvm.c detect the case of flags == 0 (perhaps only if cr0.pg == 0) and changing it only then? It should have the same effect. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- 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