From owner-freebsd-mips@FreeBSD.ORG Wed Aug 11 05:51:20 2010 Return-Path: Delivered-To: mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 982D3106566B; Wed, 11 Aug 2010 05:51:20 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 035F98FC14; Wed, 11 Aug 2010 05:51:19 +0000 (UTC) Received: by wyj26 with SMTP id 26so14964274wyj.13 for ; Tue, 10 Aug 2010 22:51:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=CVi/S5j8fVz+PL8TMm7ieBTpG6zK7eitMdWABCLFDUc=; b=ktyvWSOV5r7d2s+7M/Kq/QrCfY7oC74q0dzq9eGOs530EOs5bx9EfWmAyBFFXbbPHt NATmVg31fLkH2jY2lq9HO9Y8G+ksRBiaEY/FllXj0DISnEMO7o2B5/UAYYeNcfBCPDOQ PPZoBMUtM5skUrNB6+wxju4OyFIu1VSo9jS5s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=heMNP2UbdF1ZZdj4Q75M5aiJ4DgPlPiVQZ5kNIBpVpp1YueoWR1yk27nJTk/GMWzmB WKD5qLHI32QAhfBW+XyE8VEQZraLc2jMuq5ElqsWp7pLBKZ8HuurFpN3uRSNb/o20dFx rYA4jDJB9FqJRBvUnDQwXUVtRWNK2LHJJulUc= MIME-Version: 1.0 Received: by 10.216.232.90 with SMTP id m68mr16069778weq.10.1281505878894; Tue, 10 Aug 2010 22:51:18 -0700 (PDT) Received: by 10.216.160.10 with HTTP; Tue, 10 Aug 2010 22:51:18 -0700 (PDT) In-Reply-To: References: <201008041412.o74ECAix092415@svn.freebsd.org> <4C5A569B.9090401@cs.rice.edu> <4C5BA088.7060105@cs.rice.edu> <4C5C3A08.500@cs.rice.edu> Date: Wed, 11 Aug 2010 11:21:18 +0530 Message-ID: From: "Jayachandran C." To: Alan Cox , mips@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "Jayachandran C." Subject: Re: svn commit: r210846 - in head/sys/mips: include mips X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2010 05:51:20 -0000 On Wed, Aug 11, 2010 at 10:36 AM, Jayachandran C. wrote: > On Fri, Aug 6, 2010 at 10:06 PM, Alan Cox wrote: >> The patch looks good. >> >> While we're talking about software dirty bit emulation, I would encourag= e >> you to look at two things: >> >> 1. trap.c contains two copies of the same code for emulation. =A0I would >> encourage you to eliminate this duplication by creating a >> pmap_emulate_modified(). >> >> 2. Software dirty bit emulation is using pmap_update_page() to invalidat= e >> the TLB entry on which the modified bit is being set. =A0On a multiproce= ssor, >> this is going to make dirty bit emulation very costly because every >> processor will be interrupted. =A0In principle, it should be possible an= d >> faster to only flush the TLB entry from the current processor. =A0The ot= her >> processors can handle this lazily. =A0They either do not have that mappi= ng in >> their TLB, in which case interrupting them was wasted effort, or they do >> have it in their TLB and when they fault on it they'll discover the dirt= y >> bit is already set. =A0In fact, the emulation code already handles this = case, >> on account of the fact that two processors could simultaneously write to= the >> same clean page and only one will get the pmap lock first. > > I've made the changes suggested, the changes are attached. > > The first set of changes just re-arranges the pmap calls that use > smp_rendezvous() on SMP, so that their per-cpu variants are also > available to be called. =A0The first patch also has an optimization from > Juli's branch, to call pmap_update_page in pmap_kenter only if the pte > is valid. > > The second patch makes the changes suggested above. My testing shows > no issues so far, but please let me know if you have any comments. The second patch had an error (noted by Neel, thanks!), I unlock kernel_pmap, instead of pmap in a return path. I will fix this before check-in, more comments welcome. Thanks, JC.