From owner-freebsd-mips@FreeBSD.ORG Wed Aug 15 22:21:35 2012 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 A696E106566B for ; Wed, 15 Aug 2012 22:21:35 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 37CDE8FC0A for ; Wed, 15 Aug 2012 22:21:34 +0000 (UTC) Received: by weyx56 with SMTP id x56so1648665wey.13 for ; Wed, 15 Aug 2012 15:21:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=fH1wP5LGM5HWizeiv4s2W3oqcw9zUBwY0HKVvp4ctnk=; b=qY9xNZcuxpa2AKKgM9sCeB0eEbfBZRR6gMvU6q9YbeCPo06fdUF5FexJ96BKOt2gLF +5Sj4/nU2q/BF1VWuhYULUVFt8X2frLYBWy/hcklNT8VcsGrOsUWF8SsQXLEZSmE07LS n2g3neZqQqVSrZXvMkd2IsZK+oQqbrzmURZ6JZtLch5ncxpIik/xKGr1Uxt7dU5/i4ue AwRYLgPVZgfH4zHWgmRSy547XIiQEMLH0MIzCHybFw5pN3X0fjz/ycy0MZwC88+EpFZv Q7IkJmOs3zI8abisMyvTzcBH2WykGTN2gua2bfr0i0SNFPyQrnBwX3vWVt4NBkZVy8Ro hSdA== MIME-Version: 1.0 Received: by 10.216.123.130 with SMTP id v2mr11122506weh.117.1345069294090; Wed, 15 Aug 2012 15:21:34 -0700 (PDT) Received: by 10.216.115.3 with HTTP; Wed, 15 Aug 2012 15:21:34 -0700 (PDT) In-Reply-To: <5029635A.4050209@rice.edu> References: <50228F5C.1000408@rice.edu> <50269AD4.9050804@rice.edu> <5029635A.4050209@rice.edu> Date: Thu, 16 Aug 2012 03:51:34 +0530 Message-ID: From: "Jayachandran C." To: Alan Cox Content-Type: text/plain; charset=ISO-8859-1 Cc: mips@freebsd.org Subject: Re: mips pmap patch 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, 15 Aug 2012 22:21:35 -0000 On Tue, Aug 14, 2012 at 1:58 AM, Alan Cox wrote: > On 08/13/2012 11:37, Jayachandran C. wrote: >> >> On Sat, Aug 11, 2012 at 11:18 PM, Alan Cox wrote: >>> >>> On 08/09/2012 10:36, Jayachandran C. wrote: >>> >>> On Wed, Aug 8, 2012 at 9:40 PM, Alan Cox wrote: >>>> >>>> Can someone please test this patch? It applies some changes to the mips >>>> pmap that were made a long time ago to the amd64 and i386 pmaps. In >>>> particular, it reduces the size of a pv entry. >>>> >>>> Briefly, the big picture is that in order to move forward with further >>>> locking refinements to the VM system's machine-independent layer, I need to >>>> eliminate all uses of the page queues lock from every pmap. In order to >>>> remove the page queues lock from the mips pmap, I need to port the new pv >>>> entry allocator from the amd64 and i386 pmaps. This patch is preparation >>>> for that. >>> >>> >>> Tested the patch on XLP for about an hour ('make -j 64 buildworld' on 32 >>> cpu mips64) and did not see any issues. >>> >>> >>> Thank you for the quick response. I am attaching the next patch for >>> testing. >>> >>> This patch does two things: >>> >>> 1. It ports the new PV entry allocator from x86. This new allocator has >>> two virtues. First, it doesn't use the page queues lock. Second, it >>> shrinks the size of a PV entry by almost half. >>> >>> 2. I observed and fixed a rather serious bug in pmap_remove_write(). >>> After removing write access from the physical page's first mapping, >>> pmap_remove_write() then used the wrong "next" pointer. So, the page's >>> second, third, etc. mapping would not be write protected. Instead, some >>> arbitrary mapping for a completely different page would be write protected, >>> likely leading to spurious page faults later to reestablish write access to >>> that mapping. >>> >>> This patch needs testing in both 32 bit and 64 bit kernels. >> >> Ran the compile test on 32 and 64 bit kernels, and did not see any issue. >> >> I could not test for more than an hour on 32-bit due to another >> problem (freelist 1 containing direct-mapped pages runs out of pages >> after about an hour of compile test). This issue has been there for a >> long time, I am planning to look at it when I get a chance. >> > > What exactly happens? panic? deadlock? The build slows down to a crawl and hangs when it runs out of pages in the freelist. > I'm attaching the next patch. This one replaces the page queues lock with a > new lock that is private to the pmap. Tested this with the same setup and I don't see any issues. > After this patch gets committed, I will likely prepare a patch correcting > the behavior of pmap_clear_modify(). It is not only clearing the modified > bit/flag, but also doing two things that it shouldn't: calling > vm_page_dirty() and I believe write protecting the page (which will trigger > unnecessary soft faults). Let me know if you need any specific tests to be done on these patches. JC.