On Tuesday 10 February 2009 3:14:47 pm Alexey Shuvaev wrote: > On Mon, Feb 09, 2009 at 02:58:41PM -0500, John Baldwin wrote: > > On Monday 09 February 2009 1:58:39 pm Christian Gusenbauer wrote: > > > On Monday 09 February 2009, John Baldwin wrote: > > > > > > > > Please help to debug this so we can have working lpt0 in 8.0. No one > > > > tested the patches months ago when I first posted them, and if folks do > > not > > > > test them now I will simply remove the driver before 8.0 ships. I no > > > > > > Mea culpa, too. As you sent your patches, I thought someone else will do the > > > tests surely ... :-(. > > > > > > > longer have any hardware such that I can test this directly, so I am > > > > depending on folks to test things I have asked for and report back. I > > > > believe the last thing I asked for was for someone to do this when they > > lpt > > > > was hung: > > > > > > > > Ok, can you run kgdb against your running kernel (Just run 'kgdb' without > > > > any arguments) and do the following: > > > > > > > > (kgdb) p *(struct ppb_data *)ppbus_devclass->devices[0]->softc > > > > > > > > Assuming the ppb_owner is not 0, can you then do this: > > > > > > > > (kgdb) p *(device_t)((struct ppb_data > > > > *)ppbus_devclass->devices[0]->softc)->ppb_owner > > > > > > This is the output (unfortunately ppb_owner IS 0): > > > > > > (kgdb) p *(struct ppb_data *)ppbus_devclass->devices[0]->softc > > > $1 = {class_id = 10, state = 1, error = 0, mode = 0, ppb_owner = 0x0, > > > ppc_lock = 0xc56bfe7c, ppc_irq_res = 0xc573d5c0} > > > > And this is while lpd or the like is hung trying to write to /dev/lpt0? > > > Hello all! > > Ok, here we go. 1st, the system: > ~> uname -a > FreeBSD wep4035 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Sat Feb 7 20:25:10 CET 2009 root_at_wep4035:/usr/obj/usr/src/sys/NOUSB amd64 > > Parallel port (from dmesg): > ppc0: <Parallel port> port 0x378-0x37f,0x778-0x77f irq 7 drq 3 on acpi0 > ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode > ppc0: FIFO with 16/16/9 bytes threshold > ppc0: [ITHREAD] > ppbus0: <Parallel port bus> on ppc0 > ppbus0: IEEE1284 device found /NIBBLE/ECP > ppbus0: Probing for PnP devices: > ppbus0: <HEWLETT-PACKARD OFFICEJET R60> PRINTER MLC,PCL,PML,SCL > plip0: <PLIP network interface> on ppbus0 > plip0: [ITHREAD] > lpt0: <Printer> on ppbus0 > lpt0: [ITHREAD] > lpt0: Interrupt-driven port > ppi0: <Parallel I/O> on ppbus0 > > I have simplified things and do not run lpd. The command is: > 'ktrace -id cat monitor_info > /dev/lpt0' > (I think it should work?) > kdump -E > ktrace.dump does not show anything interesting: > [snip] > 1564 cat 0.001120 CALL open(0x7fffffffee1c,O_RDONLY,<unused>0x6d) > 1564 cat 0.001127 NAMI "monitor_info" > 1564 cat 0.001143 RET open 3 > 1564 cat 0.001149 CALL fstat(0x1,0x7fffffffeac0) > 1564 cat 0.001155 STRU struct stat {dev=83951360, ino=53, mode=crw-rw--- > - , nlink=1, uid=0, gid=0, rdev=53, atime=1234294743.332164000, stime=1234294743 > .332164000, ctime=1234294974, birthtime=-1, size=0, blksize=4096, blocks=0, flag > s=0x0 } > 1564 cat 0.001160 RET fstat 0 > 1564 cat 0.001180 CALL __sysctl(0x7fffffffea20,0x2,0x80085eeb8,0x7ffffff > fea18,0,0) > 1564 cat 0.001187 RET __sysctl 0 > 1564 cat 0.001191 CALL __sysctl(0x7fffffffea60,0x2,0x7fffffffea7c,0x7fff > ffffea70,0,0) > 1564 cat 0.001198 RET __sysctl 0 > 1564 cat 0.001203 CALL __sysctl(0x7fffffffea60,0x2,0x7fffffffea7c,0x7fffffffea70,0,0) > 1564 cat 0.001208 RET __sysctl 0 > 1564 cat 0.001230 CALL __sysctl(0x7fffffffe5f0,0x2,0x8008509e8,0x7fffffffe5e8,0,0) > 1564 cat 0.001236 RET __sysctl 0 > 1564 cat 0.001242 CALL readlink(0x800722639,0x7fffffffe610,0x400) > 1564 cat 0.001248 NAMI "/etc/malloc.conf" > 1564 cat 0.001264 RET readlink -1 errno 2 No such file or directory > 1564 cat 0.001270 CALL issetugid > 1564 cat 0.001275 RET issetugid 0 > 1564 cat 0.001296 CALL break(0x600000) > 1564 cat 0.001302 RET break 0 > 1564 cat 0.001317 CALL __sysctl(0x7fffffffe850,0x2,0x7fffffffe86c,0x7fffffffe860,0,0) > 1564 cat 0.001324 RET __sysctl 0 > 1564 cat 0.001329 CALL mmap(0,0x100000,PROT_READ| PROT_WRITE,MAP_PRIVATE|MAP_ANON,0xffffffff,0) > 1564 cat 0.001335 RET mmap 8790016/0x800862000 > 1564 cat 0.001340 CALL mmap(0x800962000,0x9e000,PROT_READ| PROT_WRITE,MAP_PRIVATE|MAP_ANON,0xffffffff,0) > 1564 cat 0.001346 RET mmap 9838592/0x800962000 > 1564 cat 0.001351 CALL munmap(0x800862000,0x9e000) > 1564 cat 0.001359 RET munmap 0 > 1564 cat 0.001378 CALL read(0x3,0x800902000,0x1000) > 1564 cat 0.006845 GIO fd 3 read 4096 bytes > "(II) VESA(0): VESA VBE DDC supported > (II) VESA(0): VESA VBE DDC Level 2 > (II) VESA(0): VESA VBE DDC transfer in appr. 1 sec. > (==) VESA(0): Write-combining range (0x0,0x1000) was already clear > (==) VESA(0): Write-combining range (0x0,0x1000) was already clear > [snip] > 1 604 625 +hsync +vsync (46.9 kHz) > (II) VESA(0): Modeline "800x600"x0.0 50.00 800 856 976 1040 600 63\ > 7 643 666 +hsync +vsync (48.1 kHz) > (II) VESA(0): Modeline "1280x1024"x60.0 108.88 1280 1360 1496 1712 \ > 1024 1025 1028 1060 -hsync +vsync (63.6 kHz) > (II) VESA(0): Modeline "1680x1050"x60.0 147.14 16" > 1564 cat 0.006879 RET read 4096/0x1000 > 1564 cat 0.006888 CALL write(0x1,0x800902000,0x1000) > 1564 cat 114.695563 RET write RESTART > 1564 cat 114.695637 PSIG SIGINT SIG_DFL > > After 114 seconds I have hit Ctrl-C. > > 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? Can you see if the first 'cat' process is still around? 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 _at__at_ -611,11 +611,8 _at__at_ 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); _at__at_ -635,16 +632,16 _at__at_ 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); } -- John BaldwinReceived on Tue Feb 10 2009 - 20:13:16 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:42 UTC