HEADSUP: New pts code triggers panics on amd64 systems.
Giorgos Keramidas
keramida at ceid.upatras.gr
Wed Feb 8 04:50:00 PST 2006
On 2006-02-08 13:06, Giorgos Keramidas <keramida at ceid.upatras.gr> wrote:
> On 2006-02-08 12:56, Giorgos Keramidas <keramida at ceid.upatras.gr> wrote:
> >On 2006-02-07 13:26, Robert Watson <rwatson at FreeBSD.org> wrote:
> >> Does the instability occur if kern.pts.enable=0, or only when
> >> kern.pts.enable=1?
> >
> > Both. I rebuilt a kernel & userland from today's HEAD, and installed it
> > on a clean partition. Both a GENERIC kernel and my own FLAME kernel
> > config (attached) were tested with kern.pts.enable=0 and kern.pts.enable=1.
>
> Attachment forgotten... naturally :)
I updated to HEAD and then reverted the tty_pts changes from src/sys
only, using the attached patch, but the problems of syscons are still
there :-/
%%%
Index: conf/files
===================================================================
--- conf/files (revision 10)
+++ conf/files (revision 11)
@@ -1347,7 +1347,6 @@
kern/tty_conf.c standard
kern/tty_cons.c standard
kern/tty_pty.c optional pty
-kern/tty_pts.c optional pty
kern/tty_subr.c standard
kern/tty_tty.c standard
kern/uipc_accf.c optional inet
Index: kern/tty_pty.c
===================================================================
--- kern/tty_pty.c (revision 10)
+++ kern/tty_pty.c (revision 11)
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/tty_pty.c,v 1.145 2006/02/02 20:35:45 cognet Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/tty_pty.c,v 1.141 2006/01/10 09:19:09 phk Exp $");
/*
* Pseudo-teletype Driver
@@ -107,7 +107,6 @@
u_char pt_ucntl;
struct tty *pt_tty;
struct cdev *devs, *devc;
- int pt_devs_open, pt_devc_open;
struct prison *pt_prison;
};
@@ -133,6 +132,7 @@
static struct cdev *
ptyinit(struct cdev *devc, struct thread *td)
{
+ struct cdev *devs;
struct ptsc *pt;
int n;
@@ -143,47 +143,19 @@
devc->si_flags &= ~SI_CHEAPCLONE;
- /*
- * Initially do not create a slave endpoint.
- */
pt = malloc(sizeof(*pt), M_PTY, M_WAITOK | M_ZERO);
+ pt->devs = devs = make_dev_cred(&pts_cdevsw, n, td->td_ucred,
+ UID_ROOT, GID_WHEEL, 0666, "tty%c%r", names[n / 32], n % 32);
pt->devc = devc;
pt->pt_tty = ttyalloc();
pt->pt_tty->t_sc = pt;
- devc->si_drv1 = pt;
- devc->si_tty = pt->pt_tty;
+ devs->si_drv1 = devc->si_drv1 = pt;
+ devs->si_tty = devc->si_tty = pt->pt_tty;
+ pt->pt_tty->t_dev = devs;
return (devc);
}
-static void
-pty_create_slave(struct ucred *cred, struct ptsc *pt, int n)
-{
-
- pt->devs = make_dev_cred(&pts_cdevsw, n, cred, UID_ROOT, GID_WHEEL,
- 0666, "tty%c%r", names[n / 32], n % 32);
- pt->devs->si_drv1 = pt;
- pt->devs->si_tty = pt->pt_tty;
- pt->pt_tty->t_dev = pt->devs;
-}
-
-static void
-pty_destroy_slave(struct ptsc *pt)
-{
-
- pt->pt_tty->t_dev = NULL;
- destroy_dev(pt->devs);
- pt->devs = NULL;
-}
-
-static void
-pty_maybe_destroy_slave(struct ptsc *pt)
-{
-
- if (0 && pt->pt_devc_open == 0 && pt->pt_devs_open == 0)
- pty_destroy_slave(pt);
-}
-
/*ARGSUSED*/
static int
ptsopen(struct cdev *dev, int flag, int devtype, struct thread *td)
@@ -200,7 +172,7 @@
ttyinitmode(tp, 1, 0);
} else if (tp->t_state & TS_XCLUDE && suser(td))
return (EBUSY);
- else if (pt->pt_prison != td->td_ucred->cr_prison && suser(td))
+ else if (pt->pt_prison != td->td_ucred->cr_prison)
return (EBUSY);
if (tp->t_oproc) /* Ctrlr still around. */
(void)ttyld_modem(tp, 1);
@@ -213,32 +185,20 @@
return (error);
}
error = ttyld_open(tp, dev);
- if (error == 0) {
+ if (error == 0)
ptcwakeup(tp, FREAD|FWRITE);
- pt->pt_devs_open = 1;
- } else
- pty_maybe_destroy_slave(pt);
return (error);
}
static int
ptsclose(struct cdev *dev, int flag, int mode, struct thread *td)
{
- struct ptsc *pti;
struct tty *tp;
int err;
tp = dev->si_tty;
- pti = dev->si_drv1;
-
- KASSERT(dev == pti->devs, ("ptsclose: dev != pti->devs"));
-
err = ttyld_close(tp, flag);
(void) tty_close(tp);
-
- pti->pt_devs_open = 0;
- pty_maybe_destroy_slave(pti);
-
return (err);
}
@@ -326,18 +286,12 @@
pt->pt_flags = 0;
pt->pt_send = 0;
pt->pt_ucntl = 0;
-
- if (!pt->devs)
- pty_create_slave(td->td_ucred, pt, minor(dev));
- pt->pt_devc_open = 1;
-
return (0);
}
static int
ptcclose(struct cdev *dev, int flags, int fmt, struct thread *td)
{
- struct ptsc *pti = dev->si_drv1;
struct tty *tp;
tp = dev->si_tty;
@@ -358,8 +312,6 @@
}
tp->t_oproc = 0; /* mark closed */
- pti->pt_devc_open = 0;
- pty_maybe_destroy_slave(pti);
return (0);
}
%%%
More information about the freebsd-amd64
mailing list