From owner-freebsd-ppc@freebsd.org Tue Jan 28 14:57:53 2020 Return-Path: Delivered-To: freebsd-ppc@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9FBC22F7B3 for ; Tue, 28 Jan 2020 14:57:53 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-yw1-xc2e.google.com (mail-yw1-xc2e.google.com [IPv6:2607:f8b0:4864:20::c2e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 486V8w53lpz44BW for ; Tue, 28 Jan 2020 14:57:52 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-yw1-xc2e.google.com with SMTP id l5so6611351ywd.4 for ; Tue, 28 Jan 2020 06:57:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6ymHWYHo0AXJvrFL4d97LqfuQNScX9uJ4ApJRV/MPN4=; b=hOplf7d4kTsZ/n6AJ3cYQR7CEaqNgfpwwSM6Os8wrCqROwZF8Qrz/2QbnCcme4qu7o lKxDK4wB8t/WnXdXckuRL6wPGdTpdrzDuJaoVTsGMi5rY/I+mME24BayDUxTpxxVk565 +Vgc87BFQdp5Qp4BKUCLNdCvf+shbDi62Zn+hZV/L59xueNYSSipCqCjzhtwjttjpiGh R6NMYA0E/VsiUx74IkSAVoe26cj2uFjU7UPwOebIhH8YGHe1XMpCQKFJpW1qPKvBFMjl UIHIj6X2a+GGoUmMvL+H1UsiyjVUsE+rtBtlYiyp4yFQS36yH+6qUexZm0cQnM0kNKQo oyVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6ymHWYHo0AXJvrFL4d97LqfuQNScX9uJ4ApJRV/MPN4=; b=QDx9yDoTbIhRfY5tt01Qb3mgJzXVWtN+naV5WbOE0N0/QpV9Fzr3juuI8GBIBBXYjA HmQdVlnNL18SCjwgEtQ+yjIkbdOmtN1Sp462WgIlhAn0hhb785aH0g+EuH5thiyOb0vH 5K8/guln7BHwt1Shi0yBj368Usk4oIUtCHckeBu2Y3/UISW2D78WAlnmYaTJdjc+iSgi i4NpcrQfa0MS95hSKRdr8MoNFUBXddfx2sGsZIvTsYyea+N9fZae9aX4MsDWBZwI/KdQ oet/dhS0v/mWPP9Ov7aj9NICqY2g0fW2qR0TzJwAXjd0jrcitEaoJLWfAm+DbLQWKp3m wvgw== X-Gm-Message-State: APjAAAWe1gxAs5X54FEBaz7p/upjKPTqUhqmhiWhamsxao/IwTd7lIaw MAlmVi52bjx7Z++xE0VbDCkVUHRi X-Google-Smtp-Source: APXvYqzyjuVVvpReko70YIsLrA1JdhM6A/dMQXqMT0jQi328wa3eg2f/4WWRuACmOKil8FHyE+H5rw== X-Received: by 2002:a0d:d68d:: with SMTP id y135mr16123184ywd.310.1580223471126; Tue, 28 Jan 2020 06:57:51 -0800 (PST) Received: from titan.knownspace (173-19-125-130.client.mchsi.com. [173.19.125.130]) by smtp.gmail.com with ESMTPSA id m16sm8234490ywa.90.2020.01.28.06.57.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jan 2020 06:57:50 -0800 (PST) Date: Tue, 28 Jan 2020 08:57:47 -0600 From: Justin Hibbits To: freebsd-ppc Subject: Re: I have submitted https://reviews.freebsd.org/D23376 for avoiding the PowerMac threads-stuck-sleeping issue Message-ID: <20200128085747.7699601e@titan.knownspace> In-Reply-To: <1EDABAB4-87F5-4C8E-A7B9-9143D520BDE0@yahoo.com> References: <1EDABAB4-87F5-4C8E-A7B9-9143D520BDE0.ref@yahoo.com> <1EDABAB4-87F5-4C8E-A7B9-9143D520BDE0@yahoo.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; powerpc64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 486V8w53lpz44BW X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=hOplf7d4; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of chmeeedalf@gmail.com designates 2607:f8b0:4864:20::c2e as permitted sender) smtp.mailfrom=chmeeedalf@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RECEIVED_SPAMHAUS_PBL(0.00)[130.125.19.173.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; URL_IN_SUBJECT(1.00)[reviews.freebsd.org]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-ppc@freebsd.org]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[e.2.c.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; IP_SCORE(0.00)[ip: (-9.14), ipnet: 2607:f8b0::/32(-2.04), asn: 15169(-1.78), country: US(-0.05)]; FREEMAIL_CC(0.00)[yahoo.com]; RCVD_TLS_ALL(0.00)[] 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: Tue, 28 Jan 2020 14:57:53 -0000 On Sun, 26 Jan 2020 15:28:41 -0800 Mark Millard via freebsd-ppc wrote: > I've described my first ever reviews.freebsd.org/D????? > submittal with: > > QUOTE > REVISION SUMMARY > Explicitly initialize the bsp's TB value early on. For PowerMacs > with multiple sockets or cores only, have machdep_ap_bootstrap for > each ap make a round trip with the bsp to get a current bsp's TB > value and then shift the ap's time so that the midpoint of the > shifted round tip interval approximately matches the TB value the bsp > supplied. The round trips and data transfers use a memory protocol. > > For non-PowerMacs, do the old way for the ap's. > > TEST PLAN > I've been running based on the patches being invovled since late > 2019-May or so: PowerMac11,2 with 2 sockets, 2 cores each, and > PowerMac3,6 with 2 sockets, 1 core each. No examples of 1 socket with > 2 cores, unfortunately. No examples of powerpc64 or powerpc > non-PowerMacs either. I do use the same source tree to build for > amd64, aarch64, and armv7 and they have been working too. But the > patch material is extracted from a source tree that has more local > changes: the testing has not been with only these changes. > > I've not had any examples of the stuck-sleeping issue since adopting > these changes. Nor have I had new problems from the changes. END QUOTE > > > A summary of my changes is: > > > Part 0: > Avoid interrupts messing up mttb use: > > sys/powerpc/include/cpufunc.h > > > Part 1: > Enable the "alternate_timebase_sync_style" indicator > only for PowerMacs: > > sys/powerpc/powermac/platform_powermac.c > > > Part 2: > The code supporting machdep_ap_bootstrap's part of the > hard work, including the changes to machdep_ap_bootstrap: > > sys/powerpc/powerpc/mp_machdep.c > > > Part 3: > Making sure that the bsp follows the rule: > "The TB is a volatile resource and must be initialized during reset." > > sys/powerpc/powerpc/machdep.c > > > > > I'll note that I'm not style(9) literate/familiar and at the time > my capacity went to investigating the problem and potential solutions, > not to style(9). So, once a technique is classified as okay, how > it is written in the source would need its own round of work, > presuming my submittal does not inspire a separate fix by someone. Hi Mark, Thanks for taking this on. I'm glad someone can do it, since I don't have a FreeBSD G5 anymore. However, your approach only gets partway to the correct solution. Please see the solution I made for the mpc85xx, in mpc85xx/platform_mpc85xx.c; tl;dr being that you need to stop the timebase on all cores, align them, then restart the timebase. On the SoCs it's easy, since it's just a simple register. On PowerMac hardware it's still doable, but requires some extra steps. Some platforms require twiddling a GPIO ('timebase-enable' node, using a 'platform function' which you'd either need to write an interpreter for, or manually interpret it into C), while others (PowerMac7,2, PowerMac7,3, and RackMac3,1 according to Linux) require twiddling on i2c. Using the disable-sync-enable method with rendezvous would provide the best sync option, and would avoid messing with the platform independent code. - Justin