Re: bsd.upgrade uvm_fault
Greg Steuck <[email protected]>
| Newsgroups | gmane.os.openbsd.bugs |
|---|---|
| Message-ID | <[email protected]> |
"Theo de Raadt" <[email protected]> writes: > I have no idea how com_cd.cd_devs[DEVUNIT(dev)] became NULL. > >> com4 at puc0 port 0 apic 2 int 16: ns16550a, 16 byte fifo > > because the way the config works is that if that line is printed, > the com_cd.cd_devs[] has been filled with pointer to a properly-over-sized > struct device * useable as a device-specific softc. > > One ugly thing about console in some drivers, is that the *open function > might not be called before the first *write call, but *open() is responsible > for allocating the tty structure with a call to ttymalloc(). Some more debugging **without** puc and this diff: diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index c5ceb956a67..438d6df11fa 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -638,7 +638,11 @@ comread(dev_t dev, struct uio *uio, int flag) int comwrite(dev_t dev, struct uio *uio, int flag) { + extern struct vnode *cn_devvp; + extern struct tty *constty; struct com_softc *sc = com_cd.cd_devs[DEVUNIT(dev)]; + printf("dev %d sc %p constty %p cn_devvp %p\n", + DEVUNIT(dev), sc, constty, cn_devvp); struct tty *tp = sc->sc_tty; return ((*linesw[tp->t_line].l_write)(tp, uio, flag)); this prints: root on rd0a swap on rd0b dump on rd0b WARNING: CHECK AND RESET THE DATE! dev 4 sc 0x0 constty 0x0 cn_devvp 0xfffffd811efe1870 uvm_fault(0xfffffd811efd35c0, 0x58, 0, 1) -> e fatal page fault in supervisor mode Full disclosure: I'm running with DDB enabled in RAMDISK_CD as I couldn't get the stack traces otherwise. Here's the whole set of modified files: diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index c5ceb956a67..438d6df11fa 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -638,7 +638,11 @@ comread(dev_t dev, struct uio *uio, int flag) int comwrite(dev_t dev, struct uio *uio, int flag) { + extern struct vnode *cn_devvp; + extern struct tty *constty; struct com_softc *sc = com_cd.cd_devs[DEVUNIT(dev)]; + printf("dev %d sc %p constty %p cn_devvp %p\n", + DEVUNIT(dev), sc, constty, cn_devvp); struct tty *tp = sc->sc_tty; return ((*linesw[tp->t_line].l_write)(tp, uio, flag)); diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 2e5934be756..4e72fca814b 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -2524,7 +2524,7 @@ so_print(void *v, (*pr)("so_qlimit: %i\n", so->so_qlimit); (*pr)("so_timeo: %i\n", so->so_timeo); (*pr)("so_obmark: %lu\n", so->so_oobmark); - +#ifdef SOCKET_SPLICE (*pr)("so_sp: %p\n", so->so_sp); if (so->so_sp != NULL) { (*pr)("\tssp_socket: %p\n", so->so_sp->ssp_socket); @@ -2537,7 +2537,7 @@ so_print(void *v, timeout_pending(&so->so_spliceidleto) ? "" : "not ", so->so_spliceidleto.to_time); } - +#endif (*pr)("so_rcv:\n"); sobuf_print(&so->so_rcv, pr); (*pr)("so_snd:\n"); diff --git a/sys/uvm/uvm_meter.c b/sys/uvm/uvm_meter.c index 890b6b227b0..b27dbda32ec 100644 --- a/sys/uvm/uvm_meter.c +++ b/sys/uvm/uvm_meter.c @@ -297,7 +297,11 @@ uvmexp_print(int (*pr)(const char *, ...)) { struct uvmexp uexp; +#ifdef SMALL_KERNEL + memcpy(&uexp, &uvmexp, sizeof(uexp)); +#else uvmexp_read(&uexp); +#endif (*pr)("Current UVM status:\n"); (*pr)(" pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d\n",