Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Nov 2016 01:13:24 -0700
From:      Warner Losh <wlosh@bsdimp.com>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Warner Losh <imp@bsdimp.com>, Adrian Chadd <adrian.chadd@gmail.com>, "freebsd-mips@freebsd.org" <freebsd-mips@freebsd.org>, Juli Mallett <jmallett@freebsd.org>
Subject:   Re: svn commit: r307626 - head/sys/ufs/ffs
Message-ID:  <71C512CD-0FB6-40D8-B46C-30467A245693@bsdimp.com>
In-Reply-To: <20161113075557.GH54029@kib.kiev.ua>
References:  <201610191109.u9JB9TTC002727@repo.freebsd.org> <CAJ-Vmom5rYe89m7bch4qoHHq3X2e67pPk_7G2aRGrjSPNp5mzg@mail.gmail.com> <20161113065851.GD54029@kib.kiev.ua> <CANCZdfreg9wD-2pdGtzgeO86BptSE4M7LnLFTC09K3RHyHR8cQ@mail.gmail.com> <20161113071911.GF54029@kib.kiev.ua> <CANCZdfpC6smeNSPKzpbX8aAnF8CZ%2BSEFQmQ74jqvWUVXrttM%2BQ@mail.gmail.com> <20161113075557.GH54029@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_070B6E65-8DF8-45E7-A09D-18C3A65DACF0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

[[ Moved to freebsd-mips and cc=E2=80=99d to Juli ]]

> On Nov 13, 2016, at 12:55 AM, Konstantin Belousov =
<kostikbel@gmail.com> wrote:
>=20
> On Sun, Nov 13, 2016 at 12:33:57AM -0700, Warner Losh wrote:
>> On Sun, Nov 13, 2016 at 12:19 AM, Konstantin Belousov
>> <kostikbel@gmail.com> 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
>>>> <kostikbel@gmail.com> wrote:
>>>>> On Sat, Nov 12, 2016 at 03:19:13PM -0800, Adrian Chadd wrote:
>>>>>> hi!
>>>>>>=20
>>>>>> This broke freebsd on mips24k.
>>>>>>=20
>>>>>> 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 =3D 0x809be000, pte =
=3D 0xa001acda
>>>>>> Dumping 4 words starting at pc address 0x4002a4:
>>>>>> 8c420000 14400003 00908021 8f828024
>>>>>> Page table info for bad address 0: pde =3D 0, pte =3D 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.
>>>>>=20
>>>>> Still, I am curious whether setting the loader tunable =
vfs.buf_pager_relbuf
>>>>> to 1 change anything.
>>>>=20
>>>> 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.
>>>=20
>>> 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.
>>=20
>> 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.

That=E2=80=99s a very good question. Unfortunately my memory here fails =
me. I have a recollection that the various cache flushing that we do in =
the map ensures that we don=E2=80=99t hit a problem. However, I =
couldn=E2=80=99t construct a coherent answer to where this takes place =
after a brief look at the code. Multiple mappings will cause data =
corruption though. I wouldn=E2=80=99t have thought it causes the fault =
in question, but MIPS errors can manifest in strange ways, so perhaps =
you are correct. I don=E2=80=99t get how the fault address is 0 though =
from that scenario. Maybe Adrian can recall. Or Juli can help.

Warner

--Apple-Mail=_070B6E65-8DF8-45E7-A09D-18C3A65DACF0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJYKCClAAoJEGwc0Sh9sBEAIOsQAKWRViXd09yNuv77TI9EKmZi
dqnuwrLBy8iuqQMvUQVvmEs/miOBarVZt/4HdrAaij3ruvDwK9XqbRZc8zs2UGI6
Ep5dAzuAXZr7hMJXFSr+5zlCdNaPui85AYCbOqcEEuZ34NNRrE4b3hPUsBd9dcMR
ZCDu2wVlWhpZtsCJNohF/4SohU8W2qo7ZCSlpckR04yNsaQX+sxkwRopRGFSs101
wUihLKTto4Kj7Bhvpv8Up79AyIC9HelpZBPhTKOgq777YGrPlJdr1p7yKPfFogKh
H+oVbKn+6mPcAYJ0845yz9x2l34WDgxzAKGoDacpPo5+n2W/oFx7uiifHx0j20Ak
YYKSDcn/+MjgTGEargqSWxrFORJYhIDVromlMVBq81ENxLbT71xS6NUVczh/EJrr
vv3RxBWbk2q05fzCaWzJVc/9f70JXfgwbWMhsn0Bv/NhC3SDrcd2teCTHBZAfCIn
j1GlHpmA6pknwVK1lm9NBjeAhpG29jsttizr7C9TiRwOH3aNIBG27/KExSwHDGhz
QYht1kp8yYdu6djsTbI+7mTEEWV5fv7qWw6NBHO0sM/GH3GstNNaP4Gw74XHq7Zi
pp4tMFi/qacOSazYa+03E8B7Pi5K2vUt7c76kjTYzp3AQnsOglVUzE97LkRNDvIr
VVtGxz3BG0UyepWmZoNr
=fUMb
-----END PGP SIGNATURE-----

--Apple-Mail=_070B6E65-8DF8-45E7-A09D-18C3A65DACF0--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?71C512CD-0FB6-40D8-B46C-30467A245693>