diff options
author | Bruce Evans <bde@FreeBSD.org> | 2018-06-02 10:36:30 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 2018-06-02 10:36:30 +0000 |
commit | fa49511709009dd1a3c89c10eec6111303b63aed (patch) | |
tree | c8aa0133e4639f9d88312c4842314591963ecb49 /sys/dev/syscons | |
parent | d10566cf499af9394e369cb07a4844d1552ef0cf (diff) |
Use per-CPU attributes earlier.
The per-CPU ts is not initialized early, so the global kernel ts is used
early, but it ony has 1 (normal) attribute. Switch this to the per-CPU
attribute.
The difference is most visible with EARLY_AP_STARTUP.
Change to using the curcpu macro instead of PCPU_GET(cpuid) in 2 places for
the above and in 1 other place in my old code in syscons. The function-like
spelling is perhaps better for indicating that curcpu is volatile (unlike
curthread), but for CPU attributes volatility is a feature.
Notes
Notes:
svn path=/head/; revision=334529
Diffstat (limited to 'sys/dev/syscons')
-rw-r--r-- | sys/dev/syscons/syscons.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 4b5d46b9be62..92ed069b63c7 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -2023,18 +2023,27 @@ sc_cnputc(struct consdev *cd, int c) sizeof(sc_cnputc_log)) continue; /* Console output has a per-CPU "input" state. Switch for it. */ - oldtsw = scp->tsw; - oldts = scp->ts; - ts = sc_kts[PCPU_GET(cpuid)]; + ts = sc_kts[curcpu]; if (ts != NULL) { + oldtsw = scp->tsw; + oldts = scp->ts; scp->tsw = sc_ktsw; scp->ts = ts; (*scp->tsw->te_sync)(scp); + } else { + /* Only 1 tsw early. Switch only its attr. */ + (*scp->tsw->te_default_attr)(scp, sc_kattrtab[curcpu], + SC_KERNEL_CONS_REV_ATTR); } sc_puts(scp, buf, 1); - scp->tsw = oldtsw; - scp->ts = oldts; - (*scp->tsw->te_sync)(scp); + if (ts != NULL) { + scp->tsw = oldtsw; + scp->ts = oldts; + (*scp->tsw->te_sync)(scp); + } else { + (*scp->tsw->te_default_attr)(scp, SC_KERNEL_CONS_ATTR, + SC_KERNEL_CONS_REV_ATTR); + } } s = spltty(); /* block sckbdevent and scrn_timer */ @@ -4177,7 +4186,7 @@ sc_kattr(void) { if (sc_console == NULL) return (SC_KERNEL_CONS_ATTR); /* for very early, before pcpu */ - return (sc_kattrtab[PCPU_GET(cpuid) % nitems(sc_kattrtab)]); + return (sc_kattrtab[curcpu % nitems(sc_kattrtab)]); } static void |