[net.bugs.4bsd] VAX750 interrupt metering bug fix

mike (03/11/83)

	Due to a great deal of interest in this fix, here it is.

		Mike Hibler
		ucbvax!unmvax!nmtvax!mike
		mike.nmt@rand-relay
------------------------------------------------------------------------
DESCRIPTION:
	This is not really a bug in 'config', but the fix goes here.

	The problem is that UNIBUS device interrupt "metering"
	(counting the # of interrupts for 'vmstat') is not done on
	VAX750s and VAX730s (VAXZZs).  On 780s, the UBA interrupts
	instead of the individual devices.  Because of this, the
	interrupts are counted in the common UBA interrupt handling
	routine (in 'locore.s').  This code is not even defined on
	non-780s and, as a result, the only interrupts which are
	counted are: the clock, the console, and Massbus devices.

TO REPRODUCE:
	Run 'vmstat 5' on a 750 system with no Massbus devices and
	the console idle.  Notice that the "in" field (device interrupts
	per second) is -1.  This is because we are only getting the
	59 clock interrupts per second (we are in the 60th when the
	data are averaged) and nothing else.  'vmstat' subtracts off
	the clock interrupts, and hence, we are left with -1.

FIX:
	In all the interrupt "preambles" (assembler interrupt handlers)
	defined in 'ubglue.s' we must include an increment of the
	proper field of the "metering" structure 'cnt'.  The fix is
	to add:

		#if defined(VAX750) || defined(VAXZZ)
			incl	_cnt+V_INTR
		#endif

	just before the 'rei' instruction in each routine.  Since this
	file is generated by 'config', the proper place to fix the
	problem is there, and not in 'ubglue.s'.

	The file we change is 'mkubglue.c'.  In diff format the changes
	look like:

77c77,85
< 	fprintf(fp, "\tcalls\t$1,_%s\n\tpopr\t$0x3f\n\trei\n\n", vector);
---
> 	fprintf(fp, "\tcalls\t$1,_%s\n\tpopr\t$0x3f\n", vector);
> 	/*
> 	 * Make sure we put out code to properly handle metering of
> 	 * UNIBUS device interrupts on VAX 730s and 750s.
> 	 */
> 	fprintf(fp, "#if defined(VAX750) || defined(VAXZZ)\n");
> 	fprintf(fp, "\tincl\t_cnt+V_INTR\n");
> 	fprintf(fp, "#endif\n");
> 	fprintf(fp, "\trei\n\n");
------------------------------------------------------------------------