From: Skip Tavakkolian <skip.tavakkolian@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] Plan9 on Pi 3B+
Date: Tue, 3 Apr 2018 17:30:24 -0700 [thread overview]
Message-ID: <CAJSxfm+vMzFR5DO79bvvGXtRdrxmW_XbwMoAqscb=2LEL9qOnA@mail.gmail.com> (raw)
In-Reply-To: <89a44511b98911d8e26633895373dab7@hamnavoe.com>
[-- Attachment #1: Type: text/plain, Size: 3523 bytes --]
Thanks! I got one recently and have been meaning to ask about his.
Running Linux, 3B+ seems perceptibly faster than 3B.
On Tue, Apr 3, 2018 at 2:05 PM, Richard Miller <9fans@hamnavoe.com> wrote:
> > But what is the
> > rationale for the lock in the second loop?
>
> Sorry for the confusing code. The startlocks are locked by
> cpu0 before booting the secondary cores. Each core unlocks
> its own startlock when it starts. Cpu0 blocks on each startlock
> waiting for the corresponding core to unlock it, as a way of
> serialising the booting of the secondary cores (and detecting
> that they have started).
>
> If for some reason the secondary cpus don't start up, the
> result is a lock loop. I really should have used canlock()
> instead, to expose a more helpful error message. But it's
> a "should never happen" condition.
>
> It's happening with the new start_cd.elf because the Pi
> Foundation made a little change in the firmware which makes
> secondary cores wait with a WFE when booting, so the OS
> now has to do a SEV to wake them up.
>
> I'm just about to release an update to the bcm port for
> the 3B+, including drivers for the new "gigabit" ethernet
> (not really, because it's squeezed through a slow usb2 adapter)
> and the updated wifi chip. But in the meantime the following
> should let you boot any pi2 or pi3 with the latest start_cd.elf:
>
> --- /sys/src/9/bcm/archbcm2.c Fri Mar 16 17:08:21 2018
> ***************
> *** 167,172 ****
> --- 167,174 ----
> if(mb->clr[cpu].startcpu)
> return -1;
> mb->set[cpu].startcpu = PADDR(cpureset);
> + coherence();
> + sev();
> for(i = 0; i < 1000; i++)
> if(mb->clr[cpu].startcpu == 0)
> return 0;
> ***************
> *** 196,202 ****
> int
> startcpus(uint ncpu)
> {
> ! int i;
>
> for(i = 0; i < ncpu; i++)
> lock(&startlock[i]);
> --- 198,204 ----
> int
> startcpus(uint ncpu)
> {
> ! int i, timeout;
>
> for(i = 0; i < ncpu; i++)
> lock(&startlock[i]);
> ***************
> *** 204,210 ****
> for(i = 1; i < ncpu; i++){
> if(startcpu(i) < 0)
> return i;
> ! lock(&startlock[i]);
> unlock(&startlock[i]);
> }
> return ncpu;
> --- 206,215 ----
> for(i = 1; i < ncpu; i++){
> if(startcpu(i) < 0)
> return i;
> ! timeout = 10000000;
> ! while(!canlock(&startlock[i]))
> ! if(--timeout == 0)
> ! return i;
> unlock(&startlock[i]);
> }
> return ncpu;
>
> --- /sys/src/9/bcm/armv7.s Fri Mar 16 16:47:18 2018
> ***************
> *** 17,22 ****
> --- 17,23 ----
> #define WFI WORD $0xe320f003 /* wait for interrupt */
> #define WFI_EQ WORD $0x0320f003 /* wait for interrupt if
> eq */
> #define ERET WORD $0xe160006e /* exception return from HYP */
> + #define SEV WORD $0xe320f004 /* send event */
>
> /* tas/cas strex debugging limits; started at 10000 */
> #define MAXSC 1000000
> ***************
> *** 386,391 ****
> --- 387,396 ----
>
> TEXT coherence(SB), $-4
> BARRIERS
> + RET
> +
> + TEXT sev(SB), $-4
> + SEV
> RET
>
> /*
>
>
>
[-- Attachment #2: Type: text/html, Size: 4540 bytes --]
next prev parent reply other threads:[~2018-04-04 0:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1092190499.1253166.1522781548163.ref@mail.yahoo.com>
2018-04-03 18:52 ` Brian L. Stuart
2018-04-03 19:35 ` Erik Quanstrom
2018-04-03 21:05 ` Richard Miller
2018-04-04 0:30 ` Skip Tavakkolian [this message]
2018-04-05 14:17 ` Richard Miller
2018-04-05 15:03 ` Richard Miller
2018-04-05 17:02 ` Steve Simon
2018-04-05 20:25 ` Bakul Shah
2018-04-05 22:13 ` hiro
2018-04-05 22:40 ` Rui Carmo
2018-04-05 21:33 ` Richard Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJSxfm+vMzFR5DO79bvvGXtRdrxmW_XbwMoAqscb=2LEL9qOnA@mail.gmail.com' \
--to=skip.tavakkolian@gmail.com \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).