Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Aug 2007 11:37:20 +0900
From:      "Hidetoshi Shimokawa" <simokawa@FreeBSD.ORG>
To:        "Bruce Cran" <bruce@cran.org.uk>, "KOT MATPOCKuH" <matpockuh@gmail.com>,  gary.jennejohn@freenet.de
Cc:        current@freebsd.org
Subject:   Re: console hangs after setting hostname
Message-ID:  <626eb4530708221937h31c8f37fu9527e941ed4000b6@mail.gmail.com>
In-Reply-To: <46BE1D6C.6040903@cran.org.uk>
References:  <3979a4b0707291120v4927a20cm357b845f6d1f3567@mail.gmail.com> <46BE1D6C.6040903@cran.org.uk>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
It looks that the low level console is not locked though the high level console
is locked by Giant.

Could you try the attached patch?


On 8/12/07, Bruce Cran <bruce@cran.org.uk> wrote:
> KOT MATPOCKuH wrote:
> > I got a problem. After messages on console:
> > ...
> > Mounting local files systems:.
> > Setting hostname: green.
> > fxp: link state changed to UP
> > nfe0: link state changed to DOWN
> >
> > console hangs.
> > No any new messages, I can't input anything from keyboard, changing virtual
> > consoles is not working. After X is started, console is not switched to xdm
> > display.
> > But system is works - I can login to system via ssh, ...
> >
> > dmesg.boot is attached.
> >
> > Where is a problem and what I need to do? :)
> >
>
> I'm also seeing the console hang, but in a different situation.  If I
> attach and remove my iPod the console hangs - the only key press that's
> accepted is ctrl-alt-esc to break into the debugger.
>
> umass0: <Apple iPod, class 0/0, rev 2.00/0.01, addr 2> on uhub5
> da0 at umass-sim0 bus 0 target 0 lun 0
> da0: <Apple iPod 1.62> Removable Direct Access SCSI-0 device
> da0: 40.000MB/s transfers
> da0: 19073MB (39063024 512 byte sectors: 255H 63S/T 2431C)
> (da0:umass-sim0:0:0:0): READ(10). CDB: 28 0 2 54 d ef 0 0 1 0
> (da0:umass-sim0:0:0:0): CAM Status: SCSI Status Error
> (da0:umass-sim0:0:0:0): SCSI Status: Check Condition
> (da0:umass-sim0:0:0:0): ILLEGAL REQUEST asc:21,0
> (da0:umass-sim0:0:0:0): Logical block address out of range
> (da0:umass-sim0:0:0:0): Unretryable error
> (da0:umass-sim0:0:0:0): READ(10). CDB: 28 0 2 54 d ef 0 0 1 0
> (da0:umass-sim0:0:0:0): CAM Status: SCSI Status Error
> (da0:umass-sim0:0:0:0): SCSI Status: Check Condition
> (da0:umass-sim0:0:0:0): ILLEGAL REQUEST asc:21,0
> (da0:umass-sim0:0:0:0): Logical block address out of range
> (da0:umass-sim0:0:0:0): Unretryable error
> GEOM_LABEL: Label for provider da0s2 is msdosfs/IPOD.
>
> When I remove the iPod I get the following messages:
>
> umass0: at uhub5 port 1 (addr 2) disconnected
> da0:umass-sim0:0:0G:0EO :M _LlAoBst L d  ev aibceel
> )m(sd ao0s:fs m/aIsPsO-Ds irme0m:o0v:ed :.0
>  : removing device entry
> umass0: detached
>
> enter: manual escape to debugger
> [thread pid 19 tid 100018 ]
> Stopped at   kdb_enter+0x31: leave
> db> wh
> Tracing pid 19 tid 100018 td 0xffffff000112d350
> kdb_enter()
> scgetc()
> sckbdevent()
> kbdmux_intr()
> kdbmux_kdb_intr()
> taskqueue_run()
> taskqueue_swi_giant_run()
> ithread_loop
> fork_exit()
> fork_trampoline()
> --- trap 0, rip = 0, rsp = 0xffffffff9ca59d30, rbp = 0 ---
> db>
>
> I'm using ULE.
> uname -a:
> FreeBSD muon.draftnet 7.0-CURRENT FreeBSD 7.0-CURRENT #1: Sat Aug 11
> 21:07:09 BST 2007
> brucec@muon.draftnet:/usr/obj/usr/src/sys/INSPIRON  amd64
>
> --
> Bruce Cran
>
> _______________________________________________
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
>


-- 
/\ Hidetoshi Shimokawa
\/  simokawa@FreeBSD.ORG

[-- Attachment #2 --]
Index: syscons.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/syscons/syscons.c,v
retrieving revision 1.451
diff -u -r1.451 syscons.c
--- syscons.c	4 Jun 2007 23:57:30 -0000	1.451
+++ syscons.c	23 Aug 2007 02:14:39 -0000
@@ -2511,14 +2511,23 @@
 void
 sc_puts(scr_stat *scp, u_char *buf, int len)
 {
+    int need_unlock = 0;
+
 #ifdef DEV_SPLASH
     /* make screensaver happy */
     if (!sticky_splash && scp == scp->sc->cur_scp && !sc_saver_keyb_only)
 	run_scrn_saver = FALSE;
 #endif
 
-    if (scp->tsw)
+    if (scp->tsw) {
+	if (!kdb_active && !mtx_owned(&scp->scr_lock)) {
+		need_unlock = 1;
+		mtx_lock_spin(&scp->scr_lock);
+	}
 	(*scp->tsw->te_puts)(scp, buf, len);
+	if (need_unlock)
+		mtx_unlock_spin(&scp->scr_lock);
+    }
 
     if (scp->sc->delayed_next_scr)
 	sc_switch_scr(scp->sc, scp->sc->delayed_next_scr - 1);
@@ -2896,6 +2905,7 @@
 	(*scp->tsw->te_term)(scp, &scp->ts);
     if (scp->ts != NULL)
 	free(scp->ts, M_DEVBUF);
+    mtx_destroy(&scp->scr_lock);
 
     /* clear the structure */
     if (!(flags & SC_KERNEL_CONSOLE)) {
@@ -3079,6 +3089,8 @@
     scp->history = NULL;
     scp->history_pos = 0;
     scp->history_size = 0;
+
+    mtx_init(&scp->scr_lock, "scrlock", NULL, MTX_SPIN);
 }
 
 int
Index: syscons.h
===================================================================
RCS file: /home/ncvs/src/sys/dev/syscons/syscons.h,v
retrieving revision 1.87
diff -u -r1.87 syscons.h
--- syscons.h	13 Sep 2006 15:48:15 -0000	1.87
+++ syscons.h	23 Aug 2007 02:30:18 -0000
@@ -333,6 +333,7 @@
 
 	int		splash_save_mode;	/* saved mode for splash screen */
 	int		splash_save_status;	/* saved status for splash screen */
+	struct mtx	scr_lock;		/* mutex for sc_puts() */
 #ifdef _SCR_MD_STAT_DECLARED_
 	scr_md_stat_t	md;			/* machine dependent vars */
 #endif

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?626eb4530708221937h31c8f37fu9527e941ed4000b6>