From owner-freebsd-current@FreeBSD.ORG Tue Feb 10 21:57:22 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BD141065690; Tue, 10 Feb 2009 21:57:22 +0000 (UTC) (envelope-from shuvaev@physik.uni-wuerzburg.de) Received: from mailrelay.rz.uni-wuerzburg.de (mailrelay.rz.uni-wuerzburg.de [132.187.3.28]) by mx1.freebsd.org (Postfix) with ESMTP id D62ED8FC2C; Tue, 10 Feb 2009 21:57:21 +0000 (UTC) (envelope-from shuvaev@physik.uni-wuerzburg.de) Received: from virusscan.mail (localhost [127.0.0.1]) by mailrelay.mail (Postfix) with ESMTP id 31E1219907D; Tue, 10 Feb 2009 22:57:21 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by virusscan.mail (Postfix) with ESMTP id 25CE719907B; Tue, 10 Feb 2009 22:57:21 +0100 (CET) Received: from mail.physik.uni-wuerzburg.de (wthp192.physik.uni-wuerzburg.de [132.187.40.192]) by mailmaster.uni-wuerzburg.de (Postfix) with ESMTP id 076F219906E; Tue, 10 Feb 2009 22:57:21 +0100 (CET) Received: from wep4035 ([132.187.37.35]) by mail.physik.uni-wuerzburg.de (Lotus Domino Release 8.0.2HF443) with ESMTP id 2009021022572051-50830 ; Tue, 10 Feb 2009 22:57:20 +0100 Received: by wep4035 (sSMTP sendmail emulation); Tue, 10 Feb 2009 22:57:20 +0100 From: "Alexey Shuvaev" Date: Tue, 10 Feb 2009 22:57:20 +0100 To: John Baldwin Message-ID: <20090210215720.GA1594@wep4035.physik.uni-wuerzburg.de> References: <200902021643.39862.c47g@gmx.at> <200902091458.41637.jhb@freebsd.org> <20090210201447.GA1664@wep4035.physik.uni-wuerzburg.de> <200902101612.57922.jhb@freebsd.org> MIME-Version: 1.0 In-Reply-To: <200902101612.57922.jhb@freebsd.org> Organization: Universitaet Wuerzburg User-Agent: Mutt/1.5.18 (2008-05-17) X-MIMETrack: Itemize by SMTP Server on domino1/uni-wuerzburg(Release 8.0.2HF443 | November 25, 2008) at 02/10/2009 10:57:20 PM, Serialize by Router on domino1/uni-wuerzburg(Release 8.0.2HF443 | November 25, 2008) at 02/10/2009 10:57:20 PM, Serialize complete at 02/10/2009 10:57:20 PM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Virus-Scanned: by amavisd-new at uni-wuerzburg.de Cc: freebsd-current@freebsd.org Subject: Re: lpt stopped working X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Feb 2009 21:57:22 -0000 On Tue, Feb 10, 2009 at 04:12:57PM -0500, John Baldwin wrote: > On Tuesday 10 February 2009 3:14:47 pm Alexey Shuvaev wrote: > > Hello all! > > > > [snip] > > > > And this is from kgdb: > > (kgdb) p *(struct ppb_data *)ppbus_devclass->devices[0]->softc > > $1 = {class_id = 0, state = 1, error = 0, mode = 0, > > ppb_owner = 0xffffff0004668700, ppc_lock = 0xffffff0004668eb8, > > ppc_irq_res = 0xffffff0004677900} > > (kgdb) p *(device_t)((struct > ppb_data*)ppbus_devclass->devices[0]->softc)->ppb > > _owner > > $2 = {ops = 0xffffff0001520000, link = {tqe_next = 0xffffff0004668500, > > tqe_prev = 0xffffff0004668908}, devlink = {tqe_next = > 0xffffff0004668500, > > tqe_prev = 0xffffff0004668918}, parent = 0xffffff0004669000, children = > { > > tqh_first = 0x0, tqh_last = 0xffffff0004668730}, > > driver = 0xffffffff806961c0, devclass = 0xffffff00014f4900, unit = 0, > > nameunit = 0xffffff0004666940 "lpt0", desc = 0xffffffff804fc110 "Printer", > > busy = 0, state = DS_ATTACHED, devflags = 0, flags = 7, order = 0 '\0', > > pad = 0 '\0', ivars = 0xffffff0004668800, softc = 0xffffff0004668400, > > sysctl_ctx = {tqh_first = 0xffffff0004674180, > > tqh_last = 0xffffff0004674288}, sysctl_tree = 0xffffff000467d480} > > (kgdb) > > > > The driver stays in this state even after exit of 'cat' process > > (I think this was already reported): > > ~> cat monitor_info > /dev/lpt0 > > /dev/lpt0: Device busy. > > Ok, so the first cat works, the second one gets EBUSY? > Mmm... I don't think the first cat really works. It hangs, I suppose nothing goes to the wire, and during this I got the above printigs from kgdb. > Can you see if the first 'cat' process is still around? > It is possible to kill this cat process either by kill or just type Ctrl-C twice in the terminal where it hangs. I don't see it in ps output thereafter. Nevertheless the lpt returns 'Device busy' and if I try kgdb commands again the results are the same. > Hmm, I think I've found it. Due to a bug, lptclose() wasn't releasing the > bus. > > --- //depot/user/jhb/acpipci/dev/ppbus/lpt.c > +++ /home/jhb/work/p4/acpipci/dev/ppbus/lpt.c > @@ -611,11 +611,8 @@ > int err; > > ppb_lock(ppbus); > - if (sc->sc_flags & LP_BYPASS) { > - sc->sc_state = 0; > - ppb_unlock(ppbus); > + if (sc->sc_flags & LP_BYPASS) > goto end_close; > - } > > if ((err = lpt_request_ppbus(lptdev, PPB_WAIT|PPB_INTR)) != 0) { > ppb_unlock(ppbus); > @@ -635,16 +632,16 @@ > sc->sc_state &= ~OPEN; > callout_stop(&sc->sc_timer); > ppb_wctr(ppbus, LPC_NINIT); > - sc->sc_state = 0; > - sc->sc_xfercnt = 0; > > /* > * unregistration of interrupt forced by release > */ > lpt_release_ppbus(lptdev); > - ppb_unlock(ppbus); > > end_close: > + sc->sc_state = 0; > + sc->sc_xfercnt = 0; > + ppb_unlock(ppbus); > lprintf(("closed.\n")); > return(0); > } > Just recompiled the whole kernel and tried again. The same symptoms and almost the same kgdb output: --- old 2009-02-10 22:42:53.000000000 +0100 +++ lpt_2 2009-02-10 22:41:20.000000000 +0100 @@ -9,9 +9,10 @@ tqe_prev = 0xffffff0004668918}, parent = 0xffffff0004669000, children = { tqh_first = 0x0, tqh_last = 0xffffff0004668730}, driver = 0xffffffff806961c0, devclass = 0xffffff00014f4900, unit = 0, - nameunit = 0xffffff0004666940 "lpt0", desc = 0xffffffff804fc110 "Printer", + nameunit = 0xffffff0004666930 "lpt0", desc = 0xffffffff804fc110 "Printer", busy = 0, state = DS_ATTACHED, devflags = 0, flags = 7, order = 0 '\0', pad = 0 '\0', ivars = 0xffffff0004668800, softc = 0xffffff0004668400, - sysctl_ctx = {tqh_first = 0xffffff0004674180, - tqh_last = 0xffffff0004674288}, sysctl_tree = 0xffffff000467d480} + sysctl_ctx = {tqh_first = 0xffffff0004674160, + tqh_last = 0xffffff0004674268}, sysctl_tree = 0xffffff000467d480} (kgdb) Interesting, I get something in the dmesg about the printer: ppbus0: on ppc0 ppbus0: IEEE1284 device found /NIBBLE/ECP ppbus0: Probing for PnP devices: ppbus0: PRINTER MLC,PCL,PML,SCL AFAIK the second core is not launched at this moment (and yes, I am on a dual-core machine :). Just some thoughts, Alexey.