Commit Graph

64164 Commits

Author SHA1 Message Date
Marcel Moolenaar
01bd17cc99 Add kdb_cpu_sync_icache(), intended to synchronize instruction
caches with data caches after writing to memory. This typically
is required to make breakpoints work on ia64 and powerpc. For
those architectures the function is implemented.
2007-06-09 21:55:17 +00:00
Attilio Rao
a1fe14bc33 rufetch and calcru sometimes should be called atomically together.
This patch fixes places where they should be called atomically changing
their locking requirements (both assume per-proc spinlock held) and
introducing rufetchcalc which wrappers both calls to be performed in
atomic way.

Reviewed by: jeff
Approved by: jeff (mentor)
2007-06-09 21:48:44 +00:00
Andre Oppermann
104ebb2a45 Make the handling of the tcp window explicit for the SYN_SENT case
in tcp_outout().  This is currently not strictly necessary but paves
the way to simplify the entire SYN options handling quite a bit.
Clarify comment.  No change in effective behavour with this commit.

RFC1323 requires the window field in a SYN (i.e., a <SYN> or
<SYN,ACK>) segment itself never be scaled.
2007-06-09 21:19:12 +00:00
Andre Oppermann
5396d0f8d8 Remove some bogosity from the SYN_SENT case in tcp_do_segment
and simplify handling of the send/receive window scaling.  No
change in effective behavour.

RFC1323 requires the window field in a SYN (i.e., a <SYN> or
<SYN,ACK>) segment itself never be scaled.

Noticed by:	yar
2007-06-09 21:09:49 +00:00
Attilio Rao
86a49dea5b Since locking in kern/subr_prof.c is changed a bit, we need nomore of
time_lock spinlock exported.

Approved by: jeff (mentor)
2007-06-09 19:41:14 +00:00
Andre Oppermann
b7de7d87a0 Don't send pure window updates when the peer has closed the connection
and won't ever send more data.
2007-06-09 19:39:14 +00:00
Attilio Rao
a140976eb4 The current rusage code show peculiar problems:
- Unsafeness on ruadd() in thread_exit()
- Unatomicity of thread_exiit() in the exit1() operations

This patch addresses these problems allocating p_fd as part of the
process and modifying the way it is accessed.

A small chunk of this patch, resolves a race about p_state in kern_wait(),
since we have to be sure about the zombif-ing process.

Submitted by: jeff
Approved by: jeff (mentor)
2007-06-09 18:56:11 +00:00
Matt Jacob
65d32cd8fb Propagate volatile qualifier to make gcc4.2 happy. 2007-06-09 18:09:37 +00:00
Andre Oppermann
f58747375d Handle a race condition on >2 core machines in tcp_timer() when
a timer issues a shutdown and a simultaneous close on the socket
happens.  This race condition is inherent in the current socket/
inpcb life cycle system but can be handled well.

Reported by:	kris
Tested by:	kris (on 8-core machine)
2007-06-09 17:49:39 +00:00
Randall Stewart
2bf083e4c9 - Opps.. takes out debug printfs I accidentally left in :-( 2007-06-09 13:53:27 +00:00
Randall Stewart
d00aff5d79 - fix send_failed notification contents
- Reorder send failed to be in correct order.
- Fixed calulation of init-ack to be right off
  mbuf lengths instead of the precalculated value. This
  will fix one 64 bit platform issue.
2007-06-09 13:46:57 +00:00
Ruslan Ermilov
1f082787d4 Make this compile. 2007-06-09 11:07:07 +00:00
Darren Reed
a2ba8029c8 Pointer to an ICMP header was getting left behind after doing a pullup. 2007-06-09 09:28:36 +00:00
Warner Losh
387ecc9396 Expand USB_ATTACH_SETUP inline.
Kill devinfo stuff.
2007-06-09 06:53:27 +00:00
Warner Losh
8d58ce651f Expand USB_ATTACH_SETUP inline + devinfo tweaks
# looks like there's a chance that uaudio might compile on otherBSD, so leave
# those #defines alone as well as make this change in a compatible way.
2007-06-09 06:49:05 +00:00
Warner Losh
a5b1cb0cd0 Remove devinfo junk.
Remove bogus bzero/memset
Expand USB_ATTACH_SETUP
Minor nits
2007-06-09 06:42:19 +00:00
Warner Losh
07f51bab6d Remove lots of extra junk:
o other bsd defines, there's no way this would work there
o devinfo junk
2007-06-09 06:40:17 +00:00
Warner Losh
80170fd0c4 Kill devinfo stuff. It is no longer needed.
Kill bogus bzero as necessary.
Minor tidy.
Expand USB_ATTACH_SETUP inline where needed.
2007-06-09 06:39:43 +00:00
Warner Losh
7f5ede5819 Kill USB_MATCH_SETUP, since this is the only place it was used in the tree.
While I'm here, kill devinfo junk.
2007-06-09 06:38:19 +00:00
Warner Losh
e491a67b63 Try to set the data multiplexed feature, but don't care if there's an
error doing so.  It seems an increasing number of phones have this
quirk, and we're not keeping up.  There appears to be nothing bad that
happens for non-quirked phones.

Minor cleanups:
o prefer device_printf over printf
o kill devinfo stuff
o minor other preening.
2007-06-09 06:37:17 +00:00
Warner Losh
e591b223d8 The devinfo stuff has been moved up into the parent bus. There's no
need to do it at all anymore.  Remove it from here.  Expand
USB_ATTACH_SETUP inline now that it is one line and we're moving away
from the compat macros.  Remove some bzero calls that turn out not be
be necessary.
2007-06-09 06:31:07 +00:00
Marcel Moolenaar
354de1d7db Physical memory regions can be larger than INT_MAX. Change size1
from an int to a long to avoid printing negative byte and page
counts.
2007-06-09 01:19:08 +00:00
Warner Losh
58ba374e3d Cleanup messages printed on attach. Since the description gets set to
what we print, don't print it anymore.  And don't compute it anymore.
And don't malloc/free memory for it anymore.  While I'm here, prefer
device_printf where appropriate.
2007-06-08 22:25:09 +00:00
Doug White
d9306f7610 Don't cast the command argument to ether_ioctl() to an int since its not an
int anymore. This was causing all sorts of bad behavior when booting a system
with an nve interface present.
2007-06-08 22:00:56 +00:00
Attilio Rao
e682569165 Remove the MUTEX_WAKE_ALL option and make it the default behaviour for our
mutexes.
Currently we alredy force MUTEX_WAKE_ALL beacause of some problems with the
!MUTEX_WAKE_ALL case (unavioidable priority inversion).
2007-06-08 21:36:52 +00:00
Robert Watson
68d4cc614a Enable AUDIT by default in the GENERIC kernel, allowing security event
auditing to be turned on without a kernel recompile, just an rc.conf
option.

Approved by:	re (kensmith)
Obtained from:	TrustedBSD Project
2007-06-08 20:29:07 +00:00
Marcel Moolenaar
6d63683c41 Add my copyright.
Requested by: pjd@
2007-06-08 16:20:03 +00:00
Yaroslav Tykhiy
22b971db87 Replace a constant with an already defined symbolic name for it.
Tested with: md5(1)
2007-06-08 13:43:28 +00:00
Yaroslav Tykhiy
dba3c50842 Add a sysctl for the purge run interval so that it can
be tuned along with the rest of hostcache parameters.
The new sysctl name is `net.inet.tcp.hostcache.prune'.
2007-06-08 13:35:51 +00:00
Andrew Gallatin
0bb6a7159d Correct the definition of PFIL_HOOKED() so that it compares
the value of ph_nhooks to zero, not the address.  This removes
extranious calls to pfil_run_hooks (and an rw lock) from the
network stack's critical path when no pfil hooks are active.

Reviewed by: csjp
Sponsored by: Myricom Inc.
2007-06-08 12:43:25 +00:00
Pawel Jakub Dawidek
3b7917d766 - Reduce number of atomic operations needed to be implemented in asm by
implementing some of them using existing ones.
- Allow to compile ZFS on all archs and use atomic operations surrounded
  by global mutex on archs we don't have or can't have all atomic
  operations needed by ZFS.
2007-06-08 12:35:47 +00:00
Pawel Jakub Dawidek
083c4dd695 Missing atomic operations for ZFS/ia64.
Submitted by:	marcel
2007-06-08 12:26:30 +00:00
Poul-Henning Kamp
7acfb0af82 Double the WITNESS and DIAGNOSTIC benchmark warnings right before we
go into userland to improve the chances of people noticing them.
2007-06-08 11:47:36 +00:00
Randall Stewart
108df27c0b - RTO was not being initialized to 0, thus the rtt calculation
algoritm would not go through the proper initialization.
- The initialization was incorrect as well, causing problems in
  sat networks with > 1sec RTT
- Get rid of magic numbers in RTT calculations.
2007-06-08 10:57:11 +00:00
Hidetoshi Shimokawa
c59557f5d4 Timestamp after sent. 2007-06-08 09:04:30 +00:00
Hidetoshi Shimokawa
55f84274e3 Don't invalidate dcons buffer on shutdown.
We would like to keep connection after halt.
2007-06-08 08:23:14 +00:00
Hidetoshi Shimokawa
7acf69638a Fix a race after a bus reset.
- We are in FWBUSINIT state just after SID interrupt.
- Do not pass normal xfers before bus probe is done.
2007-06-08 07:53:59 +00:00
Xin LI
7b8c8b858c In getblk(), before gbincore(), use BO_LOCK directly when locking
the bufobj, rather than using VI_LOCK, like what was done with
revision 1.453.
2007-06-08 07:05:08 +00:00
Marcel Moolenaar
ba49b9f773 Sync with other platforms: add kluge to use contigmalloc when the
alignment is larger than the size and print a diagnostic when we
didn't satisfy the alignment.
2007-06-08 04:46:50 +00:00
Hidetoshi Shimokawa
293b847542 Add the address of IDT in the configuration ROM. (i386/amd64 only)
A change to dconschat(8) will follow so that it can bomb
this address over FireWire to reset a wedged system.

Though this method is just a hack and far from perfection,
it should be useful if you don't want to go machine room
just to reset or to power-cycle a machine without
remote-managed power supply.  And much better than doing:
# fwcontrol -m target-eui64
# dd if=/dev/zero of=/dev/fwmem0.2 bs=1m
2007-06-08 04:33:25 +00:00
Warner Losh
17ee700be6 gcc 4.2 thinks that tupleid is uninitialized. Or might be used
uninitialized.  It gets passed into other routines that initialize
it...  Cope by initializing.

Submitted by: mjacob
2007-06-08 04:03:57 +00:00
Hidetoshi Shimokawa
c8dde64562 Replace breakpoint() with kdb_enter(). 2007-06-08 03:05:57 +00:00
David Christensen
599741f908 - Fixed a problem that caused autonegotiation failures.
Submitted by:	tor.egge@cvsup.no.freebsd.org
MFC after:	4 weeks
2007-06-08 02:34:44 +00:00
Matt Jacob
208f1b3bd4 Propagae volatile qualifier. 2007-06-08 01:54:22 +00:00
Matt Jacob
76ab5302cf Fix preprocessor code to check for a symbol being defined prior to checking
for non-zero.
2007-06-08 01:49:04 +00:00
Matt Jacob
0f74a11673 Carry volatile type in cast so gcc 4.2 will be happy. 2007-06-08 01:48:23 +00:00
Matt Jacob
1fd47020d8 Quiet GCC 4.2 warning. 2007-06-08 01:39:04 +00:00
Matt Jacob
7325b9bce7 Remove the __inline qualifier from a function which is in fact not an
inline but instead a module wide function, thus quieting a GCC 4.2 warning.
2007-06-08 01:37:47 +00:00
Matt Jacob
ea47b6c8d2 Include now unused var within #if 0 where it come back if the other
#if 0 code comes back- quiets gcc 4.2
2007-06-08 01:34:04 +00:00
Matt Jacob
2342e96586 Remove assignment to uninitialized variable that wasn't then used anyway. 2007-06-08 01:21:20 +00:00
Hidetoshi Shimokawa
9953c34ca6 Poll bus resets on FireWire while kdb/gdb is active.
Now, it's safe to call the fwohci interrupt(polling) routine while ddb/gdb
is active. After this change, a dcons connnection over FireWire can survive
bus resets even in kernel debugger.

This means that it is not too late to plug a FireWire cable after a panic
to investigate the problem.

Actually there is a small window(between a jump to kernel from loader and
initialization of dcons_crom) in which no one can take care of a bus reset.
Except that window, firewire console should keep working
from loader to reboot even with a panic and a bus reset.
(as far as you enable LOADER_FIREWIRE_SUPPORT)
2007-06-08 00:54:44 +00:00
Robert Watson
faef53711b Move per-process audit state from a pointer in the proc structure to
embedded storage in struct ucred.  This allows audit state to be cached
with the thread, avoiding locking operations with each system call, and
makes it available in asynchronous execution contexts, such as deep in
the network stack or VFS.

Reviewed by:	csjp
Approved by:	re (kensmith)
Obtained from:	TrustedBSD Project
2007-06-07 22:27:15 +00:00
Olivier Houchard
d3cdd95ce0 There's no nobounce_dmamap on arm. 2007-06-07 21:51:09 +00:00
Andre Oppermann
45024be06f In tcp_hc_insert() we may have the case where we have hit the global
cache size limit but this bucket row is empty.  Normally we want to
recycle the oldest entry in the bucket row.  If there isn't any the
TAILQ_REMOVE leads to a panic by trying to remove a non-existing
element.  Fix this by just returning NULL and failing the insert.
This is not a problem as the TCP hostache is only advisory.

Submitted by:	jhb
2007-06-07 21:41:50 +00:00
John Baldwin
a66fde8d35 - Remove unused variable from create_thread().
- Move kern_thr_*() prototype to <sys/syscallsubr.h> where all the other
  kern_*() prototypes live.
2007-06-07 19:45:19 +00:00
Marcel Moolenaar
50e92415c7 Remove remaining references to pc_curtid missed in previous commit. 2007-06-07 18:36:58 +00:00
Marcel Moolenaar
f545763cbd Eliminate pmap_install(), which was used to wrap pmap_switch() and
grab sched_lock. This would serialize calls to pmap_switch from
cpu_switch(). With the introduction of thread_lock, this is not
possible anymore, because thread_lock is not a single lock. It
varies.  Secondly and most importantly, it's not needed at all. The
only requirement for pmap_switch() is that it's not preempted
while in the middle of updating the CPU and PCPU. In other words,
it's a critical region. No locking required.
2007-06-07 16:04:23 +00:00
Bruce A. Mah
5cca41595d Fix off-by-one error (introduced in r1.60) that had the effect of
disallowing a read of exactly MAXPHYS bytes.

Reviewed by:	des, rdivacky
MFC after:	1 week
Sponsored by:	nCircle Network Security
2007-06-07 15:04:30 +00:00
Hidetoshi Shimokawa
ac2d2894b4 Add a tunable hw.firewire.phydma_enable.
This is enabled by default.  It should be disabled for
those who are uneasy with peeking/poking from FireWire.

Please note sbp(4) and dcons(4) over FireWire need
this feature.
2007-06-07 13:20:48 +00:00
Christian Brueffer
578e607926 Remove compat ifdefs for version < 500014 from the rest of the USB files.
Approved by:	rwatson (mentor)
MFC after:	1 week
2007-06-07 09:29:37 +00:00
Konstantin Belousov
5dfd976f34 Bump __FreeBSD_version for the change of the vn_open/VOP_OPEN file index
argument to struct file *.

Requested by:	Csaba Henk <csaba-ml at creo hu>
2007-06-07 07:32:15 +00:00
Peter Wemm
e704d0ebe7 Calculate the correct PCI BAR for the Timedia based serial cards. The
Linux equivalent gives BAR offsets relative to the implied base of 0x10.
Our PUC_CFG_GET_RID functions have to add the base offset themselves.
2007-06-07 06:28:48 +00:00
Warner Losh
cf93a36f82 Fix spaces introduced in last commit 2007-06-07 06:05:53 +00:00
David Christensen
133ac1f5cc New Features:
- Added 2.5G support for BCM5708S.

MFC after:	4 weeks
2007-06-07 02:23:56 +00:00
David Christensen
7656f58e1c New features:
- Moved BCM5706S/5708S SerDes support to brgphy (since they are not technically
  TBI interfaces)
- Added 2.5G support for BCM5708S

Comments:
Since this driver is shared with bge I tested several available controllers
supported by bge and all worked as expected, however the list was not
exhaustive.  Need wider testing.

MFC after:	4 weeks
2007-06-07 02:21:38 +00:00
David Xu
c168150cf4 Fix compiling error. 2007-06-07 01:53:29 +00:00
Pyun YongHyeon
78bec5fa2f The maxsegsz of a dma tag created in de(4) is TULIP_DATA_PER_DESC bytes.
In Rx path it allocates a new mbuf with m_getcl(9) so the length of
the mbuf is MCLBYTES which is greater than a segment size specified by
the dma tag. This segment size mismatch caused a voluntary panic.
Fix the panic by settting the mbuf length to TULIP_DATA_PER_DESC.

Reported by:	Arne H Juul <arnej AT yahoo-inc DOT com>
Tested by:	Arne H Juul <arnej AT yahoo-inc DOT com>
2007-06-07 00:28:47 +00:00
Jeff Roberson
4736604759 - PCPU_ADD is no longer spelled with LAZY_ in the middle.
Submitted by:	attilio
2007-06-06 23:23:47 +00:00
Paolo Pisati
f9a41a1101 Teach the bridge wrapper how to handle the filter+ithread case.
Reviewed by: marius
2007-06-06 22:19:23 +00:00
Paolo Pisati
8d715a3523 -axe p_ih from struct puc_port cause it was useless
-correctly check for filter only handler

Reviewed by: marcel
Tested by: marcel
2007-06-06 22:17:01 +00:00
Andre Oppermann
1f939165ce Correctly print SEQ and IRS in the corresponding log message in
syncache_expand().
2007-06-06 22:10:12 +00:00
Andrew Gallatin
4930d13c50 Fix a typo to make this file compile 2007-06-06 18:33:38 +00:00
Sam Leffler
515d617e8d update copyrights to 2007 and convert to be 2-clause bsd-only 2007-06-06 15:49:16 +00:00
Hidetoshi Shimokawa
9950b741e9 MFp4: MPSAFE firewire stack.
- lock its own locks and drop Giant.
- create its own taskqueue thread.
- split interrupt routine
- use interrupt filter as a fast interrupt.
- run watchdog timer in taskqueue so that it should be
   serialized with the bottom half.
- add extra sanity check for transaction labels.
   disable ad-hoc workaround for unknown tlabels.
- add sleep/wakeup synchronization primitives
- don't reset OHCI in fwohci_stop()
2007-06-06 14:31:36 +00:00
Gleb Smirnoff
e9bf9fb67c Do not leak lock in the case of EEXIST error.
PR:		kern/92776
Submitted by:	Ed Schouten <Ed.Schouten tunix.nl>
2007-06-06 14:21:49 +00:00
Yoshihiro Takahashi
d0a2646099 MFi386: revision 1.657
Backout experimental adaptive-spin umtx code.
2007-06-06 13:04:15 +00:00
David Xu
42ce445fed Backout experimental adaptive-spin umtx code. 2007-06-06 07:35:08 +00:00
Pyun YongHyeon
f6e6f7f2fa Add support IC Plus IP101 10/100 PHY that is found on nVidia network
adapters.

Submitted by:	Shigeaki Tagashira < shigeaki AT se DOT hiroshima-u DOT ac DOT jp >
2007-06-06 07:07:23 +00:00
Pyun YongHyeon
3d6f32f19f Add IC Plus IP101 PHY 2007-06-06 07:05:02 +00:00
Pyun YongHyeon
9f6cc3adc7 Add support Vitesse VSC8601 PHY that is found on nVidia network
adapters.

Submitted by:	Shigeaki Tagashira < shigeaki AT se DOT hiroshima-u DOT ac DOT jp >
Tested by:	Yuri Pankov < yuri.pankov AT gmail DOT com>,
		Rainer Hurling <rhurlin AT gwdg DOT de >
2007-06-06 06:55:49 +00:00
Pyun YongHyeon
1fec2d74cf Add OUI for Vitesse Semiconductor.
Add Vitesse VSC8601 PHY.
2007-06-06 06:53:40 +00:00
Peter Grehan
921c1d50f0 Fix the compile. Band-aid until it is worked out how to use the context
switch api on ppc.
2007-06-06 06:01:56 +00:00
Marcel Moolenaar
cf23147053 Prefix unknown (i.e. un-aliased) partition types with '!'. This is
how they had to be given with ctlreq.
2007-06-06 05:06:14 +00:00
Marcel Moolenaar
33a558c7e9 Call sbuf_finish() before sbuf_data() and sbuf_len(). 2007-06-06 05:01:41 +00:00
Sam Leffler
ae8b733312 copyright updates:
o update to include 2007
o switch back to a 2-clause bsd-only license

Reviewed by:	onoe
2007-06-06 04:56:04 +00:00
Marcel Moolenaar
e825cb8f3f Include <sys/sched.h> for sched_throw(). 2007-06-06 04:44:19 +00:00
Jeff Roberson
710eacdc5f - Placing the 'volatile' on the right side of the * in the td_lock
declaration removes the need for __DEVOLATILE().

Pointed out by:	tegge
2007-06-06 03:40:47 +00:00
Randall Stewart
5f26a41d17 - Fixes a case where doing a sysctl would leave locks held
when coping out association data.
- Fixes a small bug that prevented the SCTP_UNORDERED indication
  from going up to the app on a recv in the sinfo_flags field.
2007-06-06 00:40:41 +00:00
Warner Losh
1fdf3b1b35 Add more IDs for the uftdi driver. Slight tweaks to patch by me.
Submitted by:  Thorsten Trampisch
PR: 113384
2007-06-05 21:06:17 +00:00
Ariff Abdullah
69f6d261cf - Do triple reads on reset register to detect read register bug. 2 reads
seems not enough to verify its consistencies.
- Define AC97_MIXER_SIZE as SOUND_MIXER_NRDEVICES (25), since we
  don't need more than that. Stop doing wild and random guess about
  its size since we're stricly bound to it.
2007-06-05 20:30:16 +00:00
Ariff Abdullah
34b8e37073 Fix (enable) phone out for laptops with ALC655, specifically
for Amilo Pro V2055.

PR:		kern/113101
Submitted by:	konrad@egipt-medytacje.pl
MFC after:	3 days
2007-06-05 20:12:40 +00:00
John Baldwin
ce0b0c05aa Move a warning under bootverbose as no machines that trigger it have ended
up being broken.
2007-06-05 18:57:48 +00:00
Attilio Rao
d301eb10c7 Fix a problem with not-preemptive kernels caming from mis-merging of
existing code with the new thread_lock patch.
This also cleans up a bit unlock operation for mutexes.

Approved by: jhb, jeff(mentor)
2007-06-05 18:57:09 +00:00
Warner Losh
6634080bee MFp4: When querying the operating condition of SD cards (using the
application specific SEND_OP_COND (CMD55 + ACMD41), go ahead and allow
100 tries.  This gives a timeout of a second rather than the ~100ms
the old style produces.

I've had one old 16MB SD card which needs the extra time.  I've now
had reports from the field that other cards need this too.

Originally done at BSDcan 2007 while waiting to give my embedding
madness minitalk.
2007-06-05 17:04:44 +00:00
Andrew Gallatin
c2c14a696c Use pmap_change_attr() to setup a write combine attribute for our
device memory, rather than relying on the less reliable MTRR method
used by mem_range_attr_set().

Glanced at by: jhb
2007-06-05 15:02:14 +00:00
Konstantin Belousov
b95b98b0bd Restore non-SMP build.
Reviewed by:	attilio
2007-06-05 14:20:13 +00:00
Hidetoshi Shimokawa
807d548b66 Remove GIANT_REQUIRED for upcoming changes in FireWire stack. 2007-06-05 14:15:45 +00:00
Yoshihiro Takahashi
89c0e02402 MFi386: revision 1.656
Add the machine-specific definitions for configuring the new physical
  memory allocator.

  Set the size of phys_avail[] and dump_avail[] using one of these
  definitions.
2007-06-05 11:49:56 +00:00
Alan Cox
e5c45405f0 Add the machine-specific definitions for configuring the new physical
memory allocator.

Set the size of phys_avail[] and dump_avail[] using one of these
definitions.

Approved by:	re
2007-06-05 05:17:20 +00:00
Scott Long
d4a4ddc6ba Satisfy witness during shutdown 2007-06-05 05:03:13 +00:00
Jeff Roberson
95e3a0bca3 - Better fix for previous error; use DEVOLATILE on the td_lock pointer
it can actually sometimes be something other than sched_lock even on
   schedulers which rely on a global scheduler lock.

Tested by:	kan
2007-06-05 04:12:46 +00:00
Jeff Roberson
c219b097af - Pass &sched_lock as the third argument to cpu_switch() as this will
always be the correct lock and we don't get volatile warnings this
   way.

Pointed out by:	kan
2007-06-05 03:46:54 +00:00
Jeff Roberson
36b369163b - Define TDQ_ID() for the !SMP case.
- Default pick_pri to off.  It is not faster in most cases.
2007-06-05 02:53:51 +00:00
David Christensen
051e756190 - Added a new Ethernet media type (2500BaseSX) to support BCM5708 controllers
which support a 2.5Gbps mode over fiber using next page extensions during
  autonegotiation.  Typically only found in blade systems which also include
  a Broadcom 2.5Gbps capable switch.

MFC after:	2 weeks
2007-06-05 00:32:01 +00:00
Jeff Roberson
5d68dad329 - Add a new argument to cpu_switch. This is a pointer to a mutex that
oldthread should point at before we return.
 - When cpu_switch() is called the td_lock pointer in the old thread may
   point at the blocked lock.  This prevents other processors from
   switching into this thread while we're still switching out.  Wait
   until we're done deactivating the vmspace before we release the
   thread by assigning to td_lock.
 - Before we can activate the new vmspace we must make sure that the new
   thread is not assigned to the blocked lock.  It may be in the process
   of switching out on another cpu.  Spin until the new thread is
   available.
2007-06-05 00:16:43 +00:00
Jeff Roberson
ebb6b0c0ec - Expose td_lock to assembly so it may be used in cpu_switch(). 2007-06-05 00:13:49 +00:00
Jeff Roberson
8e0185f604 - Remove sched_core.c. The maintainer has lost interest in pursuing this
and it has been neglected in the recent ksegrp removal as well as
   the thread_lock() changes.

Discussed with:	davidxu
2007-06-05 00:12:37 +00:00
Jeff Roberson
982d11f836 Commit 14/14 of sched_lock decomposition.
- Use thread_lock() rather than sched_lock for per-thread scheduling
   sychronization.
 - Use the per-process spinlock rather than the sched_lock for per-process
   scheduling synchronization.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-05 00:00:57 +00:00
Jeff Roberson
a8cdbf449a Commit 13/14 of sched_lock decomposition.
- Add a new parameter to cpu_switch() that is used to release the lock on
   the outgoing thread and properly acquire the lock on the incoming
   thread.  This parameter is not required for schedulers that don't do
   per-cpu locking and architectures which do not support it may continue
   to use the 4BSD scheduler.  This feature is presently not supported
   on ia64

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-04 23:58:47 +00:00
Jeff Roberson
1b1618fb12 - Change comments and asserts to reflect the removal of the global
scheduler lock.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-04 23:57:32 +00:00
Jeff Roberson
74aaec43e8 Commit 11/14 of sched_lock decomposition.
- There is no globally visible scheduler lock any longer.  For now the
   watchdog can only check Giant.  This model of checking particular locks
   is flawed and should be revisited.  Other metrics should be considered.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-04 23:56:33 +00:00
Jeff Roberson
e4b5aee3a8 Commit 10/14 of sched_lock decomposition.
- Use sched_throw() rather than replicating the same cpu_throw() code for
   each architecture.  This also allows the scheduler to use any locking it
   may want to.
 - Use the thread_lock() rather than sched_lock when preempting.
 - The scheduler lock is not required to synchronize release_aps.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-04 23:56:08 +00:00
Jeff Roberson
bd43e47156 Commit 10/14 of sched_lock decomposition.
- Add new spinlocks to support thread_lock() and adjust ordering.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-04 23:55:45 +00:00
Jeff Roberson
07a61420ff Commit 9/14 of sched_lock decomposition.
- Attempt to return the ttyinfo() selection algorithm to something sane
   as it has been broken and disabled for some time.  Adapt this algorithm
   in such a way that it does not conflict with per-cpu scheduler locking.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-04 23:55:32 +00:00
Jeff Roberson
3c2e44364e Commit 8/14 of sched_lock decomposition.
- Use a global umtx spinlock to protect the sleep queues now that there
   is no global scheduler lock.
 - Use thread_lock() to protect thread state.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-04 23:54:50 +00:00
Jeff Roberson
765b2891e8 Commit 7/14 of sched_lock decomposition.
- Use thread_lock() rather than sched_lock for per-thread scheduling
   sychronization.
 - Use the per-process spinlock rather than the sched_lock for per-process
   scheduling synchronization.
 - Use a global kse spinlock to protect upcall and thread assignment.  The
   per-process spinlock can not be used because this lock must be acquired
   via mi_switch() where we already hold a thread lock.  The kse spinlock
   is a leaf lock ordered after the process and thread spinlocks.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-04 23:54:27 +00:00
Jeff Roberson
11bda9b8d5 Commit 6/14 of sched_lock decomposition.
- Use thread_lock() rather than sched_lock for per-thread scheduling
   sychronization.
 - Use the per-process spinlock rather than the sched_lock for per-process
   scheduling synchronization.
 - Replace the tail-end of fork_exit() with a scheduler specific routine
   which can do the appropriate lock manipulations.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-04 23:53:34 +00:00
Jeff Roberson
40acdeabab Commit 5/14 of sched_lock decomposition.
- Protect the cp_time tick counts with atomics instead of a global lock.
   There will only be one atomic per tick and this allows all processors
   to execute softclock concurrently.
 - In softclock, protect access to rusage and td_*tick data with the
   thread_lock(), expanding the scope of the thread lock over the whole
   function.
 - Do some creative re-arranging in hardclock() to avoid excess locking.
 - Protect the p_timer fields with the per-process spinlock.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-04 23:53:06 +00:00
Jeff Roberson
a54e85fdbf Commit 4/14 of sched_lock decomposition.
- Use thread_lock() rather than sched_lock for per-thread scheduling
   sychronization.
 - Use the per-process spinlock rather than the sched_lock for per-process
   scheduling synchronization.
 - Move some common code into thread_suspend_switch() to handle the
   mechanics of suspending a thread.  The locking here is incredibly
   convoluted and should be simplified.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-04 23:52:24 +00:00
Jeff Roberson
2502c107ba Commit 3/14 of sched_lock decomposition.
- Add a per-turnstile spinlock to solve potential priority propagation
   deadlocks that are possible with thread_lock().
 - The turnstile lock order is defined as the exact opposite of the
   lock order used with the sleep locks they represent.  This allows us
   to walk in reverse order in priority_propagate and this is the only
   place we wish to multiply acquire turnstile locks.
 - Use the turnstile_chain lock to protect assigning mutexes to turnstiles.
 - Change the turnstile interface to pass back turnstile pointers to the
   consumers.  This allows us to reduce some locking and makes it easier
   to cancel turnstile assignment while the turnstile chain lock is held.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-04 23:51:44 +00:00
Jeff Roberson
d72e80f09a Commit 2/14 of sched_lock decomposition.
- Adapt sleepqueues to the new thread_lock() mechanism.
 - Delay assigning the sleep queue spinlock as the thread lock until after
   we've checked for signals.  It is illegal for a thread to return in
   mi_switch() with any lock assigned to td_lock other than the scheduler
   locks.
 - Change sleepq_catch_signals() to do the switch if necessary to simplify
   the callers.
 - Simplify timeout handling now that locking a sleeping thread has the
   side-effect of locking the sleepqueue.  Some previous races are no
   longer possible.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-04 23:50:56 +00:00
Jeff Roberson
7b20fb19fb Commit 1/14 of sched_lock decomposition.
- Move all scheduler locking into the schedulers utilizing a technique
   similar to solaris's container locking.
 - A per-process spinlock is now used to protect the queue of threads,
   thread count, suspension count, p_sflags, and other process
   related scheduling fields.
 - The new thread lock is actually a pointer to a spinlock for the
   container that the thread is currently owned by.  The container may
   be a turnstile, sleepqueue, or run queue.
 - thread_lock() is now used to protect access to thread related scheduling
   fields.  thread_unlock() unlocks the lock and thread_set_lock()
   implements the transition from one lock to another.
 - A new "blocked_lock" is used in cases where it is not safe to hold the
   actual thread's lock yet we must prevent access to the thread.
 - sched_throw() and sched_fork_exit() are introduced to allow the
   schedulers to fix-up locking at these points.
 - Add some minor infrastructure for optionally exporting scheduler
   statistics that were invaluable in solving performance problems with
   this patch.  Generally these statistics allow you to differentiate
   between different causes of context switches.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-04 23:50:30 +00:00
Attilio Rao
b4b7081961 Do proper "locking" for missing vmmeters part.
Now, we assume no more sched_lock protection for some of them and use the
distribuited loads method for vmmeter (distribuited through CPUs).

Reviewed by: alc, bde
Approved by: jeff (mentor)
2007-06-04 21:45:18 +00:00
Attilio Rao
6759608248 Rework the PCPU_* (MD) interface:
- Rename PCPU_LAZY_INC into PCPU_INC
- Add the PCPU_ADD interface which just does an add on the pcpu member
  given a specific value.

Note that for most architectures PCPU_INC and PCPU_ADD are not safe.
This is a point that needs some discussions/work in the next days.

Reviewed by: alc, bde
Approved by: jeff (mentor)
2007-06-04 21:38:48 +00:00
David Malone
041b706b2f Despite several examples in the kernel, the third argument of
sysctl_handle_int is not sizeof the int type you want to export.
The type must always be an int or an unsigned int.

Remove the instances where a sizeof(variable) is passed to stop
people accidently cut and pasting these examples.

In a few places this was sysctl_handle_int was being used on 64 bit
types, which would truncate the value to be exported.  In these
cases use sysctl_handle_quad to export them and change the format
to Q so that sysctl(1) can still print them.
2007-06-04 18:25:08 +00:00
David Malone
df82ff50ed Add a function for exporting 64 bit types. 2007-06-04 18:14:28 +00:00
Marcel Moolenaar
e59febd747 Revert to the previous version where the return value of uart_getenv()
is being ignored. It's optional and the lack of environment variable
is not an error condition.
2007-06-04 17:53:42 +00:00
Doug Ambrisko
5be25877a1 Add in a couple of things:
-	In the ioctl path let command get queued up and return
	when complete _without_ blocking the driving waiting for
	the response.  This way the driver doesn't "lock up" for
	~30s during a flash command.  Submitted by scottl.
      -	Add a guard so that if a DCMD of 0 is sent down the ioctl
	path don't send it to the controller.  Return with a
	status of OK.  This is a little strange since MegaCli
	doesn't seem to like something and will issue some DCMD
	of 0.  This doesn't happen under Linux.  So the emulation
	needs to be improved but I'm not sure what.  Another strange
	thing is that when a DCMD of 0 gets issued under i386 the
	controller returns OK but in amd64 the context is messed
	up.
      -	Add a guard so the context has to be with-in the legal
	limit so we get a reasonable error assertion versus random
	panic.

It's going to be a challenge to figure out why MegaCli is not totally
happy and then sends some bogus commands.  This means that flashing
firmware via the Linux tool won't work since it generates a DCMD of
0 when it should be opening the firmware for a flash update.  Without
this problem flashing works fine.  This means there is no publicly
available tool to upgrade the RAID firmware under FreeBSD right now.

I plan to MFC all of the mfi changes to 6.X shortly.  This might not
include the SCSI pass-through changes.

Submitted by:	scottl
Reviewed by:	scottl
MFC after:	3 days
2007-06-04 16:39:22 +00:00
Alexander Motin
c35e19c430 No need to update link queue stats when round-robin algorithm enabled.
Approved by:	glebius (mentor)
2007-06-04 13:50:09 +00:00
Pawel Jakub Dawidek
b166b92692 Reimplement traverse() helper function:
1. Pass locking flags to VFS_ROOT().
2. Check v_mountedhere while the vnode is locked.
3. Always return locked vnode on success.

Change 1 fixes problem reported by Stephen M. Rumble - after
zfs_vfsops.c,1.9 change, zfs_root() no longer locks the vnode
unconditionally and traverse() didn't pass right lock type to
VFS_ROOT(). The result was that kernel paniced when .zfs/ directory
was accessed via NFS.
2007-06-04 11:31:46 +00:00
Brian Somers
7344a290dc Now that tone & delay times are correct (independent of hz), adjust
playtone() so that it uses times of 1/100ths of a second.

Now 'time echo T60ABC >/dev/speaker' takes ~3 seconds.

MFC after:		2 weeks
Problem noted by:	dwmalone
2007-06-04 09:27:13 +00:00
Brian Somers
b2424ac045 Speaker durations are specified in 1/100ths of a second according to
spkr(4).

PR:		70610, 67995
Submitted by:	dada at sbox dot tugraz dot at (modulo one fix)
MFC after:	2 weeks
2007-06-04 08:33:18 +00:00
Alan Cox
9211deca08 Add the machine-specific definitions for configuring the new physical
memory allocator.

Approved by:	re
2007-06-04 08:02:22 +00:00
Scott Long
a490742913 Track an update in the MPI headers that was missed earlier. 2007-06-04 06:18:07 +00:00
JINMEI Tatuya
5e9510e3b6 cleanup about the reassembly structures and routine:
- removed unused structure members
  - fixed a minor bug that the ECN code point may not be restored correctly

Approved by:	ume (mentor)
MFC after:	1 week
2007-06-04 06:06:35 +00:00
Pyun YongHyeon
12fb0330d8 o Implemented Rx/Tx checksum offload. The simple checksum logic in
GEMs is unable to discriminate UDP from TCP packets such that
  it can generate 0x0000 checksum value for the UDP datagram. So the
  UDP checksum offload was disabled by default. You can enable it
  by setting link0 flag with ifconfig(8).
o bus_dma(9) clean up. It now correctly set number of required DMA
  segments/size and removed incorrect use of BUS_DMA_ALLOCNOW flag
  in static allocations done via bus_dmamem_alloc(9).
o Implemented ALTQ(9) support.
o Implemented Tx side bus_dmamap_load_mbuf_sg(9) which can remove
  several book keeping chores orginated from call-back mechanism.
  Therefore gem_txdma_callback() was removed and its functionality
  was reimplemented in gem_load_txmbuf().
o Don't set GEM_TD_START_OF_PACKET flag until all remaining mbuf
  chains are set. I think it was a long standing bug and it caused
  fluctuating interrupts/CPU usage patterns while netperf test
  is in progress. Previously it seems that we race with the device.
  Because I don't have a documentation for GEM I'm not sure this is
  correct but almost all other documentations I have stated this
  implications on setting SOP mark in descriptor ring(e.g. hme(4)).
o Borrowed gem_defrag() from ath(4) which is supposed to be much
  faster than m_defrag(9) since it's not need to defrag all
  mbuf chains.
o gem_load_txmbuf() was changed to allow passed mbuf chains to free.
  Caller of gem_load_txmbuf() correctly handles freed mbuf chains.
o In gem_start_locked(), added checks for availability of Tx
  descriptors before trying to load DMA maps which could save CPU
  cycles when number of available descriptors are low. Also, simplyfy
  IFF_DRV_OACTIVE detection logic.
o Removed hard-coded function names in CTR macros and replaced it
  with __func__.
o Moved statistics counter register access to gem_tick() to reduce
  number of PCI bus accesses. There is no reason to update statistics
  counters in interrupt handler.
o Removed unnecessary call of gem_start_locked() in gem_ioctl().

Reviewed by:	grehan (initial version), marius (with improvements and suggestions)
Tested by:	grehan (ppc), marius(sparc64)
2007-06-04 06:01:04 +00:00
Warner Losh
6e878bc765 Migrate from setting a CARD_OK flag in a shared word, to setting its
own entry in the softc.  This should allow more of cbb_pci_intr() to
migrate to a new cbb_pci_filt() so that we don't have to run cbb's ISR
in almost every case we get an interrupt.  We can't just move
cbb_pci_intr into cbb_pci_filt because it does things that aren't safe
to do from a fast interrupt handler, err I mean from a filter.  This is
an important first step.

# I wonder if I need to make cardok volatile or not.
2007-06-04 05:59:44 +00:00
Scott Long
a54876ea20 Free the portinfo object on unload. 2007-06-04 04:35:04 +00:00
Warner Losh
16f89cb420 Don't register cb_func_filt if the client driver doesn't have a filter.
ditto for the isr.

Reviewed/Suggested by: simokawa-san
2007-06-04 03:13:24 +00:00
Darren Reed
d7eeb25225 Merge IPFilter 4.1.23 back to HEAD
See src/contrib/ipfilter/HISTORY for details of changes since 4.1.13
2007-06-04 02:54:36 +00:00
Darren Reed
2bf2a702cc This commit was generated by cvs2svn to compensate for changes in r170263,
which included commits to RCS files with non-trunk default branches.
2007-06-04 02:50:28 +00:00
Darren Reed
103b406762 Import IPFilter 4.1.23 to vendor branch.
See src/contrib/ipfilter/HISTORY for details of changes since 4.1.13
2007-06-04 02:50:28 +00:00
Alan Cox
04f70df029 Add the machine-specific definitions for configuring the new physical
memory allocator.

Approved by:	re
2007-06-04 02:32:07 +00:00
Alan Cox
c63f556284 Add the machine-specific definitions for configuring the new physical
memory allocator.

Approved by:	re
2007-06-03 23:33:11 +00:00
Alan Cox
5b4a3e940f Add the machine-specific definitions for configuring the new physical
memory allocator.

Set the size of phys_avail[] and dump_avail[] using one of these
definitions.

Approved by:	re
2007-06-03 23:18:29 +00:00
Scott Long
1d558d6a15 mpt.c:
mpt.h:
	Add support for reading extended configuration pages.
mpt_cam.c:
	Do a top level topology scan on the SAS controller.  If any SATA
	device are discovered in this scan, send a passthrough FIS to set
	the write cache.  This is controllable through the following
	tunable at boot:

	hw.mpt.enable_sata_wc:
		-1 = Do not configure, use the controller default
		 0 = Disable the write cache
		 1 = Enable the write cache

	The default is -1.  This tunable is just a hack and may be
	deprecated in the future.

Turning on the write cache alleviates the write performance problems with
SATA that many people have observed.  It is not recommend for those who
value data reliability!  I cannot stress this strongly enough.  However,
it is useful in certain circumstances, and it brings the performence in line
with what a generic SATA controller running under the FreeBSD ATA driver
provides (and the ATA driver has had the WC enabled by default for years).
2007-06-03 23:13:05 +00:00
Scott Long
62ae194db2 Update to MPI 1.5.16 2007-06-03 22:58:27 +00:00
Alan Cox
518538603d Prepare for the new physical memory allocator: Change the way that the
physical page's color is obtained.

Approved by:	re
2007-06-03 19:39:38 +00:00
Kris Kennaway
cdcc788a7e Revert some debugging KTRs that were added during development. 2007-06-03 18:24:31 +00:00
Ariff Abdullah
9c271f79d6 Insert NULL pointer checking around devclass_get_maxunit(pcm_devclass, ..) .
Things can get ugly without it due to uninitialized class. RELENG_6 need
a simmilar, but different treatment as well.

err.. perhaps we should teach devclass_get_maxunit() to return -1 ?

MFC after:	1 day
2007-06-03 10:56:22 +00:00