Subject: "Lint" kernel configuration, rotting code, proper options
To: None <tech-kern@netbsd.org>
From: Quentin Garnier <cube@cubidou.net>
List: tech-kern
Date: 01/13/2007 22:42:13
--GNsO7fNsq+j2k5eo
Content-Type: multipart/mixed; boundary="s+oWWcayER+yiG5Z"
Content-Disposition: inline


--s+oWWcayER+yiG5Z
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi folks,

As you may have noticed, I've recently committed a bunch of changes that
make some rarely (to say the least) used code to make it compile.

I came across those errors through the compilation of a so-called "lint"
kernel configuration obtained thanks to the -L flag of config(1) I
introduced earlier.

% ~/i386/tools/bin/nbconfig -L -s /cvsroot/commit/src/sys sys/arch/i386/con=
f/std.i386 > ~/i386.lint

This gives me a kernel configuration with all options selected.  For
various reasons, that configuration doesn't compile.  I'm attaching
the patch that shows which configuration I use.  I have committed
most of the changes I did to make it compile, but not all of them yet,
so it's still not enough against a clean source tree.

There are a lot of options commented out in that patch, you should note
that a lot of them are options defined by the ALTQ subsystem, which are
redefined in some source files unconditionally, I haven't investigated
why yet.

IPSEC and some pccons-related devices are disbaled because they conflict
with other options.  My current plan is to defflag a special option
(named "lintconfig" or something like that) and resolve the conflicts
under #ifdef lintconfig.  The said option would not be for user's
selection, but as a defflag, config -L would pick it up.

Some other options and instances are commented out because I couldn't
figure an easy way to make them compile, or because they just really
don't belong there (such as COMPAT_NETBSD32 on i386).

Note that in the end, it doesn't link, some symbols are missing.  One
of the reasons is that an option is defined in conf/files, but the files
that implement it are listed in a file that only specific archs include.

That said, here are my conclusions:

  - We have code that is seriously rotting.  Among the changes I made,
    there was a lot of const-related issues, incomplete initializer, and
    last but not least, proc -> lwp problems.  One driver, ega(4), uses
    the wrong number of arguments for callout_reset()...

    The question is, what do we want to do with those pieces of code?
    Take IPKDB, for instance.  Nobody could tell me if it ever worked,
    it is limited to a couple of network cards, and it did not see the
    light of a compiler for quite some time.

  - Negative options are bad.  config -L picks them, which actually
    reduce the amount of code tested.  And they rot, too.  One of the
    reasons the resulting kernel doesn't link is because of option
    NO_DEV_PTM.

  - We have a lot of drivers in sys/dev, supposedly MI, that actually
    assume things from the arch.  One example is the presence of the
    header machine/autoconf.h.  It's hard to be conclusive there: should
    those drivers compile on all archs, or only on archs where they make
    sense?  There are pros and cons for both, but in the latter case,
    the definitions for the drivers should only be seen by the relevant
    archs.

We're still a long way from being able to automate the use of config -L
in order to have all options tested as part of the regression tests
suite.

I experimented with that because I didn't really know what to expect
from it.  It wasn't a lot of work, but it sure was tedious enough.  On
the other hand, if done regularly enough, it will make things better.

One last word:  I'll try to find a way to defflag the remaining options
that are still not, such as DIAGNOSTIC, or at least find a way to enable
them in config -L.  I haven't given a long thought on how to proceed
yet, though.

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"You could have made it, spitting out benchmarks
Owe it to yourself not to fail"
Amplifico, Spitting Out Benchmarks, Hometakes Vol. 2, 2005.

--s+oWWcayER+yiG5Z
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff
Content-Transfer-Encoding: quoted-printable

--- i386.lint.up.orig	2007-01-13 20:50:22.000000000 +0100
+++ i386.lint.up	2007-01-13 21:56:06.000000000 +0100
@@ -6,7 +6,7 @@
=20
 options	EON
 options	ISICPNP_TEL_S0_16_3_P
-options	FIFOQ_STATS
+#options	FIFOQ_STATS
 options	PCIIDE_CMD064x_DISABLE
 options	PIM
 options	VNODE_LOCKDEBUG
@@ -31,7 +31,7 @@
 options	IN_RTFLUSH_DEBUG
 options	IPSELSRC
 options	COMPAT_M68K4K
-options	COMPAT_NETBSD32
+#options	COMPAT_NETBSD32
 options	FFS_NO_SNAPSHOT
 options	COMPAT_OSSAUDIO
 options	QUOTA
@@ -105,7 +105,7 @@
 options	NFS_BOOT_BOOTSTATIC
 options	ISICPNP_ELSA_PCC16
 options	COMPAT_IBCS2
-options	BLUE_STATS
+#options	BLUE_STATS
 options	IPKDB_NE_PCI
 options	SYSCTL_DEBUG_SETUP
 options	secmodel_bsd44_logic
@@ -116,7 +116,7 @@
 options	COMPAT_FREEBSD
 options	XBOX
 options	NTFS_DEBUG
-options	EXEC_ECOFF
+#options	EXEC_ECOFF
 options	BKTR_REVERSE_MUTE
 options	TCP_OUTPUT_COUNTERS
 options	COMPAT_43
@@ -161,7 +161,7 @@
 options	USBVERBOSE
 options	BKTR_NO_MSP_RESET
 options	PCMCIAVERBOSE
-options	CBQ_TRACE
+#options	CBQ_TRACE
 options	COM_DEBUG
 options	ISICPCMCIA_SBSPEEDSTAR2
 options	INET6
@@ -198,7 +198,7 @@
 options	ALTQ
 options	COMPAT_PECOFF
 options	ATHHAL_DEBUG
-options	RIO_STATS
+#options	RIO_STATS
 options	COMPAT_MACH
 options	SYSCALL_TIMES
 options	CALLWHEEL_STATS
@@ -214,9 +214,9 @@
 options	EXEC_MACHO
 options	RCONS_16BPP
 options	ISICISA_USR_STI
-options	secmodel_overlay
+#options	secmodel_overlay
 options	NATM
-options	ADJUST_CUTOFF
+#options	ADJUST_CUTOFF
 options	FONT_VT220KOI8x10_KOI8_R
 options	MPVERBOSE
 options	IRIP_VJ
@@ -243,16 +243,16 @@
 options	KSTACK_CHECK_DR0
 options	APM_USE_KVM86
 options	PCIBIOS
-options	RED_STATS
+#options	RED_STATS
 options	ISICPNP_ELSA_QS1ISA
 options	CODA_COMPAT_5
 options	PCI_BUS_FIXUP
 options	PCIVERBOSE
-options	IPSEC
+#options	IPSEC
 options	SYSCTL_INCLUDE_DESCR
 options	DEBUG_1284
 options	SYSCALL_TIMES_HASCOUNTER
-options	TCP_SIGNATURE
+#options	TCP_SIGNATURE
 options	COMPAT_NOMID
 options	PCI_NETBSD_CONFIGURE
 options	KVM86
@@ -260,14 +260,14 @@
 options	APPLE_UFS
 options	PMS_DISABLE_POWERHOOK
 options	MEMORY_DISK_IS_ROOT
-options	EXEC_COFF
+#options	EXEC_COFF
 options	EST_FREQ_USERWRITE
 options	ISICPNP_SIEMENS_ISURF2
 options	ATHHAL_ASSERT
 options	MTRR
 options	COMPAT_HPUX
 options	BKTR_430_FX_MODE
-options	FV_STATS
+#options	FV_STATS
 options	PCIBIOS_INTR_GUESS
 options	COMPAT_ULTRIX
 options	RAID_AUTOCONFIG
@@ -313,8 +313,8 @@
 options	ST_ENABLE_EARLYWARN
 options	FAST_IPSEC
 options	BKTR_SIS_VIA_MODE
-options	BORROW_OFFTIME
-options	EXEC_ELF64
+#options	BORROW_OFFTIME
+#options	EXEC_ELF64
 options	ALTQ_IPSEC
 options	UGEN_BULK_RA_WB
 options	COMPAT_DARWIN
@@ -326,7 +326,7 @@
 options	UFS_DIRHASH
 options	GATEWAY
 options	NOREDZONE
-options	ATHHAL_DEBUG_ALQ
+#options	ATHHAL_DEBUG_ALQ
 options	AHC_NO_TAGS
 options	ALTQ_BLUE
 options	COM_REGMAP
@@ -393,7 +393,7 @@
 options	WS_KERNEL_BG=3D"1"
 options	SEMMNS=3D"1"
 options	REALEXTMEM=3D"1"
-options	TCP_CONGCTL_DEFAULT=3D"1"
+options	TCP_CONGCTL_DEFAULT=3D"\"newreno\""
 options	SEMMNU=3D"1"
 options	WS_KERNEL_FG=3D"1"
 options	NFS_BOOTSTATIC_SERVER=3D"\"\""
@@ -546,7 +546,7 @@
 wsmouse0	at	wsmousedev?
 pckbd0	at	pckbport?
 wskbd0	at	wskbddev?
-pcconskbd0	at	pckbport?
+#pcconskbd0	at	pckbport?
 lm0	at	pnpbios?
 pciide0	at	pnpbios?
 atabus0	at	ata?
@@ -701,7 +701,7 @@
 r2025rtc0	at	iic? addr 0
 rs5c372rtc0	at	iic? addr 0
 adm1030c0	at	iic? addr 0
-adt7467c0	at	iic? addr 0
+#adt7467c0	at	iic? addr 0
 adt7463c0	at	iic? addr 0
 xrtc0	at	iic? addr 0
 dsrtc0	at	iic? addr 0
@@ -718,7 +718,7 @@
 fdc0	at	isa?
 mms0	at	isa?
 lms0	at	isa?
-pc0	at	isa?
+#pc0	at	isa?
 npx0	at	isa?
 isapnp0	at	isa?
 pcic0	at	isapnp?
@@ -743,8 +743,8 @@
 fmv0	at	isapnp?
 ep0	at	isapnp?
 tsdio0	at	isa?
-toaster0	at	tsdio?
-toasterlcd0	at	tsdio?
+#toaster0	at	tsdio?
+#toasterlcd0	at	tsdio?
 slhci0	at	isa?
 usb0	at	usbus?
 xboxcontroller0	at	usbdevif?
@@ -811,7 +811,7 @@
 az0	at	isa?
 sf2r0	at	isa?
 pcdisplay0	at	isa?
-ega0	at	isa?
+#ega0	at	isa?
 vga0	at	isa?
 pckbc0	at	isa?
 satlink0	at	isa?
@@ -917,14 +917,14 @@
 wpi0	at	pci?
 iwi0	at	pci?
 ipw0	at	pci?
-ndis0	at	pci?
+#ndis0	at	pci?
 re0	at	pci?
 dge0	at	pci?
 bce0	at	pci?
 skc0	at	pci?
 sk0	at	skc?
 txp0	at	pci?
-chipsfb0	at	pci?
+#chipsfb0	at	pci?
 radeonfb0	at	pci?
 unichromefb0	at	pci?
 voodoofb0	at	pci?
@@ -950,12 +950,12 @@
 viaenv0	at	viapm?
 btvmeii0	at	pci?
 vme0	at	vmebus?
-sc0	at	vme?
+#sc0	at	vme?
 si0	at	vme?
-xyc0	at	vme?
-xy0	at	xyc? drive ?
-xdc0	at	vme?
-xd0	at	xdc? drive ?
+#xyc0	at	vme?
+#xy0	at	xyc? drive ?
+#xdc0	at	vme?
+#xd0	at	xdc? drive ?
 ie0	at	vme?
 vme_slv0	at	vme?
 cbb0	at	pci?
@@ -1175,3 +1175,5 @@
 pseudo-device	loop
 pseudo-device	pty
 pseudo-device	bridge
+
+options	DIAGNOSTIC

--s+oWWcayER+yiG5Z--

--GNsO7fNsq+j2k5eo
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (NetBSD)

iQEVAwUBRalSNdgoQloHrPnoAQJcJQgAs872+S1fr1TJf5CwWk1Gcv+OtppHENHX
NeWh+HajiX+U2B3dc9dc+rIk2bB+7QmjyUpTiuorW1aVLqSgrqzVCvzIlyKdtVgu
GrnMVuIRJ7+Wr1upMiCmjtgK90n5sZCQThTPJ3f9FZLhJEhDcu1Y7FnT9xG9SIxp
lkwM8Wl+2Yinmgn9f3PB9i6n32gEUkMngbpAyzulYED0Z4rf12bpQTw+F0gqh91j
enMBPFfpc4TONmf+r8B5nnuZkJ45ASWZmJX2HWzfBD9wT14/Hw+VCnsTgEAkoMXs
GZ4+3/lpyvqAQq2yNI8I9UpmTmjENM5+LytY33tZdYA/jeBmVMl93Q==
=eMyO
-----END PGP SIGNATURE-----

--GNsO7fNsq+j2k5eo--