> Date: Tue, 04 Oct 2022 12:12:15 +0900
> From: Ryo ONODERA <r...@tetera.org>
> 
> "Taylor R Campbell" <riastr...@netbsd.org> writes:
> 
> > console(4), constty(4): Rip off the kernel lock.
> 
> After introduction of MP-safe console/constty, my kernel stopped
> just after genfb(4) detection.
> LOCKDEBUG, DIAGNOSTIC, DEBUG options does not provide any additional
> information with me.
> Could you take a look at my problem?

Sorry about that -- I've reverted this change and the MP-safe cons(4)
change for now, but let's try to figure out what's wrong with them so
I can reapply them and get the console paths out of the kernel lock
for good.

Can you try the attached patch on top?
>From 2de03f1efbe5b73d42dc2f59730c17b99c04b3b9 Mon Sep 17 00:00:00 2001
From: Taylor R Campbell <riastr...@netbsd.org>
Date: Tue, 4 Oct 2022 05:24:49 +0000
Subject: [PATCH] squash! constty(4): Make MP-safe.

- Fix initialization of ok in cn_redirect.
---
 sys/dev/cons.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys/dev/cons.c b/sys/dev/cons.c
index f4f9a1602221..e621292a6b4a 100644
--- a/sys/dev/cons.c
+++ b/sys/dev/cons.c
@@ -463,7 +463,7 @@ cn_redirect(dev_t *devp, int is_read, int *error, struct 
tty **ctpp)
        dev_t dev = *devp;
        struct tty *ctp;
        int s;
-       bool ok;
+       bool ok = false;
 
        *error = ENXIO;
        *ctpp = NULL;
@@ -472,18 +472,17 @@ cn_redirect(dev_t *devp, int is_read, int *error, struct 
tty **ctpp)
            (cn_tab == NULL || (cn_tab->cn_pri != CN_REMOTE))) {
                if (is_read) {
                        *error = 0;
-                       ok = false;
                        goto out;
                }
                tty_acquire(ctp);
                *ctpp = ctp;
                dev = ctp->t_dev;
        } else if (cn_tab == NULL) {
-               ok = false;
                goto out;
        } else {
                dev = cn_tab->cn_dev;
        }
+       ok = true;
        *devp = dev;
 out:   pserialize_read_exit(s);
        return ok;

Reply via email to