From owner-freebsd-emulation@FreeBSD.ORG Tue Jun 3 20:54:40 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00A7B1065688 for ; Tue, 3 Jun 2008 20:54:40 +0000 (UTC) (envelope-from nox@saturn.kn-bremen.de) Received: from gwyn.kn-bremen.de (gwyn.kn-bremen.de [212.63.36.242]) by mx1.freebsd.org (Postfix) with ESMTP id 7C1A68FC1F for ; Tue, 3 Jun 2008 20:54:39 +0000 (UTC) (envelope-from nox@saturn.kn-bremen.de) Received: by gwyn.kn-bremen.de (Postfix, from userid 10) id D6AE62E02B7; Tue, 3 Jun 2008 22:54:35 +0200 (CEST) Received: from saturn.kn-bremen.de (nox@localhost [127.0.0.1]) by saturn.kn-bremen.de (8.14.2/8.13.8) with ESMTP id m53KqlM0013868; Tue, 3 Jun 2008 22:52:47 +0200 (CEST) (envelope-from nox@saturn.kn-bremen.de) Received: (from nox@localhost) by saturn.kn-bremen.de (8.14.2/8.13.6/Submit) id m53KqjcO013867; Tue, 3 Jun 2008 22:52:45 +0200 (CEST) (envelope-from nox) From: Juergen Lock Date: Tue, 3 Jun 2008 22:52:45 +0200 To: Todd Wasson Message-ID: <20080603205245.GA13843@saturn.kn-bremen.de> Mail-Followup-To: Todd Wasson , freebsd-emulation@freebsd.org, Bakul Shah References: <20080515080948.3B1F15B47@mail.bitblocks.com> <200805152323.m4FNNO7H017348@saturn.kn-bremen.de> <20080518142427.GA20876@saturn.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Cc: freebsd-emulation@freebsd.org Subject: Re: kqemu locking my machine hard on amd64 smp, with most recent patches X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jun 2008 20:54:40 -0000 On Sun, May 18, 2008 at 06:16:21PM -0400, Todd Wasson wrote: > Hi Juergen. That patch seems to have fixed the problem for me, as verified > with both kqemu-kmod-1.3.0.p11_6 and kqemu-kmod-1.3.0.p11_7. However, I'm > somewhat uneasy about using this patch on my system long-term, since it > hasn't been rigorously tested. Are there putative implications of this > patch with other software that I should be aware of? Is this kernel patch > considered to be the final fix, or just a band-aid until the underlying > cause can be addressed from within kqemu alone? I just noticed the new fixup code should better be called before entering the monitor not after, maybe that was what caused your problem. Can you please try the following patch (without the kernel patch)? Thanx, Juergen Index: Makefile =================================================================== RCS file: /home/pcvs/ports/emulators/kqemu-kmod/Makefile,v retrieving revision 1.26 diff -u -p -r1.26 Makefile --- Makefile 18 May 2008 20:23:40 -0000 1.26 +++ Makefile 3 Jun 2008 20:45:07 -0000 @@ -7,7 +7,7 @@ PORTNAME= kqemu PORTVERSION= 1.3.0.p11 -PORTREVISION= 7 +PORTREVISION= 8 CATEGORIES= emulators kld MASTER_SITES= http://fabrice.bellard.free.fr/qemu/ \ http://qemu.org/ \ Index: files/patch-tssworkaround =================================================================== RCS file: /home/pcvs/ports/emulators/kqemu-kmod/files/patch-tssworkaround,v retrieving revision 1.4 diff -u -p -r1.4 patch-tssworkaround --- files/patch-tssworkaround 18 May 2008 20:23:40 -0000 1.4 +++ files/patch-tssworkaround 3 Jun 2008 20:08:24 -0000 @@ -83,20 +83,21 @@ Index: common/kernel.c #endif #ifdef PROFILE -@@ -1188,6 +1191,13 @@ - apic_restore_nmi(s, apic_nmi_mask); +@@ -1096,6 +1099,14 @@ + apic_nmi_mask = apic_save_and_disable_nmi(s); } - profile_record(s); + +#ifdef __FreeBSD__ +#ifdef __x86_64__ + spin_lock(&g->lock); ++ asm volatile ("sgdt %0" : : "m" (s->kernel_gdt)); + kqemu_tss_fixup(s->kernel_gdt.base); + spin_unlock(&g->lock); +#endif +#endif - - if (s->mon_req == MON_REQ_IRQ) { - struct kqemu_exception_regs *r; + /* load breakpoint registers and avoid setting them if in the + monitor address space. We suppose that no breakpoints are + set by the host OS for this process */ Index: kqemu-kernel.h @@ -48,4 +48,10 @@