From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Solaris 10 doesn't work under KVM Date: Mon, 12 Feb 2007 11:48:49 +0200 Message-ID: <45D03801.4040006@qumranet.com> References: <20070128144052.GA5069@waba> <45BDDF32.3010607@qumranet.com> <20070201214924.GB7489@waba> <20070202191942.GB8804@amd.com> <20070204183141.GB13914@waba> <45C99EE9.3010306@qumranet.com> <20070207230427.GA7946@waba> <45CAECEB.4000701@qumranet.com> <20070210133443.GA13495@waba> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020106020306050707020400" Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Waba Return-path: In-Reply-To: <20070210133443.GA13495@waba> 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 This is a multi-part message in MIME format. --------------020106020306050707020400 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Waba wrote: > It took me a while, but I figured it out... nearly! > > Everything SIGILLs after the fs-root service is started. Its start > method does several things, but the problematic bit is replacing the > libc with an optimised version (namely, /usr/lib/libc/libc_hwcap1.so.1, > which makes use of the SSE, MMX, CMOV, SEP and FPU instruction sets > according to file(1)). > > All these flags are indeed advertised in the CPUID (isainfo -v: sse2 sse > fxsr mmx cmov sep cx8 tsc fpu)). If the amd_sysc bit had been present, > the hwcap2 version would have been selected by moe(1), I guess (adds > SSE2 support and replaces SEP by AMD_SYSC). > > Disabling the libc replacement in /lib/svc/method/fs-root entirely > workarounds the problem. > > Further investigating, I tricked ls(1) into using the optimised libc > through LD_LIBRARY_PATH and obtained a core. mdb(1) told me that the > culprit was hiding at libc`memset+0x74. And finally, dis(1) revealed > that the faulty instruction is "movups (%esp), %xmm0", a SSE feature. > The %xmm0 register is apparently for storage purposes only, as the only > instructions used to access it are movups, movntps and movaps. > > At this point I hope that it makes a lot of sense to you, because I > have no idea why it works fine on Avi's Opteron, etc. > > Let me know if you need any additional debugging. > Let's look at the control registers at the time of the SIGILL. Can you reproduce the error with the attached patch and send dmesg? -- error compiling committee.c: too many arguments to function --------------020106020306050707020400 Content-Type: text/x-patch; name="ud-print-cr0-cr4.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ud-print-cr0-cr4.patch" Index: svm.c =================================================================== --- svm.c (revision 4412) +++ svm.c (working copy) @@ -481,7 +481,7 @@ INTERCEPT_DR5_MASK | INTERCEPT_DR7_MASK; - control->intercept_exceptions = 1 << PF_VECTOR; + control->intercept_exceptions = (1 << PF_VECTOR) | (1 << UD_VECTOR); control->intercept = (1ULL << INTERCEPT_INTR) | @@ -1247,6 +1247,15 @@ return 1; } +static int ud_interception(struct kvm_vcpu *vcpu, struct kvm_run *run) +{ + printk(KERN_ERR "#ud: cr0 %lx (%llx) cr4 %lx (%llx)\n", + vcpu->cr0, vcpu->svm->vmcb->save.cr0, + vcpu->cr4, vcpu->svm->vmcb->save.cr4); + run->exit_reason = KVM_EXIT_SHUTDOWN; + return 0; +} + static int (*svm_exit_handlers[])(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) = { [SVM_EXIT_READ_CR0] = emulate_on_interception, @@ -1267,6 +1276,7 @@ [SVM_EXIT_WRITE_DR5] = emulate_on_interception, [SVM_EXIT_WRITE_DR7] = emulate_on_interception, [SVM_EXIT_EXCP_BASE + PF_VECTOR] = pf_interception, + [SVM_EXIT_EXCP_BASE + UD_VECTOR] = ud_interception, [SVM_EXIT_INTR] = nop_on_interception, [SVM_EXIT_NMI] = nop_on_interception, [SVM_EXIT_SMI] = nop_on_interception, --------------020106020306050707020400 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- 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 --------------020106020306050707020400 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel --------------020106020306050707020400--