From owner-freebsd-current@FreeBSD.ORG Wed Feb 8 12:50:00 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6404316A420; Wed, 8 Feb 2006 12:50:00 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id 72C6D43D6D; Wed, 8 Feb 2006 12:49:53 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from flame.pc (dialup174.ach.sch.gr [81.186.70.174]) (authenticated bits=0) by igloo.linux.gr (8.13.5/8.13.5/Debian-3) with ESMTP id k18CnKfo005210; Wed, 8 Feb 2006 14:49:37 +0200 Received: by flame.pc (Postfix, from userid 1001) id 8A2FE5C5D; Wed, 8 Feb 2006 14:19:09 +0200 (EET) Date: Wed, 8 Feb 2006 14:19:09 +0200 From: Giorgos Keramidas To: Robert Watson Message-ID: <20060208121909.GA795@flame.pc> References: <20060201235556.GA708@troutmask.apl.washington.edu> <20060207104411.GA1067@flame.pc> <20060207132335.W37594@fledge.watson.org> <20060208105613.GA1181@flame.pc> <20060208110655.GC1181@flame.pc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060208110655.GC1181@flame.pc> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (score=-3.476, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.92, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr Cc: freebsd-current@freebsd.org, Steve Kargl , Olivier Houchard , freebsd-amd64@freebsd.org Subject: Re: HEADSUP: New pts code triggers panics on amd64 systems. 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: Wed, 08 Feb 2006 12:50:00 -0000 On 2006-02-08 13:06, Giorgos Keramidas wrote: > On 2006-02-08 12:56, Giorgos Keramidas wrote: > >On 2006-02-07 13:26, Robert Watson 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 -__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); } %%%