Commit Graph

39264 Commits

Author SHA1 Message Date
John Baldwin
213b19e9fb - Use a local struct proc variable to improve readability.
- Use a local variable to close a minor race when determining if the wmesg
    printed out needs a prefix such as when a thread is blocked on a lock.
2003-04-17 22:36:40 +00:00
John Baldwin
f5d5cb3c7c Tweak locking in the PS_XCPU handler to hold the sched_lock while reading
p_runtime.
2003-04-17 22:33:04 +00:00
John Baldwin
b68e08498f The sched_lock is not needed while clearing two of the P_STOPPED bits in
p_flag.  Also, the proc lock can't be recursed, so simplify an older proc
lock assertion.
2003-04-17 22:31:54 +00:00
John Baldwin
b5a2bad175 Don't assume that p_session hasn't changed out from under us after unlocking
the process and session.  Instead, cache a true reference to the session
when we do the hold and release our reference on that session.  This avoids
the need for the proc lock when dropping the reference.
2003-04-17 22:30:43 +00:00
John Baldwin
f385f7156a Lock the sched_lock while setting TDF_INPANIC. 2003-04-17 22:29:23 +00:00
John Baldwin
27dad03c97 Use TD_IS_RUNNING() instead of thread_running() in the adaptive mutex
code.
2003-04-17 22:28:58 +00:00
John Baldwin
0bfc4d1445 fork1() already sets PS_INMEM, so don't set it again. This lets us push
sched_lock down slightly so that it isn't needed in the RFSTOPPED case.
2003-04-17 22:28:28 +00:00
John Baldwin
69c4ee54ff - The prison mutex cannot possibly protect pointers to the prison it
protects, so don't bother locking it while we assign it to a ucred's
  cr_prison.
- Fully construct the new credential for a process before assigning it to
  p_ucred.
2003-04-17 22:26:53 +00:00
John Baldwin
e674d80790 Add some locking in for a few proc and thread fields. 2003-04-17 22:25:35 +00:00
John Baldwin
bb0e8070fd - Push Giant down into the fork1() function a small bit.
- Set p_acflag earlier while already hold the proc lock in fork1().
- Mark the realitexpire() callout MPSAFE for new processes.  It was already
  marked safe for proc0 a long while ago.
2003-04-17 22:24:59 +00:00
John Baldwin
462f31bff0 Adjust a few comments. 2003-04-17 22:22:47 +00:00
John Baldwin
94df4b8584 Protect td_sigmask with the proc lock. 2003-04-17 22:21:57 +00:00
John Baldwin
538621734a Test the P_WEXIT flag while already hold the proc lock instead of right
after dropping it.
2003-04-17 22:21:05 +00:00
John Baldwin
7e653dbd3b Hold the proc lock across a wider range of fields that it protects. 2003-04-17 22:20:30 +00:00
John Baldwin
aff1d36ceb Add some missing proc mutex unlocks. 2003-04-17 22:19:47 +00:00
John Baldwin
e5567180fb Don't drop the proc lock just to reacquire it after a few simple assignment
statements.  Just hold the lock the entire time.
2003-04-17 22:18:07 +00:00
John Baldwin
8365f5bf7c Remove a couple of unused symbols. 2003-04-17 22:17:28 +00:00
John Baldwin
f36403612a - Use a local variable to close a minor race when determining if the wmesg
printed out needs a prefix such as when a thread is blocked on a lock.
- Use another local variable to close another race for the td_wmesg and
  td_wchan members of struct thread.
2003-04-17 22:16:58 +00:00
John Baldwin
ab0eee5563 Protect p_flag with the proc lock. The sched_lock is not needed to turn
off P_STOPPED_SIG in p_flag.
2003-04-17 22:14:30 +00:00
John Baldwin
c2247848dc - P_SHOULDSTOP just needs proc lock now, so don't acquire sched_lock unless
it is needed.
- Add a proc lock assertion.
2003-04-17 22:13:46 +00:00
John Baldwin
c110b8e65e Add a proc lock assertion and move another assertion up to the top of the
function.
2003-04-17 22:12:12 +00:00
John Baldwin
4cac73c759 The proc lock is sufficient to test p_state against PRS_ZOMBIE, so don't
needlessly lock sched_lock.
2003-04-17 22:09:08 +00:00
John Baldwin
9d8643eca6 Don't hold the proc lock while performing sigset conversions on local
variables.
2003-04-17 22:07:56 +00:00
John Baldwin
5edadff94d - Remove garbage SIGSETOR() that snuck into struct sigpending_args
definition.
- Use the proper constant for the last arg to kern_sigaction() in osigvec()
  instead of a magic value.
2003-04-17 22:06:43 +00:00
John Baldwin
8804bf6b03 Use local struct proc variables to reduce repeated td->td_proc dereferences
and improve readability.
2003-04-17 22:02:47 +00:00
John Baldwin
9520fc2bed Adjust a KTR trace to log thread state instead of proc state as that is
more relevant.
2003-04-17 22:01:01 +00:00
John Baldwin
418e9d1b9e P_SHOULDSTOP used to be p_stat == SSTOP and needed the sched_lock, now it
is protected by the proc lock and doesnt' need sched_lock, so adjust the
locking appropriately.
2003-04-17 21:58:45 +00:00
John Baldwin
00e93b4d53 Protect the per-process UAC field with the proc lock where it isn't already
protected.
2003-04-17 21:57:16 +00:00
Nate Lawson
693f4477b1 Revise attach/detach resource cleanup
- Unconditionally call *_stop() if device is in the tree. This is to
  prevent callouts from happening after the device is gone. Checks for
  bus_child_present() should be added in the future to keep from touching
  potentially non-existent hardware in *_detach().  Found by iedowse@.
- Always check for and free miibus children, even if the device is not in
  the tree since some failure cases could have gotten here.
- Call ether_ifdetach() in the irq setup failure case
- ti(4), xl(4): move ifmedia_init() calls to the beginning of attach so
  that ifmedia_removeall() can be unconditionally called on detach. There
  is no way to detect whether ifmedia has been initialized without using
  a separate variable (as tl(4) does).
- Add comments to indicate assumptions of code path
2003-04-17 20:32:06 +00:00
John Hay
e37f27be24 Get wlread() closer to working. Use m->m_len as the initial value for
bytes_in_mbuf rather than MCLBYTES. Add the ethertnet header to the
front of the mbuf. Adjust bytes_in_mbuf inside the loop that reads
the packet out of the card.
2003-04-17 17:51:24 +00:00
John Hay
a368c85b62 Add locking to wlinit(). 2003-04-17 17:45:58 +00:00
Tom Rhodes
9faaf3b3c8 Add some tunable descriptions.
Submitted by:	hmp
Discussed with:	bde
2003-04-17 15:44:22 +00:00
John Hay
cc8e8a9865 Put the spl calls back until we are sure that everything that they cover
are locked.
2003-04-17 15:42:30 +00:00
Tom Rhodes
2a3eeaa240 Pre-content whitespace commit.
Discussed with:	bde
2003-04-17 15:39:12 +00:00
Hartmut Brandt
6e17a0d754 Unbreak vinum, iostat and systat on sparc64 by changing the devstat
generation number back to a long (sizeof(u_int) != sizeof(long) on
sparc64). The alternative would have been to heavily change the libdevstat API.

Discussed with: phk, ken
2003-04-17 15:06:28 +00:00
Orion Hodson
5a289baba9 Perform warm or cold reset AC97 per the spec depending on state of the
codec during initialization.  This code mirrors the reset code used on
the VIA82c686 and fixes a codec initialization failure (SoundMAX
AD1885) reported by Matthias Schuendehuette.
2003-04-17 15:04:11 +00:00
Jacques Vidrine
ecbe520722 Bump __FreeBSD_version for new NSS implementation; addition of
getpw*_r, getgr*_r interfaces.
2003-04-17 14:18:53 +00:00
Poul-Henning Kamp
c72e7314c2 These two files fell off during my previous commit: put the encoding
decoding functions for struct disklabel in a separate .c file.
2003-04-17 08:41:08 +00:00
Ian Dowse
2ea36df806 Revert part of revision 1.97 by calling dc_stop() unconditionally
in dc_detach() instead of only calling it if the hardware is preset.
This is a workaround for page faults in softclock() after a `dc'
device was detached, caused by not disabling a timer before freeing
its memory. The bus_child_present() checks should probably be
re-added later, but only to avoid the hardware accesses and not the
other resource cleanups in dc_stop().

Approved by:	njl
2003-04-17 08:36:52 +00:00
Poul-Henning Kamp
daabb372ca Separate the encoding/decoding functions for struct disklabel into a
separate source file which can be used from both kernel and userland code.
2003-04-17 07:39:03 +00:00
Hidetoshi Shimokawa
4ed471c143 Add dev/firewire/fwdma.c. 2003-04-17 03:39:27 +00:00
Hidetoshi Shimokawa
77ee030b5f MFp4(simokawa_firewire):
Many internal structure changes for the FireWire driver.

- Compute CRC in CROM parsing.
- Add support for configuration ROM build.
- Simplify dummy buffer handling.
- busdma conversion
- Use swi_taskqueue_giant for -current.  Mark the interrupt routine as MPSAFE.
- AR buffer handling.
	Don't reallocate AR buffer but just recycle it.
	Don't malloc and copy per packet in fwohci_arcv().
	Pass packet to fw_rcv() using iovec.
	Application must prepare receiving buffer in advance.
- Change fw_bind API so that application should pre-allocate xfer structure.
- Add fw_xfer_unload() for recycling struct fw_xfer.
- Add post_busreset hook
- Remove unused 'sub' and 'act_type' in struct fw_xfer.
- Remove npacket from struct fw_bulkxfer.
- Don't call back handlers in fwochi_arcv() if the packet has
	not drained in AT queue
- Make firewire works on big endian platform.
- Use native endian for packet header and remove unnecessary ntohX/htonX.
- Remove FWXFERQ_PACKET mode.  We don't use it anymore.
- Remove unnecessary restriction of FWSTMAXCHUNK.
- Don't set root node for phy config packet if the root node is
	not cycle master capable but set myself for root node.
	We should be the root node after next bus reset.

	Spotted by: Yoshihiro Tabira <tabira@scd.mei.co.jp>
- Improve self id handling

Tested on: i386, sparc64 and i386 with forced bounce buffer
2003-04-17 03:38:03 +00:00
Poul-Henning Kamp
f770d2d3dd Cut&Paste considered far too easy:
Don't include <sys/disklabel.h>
2003-04-16 21:09:41 +00:00
Poul-Henning Kamp
a300701213 Don't include <sys/disklabel.h> 2003-04-16 20:57:35 +00:00
Poul-Henning Kamp
8f18989721 Include <sys/ioccom.h> instead of <sys/disklabel.h> 2003-04-16 20:46:30 +00:00
John Baldwin
20b04da89c Explicitly cast a l_ulong to an unsigned long to make all arch's happy
with the printf format.
2003-04-16 20:43:10 +00:00
John Baldwin
760eb2e033 Fix printf format in a debug printf. 2003-04-16 20:07:48 +00:00
John Baldwin
e68c51ed5d Fix printf args in debug printfs. 2003-04-16 20:05:42 +00:00
John Baldwin
46ae26f7e0 Assume a struct thread *td instead of a struct proc *p in the debug
printf macros.
2003-04-16 20:04:47 +00:00
John Baldwin
4bedc36141 Fix multiple printf warnings on Alpha:
- Prefer long long to quad_t to match printf args.
- Use uintmax_t and %j to print segsz_t and vm_size_t values.
- Fix others in Alpha-specific code.
2003-04-16 19:46:26 +00:00