Re: Recent problems with -current on alpha...

From: Ken Smith <kensmith_at_cse.Buffalo.EDU>
Date: Fri, 27 Feb 2004 10:38:17 -0500
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
_at__at_ -201,6 +201,9 _at__at_
 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 */
_at__at_ -887,6 +890,14 _at__at_
 		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
_at__at_ -83,6 +83,9 _at__at_
 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;
_at__at_ -248,9 +251,22 _at__at_
 {
 	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_at_cse.buffalo.edu
  there, funny things are everywhere.   |
                      - Theodore Geisel |
Received on Fri Feb 27 2004 - 06:38:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:44 UTC