From owner-freebsd-mips@FreeBSD.ORG Thu Jul 1 20:04:41 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 4191E106566C; Thu, 1 Jul 2010 20:04:41 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id A79E68FC12; Thu, 1 Jul 2010 20:04:40 +0000 (UTC) Received: by vws6 with SMTP id 6so2056383vws.13 for ; Thu, 01 Jul 2010 13:04:36 -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; bh=s+abTpwD3ty1U83h7KwpUTmHAQ8CvTjT0UHEgiIxrGw=; b=aLcZFF4QLMcVnS+06zOndTTWBhoxtgPq8WT1tQRt/MC9nj7An5dFZzA/YjfbNLml2Q w3+KchpKtPlvH77c29RC4F4IiV0QhS21qUuwJldKJd3+lz/RWEOb9YCwAL3h7u8+j8Cq FzcRhUcL40j3gc6GzOtdcl255dT/CsQF5GQIc= 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; b=rGly4LDzuHqD04/NjisEvBn7nkCqrai4hSun+mT0rIo7A1r1Z2ck6neKqVTrsIz3lm lVmNO6C3YjJ5XFERp0LCJGefkBkPW1OFIK9i2jVTlaHTRMfTmdpEjraSJCM0yU8kWWqO BCtFqVMLRDwXfmIoiKHuxkksS4mCxBQAz53/U= MIME-Version: 1.0 Received: by 10.220.93.17 with SMTP id t17mr5961615vcm.123.1278014675500; Thu, 01 Jul 2010 13:04:35 -0700 (PDT) Received: by 10.220.194.4 with HTTP; Thu, 1 Jul 2010 13:04:35 -0700 (PDT) In-Reply-To: References: <897604F6-95C4-49A8-B11F-277A74C8DBAE@gmail.com> <3C0AEF9B-AE0C-4459-A4E1-2C8C30C10FD6@gmail.com> <25B9A19D-0A6B-4731-8FB1-A2C6722F0E9C@gmail.com> <7886D15B-79BF-4BC6-8467-26A8D0FE3D00@gmail.com> Date: Fri, 2 Jul 2010 01:34:35 +0530 Message-ID: From: "Jayachandran C." To: Luiz Otavio O Souza Content-Type: multipart/mixed; boundary=001636284f88c03fce048a58fab6 Cc: freebsd-mips@freebsd.org Subject: Re: Merging 64 bit changes to -HEAD 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: Thu, 01 Jul 2010 20:04:41 -0000 --001636284f88c03fce048a58fab6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Fri, Jul 2, 2010 at 12:17 AM, Jayachandran C. wrote: > On Thu, Jul 1, 2010 at 10:25 PM, Luiz Otavio O Souza = wrote: >> On Jun 30, 2010, at 7:40 PM, Jayachandran C. wrote: >>> On Wed, Jun 30, 2010 at 10:38 PM, Luiz Otavio O Souza >>> wrote: >>>> On Jun 30, 2010, at 9:57 AM, Jayachandran C. wrote: >>>> >>>>> On Tue, Jun 29, 2010 at 10:32 PM, Luiz Otavio O Souza >>>>> wrote: >>>>>> >>>>>> On Jun 29, 2010, at 8:02 AM, Jayachandran C. wrote: >>>>>> >>>>>>> On Tue, Jun 29, 2010 at 2:28 AM, Luiz Otavio O Souza wrote: >>>>>>>>> Thanks for the the update. Looks like pmap_map for kernel is fail= ing, >>>>>>>>> may be the new tlb_update code causes this. =A0Can you apply the >>>>>>>>> attached patch and see if the problem still persists, it replaces= the >>>>>>>>> new tlb_update code with the older version. >>>>>>>>> >>>>>>>>> Obviously not a fix, but if we can narrow it down to this functio= n, >>>>>>>>> fixing will be easier. >>>>>>>>> >>>>>>>>> JC. >>>>>>>>> >>>>>>>> >>>>>>>> JC, >>>>>>>> >>>>>>>> This fix the problem ! Thanks ! Now, at least, you know where to l= ook :) >>>>>>> >>>>>>> The new tlb_update does not seem to update the tlb entry if the tlb= p >>>>>>> fails. =A0Here's a patch that should make the new function behave l= ike >>>>>>> the older one. =A0The patch is in attached file 'tlb-update.diff'. >>>>>>> >>>>>>> If that does not work, I'm not sure what the issue is. =A0You could= also >>>>>>> try try the nop-change.diff attached. It tries to switch the ssnop >>>>>>> used for delay in the new code with 'nop' which was used by the old >>>>>>> code. >>>>>>> >>>>>>> Thanks, >>>>>>> JC. >>>>>>> >>>>>> >>>>>> JC, >>>>>> >>>>>> The nop-change seems to have no effect at all and with the tlb-updat= e patch the kernel apparently crash at bzero(), here is the dmesg with TRAP= _DEBUG enabled: >>>>>> >>>>>> http://mips.pastebin.com/jydPvJ20 >>>>>> >>>>>> So hopefully you are on the right track and this may be something ob= vious to you. >>>>> >>>>> Not yet :) I really hoped the earlier change would fix it. =A0The num= ber >>>>> of nop does not seem to be the issue as it is higher in the C code >>>>> than the assembly. >>>>> >>>>> Can you try the attached patch (try.diff) - this re-implements the >>>>> assembly code functionality almost in the same way in C. =A0This real= ly >>>>> should work, given that the patch which made it assembly worked... >>>>> >>>>> If that works can you see if the second attached patch works, this >>>>> fixes a potential problem (ie, we should be masking 13bits for TLBHI)= . >>>>> >>>>> Both patches should apply directly to SVN (not dependent on each >>>>> other, or on previous patches) >>>>> >>>>> Thanks again, >>>>> JC. >>>>> >>>> >>>> >>>> JC, >>>> >>>> The try.diff works with or without the pte.h change (at least for a si= mple boot) and the pte.h change does nothing without the try.diff. >>> >>> I've attached the final(final.diff) version I want to check-in, can >>> you please quickly test it? >>> >>> If that does not work, can you tell me if the attached alt1.diff or >>> alt2.diff works? The try.diff had three changes: handle case of >>> index>0, remove pagemask operation, restore full entryhi instead of >>> asid. So if the first does not work, this will help narrow down the >>> rest of the cases. >>> >>> Hopefully this is the last iteration :) >>> >>> JC. >>> >> >> >> JC, >> >> The final.diff and alt1.diff crash (into debugger) like the first try.di= ff (here is the dmesg: http://pastebin.com/r2uunZPZ). >> >> The alt2.diff works, i'll try it a little more (buildworld). >> >> Feel free to send more tests if needed. > > Looks like I was on the wrong track, it now looks like the pagemask > maybe the cause. =A0My suspicion is that the bootloader setups a > pagemask and we never clear it because all the operations save and > restore the mask. As far as I can see the TLB exception handler will > not update pagemask. > > Juli - any comments on this? Do you need to save/restore pagemask for > some reason, otherwise I will take out the part from tlb.c. =A0Will send > out a patch a bit later. Okay - here's hopefully the final patch. Let me know if it boots up. Thanks, JC. --001636284f88c03fce048a58fab6 Content-Type: application/octet-stream; name="tlb.c-pagemask-remove.diff" Content-Disposition: attachment; filename="tlb.c-pagemask-remove.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gb40w8q40 SW5kZXg6IHN5cy9taXBzL2luY2x1ZGUvcHRlLmgKPT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gc3lzL21pcHMvaW5j bHVkZS9wdGUuaAkocmV2aXNpb24gMjA5NjM1KQorKysgc3lzL21pcHMvaW5jbHVkZS9wdGUuaAko d29ya2luZyBjb3B5KQpAQCAtNzMsNyArNzMsOCBAQAogICogTm90ZSB0aGF0IGluIEZyZWVCU0Qs IHdlIG1hcCAyIFRMQiBwYWdlcyBpcyBlcXVhbCB0byAxIFZNIHBhZ2UuCiAgKi8KICNkZWZpbmUJ VExCSElfQVNJRF9NQVNLCQkoMHhmZikKLSNkZWZpbmUJVExCSElfRU5UUlkodmEsIGFzaWQpCSgo KHZhKSAmIH5QQUdFX01BU0spIHwgKChhc2lkKSAmIFRMQkhJX0FTSURfTUFTSykpCisjZGVmaW5l CVRMQkhJX1BBR0VfTUFTSwkJKDIgKiBQQUdFX1NJWkUgLSAxKQorI2RlZmluZQlUTEJISV9FTlRS WSh2YSwgYXNpZCkJKCgodmEpICYgflRMQkh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