From owner-svn-src-all@freebsd.org Sun Nov 13 07:56:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEA27C3F344; Sun, 13 Nov 2016 07:56:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BBE11D4E; Sun, 13 Nov 2016 07:56:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id uAD7tvoN095317 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 13 Nov 2016 09:55:57 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua uAD7tvoN095317 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id uAD7tvgg095316; Sun, 13 Nov 2016 09:55:57 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 13 Nov 2016 09:55:57 +0200 From: Konstantin Belousov To: Warner Losh Cc: Adrian Chadd , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "freebsd-mips@freebsd.org" Subject: Re: svn commit: r307626 - head/sys/ufs/ffs Message-ID: <20161113075557.GH54029@kib.kiev.ua> References: <201610191109.u9JB9TTC002727@repo.freebsd.org> <20161113065851.GD54029@kib.kiev.ua> <20161113071911.GF54029@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 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: Sun, 13 Nov 2016 07:56:03 -0000 On Sun, Nov 13, 2016 at 12:33:57AM -0700, Warner Losh wrote: > On Sun, Nov 13, 2016 at 12:19 AM, Konstantin Belousov > wrote: > > On Sun, Nov 13, 2016 at 12:12:02AM -0700, Warner Losh wrote: > >> On Sat, Nov 12, 2016 at 11:58 PM, Konstantin Belousov > >> wrote: > >> > On Sat, Nov 12, 2016 at 03:19:13PM -0800, Adrian Chadd wrote: > >> >> hi! > >> >> > >> >> This broke freebsd on mips24k. > >> >> > >> >> BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x4002a4 got a read > >> >> fault (type 0x2) at 0 > >> >> Trapframe Register Dump: > >> >> zero: 0 at: 0 v0: 0 v1: 0 > >> >> a0: 0x7fffeecc a1: 0 a2: 0 a3: 0 > >> >> t0: 0 t1: 0 t2: 0 t3: 0 > >> >> t4: 0 t5: 0 t6: 0 t7: 0 > >> >> t8: 0 t9: 0x400260 s0: 0x10 s1: 0x2 > >> >> s2: 0x7fffeed0 s3: 0 s4: 0 s5: 0 > >> >> s6: 0 s7: 0 k0: 0 k1: 0 > >> >> gp: 0x4d55d0 sp: 0x7ffeee90 s8: 0 ra: 0 > >> >> sr: 0xfc13 mullo: 0 mulhi: 0 badvaddr: 0 > >> >> cause: 0x8 pc: 0x4002a4 > >> >> Page table info for pc address 0x4002a4: pde = 0x809be000, pte = 0xa001acda > >> >> Dumping 4 words starting at pc address 0x4002a4: > >> >> 8c420000 14400003 00908021 8f828024 > >> >> Page table info for bad address 0: pde = 0, pte = 0 > >> > MIPS24k has split I/D caches, and both are VIPT, am I right ? > >> > I was not able to find the handling of cache aliasing in mips/pmap.c. > >> > > >> > Still, I am curious whether setting the loader tunable vfs.buf_pager_relbuf > >> > to 1 change anything. > >> > >> MIPS caches are such that creating two virtual mappings to the same > >> physical page will cause corruption. It's simply not allowed, at least > >> for the class of MIPS machines I used to bring up the port originally. > > > > Yes, caches are VIPT on 24k, according to the "MIPS32(R) 24K(R) > > Processor Core Family Software User's Manual " rev 3.11. My question is, > > how is that handled in the mips pmap.c. I was not able to locate > > the alias detection and prevention code, or e.g. switching to uncached mode > > for the page when aliasing is detected, after browsing pmap. > > Aliases are not permitted. IIRC, there's no code that detects this > condition. One must simply never ever have multiple cached mappings of > a page at once. A quick glance at the code doesn't locate anything. Then, the obvious next question is what does prevent such aliased mappings ? Not only usermode might establish such situation by double-mapping, but also e.g. our coherent buffer/page cache maps page into KVA and the same page might be mapped into usermode. The later situation is my current thought about possible cause of the reported init(8) fault. > > > Does FreeBSD/mips run with the caches enabled ? > > Yes. The implementation is easier w/o caches enabled, but the > performance sucks too bad to even contemplate it except for debugging. > > Warner