From owner-freebsd-alpha@FreeBSD.ORG Fri Feb 27 07:38:21 2004 Return-Path: Delivered-To: freebsd-alpha@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DA38916A4CE; Fri, 27 Feb 2004 07:38:21 -0800 (PST) Received: from electra.cse.Buffalo.EDU (electra.cse.Buffalo.EDU [128.205.32.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5AF0443D41; Fri, 27 Feb 2004 07:38:21 -0800 (PST) (envelope-from kensmith@cse.Buffalo.EDU) Received: from electra.cse.Buffalo.EDU (kensmith@localhost [127.0.0.1]) i1RFcKTr023083; Fri, 27 Feb 2004 10:38:20 -0500 (EST) Received: (from kensmith@localhost) by electra.cse.Buffalo.EDU (8.12.10/8.12.9/Submit) id i1RFcH0n023079; Fri, 27 Feb 2004 10:38:17 -0500 (EST) Date: Fri, 27 Feb 2004 10:38:17 -0500 From: Ken Smith To: Bruce Evans Message-ID: <20040227153817.GA22405@electra.cse.Buffalo.EDU> References: <20040227041147.GC26920@electra.cse.Buffalo.EDU> <20040228010638.F2867@gamplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040228010638.F2867@gamplex.bde.org> User-Agent: Mutt/1.4.1i cc: Ken Smith cc: freebsd-alpha@freebsd.org cc: freebsd-current@freebsd.org Subject: Re: Recent problems with -current on alpha... X-BeenThere: freebsd-alpha@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Alpha List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Feb 2004 15:38:22 -0000 On Sat, Feb 28, 2004 at 02:00:44AM +1100, Bruce Evans wrote: > On Thu, 26 Feb 2004, Ken Smith wrote: > > My patch moves the initialization of the promcons stuff until after > > the VM system is initialzed and comments out all the printf()'s I > > could find that might have happened before the console is initialized. > > This would break use of ddb until after the vm system is initialized > (unless it is already broken). i386 console initialization tries hard > to initiatialize the console as early as possible so that it can be > used for debugging. This is less needed with gdb, but early printfs > still need a console. Yup, this was bothering me too. Basically I'd like to get beast to the point I don't need to manually boot it every day, but I'm stubborn enough to not disable the nightly rebuild/reboot cron job just on the principle of it. :-) So, I've been poking around at this as best I can just to try and help isolate exactly what the problem is, I figured then maybe someone(s) with a bigger clue than me can take it from there. I don't know if this patch is an appropriate short-term fix (I'd tend to agree with Marcel that Alpha's console handling could use a fairly extensive overhaul). But it demonstrates the problem and with this patch beast seems to boot and runs just fine. This is better than what I had last night I think because it doesn't disturb what had been in place before except for delaying when make_dev() gets called. I don't know if that would have any bad side-effects. If I move the call to promcons_delayed_makedev() above the code block that this patch currently puts it under, and if I force the make_dev() to be called (beast doesn't actually use promcons for its console except during the early phase of the boot, it winds up switching to a different console in machdep.c at the point the comment block says "Initialize the real console, ...") then beast crashes with the kernel stack issues. With promcons_delayed_makedev() called where this patch puts it and similarly forcing the call to make_dev() beast doesn't crash and prints out two copies of every character sent to the console during boot so I'm fairly sure the patch is doing what is intended... Further comments welcome... I'm not totally sure where to go from here unless Marcel and/or Drew wants to take over... :-) Index: machdep.c =================================================================== RCS file: /home/ncvs/src/sys/alpha/alpha/machdep.c,v retrieving revision 1.216 diff -u -r1.216 machdep.c --- machdep.c 3 Jan 2004 02:02:24 -0000 1.216 +++ machdep.c 27 Feb 2004 13:28:23 -0000 @@ -201,6 +201,9 @@ long unknownmem; /* amount of memory with an unknown use */ int ncpus; /* number of cpus */ +int promcons_dly_mkdev = 1; /* need to delay call to make_dev() */ +void promcons_delayed_makedev(void); + vm_offset_t phys_avail[10]; /* must be 2 less so 0 0 can signal end of chunks */ @@ -887,6 +890,14 @@ thread0.td_md.md_kernnest = 1; #endif } + + /* + * Check to see if promcons needs to make_dev() now, + * doing it before now crashes with kernel stack issues. + */ + if (promcons_dly_mkdev > 1) + promcons_delayed_makedev(); + promcons_dly_mkdev = 0; /* * Initialize the virtual memory system, and set the Index: promcons.c =================================================================== RCS file: /home/ncvs/src/sys/alpha/alpha/promcons.c,v retrieving revision 1.34 diff -u -r1.34 promcons.c --- promcons.c 21 Feb 2004 21:10:38 -0000 1.34 +++ promcons.c 27 Feb 2004 13:38:29 -0000 @@ -83,6 +83,9 @@ int promparam(struct tty *, struct termios *); void promstop(struct tty *, int); +extern int promcons_dly_mkdev; +void promcons_delayed_makedev(void); + int promopen(dev, flag, mode, td) dev_t dev; @@ -248,9 +251,22 @@ { prom_consdev.cn_pri = CN_NORMAL; sprintf(prom_consdev.cn_name, "promcons"); - make_dev(&prom_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "promcons"); - cnadd(&prom_consdev); + if (promcons_dly_mkdev) + promcons_dly_mkdev++; + else { + make_dev(&prom_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "promcons"); + cnadd(&prom_consdev); + } promcn_attached = 1; +} + +void +promcons_delayed_makedev(void) +{ + if (promcn_attached) { + make_dev(&prom_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "promcons"); + cnadd(&prom_consdev); + } } void -- Ken Smith - From there to here, from here to | kensmith@cse.buffalo.edu there, funny things are everywhere. | - Theodore Geisel |