From owner-freebsd-ppc@freebsd.org Mon Apr 15 07:06:48 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 D5ACB156A0B9 for ; Mon, 15 Apr 2019 07:06:47 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic307-56.consmr.mail.ne1.yahoo.com (sonic307-56.consmr.mail.ne1.yahoo.com [66.163.190.31]) (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 6CCCD6C934 for ; Mon, 15 Apr 2019 07:06:46 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: lOfegvsVM1mQS_6EuLuzS57nvcghIh3C0sk8oNROQG7pO3N5pSbCsESlg4np1Ic prQEZilrKPg_wDq0phgS_ufgvZTgjp0.y6vaZSJKXlLvLUWnYZwBlF9Rh_tGqDxCn7k5_F0hhYaE iVNki7FqYF0K6uXsEY1BXVW_WJnpxjGNIoNrtcnEAVZjxT3PX5m4s5s51KA_.X.f0gv2i76YzzAQ qMn1ZzfwYevfbatnWBCs430OkyhTYG03HxH.rLu.n6V1OsttI2zr5p_qFjPUlHPVkGvfORnmq6By pkXpVG6BS.eamRijqZ9Zp2D_NNeILvhI0e9L.7Ci.jDRn9c_0MB9C9fru9GmJ3PBnEybCSESH2MS 7frSlr_Quh4qe2ROfVzLP3jFZCwJJRoYKHCijU_v94eoKRPiQJSfp6QE7AEdCub9gMDJSB32erNz WWvRM2ScUIy0DKdijQ.FwSeHgsmOr9k6aHSudQg30ckQugdRfh3dpSmj0OY1yGG4Vkj4OUb_j6Dl cHcjzh58HJ9hi98_2QME4ncO7_c9KSBfJul0uLGyG6ThwL7HBf4FL3wsO3FBdH5vEOO00d3FeTkE _BXl3Uw0IyACyIN8T4TBRZGIQ7AWEQek9zkx7i3.kpUlBCazA9IlO1svY3tuxfShkB8gCRe2W30u ix3SsKmWBs6Ko2vvJTAiOzdsiPcyYM2KT3Ya1w9fkvvJ9PiU5b8Rum_awVH6thCJUaVuWYUXR1SZ QCtgeK5_ulKxc6y8tXygT7fOrS9JzRH6rFYW7H4yFJHIXoFghiHForz5_azLXNPEnuU0iNNCijUV P6L4oYrP2i7h2Ab5RJRnIhYO801R9i8nI27pYURdE2sWNDyZBSxoCBGfvVgKwOwOU2C483ynj3wd RuJAS9dbtB1G5uAoDpk6KZva2cnK1wmUiYH95PBQuB9nbRRdP2RXYKnY4IBfn9ahUO5kfTUZRP2y UO7X8QKSQ4EQNBBJe0xuO6ChORxBHRA7IA8pQAY9mtdjNOGaXxsrHwHz7ACg_LJsBE7dUcOh7jGE 0rdlh7oHu8iC7EoGfzeDURVaeC.88o8mmefC_Oh_612NoHCF5.NFXEVg.WDW9oHkue5JYnoBx9fg fijZb Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.ne1.yahoo.com with HTTP; Mon, 15 Apr 2019 07:06:38 +0000 Received: from c-76-115-7-162.hsd1.or.comcast.net (EHLO [192.168.1.103]) ([76.115.7.162]) by smtp415.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 00472f5fffa3fea533b9a3da76e8c247; Mon, 15 Apr 2019 07:06:37 +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: <55E83F50-197D-43C7-B4D6-E69A5AEC2630@yahoo.com> Date: Mon, 15 Apr 2019 00:06:36 -0700 Cc: freebsd-ppc@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <1B999D64-036F-4553-B024-93D0150FD60D@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> To: Dennis Clarke X-Mailer: Apple Mail (2.3445.104.8) X-Rspamd-Queue-Id: 6CCCD6C934 X-Spamd-Bar: / X-Spamd-Result: default: False [-0.22 / 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]; NEURAL_HAM_SHORT(-0.30)[-0.297,0]; 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:36646, ipnet:66.163.184.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.11)[-0.109,0]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.28)[-0.279,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.97)[ip: (2.35), ipnet: 66.163.184.0/21(1.43), asn: 36646(1.15), country: US(-0.06)]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[31.190.163.66.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: Mon, 15 Apr 2019 07:06:48 -0000 On 2019-Apr-13, at 11:39, Mark Millard wrote: > [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. 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: 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) =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)