From owner-svn-src-all@FreeBSD.ORG Tue Jan 4 13:27:28 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A372106566B; Tue, 4 Jan 2011 13:27:28 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 49FC88FC0C; Tue, 4 Jan 2011 13:27:28 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id D141F46B03; Tue, 4 Jan 2011 08:27:27 -0500 (EST) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C41D98A009; Tue, 4 Jan 2011 08:27:26 -0500 (EST) From: John Baldwin To: Colin Percival Date: Tue, 4 Jan 2011 08:00:44 -0500 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20101102; KDE/4.4.5; amd64; ; ) References: <201101040016.p040GcNf010998@svn.freebsd.org> In-Reply-To: <201101040016.p040GcNf010998@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201101040800.45155.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 04 Jan 2011 08:27:26 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r216944 - head/sys/i386/xen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jan 2011 13:27:28 -0000 On Monday, January 03, 2011 7:16:38 pm Colin Percival wrote: > Author: cperciva > Date: Tue Jan 4 00:16:38 2011 > New Revision: 216944 > URL: http://svn.freebsd.org/changeset/base/216944 > > Log: > Adjust the critical section protecting _xen_flush_queue to cover the > entire range where the page mapping request queue needs to be atomically > examined and modified. > > Oddly, while this doesn't seem to affect the overall rate of panics > (running 'make index' on EC2 t1.micro instances, there are 0.6 +/- 0.1 > panics per hour, both before and after this change), it eliminates > vm_fault from panic backtraces, leaving only backtraces going through > vmspace_fork. > > Modified: > head/sys/i386/xen/xen_machdep.c > > Modified: head/sys/i386/xen/xen_machdep.c > ============================================================================== > --- head/sys/i386/xen/xen_machdep.c Tue Jan 4 00:11:09 2011 (r216943) > +++ head/sys/i386/xen/xen_machdep.c Tue Jan 4 00:16:38 2011 (r216944) > @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > #include > > @@ -249,10 +250,13 @@ _xen_flush_queue(void) > SET_VCPU(); > int _xpq_idx = XPQ_IDX; > int error, i; > - /* window of vulnerability here? */ > > +#ifdef INVARIANTS > if (__predict_true(gdtset)) > - critical_enter(); > + KASSERT(curthread->td_critnest > 0, > + ("xen queue flush should be in a critical section")); > +#endif > + You can use CRITICAL_ASSERT(curthread) instead perhaps. > XPQ_IDX = 0; > /* Make sure index is cleared first to avoid double updates. */ > error = HYPERVISOR_mmu_update((mmu_update_t *)&XPQ_QUEUE, > @@ -286,8 +290,6 @@ _xen_flush_queue(void) > } > } > #endif > - if (__predict_true(gdtset)) > - critical_exit(); > if (__predict_false(error < 0)) { > for (i = 0; i < _xpq_idx; i++) > printf("val: %llx ptr: %llx\n", > @@ -301,7 +303,12 @@ void > xen_flush_queue(void) > { > SET_VCPU(); > + > + if (__predict_true(gdtset)) > + critical_enter(); > if (XPQ_IDX != 0) _xen_flush_queue(); > + if (__predict_true(gdtset)) > + critical_exit(); > } > > static __inline void > -- John Baldwin