# Trying to compile and install just a part of /usr/src



## inurneck (Jan 10, 2010)

Hello, I am trying to edit some of the code in /usr/src. Specifically: 
/usr/src/sys/dev/usb/controller/usb_controller.c 

And the only Makefile is at the root /usr/src

How do I tell the Makefile to recompile just the usb directory and install it oppose to building and installing world. This must be possible, I just don't know how. Thanks.


----------



## fronclynne (Jan 10, 2010)

It's under /usr/src/sys thus can be compiled either as part of the *kernel*, or in the appropriate module (if possible).  You should be able to go to /usr/src/sys/modules/usb/ & type `# make depend && make all` (I think) to build all the USB module(s).  I don't know nor care to scratch out what modules under /usr/src/sys/modules/usb/ reference /usr/src/sys/dev/usb/controller/usb_controller.c, but I'm sure some poking around will tell you.


----------



## inurneck (Jan 10, 2010)

Thanks for your reply, I leaned out my kernel and made a custom one. I do not use modules at all I took them out of the config so the kernels devices are completely static. But i'll have a look around some more.


----------



## fronclynne (Jan 10, 2010)

In which case to test your code you'll have to recompile your whole kernel.  Not a big deal, I suppose, but you can't test the new code without a reboot.


----------



## inurneck (Jan 10, 2010)

I'll write this and be more specific while I await for more answers to my first post. This all stems from me still trying to get my mouse working! My kernel detects it fine it starts at boot, it runs in X flawlessly every option on it works but it completely and randomly sometimes after a minute in X or several hours it stops responding. The only way i can get it to work is rebooting. I tried restarting hald, dbus, devd i had moused in rc.conf i had each or all disabled, I have tried so many different varieties. Looking online I seen a post where this man HANS said that the guys usb controller crashed because it does what mine does (stops responding.) and when he unplugs it and plugs it back in it says USB_TIMEOUTT_ERROR device cant be assigned or similar. Before I go in x the mouse is fine and sometimes even fine in x for hours. Then it randomly dies. It starts automatically with devd currently. hald and dbus are enabled for gnome only because from what I read I believe gnome needs them.
Anyway what im doing is what hans said, hes editing the code to change the dma bits from 32 to 30 i went in my bios trying to fix this disabled everything parallel ports, serial anything not needed. I disabled my ps/2 port etc. When the box first boots i can take the mouse out and it disconnects showing me a message in /var/log/messages/ when i plug it back in it reconnects and does the same fine. But when it has this fit theres no arguing with it besides a reboot and it sucks. Te mouse stays lit up too it just dont work and when I cat /dev/ums0 it always says device busy. Its like something locks up. This post is long enough as it is but if you want to help tell me what other info you need and ill be grateful to help you help me get this fixed im beyond annoyed here. At first i thought it was dbus or hald and now I know its not them at all because i had them disabled at one point. oh theres one more thing. when it does crash or whatever i login remotely and kill xinit i look around but im probably not looking in the right places. theres no log in /var/log/messages its not a very verbose error. Anyway when it crashes if i restart /etc/rc.d/devd that happens but the mouse dont work and hald cpu goes thru the roof. again though i had hald and dbus both disabled and it did not solve the problem. im posting this now before my mouse dies or im gonna be beyond pissed. lol.


----------



## inurneck (Jan 10, 2010)

Ok ill compile a new kernel now after i edit that code like hans said. ive been leaning out the kernel i got it at 5 megabytes lol i got /usr src /usr/obj /var/tmp and /tmp all running from MD and i did 98% of it from info right here you are all very intelligent and helpful. Thanks to this site and howtos my kernel compiles in just two minutes.


----------



## inurneck (Jan 10, 2010)

Heres some more info i know your gonna want. Keep in mind it did this since the stock install of 8.0 witht he generic kernel so I do not think its anything i did tooling around with all the things im learning on this system. Heres some info. 


```
RC.CONF
polkitd_enable="YES"
system_tools_backends_enable="YES"
gnome_enable="YES"
hald_enable="YES"
dbus_enable="YES"
```


```
Copyright (c) 1992-2010 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 9.0-CURRENT #0: Sat Jan  9 10:09:30 EST 2010
    root@daemon:/usr/obj/usr/src/sys/core i386
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Intel Pentium III (927.11-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x686  Stepping = 6
  Features=0x387fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,PN,MMX,FXSR,SSE>
real memory  = 2147483648 (2048 MB)
avail memory = 2095923200 (1998 MB)
ACPI APIC Table: <DELL   PE2400  >
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 2 package(s) x 1 core(s)
 cpu0 (BSP): APIC ID:  1
 cpu1 (AP): APIC ID:  0
ioapic0: Changing APIC ID to 2
ioapic1: Changing APIC ID to 3
MADT: Forcing active-low polarity and level trigger for SCI
ioapic0 <Version 1.1> irqs 0-15 on motherboard
ioapic1 <Version 1.1> irqs 16-31 on motherboard
kbd1 at kbdmux0
acpi0: <DELL PE2400> on motherboard
acpi0: [ITHREAD]
acpi0: Power Button (fixed)
acpi0: reservation of 0, a0000 (3) failed
acpi0: reservation of 100000, f00000 (3) failed
acpi0: reservation of 1000000, 7f000000 (3) failed
Timecounter "ACPI-safe" frequency 3579545 Hz quality 850
acpi_timer0: <32-bit timer at 3.579545MHz> port 0x808-0x80b on acpi0
pcib0: <ACPI Host-PCI bridge> on acpi0
pci0: <ACPI PCI bus> on pcib0
pcib1: <ACPI PCI-PCI bridge> at device 2.0 on pci0
pci1: <ACPI PCI bus> on pcib1
pci1: <mass storage, SCSI> at device 6.0 (no driver attached)
aac0: <Dell PERC 2/Si> mem 0xf0000000-0xf7ffffff irq 31 at device 2.1 on pci0
aac0: [FILTER]
aac0: Adaptec RAID controller, aac driver 2.0.0-1
pcm0: <Creative Audigy (EMU10K2)> port 0xece0-0xecff irq 17 at device 4.0 on pci0
pcm0: <SigmaTel STAC9721/23 AC97 Codec>
pcm0: [ITHREAD]
pci0: <serial bus, FireWire> at device 4.2 (no driver attached)
vgapci0: <VGA-compatible display> port 0xe800-0xe8ff mem 0xf9000000-0xf9ffffff,0xfe005000-0xfe005fff at device 14.0 on pci0
isab0: <PCI-ISA bridge> port 0x580-0x58f at device 15.0 on pci0
isa0: <ISA bus> on isab0
ohci0: <OHCI (generic) USB controller> mem 0xfe004000-0xfe004fff irq 10 at device 15.2 on pci0
ohci0: [ITHREAD]
usbus0: <OHCI (generic) USB controller> on ohci0
pcib2: <ACPI Host-PCI bridge> on acpi0
pci2: <ACPI PCI bus> on pcib2
fxp0: <Intel 82559 Pro/100 Ethernet> port 0xdcc0-0xdcff mem 0xe7100000-0xe7100fff,0xe7000000-0xe70fffff irq 28 at device 6.0 on pci2
miibus0: <MII bus> on fxp0
inphy0: <i82555 10/100 media interface> PHY 1 on miibus0
inphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
fxp0: Ethernet address: 00:02:b3:30:22:7b
fxp0: [ITHREAD]
fdc0: <floppy drive controller> port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on acpi0
fdc0: [FILTER]
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
atkbd0: [ITHREAD]
atrtc0: <AT realtime clock> port 0x70-0x7f irq 8 on acpi0
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
orm0: <ISA Option ROMs> at iomem 0xc0000-0xc7fff,0xc8800-0xcc7ff pnpid ORM0000 on isa0
sc0: <System console> on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
Timecounters tick every 1.000 msec
aacd0: <Volume> on aac0
aacd0: 278847MB (571080192 sectors)
usbus0: 12Mbps Full Speed USB v1.0
ugen0.1: <(0x1166)> at usbus0
uhub0: <(0x1166) OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
uhub0: 2 ports with 2 removable, self powered
SMP: AP CPU #1 Launched!
Root mount waiting for: usbus0
ugen0.2: <Microsoft> at usbus0
ums0: <Microsoft Microsoft 3-Button Mouse with IntelliEye(TM), class 0/0, rev 1.10/3.00, addr 2> on usbus0
ums0: 3 buttons and [XYZ] coordinates ID=0
Trying to mount root from ufs:/dev/aacd0s1a
ugen0.2: <Microsoft> at usbus0 (disconnected)
ums0: at uhub0, port 1, addr 2 (disconnected)
ugen0.2: <Microsoft> at usbus0
ums0: <Microsoft Microsoft 3-Button Mouse with IntelliEye(TM), class 0/0, rev 1.10/3.00, addr 2> on usbus0
ums0: 3 buttons and [XYZ] coordinates ID=0
[root@daemon /usr/src/sys/dev/usb/controller]#
```


```
[root@daemon /usr/src/sys/dev/usb/controller]# usbconfig
ugen0.1: <OHCI root HUB (0x1166)> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen0.2: <Microsoft 3-Button Mouse with IntelliEye(TM) Microsoft> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
[root@daemon /usr/src/sys/dev/usb/controller]#
```


```
[root@daemon /daemon/kernel]# cat core
###############################################################################
###############################################################################
cpu 		I686_CPU
machine		i386
ident		core
# PF FIREWALL
device		bpf	   	# Berkeley packet filter
device		pf         	#
device 		pflog      	#
device		pfsync     	#
options		ALTQ       	#
options		ALTQ_CBQ   	# Class Bases Queuing (CBQ)
options		ALTQ_RED   	# Random Early Detection (RED)
options		ALTQ_RIO   	# RED In/Out
options		ALTQ_HFSC  	# Hierarchical Packet Scheduler (HFSC)
options		ALTQ_PRIQ  	# Priority Queuing (PRIQ)
options		ALTQ_NOPCC 	# Required for SMP build
options		HZ=1000
options		DEVICE_POLLING
options		IPSTEALTH
options		SHMSEG=16
options		SHMMNI=32
options		SHMMAX=2097152
options		SHMALL=4096
options		MAXFILES=8192
# Linux compatibility
options		COMPAT_LINUX
options		LINPROCFS
options		INCLUDE_CONFIG_FILE
# SoundBlaster Audigy2 xs
device		sound
device		snd_emu10k1
options		SCHED_ULE	# ULE scheduler
options		PREEMPTION	# Enable kernel thread preemption
options		INET		# InterNETworking
options		FFS		# Berkeley Fast Filesystem
options		SOFTUPDATES	# Enable FFS soft updates support
options		UFS_ACL		# Support for access control lists
options		UFS_DIRHASH	# Improve performance on big directories
options		UFS_GJOURNAL	# Enable gjournal-based UFS journaling
options		MD_ROOT		# MD is a potential root device
options 	CD9660		# ISO 9660 Filesystem
options 	PROCFS		# Process filesystem (requires PSEUDOFS)
options 	PSEUDOFS	# Pseudo-filesystem framework
options 	GEOM_PART_GPT	# GUID Partition Tables.
options 	GEOM_LABEL	# Provides labelization
options 	SCSI_DELAY=1000	# Delay (in ms) before probing SCSI
options 	KTRACE		# ktrace(1) support
options 	STACK		# stack(9) support
options 	SYSVSHM		# SYSV-style shared memory
options 	SYSVMSG		# SYSV-style message queues
options 	SYSVSEM		# SYSV-style semaphores
options 	P1003_1B_SEMAPHORES	# POSIX-style semaphores
options 	_KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options 	PRINTF_BUFR_SIZE=128	# Prevent printf output being interspersed.
options 	KBD_INSTALL_CDEV	# install a CDEV entry in /dev
options 	HWPMC_HOOKS	# Necessary kernel hooks for hwpmc(4)
options 	AUDIT		# Security event auditing
options 	MAC		# TrustedBSD MAC Framework
options		FLOWTABLE	# per-cpu routing cache
options 	KDTRACE_HOOKS	# Kernel DTrace hooks
# To make an SMP kernel, the next two lines are needed
options 	SMP		# Symmetric MultiProcessor Kernel
device		apic		# I/O APIC
# Bus support.
device		acpi
device		pci
# Floppy drives
device		fdc
# SCSI Controllers
device		aic		# Adaptec 15[012]x SCSI adapters, AIC-6[23]60.
# SCSI peripherals
device		scbus		# SCSI bus (required for SCSI)
device		da		# Direct Access (disks)
device		cd		# CD
# RAID controller
device		aac		# Adaptec FSA RAID
#Other misc
device		atkbdc		# AT keyboard controller
device		atkbd		# AT keyboard
device		kbdmux		# keyboard multiplexer
device		vga		# VGA video card driver
device		splash		# Splash screen and screen saver support
device		sc		# default console driver
device		agp		# support several AGP chipsets
device		miibus		# MII bus support need this for fxp
device		fxp		# Intel EtherExpress PRO/100B (82557, 82558)
# Pseudo devices.
device		loop		# Network loopback
device		random		# Entropy device
device		ether		# Ethernet support
device		pty		# BSD-style compatibility pseudo ttys
device		md		# Memory "disks"
device		firmware	# firmware assist module
# USB support
device		ohci	        # OHCI PCI->USB interface
device		usb	        # USB Bus (required)
device		ukbd            # Keyboard
device		ums             # Mouse
###############################################################################
[root@daemon /daemon/kernel]#
```

Anything else ask, Thanks.


----------



## inurneck (Jan 10, 2010)

```
usb2_req_re_enumerate:1533: getting device descriptor at addr 2 failed, 
USB_ERR_TIMEOUT!
ugen1.2: <> at usbus1 (disconnected)
uhub_reattach_port:417: could not allocate new device!
```
This is similar to the error I get when it does crash and i try to unplug and then plug it back in.


```
[root@daemon /etc]# vmstat -i
interrupt                          total       rate
irq1: atkbd0                       24160          3
irq10: ohci0                       51143          7
irq17: pcm0                         5019          0
irq28: fxp0                         4019          0
irq31: aac0                       159400         23
cpu0: timer                     13607051       1999
cpu1: timer                     13605210       1999
Total                           27456002       4034
```

So ive come a long way with this box after this mouse quest i only have one other problem which might be tied in. the network usually either right before or right after this mouse crash happens completely drops. i have the onboard ethernet controller off cause im not using it (im onto something as i write this.) im actually using a network card thats in a pci slot. It came with both i left it in because I wanted to learn how to set this up as a gateway but that can wait especially if it fixes the problem. I wonder if  I take that network card out, turn on the motherboard ethernet and use that if it will free something up thats causing this. I dont use both, and they both work and are in my kernel. So its worth a shit right. heh.


----------



## inurneck (Jan 10, 2010)

err. i just took that network card out and enabled the one builtin to the mb. but im finishing this post with just keyboard shortcuts and without a mouse it died within a minute of being in x.. I came right here upon boot. One thing it did change though is when the boot screen was coming up and it got to the mouse usually it hangs there slightly about 4 seconds. it didnt, it booted really fast. i have other pcs on my network when is the best time to debug this, now right? how can i debug this what should I run while it is crashed, type it out and post it here from another computer? I have tried near everything now.. Thanks. Ive posted a lot ill sit for some replies while I try what i was originaly doing with the code in usb_controller.c im gonna change the dma bits from 32 to 30 recompile a kernel and see what happens. Maybe its this shitty KVM switch. I have the keyboard plugged into an inland ps/2 2 port KVM switch but the mouse connected directly into the box's usb port because i need the keyboard to change boxes ex: scrl lock scrl lock ^ But I dont think that should matter its the mouse giving me problems not the keyboard.


----------



## inurneck (Jan 10, 2010)

I just got this out of /var/log/Xorg.0.log is this or my Etc/x11/xorg.conf helpful?

```
(II) Initializing built-in extension COMPOSITE
(II) Initializing built-in extension DAMAGE
(II) AIGLX: Loaded and initialized /usr/local/lib/dri/swrast_dri.so
(II) GLX: Initialized DRISWRAST GL provider for screen 0
(II) config/hal: Adding input device Microsoft 3-Button Mouse with IntelliEye(TM)
(II) LoadModule: "mouse"
(II) Loading /usr/local/lib/xorg/modules/input//mouse_drv.so
(II) Module mouse: vendor="X.Org Foundation"
	compiled for 1.6.1, module version = 1.4.0
	Module class: X.Org XInput Driver
	ABI class: X.Org XInput driver, version 4.0
(**) Microsoft 3-Button Mouse with IntelliEye(TM): Device: "/dev/sysmouse"
(==) Microsoft 3-Button Mouse with IntelliEye(TM): Protocol: "Auto"
(**) Microsoft 3-Button Mouse with IntelliEye(TM): always reports core events
(**) Option "Device" "/dev/sysmouse"
(==) Microsoft 3-Button Mouse with IntelliEye(TM): Emulate3Buttons, Emulate3Timeout: 50
(**) Microsoft 3-Button Mouse with IntelliEye(TM): ZAxisMapping: buttons 4 and 5
(**) Microsoft 3-Button Mouse with IntelliEye(TM): Buttons: 9
(**) Microsoft 3-Button Mouse with IntelliEye(TM): Sensitivity: 1
(II) XINPUT: Adding extended input device "Microsoft 3-Button Mouse with IntelliEye(TM)" (type: MOUSE)
(**) Microsoft 3-Button Mouse with IntelliEye(TM): (accel) keeping acceleration scheme 1
(**) Microsoft 3-Button Mouse with IntelliEye(TM): (accel) filter chain progression: 2.00
(**) Microsoft 3-Button Mouse with IntelliEye(TM): (accel) filter stage 0: 20.00 ms
(**) Microsoft 3-Button Mouse with IntelliEye(TM): (accel) set acceleration profile 0
(II) Microsoft 3-Button Mouse with IntelliEye(TM): SetupAuto: hw.iftype is 4, hw.model is 0
(II) Microsoft 3-Button Mouse with IntelliEye(TM): SetupAuto: protocol is SysMouse
(II) config/hal: Adding input device AT Keyboard
(II) LoadModule: "kbd"
(II) Loading /usr/local/lib/xorg/modules/input//kbd_drv.so
(II) Module kbd: vendor="X.Org Foundation"
	compiled for 1.6.1, module version = 1.3.2
	Module class: X.Org XInput Driver
	ABI class: X.Org XInput driver, version 4.0
(**) AT Keyboard: always reports core events
(**) Option "Protocol" "standard"
(**) AT Keyboard: Protocol: standard
(**) Option "AutoRepeat" "500 30"
(**) Option "XkbRules" "xorg"
(**) AT Keyboard: XkbRules: "xorg"
(**) Option "XkbModel" "pc105"
(**) AT Keyboard: XkbModel: "pc105"
(**) Option "XkbLayout" "us"
(**) AT Keyboard: XkbLayout: "us"
(**) Option "CustomKeycodes" "off"
(**) AT Keyboard: CustomKeycodes disabled
(II) XINPUT: Adding extended input device "AT Keyboard" (type: KEYBOARD)
[root@daemon /]#
```


```
[root@daemon /]# cat /etc/X11/xorg.conf
Section "ServerFlags"
	Option "AutoAddDevices" "true"
	Option "AutoEnableDevices" "true"
	Option "AllowEmptyInput" "true"
EndSection	

Section "ServerLayout"
        Identifier     "X.org Configured"
	Screen      0  "Screen0" 0 0
EndSection

Section "Files"
	ModulePath   "/usr/local/lib/xorg/modules"
	FontPath     "/usr/local/lib/X11/fonts/misc/"
	FontPath     "/usr/local/lib/X11/fonts/TTF/"
	FontPath     "/usr/local/lib/X11/fonts/OTF"
	FontPath     "/usr/local/lib/X11/fonts/Type1/"
	FontPath     "/usr/local/lib/X11/fonts/100dpi/"
	FontPath     "/usr/local/lib/X11/fonts/75dpi/"
EndSection

Section "Module"
	Load  "extmod"
	Load  "record"
	Load  "dbe"
	Load  "glx"
	Load  "dri"
	Load  "dri2"
EndSection

Section "Monitor"
	DisplaySize  1280	1024
        Option       "DPI" "96 x 96"
        DisplaySize  286       179    # In millimeters
	Identifier   "Monitor0"
	VendorName   "DEL"
	ModelName    "Dell E193FP"
	HorizSync    30.0 - 83.0
	VertRefresh   70.0 - 70.0

EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
        ### [arg]: arg optional
        #Option     "probe_sparse"       	# [<bool>]
        #Option     "accel"              	# [<bool>]
        #Option     "crt_display"        	# [<bool>]
        #Option     "composite_sync"     	# [<bool>]
        #Option     "hw_cursor"          	# [<bool>]
        #Option     "force_pci_mode"     	# [<bool>]
        #Option     "dma_mode"           	# <str>
        #Option     "agp_mode"           	# <i>
        #Option     "agp_size"           	# <i>
        #Option     "local_textures"     	# [<bool>]
        #Option     "buffer_size"        	# <i>
        #Option     "tv_out"             	# [<bool>]
        #Option     "tv_standard"        	# <str>
        #Option     "mmio_cache"         	# [<bool>]
        #Option     "test_mmio_cache"    	# [<bool>]
        #Option     "panel_display"      	# [<bool>]
        #Option     "reference_clock"    	# <freq>
        #Option     "shadow_fb"          	# [<bool>]
        #Option     "sw_cursor"          	# [<bool>]
        #Option     "AccelMethod"        	# <str>
        #Option     "RenderAccel"        	# [<bool>]
	Identifier  "Card0"
	Driver      "mach64"
	VendorName  "ATI Technologies Inc"
	BoardName   "3D Rage IIC"
	BusID       "PCI:0:14:0"
EndSection

Section "Screen"
	Option	"AllowGLXWithComposite" "true"
        Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	SubSection "Display"
		Viewport   0 0
		Depth     1
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     4
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     8
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     15
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     16
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection

[root@daemon /]#
```

Moused is still running, the mouse is lit up, usbconfig is the same output even though the mouse has crashed. etc.. I feel like im spamming my own thread i'll give everyone time to wake up and appreciate any ideas to solutions. Im rebooting the box anyway.


----------



## inurneck (Jan 10, 2010)

What about these errors with gnome? Have anything to do with it. Thats just some of them I get all kinds of them for some reason. Lastly how do I edit a previous post so I can add to them instead of reposting all the time. Id like to condense a few of these and clean it up. but I cant seem to find the option to do so. 

```
: Unable to lookup session information for process '1179'
Jan 10 17:24:24 daemon pulseaudio[1197]: module.c: module-detect is deprecated: Please use module-udev-detect instead of module-detect!
Jan 10 17:24:28 daemon pulseaudio[1212]: pid.c: Daemon already running.
Jan 10 17:24:51 daemon su: mike to root on /dev/pts/0
Jan 10 17:25:06 daemon gnome-session[1179]: WARNING: Unable to determine session: Unable to lookup session information for process '1179'
Jan 10 17:25:07 daemon last message repeated 2 times
Jan 10 17:26:02 daemon su: BAD SU mike to root on /dev/ttyv0
Jan 10 17:26:08 daemon gnome-session[1293]: WARNING: Unable to determine session: Unable to lookup session information for process '1293'
Jan 10 17:26:09 daemon pulseaudio[1312]: module.c: module-detect is deprecated: Please use module-udev-detect instead of module-detect!
Jan 10 17:26:11 daemon pulseaudio[1326]: pid.c: Daemon already running.
Jan 10 17:26:32 daemon su: mike to root on /dev/pts/0
Jan 10 17:35:51 daemon cvsupd[1412]: +0 mike@daemon.local.org (daemon) [SNAP_16_1h/17.0]
I have to update my src again because i rebooted and /usr/src is MD. Gonna change those bits from 32 to 30 in /usr/src/sys/dev/usb/controller/usb_controller.c like i originally intended and see if that changes anything.
```

Of course it's a big bright red button in front of my face.. >


----------



## inurneck (Jan 10, 2010)

I rebooted into the kernel with the edited /usr/src/sys/dev/usb/controller/usb_controller.c file and as soon as i am done supping /usr/src/ again (md, remember) ill show you all exactly what i changed. Is there a way to verify it worked and anything changed for my peace of mind? If you open the file above and search for 32 change it to 30 thats all i did. In the post above i showed you my vmstat -i before and here it is.

```
[root@daemon /etc]# vmstat -i
interrupt total rate
irq1: atkbd0 24160 3
irq10: ohci0 51143 7
irq17: pcm0 5019 0
irq28: fxp0 4019 0
irq31: aac0 159400 23
cpu0: timer 13607051 1999
cpu1: timer 13605210 1999
Total 27456002 4034
```

now with the edited kernel, I get this,
take a look at ohci0 thats USB

```
[root@daemon /]# vmstat -i
interrupt                          total       rate
irq1: atkbd0                         783          0
irq7: ohci0                         2210          2
irq16: fxp0                          138          0
irq17: pcm0                          522          0
irq31: aac0                        17129         17
cpu0: timer                      1995535       1999
cpu1: timer                      1993618       1997
Total                            4009935       4017
[root@daemon /]# cd /usr/src/sys
```

I dont know if this helped as it takes time for the mouse to die but so far so good. a lot of this I am still learning i just read on vmstat and interrupts so a lot of it is over my head but im starting to understand it. From what i can see its interrupting a lot less now? But at the same time, the box may have been up longer and it just grew. On a box with no issues, what should vmstat -i be showing, are either of the vmstats above unusual? I hope im making sense as i said im still learning im good with computers and well rounded off the waters up to my neck right now and im holding on learning as i go.


----------



## inurneck (Jan 10, 2010)

its climbing


```
[root@daemon /usr/src/sys/dev/usb]# vmstat -i
interrupt                          total       rate
irq1: atkbd0                        4737          2
irq7: ohci0                        16635          8
irq16: fxp0                         1067          0
irq17: pcm0                          522          0
irq31: aac0                       114096         57
cpu0: timer                      3958389       1999
cpu1: timer                      3956472       1998
Total                            8051918       4066
[root@daemon /usr/src/sys/dev/usb]#
```
its only been a few minutes.


----------



## inurneck (Jan 11, 2010)

I just wanted to let you all know I fixed it, I am not one to wait around so hopefully someone will learn from this thread. Unfortunately it's one of those pull your hair out problems that your never sure how you precisely fixed it because you did so much so fast. I did a lot of researching and reading, and twice as much trial and error. I ended up with this 85% done config file, I am now using what I believe is a better and newer RAID controller for my card ahc instead of aic that may have done it but as you can see here: 


```
[root@daemon /]# vmstat -i
interrupt                          total       rate
irq1: atkbd0                         339          0
irq7: ohci0                         1137          0
irq16: fxp0                          102          0
irq17: pcm0                          515          0
irq30: ahc0                         6949         20
irq31: aac0                         7412         21
cpu0: timer                       678231       1994
cpu1: timer                       667537       1963
Total                            1362222       4002
[root@daemon /]#
```

Im getting some joy.
I'll keep you updated if the problem persists but I am stress testing the hell out of this box and so far it's much faster and more stable. Heres the config I ended up with for a dell poweredge 2400

I still got some final tweaking to do but I consider it 80% leaned out.


```
[root@daemon /daemon/kernel]# cat core 
###############################################################################
###############################################################################
cpu 		I686_CPU
machine		i386
ident		core
maxusers	32
options         CPU_FASTER_5X86_FPU
options         NO_F00F_HACK

# PF FIREWALL
device		bpf	   	# Berkeley packet filter
device		pf         	# OpenBSD packet filter
device 		pflog      	# logging
device		pfsync     	# Sync
options		ALTQ       	# Altq support
options		ALTQ_CBQ   	# Class Bases Queuing (CBQ)
options		ALTQ_RED   	# Random Early Detection (RED)
options		ALTQ_RIO   	# RED In/Out
options		ALTQ_HFSC  	# Hierarchical Packet Scheduler (HFSC)
options		ALTQ_PRIQ  	# Priority Queuing (PRIQ)
options		ALTQ_NOPCC 	# Required for SMP build
options		HZ=1000
options		DEVICE_POLLING
options		IPSTEALTH
options		SHMSEG=16
options		SHMMNI=32
options		SHMMAX=2097152
options		SHMALL=4096
options		MAXFILES=8192

# Linux compatibility
options		COMPAT_LINUX
options		LINPROCFS
options		INCLUDE_CONFIG_FILE

# SoundBlaster Audigy2 xs
device		sound
device		snd_emu10k1

#Some stock options I have not gone through completely yet
options		SCHED_ULE	# ULE scheduler
options		PREEMPTION	# Enable kernel thread preemption
options		INET		# InterNETworking
options		FFS		# Berkeley Fast Filesystem
options		SOFTUPDATES	# Enable FFS soft updates support
options		UFS_ACL		# Support for access control lists
options		UFS_DIRHASH	# Improve performance on big directories
options		UFS_GJOURNAL	# Enable gjournal-based UFS journaling
options		MD_ROOT		# MD is a potential root device
options 	CD9660		# ISO 9660 Filesystem
options 	PROCFS		# Process filesystem (requires PSEUDOFS)
options 	PSEUDOFS	# Pseudo-filesystem framework
options 	GEOM_PART_GPT	# GUID Partition Tables.
options 	GEOM_LABEL	# Provides labelization
options 	SCSI_DELAY=1000	# Delay (in ms) before probing SCSI
options 	STACK		# stack(9) support
options 	SYSVSHM		# SYSV-style shared memory
options 	SYSVMSG		# SYSV-style message queues
options 	SYSVSEM		# SYSV-style semaphores
options 	P1003_1B_SEMAPHORES	# POSIX-style semaphores
options 	_KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options 	PRINTF_BUFR_SIZE=128	# Prevent printf output being interspersed.
options 	AUDIT		# Security event auditing
options 	MAC		# TrustedBSD MAC Framework
options		FLOWTABLE	# per-cpu routing cache

# To make an SMP kernel, the next two lines are needed
options 	SMP		# Symmetric MultiProcessor Kernel
device		apic		# Symmetric (APIC) I/O

# Bus support.
device		pci

# Floppy drives
device		fdc

# SCSI Controllers
device          ahc             # AHA2940 and onboard AIC7xxx devices
options         AHC_ALLOW_MEMIO

# SCSI peripherals
device		scbus		# SCSI bus (required for SCSI)
device          pass            # Passthrough device (direct SCSI access)
device		da		# Direct Access (disks)
device		cd		# CD

# RAID controller
device		aac		# Adaptec FSA RAID

# other misc
device		atkbdc		# AT keyboard controller
device		atkbd		# AT keyboard
device		kbdmux		# keyboard multiplexer
device		vga		# VGA video card driver
device		splash		# Splash screen and screen saver support
device		sc		# default console driver
options         SC_NORM_ATTR="(FG_LIGHTGREY|BG_BLACK)"
options         SC_NORM_REV_ATTR="(FG_BLACK|BG_LIGHTGREY)"
options         SC_KERNEL_CONS_ATTR="(FG_WHITE|BG_BLUE)"
options         SC_KERNEL_CONS_REV_ATTR="(FG_BLUE|BG_LIGHTGREY)"
device		agp		# support several AGP chipsets
device		miibus		# MII bus support need this for fxp
device		fxp		# Intel EtherExpress PRO/100B (82557, 82558)

# Pseudo devices.
device		loop		# Network loopback
device		random		# Entropy device
device		ether		# Ethernet support
device		pty		# BSD-style compatibility pseudo ttys
device		md		# Memory "disks"
device		firmware	# firmware assist module

# USB support
device		ohci	        # OHCI PCI->USB interface
device		usb	        # USB Bus (required)
device		ukbd            # Keyboard
device		ums             # Mouse
###############################################################################
[root@daemon /daemon/kernel]#
```

Let me know if you see anything that does not belong. I disabled ACPI and I am getting some errors during boot but im under the impression they are nothing to worry about from what I have read. Here's my dmesg in the next post as the forums limiting me to 10,000 chars.


----------



## inurneck (Jan 11, 2010)

```
[root@daemon /daemon/kernel]# dmesg
Copyright (c) 1992-2010 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 9.0-CURRENT #0: Mon Jan 11 01:06:59 EST 2010
    mike@daemon:/usr/obj/usr/src/sys/core i386
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Intel Pentium III (927.11-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x686  Stepping = 6
  Features=0x387fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,PN,MMX,FXSR,SSE>
real memory  = 2147483648 (2048 MB)
avail memory = 2096173056 (1999 MB)
MPTable: <DELL     POWEREDGE 9B>
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 2 package(s) x 1 core(s)
 cpu0 (BSP): APIC ID:  1
 cpu1 (AP): APIC ID:  0
ioapic0: Changing APIC ID to 2
ioapic0: Assuming intbase of 0
ioapic1: Changing APIC ID to 3
ioapic1: Assuming intbase of 16
ioapic0 <Version 1.1> irqs 0-15 on motherboard
ioapic1 <Version 1.1> irqs 16-31 on motherboard
pcib0: <MPTable Host-PCI bridge> pcibus 0 on motherboard
pci0: <PCI bus> on pcib0
pcib0: unable to route slot 15 INTA
pcib1: <MPTable PCI-PCI bridge> at device 2.0 on pci0
pci1: <PCI bus> on pcib1
ahc0: <Adaptec aic7880 Ultra SCSI adapter> port 0xfc00-0xfcff mem 0xfcfff000-0xfcffffff irq 30 at device 6.0 on pci1
ahc0: [ITHREAD]
aic7880: Ultra Single Channel A, SCSI Id=7, 16/253 SCBs
aac0: <Dell PERC 2/Si> mem 0xf0000000-0xf7ffffff irq 31 at device 2.1 on pci0
aac0: [FILTER]
aac0: Adaptec RAID controller, aac driver 2.0.0-1
pcm0: <Creative Audigy (EMU10K2)> port 0xece0-0xecff irq 17 at device 4.0 on pci0
pcm0: <SigmaTel STAC9721/23 AC97 Codec>
pcm0: [ITHREAD]
pci0: <serial bus, FireWire> at device 4.2 (no driver attached)
fxp0: <Intel 82559 Pro/100 Ethernet> port 0xec80-0xecbf mem 0xfe106000-0xfe106fff,0xfe000000-0xfe0fffff irq 16 at device 8.0 on pci0
fxp0: Enabling Rx lock-up workaround
miibus0: <MII bus> on fxp0
inphy0: <i82555 10/100 media interface> PHY 1 on miibus0
inphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
fxp0: Ethernet address: 00:b0:d0:aa:f0:bf
fxp0: [ITHREAD]
vgapci0: <VGA-compatible display> port 0xe800-0xe8ff mem 0xf9000000-0xf9ffffff,0xfe105000-0xfe105fff at device 14.0 on pci0
isab0: <PCI-ISA bridge> port 0x580-0x58f at device 15.0 on pci0
isa0: <ISA bus> on isab0
ohci0: <OHCI (generic) USB controller> mem 0xfe104000-0xfe104fff irq 7 at device 15.2 on pci0
ohci0: [ITHREAD]
usbus0: <OHCI (generic) USB controller> on ohci0
pcib2: <MPTable Host-PCI bridge> pcibus 2 on motherboard
pci2: <PCI bus> on pcib2
cpu0 on motherboard
cpu1 on motherboard
unknown: <PNP0c02> can't assign resources (memory)
fdc0: <Enhanced floppy controller> at port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 pnpid PNP0700 on isa0
fdc0: [FILTER]
unknown: <PNP0100> can't assign resources (irq)
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 irq 1 pnpid PNP0303 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
atkbd0: [GIANT-LOCKED]
atkbd0: [ITHREAD]
atrtc0: <AT realtime clock> at port 0x70-0x7f irq 8 pnpid PNP0b00 on isa0
orm0: <ISA Option ROMs> at iomem 0xc0000-0xc7fff,0xc8800-0xcc7ff pnpid ORM0000 on isa0
sc0: <System console> on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
unknown: <PNP0c02> can't assign resources (memory)
unknown: <PNP0100> can't assign resources (irq)
Timecounters tick every 1.000 msec
aacd0: <Volume> on aac0
aacd0: 278847MB (571080192 sectors)
usbus0: 12Mbps Full Speed USB v1.0
ugen0.1: <(0x1166)> at usbus0
uhub0: <(0x1166) OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
uhub0: 2 ports with 2 removable, self powered
ugen0.2: <Microsoft> at usbus0
ums0: <Microsoft Microsoft 3-Button Mouse with IntelliEye(TM), class 0/0, rev 1.10/3.00, addr 2> on usbus0
ums0: 3 buttons and [XYZ] coordinates ID=0
(probe0:ahc0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 
(probe0:ahc0:0:0:0): CAM Status: SCSI Status Error
(probe0:ahc0:0:0:0): SCSI Status: Check Condition
(probe0:ahc0:0:0:0): UNIT ATTENTION asc:29,0
(probe0:ahc0:0:0:0): Power on, reset, or bus device reset occurred
(probe0:ahc0:0:0:0): Retrying Command (per Sense Data)
(probe5:ahc0:0:5:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 
(probe5:ahc0:0:5:0): CAM Status: SCSI Status Error
(probe5:ahc0:0:5:0): SCSI Status: Check Condition
(probe5:ahc0:0:5:0): UNIT ATTENTION asc:29,0
(probe5:ahc0:0:5:0): Power on, reset, or bus device reset occurred
(probe5:ahc0:0:5:0): Retrying Command (per Sense Data)
(probe0:ahc0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0 
(probe0:ahc0:0:0:0): CAM Status: SCSI Status Error
(probe0:ahc0:0:0:0): SCSI Status: Check Condition
(probe0:ahc0:0:0:0): NOT READY asc:3a,0
(probe0:ahc0:0:0:0): Medium not present
(probe0:ahc0:0:0:0): Unretryable error
cd0 at ahc0 bus 0 scbus0 target 0 lun 0
cd0: <HP DVD-ROM 6x/32x 1.08> Removable CD-ROM SCSI-2 device 
cd0: 20.000MB/s transfers (20.000MHz, offset 8)
cd0: Attempt to query device size failed: NOT READY, Medium not present
cd1 at ahc0 bus 0 scbus0 target 5 lun 0
cd1: <NEC CD-ROM DRIVE:466 1.06> Removable CD-ROM SCSI-2 device 
cd1: 20.000MB/s transfers (20.000MHz, offset 15)
cd1: Attempt to query device size failed: NOT READY, Medium not present
SMP: AP CPU #1 Launched!
Trying to mount root from ufs:/dev/aacd0s1a
[root@daemon /daemon/kernel]#
```


----------



## fronclynne (Jan 12, 2010)

I'm not sure, but I think you should break your ideas/problems down into discreet groups and make separate threads in the appropriate categories.

The mouse problem is one that I dealt with back in the 6.x days by throwing the offending mouse away.

I don't know much about gnome, & I seriously wish I knew even less.

Insofaras your kernel tuning goes, I'm guessing that NO_F00F_HACK is pretty meaningless without I586_CPU*, & the other stuff may or may not be as meaningful.  Don't get too excited about stripping stuff out, you aren't going to gain a terrible lot unless your system is particularly slow, old, or space restricted.




*to quote /usr/src/sys/i386/conf/NOTES: 





> # NO_F00F_HACK disables the hack that prevents Pentiums (and ONLY
> # Pentiums) from locking up when a LOCK CMPXCHG8B instruction is
> # executed.  This option is only needed if I586_CPU is also defined,
> # and should be included for any non-Pentium CPU that defines it.


----------



## inurneck (Jan 12, 2010)

fronclynne said:
			
		

> I'm not sure, but I think you should break your ideas/problems down into discreet groups and make separate threads in the appropriate categories.
> 
> The mouse problem is one that I dealt with back in the 6.x days by throwing the offending mouse away.
> 
> ...



Thanks for the good advice. I am losing my patience with gnome, and fast. It's just so bloated, dbus is ridiculous I don't know why it's so tedious with xml file configs. hald is just hald. I want a different windows manager so I can get rid of this shit all together but all thats out there it seems is either gnome, which we both decided on that one apparently. Then theres enlightenment which I love but it's so damn buggy, I really wish they would relax on adding more stuff and just make what they have already stable. Maybe i'll give that another go, I have it e17 installed already. The rest of the window managers to me are just too damn simple. Although, as they say keep it simple stupid, I probably would not have any problems with them. What window manager is a good balance nowadays? As far as the no foof hack option I noticed that today and took it out I was up real late lastnight I guess I seen all pentiums and was just paste happy at the time. Im actually having a lot of fun trying to make the kernel as small and stable as possible, more importantly im learning a lot and havent broken anything yet. Actually thats not true. I mean permanently  so Far ive been able to fix what ive broken thats how i am learning. Anyway thanks for your input.


----------

