Subject: Re: Eek! Didn't think of this!
To: None <thorpej@xenotropic.com>
From: Gordon W. Ross <gwr@mc.com>
List: port-sun3
Date: 01/04/1996 12:30:11
> X-Authentication-Warning: basalt.SJ.XENOTROPIC.COM: Host localhost.SJ.Xenotropic.COM didn't use HELO protocol
> Cc: port-sun3@netbsd.org
> From: Jason Thorpe <thorpej@xenotropic.com>
> Date: Thu, 04 Jan 1996 01:17:31 -0800
> Sender: owner-port-sun3@netbsd.org
> Precedence: list
> X-Loop: port-sun3@NetBSD.ORG
> 
> [ Cc'd to port-sun3 because this might be a problem there, too... ]
> 
> So, I had the occasion to want a crash dump (so I could keep the process 
> table around to debug something else) on my 4/260 today, which has been 
> running the new si driver (which I committed the other day) for a long 
> time...

Hmmm... Reminds me I need to do the sun3 crash dump support...

> The reason for the panic was along the lines of "kernel fault" (sorry, no 
> crash dump... :-/), and all was going fine until the si driver attempted 
> to kdvma_mapin() the buffer, which only made matters worse.  Needless to 
> say, my poor Sun 4 was quite confused and I couldn't get a crash dump.

On the sun3 dvma_mapin does not use much of the VM system, so this
might not be such a problem there.

> This is clearly a bug in the si driver, so I went poking around and 
> discovered that there's not really a way to tell a SCSI driver to _not_ 
> use DMA (or DVMA, in this case) during a crash dump.  A mechanism to 
> specify polling (rather than interrupts) exists and is used properly.

Perhaps SCSI commands submitted with the SCSI_POLL flag set should
use PIO instead of polled-DMA.  I don't think that would hurt.
There is already a hack to force SCSI_POLL during autoconfig:
[ In ncr5380_scsi_cmd() ]
	/*
	 * XXX: Hack: During autoconfig, force polling mode.
	 * Needed as long as sdsize() can be called while cold,
	 * otherwise timeouts will never call back (grumble).
	 */
	if (cold)
		flags |= SCSI_POLL;

I would add another, similar test of the variable "doingdump"
(or whatever it's named).

The SCSI_POLL flag causes the request to be enqueued with the
SR_IMMED flag set.  You could test the SR_IMMED flag and avoid
calling (*sc->sc_dma_alloc) when the flag is set.

Gordon