From owner-freebsd-mips@FreeBSD.ORG Tue Aug 3 19:44:45 2010 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A55B1065673; Tue, 3 Aug 2010 19:44:45 +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 8306E8FC0C; Tue, 3 Aug 2010 19:44:44 +0000 (UTC) Received: by wyj26 with SMTP id 26so5836140wyj.13 for ; Tue, 03 Aug 2010 12:44:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:cc:content-type; bh=riJG7Qf9fXjkMkUPVe8oWOIyPv9wZbbJFOngbxFqbBY=; b=AklVrb8ZqPQDw9Vltm4a7ofq8l5bmfTRstBAbo/mBmACrWmvpItRUfVmQXma8sRGk4 tgYmya4SJ8rgccsjNEFWjrMpnevVG1WLmUnoZTgsvkPZeKvWD+UharBdcwxwXEgdh13q oQo12xRNf2eKBYZwRp4YkEHn74WL+U/o3bHI0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=pXt80jNTI8BDxM+rkrzM6FxRMY+oiFlvAsPZQQBoq3I6IrCtmJOYgtB2c0vDp92vY4 2OH/4wzWjQOqp3CUmYc+UKp634O6E5dOCkn+h9tNM2xBnVNvSYrNqeylcm8EAxVE9ar8 i7RMvMpdRerbO/rkx08Pbc9N3lqxe0lvnuSIU= MIME-Version: 1.0 Received: by 10.227.132.199 with SMTP id c7mr6782166wbt.89.1280864683231; Tue, 03 Aug 2010 12:44:43 -0700 (PDT) Received: by 10.216.160.10 with HTTP; Tue, 3 Aug 2010 12:44:42 -0700 (PDT) Date: Wed, 4 Aug 2010 01:14:42 +0530 Message-ID: From: "Jayachandran C." To: Juli Mallett , "M. Warner Losh" , freebsd-mips@freebsd.org Content-Type: multipart/mixed; boundary=001485f6c88a730961048cf08cb7 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Merged pmap.c - Re: Support for 64bit userspace. 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: Tue, 03 Aug 2010 19:44:45 -0000 --001485f6c88a730961048cf08cb7 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Sat, Jul 31, 2010 at 5:17 AM, Jayachandran C. wrote: > On Fri, Jul 30, 2010 at 2:07 PM, Juli Mallett wrote= : > >> On Fri, Jul 30, 2010 at 01:15, Jayachandran C. >> wrote: >> > I will look at merging them without too many ifdefs. Another >> > possibility is to have a pmap.c, pmap32.c and pmap64.c, so that the >> > common code is not duplicated, but that too (as far as I can see) will >> > require a config option. >> >> I'm not really sure what the aversion to ifdefs is =97 they kind of come >> with the territory and this is exactly the part of the system where >> you expect to have them to conditionalize exactly this kind of >> behavior. If you were going to split out some subroutines for 32-bit >> and 64-bit, there are two ways you can do it without a config option >> (and I agree with you that avoiding one is very desirable =97 we already >> use too many knobs to get the right ABI in kernel configs). You could >> do: >> >> #ifndef __mips_n64 >> #include "pmap32.c" >> #else >> #include "pmap64.c" >> #endif >> >> Or you could wrap the whole 32/64 files (modulo a "struct __hack;" or >> whatever to avoid an empty translation unit) with ifdefs. >> >> Personally, I find having two implementations of a function a lot >> harder to read and keep track of than a single implementation with >> ifdefs in the body =97 there's very few places in the kernel where we do >> the former. If you do split out functions into separate files I would >> beg you to only split out the really big functions that are actually >> doing things based on different levels of page tables and then it's >> obvious why those things have two implementations and what needs to be >> abstracted to merge them. Having two copies of trivial functions or >> non-trivial functions that are mostly identical is a bad thing. >> >> You're doing the work, so at some point it's kind of your call, but I >> feel like you're making style changes to things that I cleaned up and >> tried to unify in pmap.c and that the way that they're done is pretty >> significant given how intimidating people find pmap. If we were going >> to support different kinds of MMUs (e.g. adding support for BAT-based >> MMUs) I'd be in favor of splitting things up, but then I'd want to >> follow PowerPC's lead. For now I think the appropriate thing to do is >> to follow the lead of my 64-bit work in the MIPS pmap and the PAE work >> in the i386 pmap and to use ifdefs and to try to abstract out the >> page-table differences. >> > > I had not looked at merging the files so far (mostly because it was easie= r > to do it this way), so I will see how best this can be done. > > I'm really thrilled with the work you're doing and can't wait for it >> to be in head =97 I'm quite eager to move everything on Octeon to n64 :) >> > > I have checked in everything except the page table implementation code. > > If you like to try the current code, the attached patch has the rest of t= he > changes. This has a few more issues fixed, n64 mostly works for me, exce= pt > a csh crash I'm looking at. > > I'll have a look at merging pmap.c with pmap64.c, and have another look a= t > the PAE. > Here's is the merged version of n64 changes. I had to change the existing pmap.c style a bit, so that merging the 32 bit and 64 bit versions was easier. On the n64 compilation, I have done a few more fixes, and the current code comes up multi-user and holds up pretty well on XLR. I'm doing some stress testing on o32 to see that I have not broken anything there during the changes. Let me know your comments. Also note that PTEs are still 32 bit and KSEG0 addresses are still used for page table pages, but these can be added... Thanks, JC. --001485f6c88a730961048cf08cb7 Content-Type: application/octet-stream; name="mips-3lvl-pt.patch" Content-Disposition: attachment; filename="mips-3lvl-pt.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gcf5mpts1 SW5kZXg6IHN5cy9taXBzL2luY2x1ZGUvcGFyYW0uaAo9PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBzeXMvbWlwcy9p bmNsdWRlL3BhcmFtLmgJKHJldmlzaW9uIDIxMDc5NikKKysrIHN5cy9taXBzL2luY2x1ZGUvcGFy YW0uaAkod29ya2luZyBjb3B5KQpAQCAtMTA3LDggKzEwNywxOCBAQAogI2RlZmluZQlOUFRFUE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JazEsIDAoazEp CQkJIyBrMT1wZGUgZW50cnkKKwlNRkMwCQlrMCwgTUlQU19DT1BfMF9CQURfVkFERFIJIyBrMD1i YWQgYWRkcmVzcyAoYWdhaW4pCisgIAliZXEJCWsxLCB6ZXJvLCBNaXBzS2VybkdlbkV4Y2VwdGlv bgkjID09MCAtLSBubyBwYWdlIHRhYmxlCisjZW5kaWYKIAlQVFJfU1JMCQlrMCwgUEFHRV9TSElG VCAtIDIJCSMgazA9VlBOCiAJYW5kaQkJazAsIGswLCAweGZmOAkJCSMgazA9cGFnZSB0YWIgb2Zm c2V0CiAJUFRSX0FERFUJazEsIGsxLCBrMAkJCSMgazE9cHRlIGFkZHJlc3MKSW5kZXg6IHN5cy9t aXBzL21pcHMvZ2VuYXNzeW0uYwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBzeXMvbWlwcy9taXBzL2dlbmFzc3lt LmMJKHJldmlzaW9uIDIxMDc5NikKKysrIHN5cy9taXBzL21pcHMvZ2VuYXNzeW0uYwkod29ya2lu ZyBjb3B5KQpAQCAtOTMsNiArOTMsNyBAQAogQVNTWU0oUEFHRV9TSElGVCwgUEFHRV9TSElGVCk7 CiBBU1NZTShQQUdFX1NJWkUsIFBBR0VfU0laRSk7CiBBU1NZTShQQUdFX01BU0ssIFBBR0VfTUFT Syk7CitBU1NZTShQRFJTSElGVCwgUERSU0hJRlQpOwogQVNTWU0oU0VHU0hJRlQsIFNFR1NISUZU KTsKIEFTU1lNKE5QVEVQRywgTlBURVBHKTsKIEFTU1lNKFRERl9ORUVEUkVTQ0hFRCwgVERGX05F RURSRVNDSEVEKTsKSW5kZXg6IHN5cy9taXBzL21pcHMvcG1hcC5jCj09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIHN5 cy9taXBzL21pcHMvcG1hcC5jCShyZXZpc2l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