From owner-freebsd-ppc@freebsd.org Sat Apr 20 03:19:54 2019 Return-Path: Delivered-To: freebsd-ppc@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 517431581648 for ; Sat, 20 Apr 2019 03:19:54 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic310-22.consmr.mail.gq1.yahoo.com (sonic310-22.consmr.mail.gq1.yahoo.com [98.137.69.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2C788036A for ; Sat, 20 Apr 2019 03:19:52 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: FDdSWLcVM1loSVb7IzXCifL_WxIU.W5tMaxT6T3Jg2BfRIs2Yv3YBxlTJVMsbUH lgiAfGQIfHw.1r8wvERdFFMk_VqIvt0iQShB.LzZPIGpKYQ3bL7CkZP25IE8RH4QwfDwF9KhVVLt 5vnNntTz3S1tovvr9A7PzoMYLFbvhStYReY_RKw9PVdNLK_1ARDSV3.zF_DyHIZO.MF1NKtT10DK JinhbAcdeZELOW8qRtVmPh.wrDIW1wQQXaHteSdnEhLeyPofDpv2PONKpshcWLDrlvF7C.lauT.7 LQduvGgde7aEMo54P5.8V4srbtpqdPI4pPmesXT_V6zpZgD4Gi9apADSWiQCdKRNHS9JfgaZJ4xI uKPa2n3vpTeBxSBpyHbgVd0qQxmAn99kMHSVrLmNDstWw2PfEtt.hHUQdQ4fH0WVFm5FYRuHpZxg IGhRUu774XNSgkg.sPJ3YQUw6BWydrmgZjgbDa9ZjbyaoaXJSjUwyJSnq1AAlg6i4Z_MI4L2x_RZ PmLT6mGMdwpCykU8MlfX9KaLV1.I88tMJzTy3SkuenH8IdQu.F5r.FP9MOLsHFYkf8Kf3L0ujcY0 leRVGInbrlSXwu7smA7Dlrnb8ND4z8kVXExq4xdq47EhuD.ZBPGhTSk8sjU3wKqNqvS9soIHWKry ZtyNlUCNbaWF5CIF32BWIqsdOdCRg4Tv9XonNy54akbARN5_Nc48VzEGu2oNbCmFta2o7OMlL7uh 8XKv2T2wWUXbOwIKMqlTfIcRG3Ps_QG8pMJ.mFRDVPyoR6Qhx8SOpGUB6Aaq8YXMjYbMKj3k8vjd L8Xnq8rt.dDLC.pBQW2kls8q48Bd.J_M5VVjS82m7TnLD8qCVEb0WxA020j6VbtgQJRJdChJMiBm GHgFYOJEPIweJS1eCwX2lxtz34.i.QaWUC7MGGcmtl.u9W.kIfdCDQcacX5VImQfrbO1Oa5yeof9 21ZlmGc6HtZXAnm_5WhVs7K3lu_P2OqjZNtq19WEsJXI9M5mUi_pFfWebeFJPfAPKBXRNXvKjymU .6p5Y0s1EnE6.1vTCbK6bkZb65KMUF73b5WyrQprykdhLOI_PQJpH23Czi_BRecc4QluZ.oAGD1z KxuRIJD6j8HbspvGljJtDrmWW376d Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.gq1.yahoo.com with HTTP; Sat, 20 Apr 2019 03:19:46 +0000 Received: from c-76-115-7-162.hsd1.or.comcast.net (EHLO [192.168.1.103]) ([76.115.7.162]) by smtp409.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 34a08568e063d8e914dda18eeadadc54; Sat, 20 Apr 2019 03:09:35 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: Re: Patches to allow usefdt mode that works on a 2 socket PowerMac3, 6 example too --and makes more work on 2-socket/1-core-each PowerMac11, 2 From: Mark Millard In-Reply-To: <1B999D64-036F-4553-B024-93D0150FD60D@yahoo.com> Date: Fri, 19 Apr 2019 20:09:35 -0700 Cc: freebsd-ppc@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <433A1839-8232-4785-91AD-1EF5EAF31294@yahoo.com> References: <988F644F-D5E7-4FB4-AAB3-A72E9DA88CE6@yahoo.com> <465DBF40-EEF5-4D4A-95F6-DF17EB5B130B@yahoo.com> <5aecd21e-e53c-f14c-0bdc-8732fa88fed6@blastwave.org> <55E83F50-197D-43C7-B4D6-E69A5AEC2630@yahoo.com> <1B999D64-036F-4553-B024-93D0150FD60D@yahoo.com> To: Dennis Clarke X-Mailer: Apple Mail (2.3445.104.8) X-Rspamd-Queue-Id: C2C788036A X-Spamd-Bar: - X-Spamd-Result: default: False [-1.41 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; MV_CASE(0.50)[]; FREEMAIL_FROM(0.00)[yahoo.com]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[yahoo.com:+]; MX_GOOD(-0.01)[cached: mta6.am0.yahoodns.net]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.81)[-0.811,0]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.49)[0.489,0]; NEURAL_HAM_LONG(-0.97)[-0.975,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.40)[ip: (0.38), ipnet: 98.137.64.0/21(0.92), asn: 36647(0.74), country: US(-0.06)]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[148.69.137.98.list.dnswl.org : 127.0.5.0] X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2019 03:19:54 -0000 [I have added an investigatory patch that so far has stopped the stuck-sleeping problem.] On 2019-Apr-15, at 00:06, Mark Millard wrote: > On 2019-Apr-13, at 11:39, Mark Millard wrote: >=20 >> [My adjustment to fdt_add_subnode_namelen was inept.] >>=20 >> On 2019-Apr-12, at 16:17, Mark Millard wrote: >>=20 >>> On 2019-Apr-12, at 14:20, Dennis Clarke = wrote: >>>=20 >>>> On 4/12/19 4:51 PM, Mark Millard wrote: >>>>> On 2019-Apr-12, at 13:13, Dennis Clarke = wrote: >>>>>> On 4/12/19 3:19 PM, Mark Millard via freebsd-ppc wrote: >>>> . >>>> . >>>> . >>>>>>=20 >>>>>> Would you be so kind as to paste all this into : >>>>>>=20 >>>>>> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D233863 >>>>>>=20 >>>>>> Really I would like to run some tests and follow up in the bug = reports. >>>>> Okay I'll paste them in as attachments. But be warned: >>>>=20 >>>> Fair warning received loud and clear :-) >>>>=20 >>>>> The 2 files do not deal with threads being stuck sleeping >>>>> (and, so, the fans going) or other such. The stuck-sleeping >>>>> problem happens for both multi-socket G5's and multi-socket >>>>> G4's. (I do not have access to single-socket multi-core >>>>> powerpc64 or powerpc machines to test.) >>>>=20 >>>> I have multiple G5 type boxen and will try them out. At least try >>>> to. >>>>=20 >>>>> So do not expect too much from these patches: They address >>>>> some necessary issues but are not sufficient for everything. >>>>>=20 >>>>=20 >>>> Of course. No problem. >>>>=20 >>>>=20 >>>>> These patches for the openfirmware->fdt translation are >>>>> closer to being reasonable for FreeBSD official use >>>>> than my highly context-specific stuck-sleeping patches for >>>>> usefdt mode. >>>>=20 >>>> Well to be frank we know this is for mac g5 hardware and thus = having >>>> them working at all in any fashion is better than the current = situation. >>>> Apple made a ton of them and they are dirt cheap and available as >>>> opposed to the IBM Power situation which is expensive and just in >>>> datacenters. >>>=20 >>>=20 >>> I have added another attachment with patches for having hang-ups >>> at AP startup happen less often. These are in AIM-specific code >>> and so has less of a chance of causing other contexts problems. >>> They are also powerpc64 specific. Again, the patches are >>> investigatory and not in a form for direct check-in to FreeBSD. >>>=20 >>> This pair of patches narrows the time period over which threads >>> from the stages: >>>=20 >>> SI_SUB_KTHREAD_INIT =3D 0xe000000, /* init process*/ >>> SI_SUB_KTHREAD_PAGE =3D 0xe400000, /* pageout daemon*/ >>> SI_SUB_KTHREAD_VM =3D 0xe800000, /* vm daemon*/ >>> SI_SUB_KTHREAD_BUF =3D 0xea00000, /* buffer daemon*/ >>> SI_SUB_KTHREAD_UPDATE =3D 0xec00000, /* update daemon*/ >>> SI_SUB_KTHREAD_IDLE =3D 0xee00000, /* idle procs*/ >>> #ifndef EARLY_AP_STARTUP >>> SI_SUB_SMP =3D 0xf000000, /* start the APs*/ >>> #endif=20 >>>=20 >>> can conflict with starting an AP via an slb replacement position >>> picked via expressions like mftb()%n_slbs . It does this by=20 >>> explicitly picking and setting up a slb slot for its use just >>> before starting the AP. >>>=20 >>> (The AP has to be part way along before it can do its own >>> automatic-random-slb-slot-replacements from what I can tell.) >>>=20 >>> The patches do not remove the race and still do sometimes fail to >>> prevent getting a hang-up on a AP start. But it greatly decreased >>> the rate of hangups in my testing. (So it is a good source of >>> evidence about the original problem.) >>>=20 >>> If EARLY_AP_STARTUP was supported and used, the AP startup would >>> not have hang-up problems from mftb()%n_slbs based slb >>> replacements for other threads. >>>=20 >>> The patches are a hack, rather than a general/complete fix --and >>> I do not expect to see them in FreeBSD. But they do help set up >>> a better context for investigating other things. >>=20 >> The disabling of blocking duplicate paths in fdt_add_subnode_namelen >> was done incorrectly. I'll replace the attachment after building >> and testing. I think this is the explanation for the PowerMac11,2 >> shutdown -r or -p problems. >>=20 >> The code should have just disabled the return, more like: >>=20 >> if (offset >=3D 0) >> #if 0 >> // Some Macintoshes have identical package-to-pathname results for >> // multiple nodes of the same type and unit under the parent node. >> // Avoid blocking this for fdt. >> return -FDT_ERR_EXISTS; >> #else >> ; >> #endif >> else if (offset !=3D -FDT_ERR_NOTFOUND) >> return offset; >>=20 >> Instead the messed up change did the "return offset;" and >> so did not do the addition of the node, instead returning >> the pre-existing one to be manipulated. >=20 >=20 > I've managed to boot the 2-socket/1-core-each G5 PowerMac7,2 in > usefdt mode. I've added another attachment for patching 3 more > files, also shown below: >=20 > Index: /usr/src/sys/powerpc/powermac/hrowpic.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- /usr/src/sys/powerpc/powermac/hrowpic.c (revision 345758) > +++ /usr/src/sys/powerpc/powermac/hrowpic.c (working copy) > @@ -169,7 +169,7 @@ > hrowpic_write_reg(sc, HPIC_ENABLE, HPIC_SECONDARY, 0); > hrowpic_write_reg(sc, HPIC_CLEAR, HPIC_SECONDARY, 0xffffffff); >=20 > - powerpc_register_pic(dev, ofw_bus_get_node(dev), 64, 0, = FALSE); > + powerpc_register_pic(dev, = OF_xref_from_node(ofw_bus_get_node(dev)), 64, 0, FALSE); > return (0); > } >=20 > Index: /usr/src/sys/powerpc/powermac/uninorth.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- /usr/src/sys/powerpc/powermac/uninorth.c (revision 345758) > +++ /usr/src/sys/powerpc/powermac/uninorth.c (working copy) > @@ -181,7 +181,7 @@ > <=3D 0) > panic("Interrupt but no interrupt parent!\n"); >=20 > - if (OF_searchprop(iparent, "#interrupt-cells", &icells, = sizeof(icells)) > + if (OF_searchprop(OF_node_from_xref(iparent), = "#interrupt-cells", &icells, sizeof(icells)) > <=3D 0) > icells =3D 1; >=20 > Index: /usr/src/sys/powerpc/powerpc/openpic.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- /usr/src/sys/powerpc/powerpc/openpic.c (revision 345758) > +++ /usr/src/sys/powerpc/powerpc/openpic.c (working copy) > @@ -37,6 +37,8 @@ > #include > #include >=20 > +#include > + > #include > #include > #include > @@ -220,7 +222,7 @@ > for (cpu =3D 0; cpu < sc->sc_ncpu; cpu++) > openpic_write(sc, OPENPIC_PCPU_TPR(cpu), 0); >=20 > - powerpc_register_pic(dev, node, sc->sc_nirq, 4, FALSE); > + powerpc_register_pic(dev, OF_xref_from_node(node), = sc->sc_nirq, 4, FALSE); >=20 > /* If this is not a cascaded PIC, it must be the root PIC */ > if (sc->sc_intr =3D=3D NULL) The patch is: # svnlite diff /usr/src/sys/powerpc/powerpc/mp_machdep.c | more Index: /usr/src/sys/powerpc/powerpc/mp_machdep.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- /usr/src/sys/powerpc/powerpc/mp_machdep.c (revision 345758) +++ /usr/src/sys/powerpc/powerpc/mp_machdep.c (working copy) @@ -77,9 +77,10 @@ PCPU_SET(awake, 1); __asm __volatile("msync; isync"); =20 + powerpc_sync(); while (ap_letgo =3D=3D 0) - __asm __volatile("or 31,31,31"); - __asm __volatile("or 6,6,6"); + powerpc_sync(); + isync(); =20 /* * Set timebase as soon as possible to meet an implicit = rendezvous @@ -262,8 +263,11 @@ __asm __volatile("msync; isync"); =20 /* Let APs continue */ - atomic_store_rel_int(&ap_letgo, 1); + ap_letgo=3D 1; // depend on prior sync, no need to lwsync = first =20 + powerpc_sync(); // analogous to what the ap's do (more similar = time frame?) + if (ap_letgo) isync(); + platform_smp_timebase_sync(ap_timebase, 0); =20 while (ap_awake < smp_cpus) =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)