• Loongson FPU Bug

    From Florian Lohoff@21:1/5 to All on Fri Feb 3 07:40:01 2023
    Hi,
    does anyone have a document describing the Loongson FPU bug?

    I am currently rebuilding stretch++ for --march=mips2 as all machines i
    did care for (Cobald Cube, Siemens RM200, R4k Decstation) are
    unsupported since jessie. I am building on a Loongson and i get bitten
    by the FPU bug at random occasions.

    Flo
    --
    Florian Lohoff f@zz.de
    Any sufficiently advanced technology is indistinguishable from magic.

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEEdb9o7oebX2papQ/KkN1BIMsJ8i8FAmPcqjsACgkQkN1BIMsJ 8i++BBAAilabGGwciA6jfIxAf0zbOo0Q24UNfp/mJyenA8H951QOpZU65z4H9nsn 37DoD3m8QKUf3/zlTVIVVFwhoxSjqr0qLC+X2qFaBZeFt8NIc9bOZfLKdqOVBD8W ULzta6W4tGQ2qGG69S9wDnanqakYqHxO4BGu4dyFU4SgHLz/kuuD6a4bOITT1bil bwK60eZKTR3PHiKiZOx+c2MrBlZ6XeJybvPN37gaKiUlKPC2jFwuojNn/UF8GomH ZccNt/AdAI2na/QXuptyEWf9/2889qiGGnUMi68UZ/b5EdeOt5LVqoHLJFovKfwz qu5ocD1Wo6IwIa4ue4TmXAWxVhMekVz5nhdF2SvwD1kMmgqT8JCHbS07VA/Aa0/1 RhY4UlVil9uuWHaVavzcFxL8eE5NVDTdiscmaIBDl+zPtV/IgNBgtehNa2SGEPzY AXTLmNyf3QXlYJO+Fx33VA5FgUaEO5//M7k+OzsNGGFDtPQLkpDhVAqUWVYT8VFr Qk/tQywp0p/6nKdweyI/HTg/3Q8CR2nkZ3Y2lam+QoHUUkoyeZTSlCY2+UxNv4ho lUqSYu4S9PI0YBGYhrdGkhsjELk8SYgiOfHNVz82bAGJGOHHsB8rAvqP0vAvNRhm HeKyi77pp0kYTwcsz5ySuL/PIQ+dQ822kcSNRYtOQdfmkC85hTI=
    =EGTg
    -----END PGP SIGNATURE-----

    --- SoupGate-Win3
  • From Aron Xu@21:1/5 to f@zz.de on Tue Feb 7 09:00:01 2023
    Hi,

    On Fri, Feb 3, 2023 at 2:37 PM Florian Lohoff <f@zz.de> wrote:


    Hi,
    does anyone have a document describing the Loongson FPU bug?

    I am currently rebuilding stretch++ for --march=mips2 as all machines i
    did care for (Cobald Cube, Siemens RM200, R4k Decstation) are
    unsupported since jessie. I am building on a Loongson and i get bitten
    by the FPU bug at random occasions.


    I'm not sure which version of Loongson CPU you are using, anyway these
    are several of them:

    1. madd.X/msub.X: they are fused implementations while others are
    non-fused, disabled by default in Debian
    2. EI/DI: only affect privileged mode so that the kernel needs to be
    compiled with mips64r1 (which I believe it is default upstream)
    3. swxc1: would report illegal hardware instruction on some hardware,
    and some octean boards will report SIGBUS
    4. FR0 FPU emulation mode is not architecturally valid, but this does
    not likely affect you since you are not using mips32r1/r2.

    Regards,
    Aron

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Florian Lohoff@21:1/5 to Aron Xu on Tue Feb 7 12:10:01 2023
    Hi Aron,

    On Tue, Feb 07, 2023 at 03:53:27PM +0800, Aron Xu wrote:
    Hi,
    I'm not sure which version of Loongson CPU you are using, anyway these
    are several of them:

    Architecture: mips64
    Byte Order: Little Endian
    CPU(s): 4
    On-line CPU(s) list: 0-3
    Thread(s) per core: 1
    Core(s) per socket: 4
    Socket(s): 1
    NUMA node(s): 1
    Model: ICT Loongson-3 V0.1 FPU V0.1
    BogoMIPS: 3592.19
    L1d cache: 256 KiB
    L1i cache: 256 KiB
    L2 cache: 2 MiB
    NUMA node0 CPU(s): 0-3
    Flags: vz msa loongson-mmi loongson-cam loongson-ext loongson-ext2

    1. madd.X/msub.X: they are fused implementations while others are
    non-fused, disabled by default in Debian
    2. EI/DI: only affect privileged mode so that the kernel needs to be
    compiled with mips64r1 (which I believe it is default upstream)
    3. swxc1: would report illegal hardware instruction on some hardware,
    and some octean boards will report SIGBUS
    4. FR0 FPU emulation mode is not architecturally valid, but this does
    not likely affect you since you are not using mips32r1/r2.

    I have seen the list of "fpu failing packages not for loongson" in the wanna-build codebase and while rebuilding stretch packages i also experienced various fpu based issues. glibc basically fails all idouble and ifloat tests which i disabled.

    Also i see reproducible kernel issues when building "racket". The machine starts dying afterwards slowly and needs a reboot. I tried a 6.1 and its
    even worse - e.g. when reproducing it the machine was unusable pretty fast.

    [215283.122039] BUG: Bad page map in process raco pte:480001a05 pmd:98000001258cc000
    [215283.129621] page:00000000c5d1cb6c refcount:-9669 mapcount:-9670 mapping:0000000000000000 index:0x0 pfn:0x48000
    [215283.139713] flags: 0x1201000000000()
    [215283.143366] raw: 0001201000000000 0000000000000100 0000000000000122 0000000000000000
    [215283.151181] raw: 0000000000000000 0000000000000000 ffffda3bffffda39 0000000000000000
    [215283.158999] page dumped because: bad pte
    [215283.163015] addr:0000000062938000 vm_flags:00100077 anon_vma:98000003a2f25728 mapping:0000000000000000 index:18a4e
    [215283.173432] file:(null) fault:0x0 mmap:0x0 readpage:0x0
    [215283.178734] CPU: 2 PID: 2478154 Comm: raco Tainted: G B E 5.10.0-20-loongson-3 #1 Debian 5.10.158-2
    [215283.188949] Hardware name: Lemote LEMOTE-LS3A4000-7A1000-1w-V0.1-pc/LEMOTE-LS3A4000-7A1000-1w-V01-pc, BIOS Kunlun-A1901-V4.1.4 04/2 0/2020

    So i am digging whether this is something broken in kernel, fpu etc.

    Flo
    --
    Florian Lohoff f@zz.de
    Any sufficiently advanced technology is indistinguishable from magic.

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEEdb9o7oebX2papQ/KkN1BIMsJ8i8FAmPiMOwACgkQkN1BIMsJ 8i8ODQ/+IlRUMajfdqt0+fP/+NwDF64QZQqjHhZJDB+6iAz11Uk/RPea4wXdkMd+ 2w7MGpoLncvI0g0z/zLHLz3cplrS3rSefR+TbXqiTotEu01SCFujsQxU9/UviBXa 5FNfLFvolwaJ0VUVBzKGZjQFxuFhufWrrNIa58KgELZT4U79Nv5dMKrPSznninrb ECYsfa+WbveahiXn3PBxLnx38zvOd1714J6VstpyMF95ztm3Q9KF+bLo6eDSC/H7 xlWD5+pRAkr8FzuZdfJUAD+xDyWsTJa6yABNi4LtEFmkw+NoBMv4b3hNf8FtBXXs cxG36WNGrFPWEOSnBq6RnS4zkrl9ASm4M8z+775kQTqFkwLxuP2X1dspER4avJ3G ZgJk9Wn86ueb+tgliKHK5f44lGmL9SCXTXCF2j1t5TzdWJlForiMV2aJPWPnOJJD 3wg+GJMBQyNjdlATste1YM4XHBElb6U4G+OI/MDq1d1wG4SMB6TZN+lLUbUB7Ntq SJ3vPit5DNN//b8WWfRP3jrveKHTyI8QYSew6Dkc1wY7dW7ibiybleCS/qG9IBpp 1XCHsbs59C8RmkY2K9HgioRe8rLyO/z1SBllHk7369vPFrRPwkd8xAQq3PbDFblv VuOSVjnpARLZbmdkyZ6XzUSbpYqFiA/g29wvFLBBzle9XqutAs4=
    =Z3Fz
    -----END PGP SIGNATURE-----

    --- SoupGate-Win3