]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
17 years agoCoalesce another very short section into its parent.
Bruce A. Mah [Sun, 12 Aug 2007 21:08:39 +0000 (21:08 +0000)]
Coalesce another very short section into its parent.

Approved by: re (implicitly)

17 years agoo You have to reboot the system after tuning softupdates on the root
Maxim Konovalov [Sun, 12 Aug 2007 20:08:07 +0000 (20:08 +0000)]
o You have to reboot the system after tuning softupdates on the root
filesystem on to make SU work.

Approved by: re (hrs)
MFC after: 1 week

17 years agoReplace three copies of the host controller reset sequence that
Don Lewis [Sun, 12 Aug 2007 18:45:24 +0000 (18:45 +0000)]
Replace three copies of the host controller reset sequence that
differ in their details with calls to a new function, ehci_hcreset(),
that performs the reset.

The original sequences either had no delay or a 1ms delay between
telling the controller to stop and asserting the controller reset
bit.  One instance of the original reset sequence waited for the
controller to indicate that its reset was complete before continuing,
but the other two immediately let the subsequent code execute.  The
latter is a problem on some hardware, because a read of the HCCPARAMS
register returns an incorrect value while the reset is in progress,
which triggers an infinite loop in ehci_pci_givecontroller(), which
hangs the system on shutdown.

The reset sequence in ehci_hcreset() starts with the most complete
instance from the original code, which contains a loop to wait for
the controller to indicate that its reset is complete.   This appears
to be the correct thing to do according to "Enhanced Host Controller
Interface Specification for Universal Serial Bus" revision 1.0,
section 2.3.1.  Add another loop to wait for the controller to
indicate that it has stopped before setting the HCRESET bit.  This
is required by the section 2.3.1 in the specification, which says
that setting HCRESET before the controller has halted "will result
in undefined behaviour".

Reviewed by: imp (previous patch version without the extra wait loop)
Tested by: se  (previous patch version without the extra wait loop)
Approved by: re (bmah)
MFC after: 1 week

17 years agoMake suid/sgid restore be "opportunistic" if
Tim Kientzle [Sun, 12 Aug 2007 17:35:05 +0000 (17:35 +0000)]
Make suid/sgid restore be "opportunistic" if
owner restore is not requested.  If you ask
for permissions to be restored but not owner,
you will now get no error if suid/sgid bits
cannot be set.  (It's a security hole to restore
suid/sgid bits if the owner/group aren't restored.)

This fixes an obscure problem where a simple
"tar -xf" with no other options will sometimes
fail gratuitously because of suid/sgid bits.
This is causing occasional problems for people
using bsdtar as a drop-in replacement for
"that other tar program." ;-)

Note: If you do ask for owner restore, then suid/sgid
restore failures still issue an error.  This
only suppresses the error in the case where an
suid/sgid bit restore fails because of an owner
mismatch and owner restore was not requested.

Approved by: re (bmah)
MFC after: 7 days

17 years agoUse ttyu instead of ttyd for arm, since we will probably never use sio(4).
Olivier Houchard [Sun, 12 Aug 2007 17:13:06 +0000 (17:13 +0000)]
Use ttyu instead of ttyd for arm, since we will probably never use sio(4).

Approved by: re (blanket)

17 years agoSync with the source code: NGM_FEC_MODE_(MAC|INET) should be
Daniel Gerzo [Sun, 12 Aug 2007 16:02:30 +0000 (16:02 +0000)]
Sync with the source code: NGM_FEC_MODE_(MAC|INET) should be
NGM_FEC_SET_MODE_(MAC|INET).

Approved by: re@ (bmah)

17 years agoCollapse some short sections together.
Bruce A. Mah [Sun, 12 Aug 2007 15:44:18 +0000 (15:44 +0000)]
Collapse some short sections together.

Approved by: re (implicitly)

17 years agoUpdate the tests for reading the various GNU tar sparse formats.
Tim Kientzle [Sun, 12 Aug 2007 01:16:19 +0000 (01:16 +0000)]
Update the tests for reading the various GNU tar sparse formats.
In particular:
  * Include a second entry in all of the test archives (to catch errors
    with intermediate padding)
  * Test the GNU tar 1.17 version of "posix sparse format 1.0"
    instead of the GNU tar 1.16 version (the latter is no longer
    supported by GNU tar).

Right now, libarchive fails this test because I originally
implemented the GNU tar 1.16 version of "posix sparse format 1.0".
I'll fix libarchive shortly.

Approved by: re (blanket, libarchive testing)

17 years agoRevamp the interrupt handling in support of INTR_FILTER. This includes:
Marcel Moolenaar [Sat, 11 Aug 2007 19:25:32 +0000 (19:25 +0000)]
Revamp the interrupt handling in support of INTR_FILTER. This includes:
o  Revamp the PIC I/F to only abstract the PIC hardware. The
   resource handling has been moved to nexus, where it belongs.
o  Include EOI and MASK+EOI methods to the PIC I/F in support of
   INTR_FILTER.
o  With the allocation of interrupt resources and setup of
   interrupt handlers in the common platform code we can delay
   talking to the PIC hardware after enumeration of all devices.
   Introduce a call to powerpc_intr_enable() in configure_final()
   to achieve that and have powerpc_setup_intr() only program the
   PIC when !cold.
o  As a consequence of the above, remove all early_attach() glue
   from the OpenPIC and Heathrow PIC drivers and have them
   register themselves when they're found during enumeration.
o  Decouple the interrupt vector from the interrupt request line.
   Allocate vectors increasingly so that they can be used for
   the intrcnt index as well. Extend the Heathrow PIC driver to
   translate between IRQ and vector. The OpenPIC driver already
   has the support for vectors in hardware.

Approved by: re (blanket)

17 years agoWhite space cleanups
Kip Macy [Fri, 10 Aug 2007 23:47:39 +0000 (23:47 +0000)]
White space cleanups

Approved by: re (blanket)

17 years ago- In all structures other than port info port is a pointer to a port info,
Kip Macy [Fri, 10 Aug 2007 23:33:34 +0000 (23:33 +0000)]
- In all structures other than port info port is a pointer to a port info,
  make the code less confusing by renaming the port number to port_id

Approved by: re (blanket)

17 years agoMFp4:
Xin LI [Fri, 10 Aug 2007 11:00:30 +0000 (11:00 +0000)]
MFp4:
 - LK_RETRY prohibits vget() and vn_lock() to return error.
   Remove associated code. [1]
 - Properly use vhold() and vdrop() instead of their unlocked
   versions, we are guaranteed to have the vnode's interlock
   unheld. [1]
 - Fix a pseudo-infinite loop caused by 64/32-bit arithmetic
   with the same way used in modern NetBSD versions. [2]
 - Reorganize tmpfs_readdir to reduce duplicated code.

Submitted by: kib [1]
Obtained from: NetBSD [2]
Approved by: re (tmpfs blanket)

17 years agoNew regression test updates for rename, etc.
Xin LI [Fri, 10 Aug 2007 10:08:43 +0000 (10:08 +0000)]
New regression test updates for rename, etc.

Obtained from: NetBSD
Approved by: re (tmpfs blanket)

17 years agoFix fscking gjournaled root file system: root file system is already mounted
Pawel Jakub Dawidek [Fri, 10 Aug 2007 06:29:54 +0000 (06:29 +0000)]
Fix fscking gjournaled root file system: root file system is already mounted
read-only, so we can't simply exit right after calling gjournal_check(),
instead we need to ask about super block reload.

Submitted by: Niki Denev <niki@totalterror.net>
PR: misc/113889
Approved by: re (kensmith)

17 years agoMFp4:
Xin LI [Fri, 10 Aug 2007 05:24:49 +0000 (05:24 +0000)]
MFp4:

 - Respect cnflag and don't lock vnode always as LK_EXCLUSIVE [1]
 - Properly lock around tn_vnode to avoid NULL deference
 - Be more careful handling vnodes (*)

(*) This is a WIP
[1] by pjd via howardsu

Thanks kib@ for his valuable VFS related comments.

Tested with: fsx, fstest, tmpfs regression test set
Found by: pho's stress2 suite
Approved by: re (tmpfs blanket)

17 years agoCorrections and clarifications
Julian Elischer [Thu, 9 Aug 2007 21:09:56 +0000 (21:09 +0000)]
Corrections and clarifications

Approved by: re (bmah)

17 years agoAdd "show sysregs" command to ddb. On i386, this gives gdt, idt, ldt,
Nate Lawson [Thu, 9 Aug 2007 20:14:35 +0000 (20:14 +0000)]
Add "show sysregs" command to ddb.  On i386, this gives gdt, idt, ldt,
cr0-4, etc.  Support should be added for other platforms that have a
different set of registers for system use.

Loosely based on: OpenBSD
Approved by: re

17 years agoMFP4(123963): Fixing a possible NULL pointer dereference by making
Tai-hwa Liang [Thu, 9 Aug 2007 13:29:26 +0000 (13:29 +0000)]
MFP4(123963): Fixing a possible NULL pointer dereference by making
the actual assignment after the NULL check.

Found by: Coverity Prevent(tm)
CID: 2303 (run 4156)
Reviewed by: sam
Approved by: re (bmah)

17 years ago- Renaming repocopied cached to nscd
Michael Bushkov [Thu, 9 Aug 2007 13:06:12 +0000 (13:06 +0000)]
- Renaming repocopied cached to nscd

Approved by: re (kensmith), brooks (mentor)

17 years agoUse the .S version for now. I have a version optimized for size p4,
Warner Losh [Thu, 9 Aug 2007 05:16:55 +0000 (05:16 +0000)]
Use the .S version for now.  I have a version optimized for size p4,
but I'm unsure of its provenance, so rather than add it here, revert
the migration to it.

Approved by: re@ (blanket)

17 years agoMerge in the AX88178 and AX88772 register definions (along with
Warner Losh [Thu, 9 Aug 2007 04:40:07 +0000 (04:40 +0000)]
Merge in the AX88178 and AX88772 register definions (along with
rename) from OpenBSD.  This also dribbles in a few fields from OpenBSD
as well.

Approved by: re@ (blanket)
Obtained from: OpenBSD

17 years agoCompile ipfilter:ip_lookup.c without -Werror. The file contains
Marcel Moolenaar [Thu, 9 Aug 2007 01:11:21 +0000 (01:11 +0000)]
Compile ipfilter:ip_lookup.c without -Werror. The file contains
a test that assumes that char is signed by default and causes a
warning with GCC 4.2 on PowerPC.
A patch has been sent to the maintainer that addresses this.

Approved by: re (blanket)

17 years agoKeep the snmp_bridge(3) module up to date with if_bridge(4) and add an
Shteryana Shopova [Wed, 8 Aug 2007 19:27:50 +0000 (19:27 +0000)]
Keep the snmp_bridge(3) module up to date with if_bridge(4) and add an
object to control the value of the new 'PRIVATE' bridge members' flag.
While here, remove stale '__unused' compiler directives.

Reviewed by: bz
Approved by: re (bmah), bz (mentor)

17 years agoRe-enable -Werror for PowerPC. This should really be unconditional again.
Marcel Moolenaar [Wed, 8 Aug 2007 19:12:06 +0000 (19:12 +0000)]
Re-enable -Werror for PowerPC. This should really be unconditional again.

Approved by: re (blanket)

17 years agoOoops, we need to define TD_LOCK here.
Olivier Houchard [Wed, 8 Aug 2007 09:27:52 +0000 (09:27 +0000)]
Ooops, we need to define TD_LOCK here.

Approved by: re (blanket)
Pointy hat to: cognet

17 years agoRe-enable external interrupts for faults, traps and syscalls.
Marcel Moolenaar [Wed, 8 Aug 2007 01:19:12 +0000 (01:19 +0000)]
Re-enable external interrupts for faults, traps and syscalls.

Approved by: re (blanket)

17 years agoThe PowerPC specific header interruptvar.h has been removed.
Marcel Moolenaar [Tue, 7 Aug 2007 23:48:30 +0000 (23:48 +0000)]
The PowerPC specific header interruptvar.h has been removed.

Approved by: re (blanket)

17 years agoEliminate <machine/interruptvar.h> as it has only a single
Marcel Moolenaar [Tue, 7 Aug 2007 23:33:35 +0000 (23:33 +0000)]
Eliminate <machine/interruptvar.h> as it has only a single
prototype. In the future that prototype will not be needed
at all anyway, but for now it's moved to intr_machdep.h.

Approved by: re (blanket)

17 years agoWhen storing old versions of files for use in generating new files via
Colin Percival [Tue, 7 Aug 2007 19:33:46 +0000 (19:33 +0000)]
When storing old versions of files for use in generating new files via
patching and for rolling back updates, don't copy a file if it has already
been stored.  This provides a significant speedup to the "Preparing to
download files" stage of "freebsd-update fetch" if many updates have already
been applied or if a file being updated is linked many times (such as
/rescue/*).

Reported by: Paul Dekkers
MFC after: 1 week
Approved by: re (bmah)

17 years agoRemove redundant prototype.
Marcel Moolenaar [Tue, 7 Aug 2007 18:40:02 +0000 (18:40 +0000)]
Remove redundant prototype.

Approved by: re (blanket)

17 years agoAdd prototype for trap().
Marcel Moolenaar [Tue, 7 Aug 2007 18:39:28 +0000 (18:39 +0000)]
Add prototype for trap().

Approved by: re (blanket)

17 years agoAdd cast to silent gcc warnings.
Olivier Houchard [Tue, 7 Aug 2007 18:37:21 +0000 (18:37 +0000)]
Add cast to silent gcc warnings.

Approved by: re (blanket)

17 years agoUse the third argument of cpu_switch(), as done for i386/amd63, as it is
Olivier Houchard [Tue, 7 Aug 2007 18:20:55 +0000 (18:20 +0000)]
Use the third argument of cpu_switch(), as done for i386/amd63, as it is
required for ULE.

Approved by: re (blanket)

17 years agoProtect the creation of the device pager with the dev_pager_mtx. Lookup
Konstantin Belousov [Tue, 7 Aug 2007 15:36:25 +0000 (15:36 +0000)]
Protect the creation of the device pager with the dev_pager_mtx. Lookup
of device pager in the pagers list by handle is now synchronized with
its removal from the list, and dev_pager_mtx is put before vm object
lock in lock order. Dispose the dev_pager_sx lock, since dev_pager_mtx
now covers the same block.

Noted by: kensmith
Reviewed by: alc
Approved by: re (kensmith)

17 years agoo Indent "DragonFly".
Maxim Konovalov [Tue, 7 Aug 2007 15:35:24 +0000 (15:35 +0000)]
o Indent "DragonFly".

Approved by: re (bmah)

17 years agoo DragonFlyBSD 1.10.0 added.
Maxim Konovalov [Tue, 7 Aug 2007 15:34:24 +0000 (15:34 +0000)]
o DragonFlyBSD 1.10.0 added.

Approved by: re (bmah)
MFC after: 1 week

17 years agoUse ioctl() to get correct media size so that we can locate
Hidetoshi Shimokawa [Tue, 7 Aug 2007 12:42:03 +0000 (12:42 +0000)]
Use ioctl() to get correct media size so that we can locate
ZFS labels in the tail of the media.

Approved by: re (kensmith), pjd

17 years agoMFP4(123687): Closing another LOR by dropping the driver lock around calls
Tai-hwa Liang [Tue, 7 Aug 2007 12:26:19 +0000 (12:26 +0000)]
MFP4(123687): Closing another LOR by dropping the driver lock around calls
to if_input().

Reviewed by: ambrisko
Tested by: dhw
Approved by: re (kensmith)

17 years agoIn msdosfs_read() and msdosfs_write(), don't check explicitly for
Bruce Evans [Tue, 7 Aug 2007 10:35:27 +0000 (10:35 +0000)]
In msdosfs_read() and msdosfs_write(), don't check explicitly for
(uio_offset < 0) since this can't happen.  If this happens, then the
general code handles the problem safely (better than before for reading,
returning 0 (EOF) instead of the bogus errno EINVAL, and the same as
before for writing, returning EFBIG).

In msdosfs_read(), don't check for (uio_resid < 0).  msdosfs_write()
already didn't check.

In msdosfs_read(), document in a comment our assumptions that the caller
passed a valid uio_offset and uio_resid.  ffs checks using KASSERT(),
and that is enough sanity checking.  In the same comment, partly document
there is no need to check for the EOVERFLOW case, unlike in ffs where this
case can happen at least in theory.

In msdosfs_write(), add a comment about why the checking of
(uio_resid == 0) is explicit, unlike in ffs.

In msdosfs_write(), check for impossibly large final offsets before
checking if the file size rlimit would be exceeded, so that we don't
have an overflow bug in the rlimit check and are consistent with ffs.
We now return EFBIG instead of EFBIG plus a SIGXFSZ signal if the final
offset would be impossibly large but not so large as to cause overflow.
Overflow normally gave the benign behaviour of no signal.

Approved by: re (kensmith) (blanket)

17 years agoDo not call free() while holding vnode interlock.
Konstantin Belousov [Tue, 7 Aug 2007 09:04:50 +0000 (09:04 +0000)]
Do not call free() while holding vnode interlock.

Reported and tested by: Peter Holm
Reviewed by: jeff
Approved by: re (kensmith)

17 years agoFix and update the comments about the effect of the read-only flag on writing.
Bruce Evans [Tue, 7 Aug 2007 05:42:10 +0000 (05:42 +0000)]
Fix and update the comments about the effect of the read-only flag on writing.
They are still too verbose.

Remove nearby unreachable code for handling symlinks.

Approved by: re (kensmith) (blanket)

17 years agoOutput error message to STDERR_FILENO.
David Xu [Tue, 7 Aug 2007 04:50:14 +0000 (04:50 +0000)]
Output error message to STDERR_FILENO.

Approved by: re (bmah)

17 years agoFix some style bugs (don't assume that off_t == int64_t; fix some comments;
Bruce Evans [Tue, 7 Aug 2007 03:59:49 +0000 (03:59 +0000)]
Fix some style bugs (don't assume that off_t == int64_t; fix some comments;
remove some parentheses; fix some whitespace errors; fix only one case of
a boolean comparison of a non-boolean).

Improve an error message by quoting ".", and by not printing large positive
values as negative ones.

Approved by: re (kensmith) (blanket)

17 years agoFix some style bugs (don't assume that off_t == int64_t; fix some comments;
Bruce Evans [Tue, 7 Aug 2007 03:43:28 +0000 (03:43 +0000)]
Fix some style bugs (don't assume that off_t == int64_t; fix some comments;
remove some parentheses; fix only a couple of whtespace errors).

Approved by: re (kensmith) (blanket)

17 years agoFix some style bugs (mainly some whitespace errors).
Bruce Evans [Tue, 7 Aug 2007 03:38:36 +0000 (03:38 +0000)]
Fix some style bugs (mainly some whitespace errors).

Approved by: re (kensmith) (blanket)

17 years agoFix some style bugs (some whitespace errors only).
Bruce Evans [Tue, 7 Aug 2007 03:22:10 +0000 (03:22 +0000)]
Fix some style bugs (some whitespace errors only).

Approved by: re (kensmith) (blanket)

17 years agoSort includes.
Bruce Evans [Tue, 7 Aug 2007 02:28:33 +0000 (02:28 +0000)]
Sort includes.

Remove rotted banal comment attached to includes.

Approved by: re (kensmith) (blanket)

17 years agoSort includes.
Bruce Evans [Tue, 7 Aug 2007 02:27:35 +0000 (02:27 +0000)]
Sort includes.

Remove banal comments attached to includes.

Approved by: re (kensmith) (blanket)

17 years agoForced commit to note that the log message for the previous commit should
Bruce Evans [Tue, 7 Aug 2007 02:25:56 +0000 (02:25 +0000)]
Forced commit to note that the log message for the previous commit should
have said "Sort" where it said "Remove unused".

Approved by: re (kensmith) (blanket)

17 years agoSort includes.
Bruce Evans [Tue, 7 Aug 2007 02:20:37 +0000 (02:20 +0000)]
Sort includes.

Remove banal comments before includes.  Remove rotted banal comments attached
to includes.

Approved by: re (kensmith) (blanket)

17 years agoRemove unused include(s).
Bruce Evans [Tue, 7 Aug 2007 02:11:16 +0000 (02:11 +0000)]
Remove unused include(s).

Remove banal comments before includes.

Approved by: re (kensmith) (blanket)

17 years agoRemove unused include(s).
Bruce Evans [Tue, 7 Aug 2007 02:08:06 +0000 (02:08 +0000)]
Remove unused include(s).

Approved by: re (kensmith) (blanket)

17 years agoInclude <sys/mutex.h> and its prerequisite <sys/lock.h> instead of
Bruce Evans [Tue, 7 Aug 2007 01:40:27 +0000 (01:40 +0000)]
Include <sys/mutex.h> and its prerequisite <sys/lock.h> instead of
depending on namespace pollution in <sys/buf.h> and/or <sys/vnode.h>

Approved by: re (kensmith) (blanket)

17 years agoInclude <sys/mutex.h>'s prerequisite <sys/lock.h> instead of depending on
Bruce Evans [Tue, 7 Aug 2007 01:37:59 +0000 (01:37 +0000)]
Include <sys/mutex.h>'s prerequisite <sys/lock.h> instead of depending on
namespace pollution in <sys/vnode.h>.

Sort the include of <sys/mutex.h> instead of unsorting it after
<sys/vnode.h> and depending on the pollution there.

Approved by: re (kensmith) (blanket)

17 years agoRemove unused include(s).
Bruce Evans [Tue, 7 Aug 2007 01:07:16 +0000 (01:07 +0000)]
Remove unused include(s).

Approved by: re (kensmith) (blanket)

17 years agoOver the past couple of years, there have been a number of reports relating
Christian S.J. Peron [Mon, 6 Aug 2007 22:06:36 +0000 (22:06 +0000)]
Over the past couple of years, there have been a number of reports relating
the use of divert sockets to dead locks.  A number of LORs have been reported
between divert and a number of other network subsystems including: IPSEC, Pfil,
multicast, ipfw and others.  Other dead locks could occur because of recursive
entry into the IP stack.  This change should take care of most if not all of
these issues.

A summary of the changes follow:

- We disallow multicast operations on divert sockets.  It really doesn't make
  semantic sense to allow this, since typically you would set multicast
  parameters on multicast end points.

  NOTE: As a part of this change, we actually dis-allow multicast options on
  any socket that IS a divert socket OR IS NOT a SOCK_RAW or SOCK_DGRAM family

- We check to see if there are any socket options that have been specified on
  the socket, and if there was (which is very un-common and also probably
  doesnt make sense to support) we duplicate the mbuf carrying the options.

- We then drop the INP/INFO locks over the call to ip_output().  It should be
  noted that since we no longer support multicast operations on divert sockets
  and we have duplicated any socket options, we no longer need the reference
  to the pcb to be coherent.

- Finally, we replaced the call to ip_input() to use netisr queuing.  This
  should remove the recursive entry into the IP stack from divert.

By dropping the locks over the call to ip_output() we eliminate all the lock
ordering issues above.  By switching over to netisr on the inbound path,
we can no longer recursively enter the ip_input() code via divert.

I have tested this change by using the following command:

ipfwpcap -r 8000 - | tcpdump -r - -nn -v

This should exercise the input and re-injection (outbound) path, which is
very similar to the work load performed by natd(8).  Additionally, I have
run some ospf daemons which have a heavy reliance on raw sockets and
multicast.

Approved by: re@ (kensmith)
MFC after: 1 month
LOR: 163
LOR: 181
LOR: 202
LOR: 203
Discussed with: julian, andre et al (on freebsd-net)
In collaboration with: bms [1], rwatson [2]

[1] bms helped out with the multicast decisions
[2] rwatson submitted the original netisr patches and came up with some
    of the original ideas on how to combat this issue.

17 years ago- change number assignments for SHA225-512 (match artisync
Randall Stewart [Mon, 6 Aug 2007 15:46:46 +0000 (15:46 +0000)]
- change number assignments for SHA225-512 (match artisync
  for bakeoff.. using the next sequential ones)
- In cookie processing 1-2-1, we did not increment the stcb
  refcnt before releasing the tcb lock. We need to do this
  to keep the tcb from being freed by a abort or ?? unlikely
  but worth doing. Also get rid of unneed INP_WLOCK.
- extra receive info included the rcvinfo which killed the
  padding/alignment. We now redefine all the fields properly
  so they both align properly both to 128 bytes.
- A peeled off socket would not close without an error due to
  its misguided idea that sctp_disconnect() was not supported
  on it. This fixes it so it goes through the proper path.
- When an assoc was being deleted after abort (via a timer) a
  small race condition exists where we might take a packet for
  the old assoc (since we are waiting for a cleanup timer). This
  state especially happens in mac. We now add a state in the asoc
  so these can properly handle the packet as OOTB.
Approved by: re@freebsd.org(Ken Smith)

17 years agoRemove the now-unused NET_{LOCK,UNLOCK,ASSERT}_GIANT() macros, which
Robert Watson [Mon, 6 Aug 2007 14:26:03 +0000 (14:26 +0000)]
Remove the now-unused NET_{LOCK,UNLOCK,ASSERT}_GIANT() macros, which
previously conditionally acquired Giant based on debug.mpsafenet.  As that
has now been removed, they are no longer required.  Removing them
significantly simplifies error-handling in the socket layer, eliminated
quite a bit of unwinding of locking in error cases.

While here clean up the now unneeded opt_net.h, which previously was used
for the NET_WITH_GIANT kernel option.  Clean up some related gotos for
consistency.

Reviewed by: bz, csjp
Tested by: kris
Approved by: re (kensmith)

17 years agoClear pending interrupts before we enable external interrupts.
Marcel Moolenaar [Mon, 6 Aug 2007 05:15:57 +0000 (05:15 +0000)]
Clear pending interrupts before we enable external interrupts.
Recently the AP in my Merced box seems to have grown a habit
of getting unexpected interrupts, such as redundant wake-ups
and legacy interrupts that require an INTA cycle.

While here, replace DELAY(0) with cpu_spinwait() so that it's
clear what we're doing as well as enable the code to take
advantage of cpu_spinwait() when it gets implemented.

Approved by: re (blanket)

17 years agoKeep interrupts disabled while handling external interrupts.
Marcel Moolenaar [Mon, 6 Aug 2007 05:11:01 +0000 (05:11 +0000)]
Keep interrupts disabled while handling external interrupts.
There's no advantage in allowing nested external interrupts.
In fact, it leads to a potential stack overrun.

While here, put the interrupt vector in the trapframe, so as
to compensate for the 36 cycle latency of reading cr.ivr.

Further simplify assembly code by dealing with ASTs from C.

Approved by: re (blanket)

17 years agoConsider a scenario in which one processor, call it Pt, is performing
Alan Cox [Sun, 5 Aug 2007 21:04:32 +0000 (21:04 +0000)]
Consider a scenario in which one processor, call it Pt, is performing
vm_object_terminate() on a device-backed object at the same time that
another processor, call it Pa, is performing dev_pager_alloc() on the
same device.  The problem is that vm_pager_object_lookup() should not be
allowed to return a doomed object, i.e., an object with OBJ_DEAD set,
but it does.  In detail, the unfortunate sequence of events is: Pt in
vm_object_terminate() holds the doomed object's lock and sets OBJ_DEAD
on the object.  Pa in dev_pager_alloc() holds dev_pager_sx and calls
vm_pager_object_lookup(), which returns the doomed object.  Next, Pa
calls vm_object_reference(), which requires the doomed object's lock, so
Pa waits for Pt to release the doomed object's lock.  Pt proceeds to the
point in vm_object_terminate() where it releases the doomed object's
lock.  Pa is now able to complete vm_object_reference() because it can
now complete the acquisition of the doomed object's lock.  So, now the
doomed object has a reference count of one!  Pa releases dev_pager_sx
and returns the doomed object from dev_pager_alloc().  Pt now acquires
dev_pager_mtx, removes the doomed object from dev_pager_object_list,
releases dev_pager_mtx, and finally calls uma_zfree with the doomed
object.  However, the doomed object is still in use by Pa.

Repeating my key point, vm_pager_object_lookup() must not return a
doomed object.  Moreover, the test for the object's state, i.e.,
doomed or not, and the increment of the object's reference count
should be carried out atomically.

Reviewed by: kib
Approved by: re (kensmith)
MFC after: 3 weeks

17 years agoIn ia64_set_rr(), don't perform data serialization. This allows
Marcel Moolenaar [Sun, 5 Aug 2007 18:19:38 +0000 (18:19 +0000)]
In ia64_set_rr(), don't perform data serialization. This allows
us to do the data serializations once after writing multiple
region registers, as is done in pmap_switch(). All existing
calls to ia64_set_rr() are followed with calls to ia64_srlz_d().

Approved by: re (blanket)

17 years agoImprove error handling in libdisk while parsing the kern.geom.conftxt sysctl.
Rink Springer [Sun, 5 Aug 2007 16:55:40 +0000 (16:55 +0000)]
Improve error handling in libdisk while parsing the kern.geom.conftxt sysctl.
Previously, any parse error will result in the calling program exiting with an
unpleasant message. This change will cause libdisk to issue a warning and
ignore lines it cannot parse instead of bluntly terminating the unfortunate
enough program.

This change will allow you to use sysinstall if you have a NTFS parition with
a space in the name (such as 'Win Xp'). In such a case, a line like the
following will appear in the kern.geom.conftxt output:

2 LABEL ntfs/Win Xp 209818635264 512 i 0 o 0

As the fields are space-separated, libdisk would go beserk and exit the program.
This would happen if using FreeBSD 7.0 snapshot images (as GEOM_LABEL is in
the installation kernel as well), thus making it impossible to install FreeBSD
without renaming your NTFS paritions.

Reported by: Dwight Berendse <dwight at berendse dot org>
Nod from: phk
Reviewed by: imp
Approved by: re (bmah), imp (mentor)
MFC after: 1 month

17 years agoThe call to init_file() needs to be moved outside the loop in statd.c,
Don Lewis [Sun, 5 Aug 2007 16:33:06 +0000 (16:33 +0000)]
The call to init_file() needs to be moved outside the loop in statd.c,
otherwise mmap() gets called multiple times, which eventually fails due
to address space exhaustion on i386.

Approved by: re (kensmith)
MFC after: 1 week

17 years agoRename option IPSEC_FILTERGIF to IPSEC_FILTERTUNNEL.
Bjoern A. Zeeb [Sun, 5 Aug 2007 16:16:15 +0000 (16:16 +0000)]
Rename option IPSEC_FILTERGIF to IPSEC_FILTERTUNNEL.
Also rename the related functions in a similar way.
There are no functional changes.

For a packet coming in with IPsec tunnel mode, the default is
to only call into the firewall with the "outer" IP header and
payload.

With this option turned on, in addition to the "outer" parts,
the "inner" IP header and payload are passed to the
firewall too when going through ip_input() the second time.

The option was never only related to a gif(4) tunnel within
an IPsec tunnel and thus the name was very misleading.

Discussed at: BSDCan 2007
Best new name suggested by: rwatson
Reviewed by: rwatson
Approved by: re (bmah)

17 years agoSilently fix up the estimated next free cluster number from the fsinfo
Bruce Evans [Sun, 5 Aug 2007 12:58:34 +0000 (12:58 +0000)]
Silently fix up the estimated next free cluster number from the fsinfo
sector, instead of failing the whole mount if it is garbage.  Fields
in the fsinfo sector are only advisory, so there are better sanity
checks than this, and we already silently fix up the only other advisory
field in the fsinfo (the free cluster count).

This wasn't handled quite right in rev.1.92, 1.117, or in NetBSD.  1.92
also failed the whole mount for the non-garbage magic value 0xffffffff
1.117 fixed this well enough in practice since garbage values shouldn't
occur in practice, but left the error handling larger and more convoluted
than necessary.  Now we handle the magic value as a special case of
fixing up all out of bounds values.

Also fix up the estimated next free cluster number when there is no
fsinfo sector.  We were using 0, but CLUST_FIRST is safer.

Approved by: re (kensmith)

17 years ago- Divorce the IOTSBs, which so far where handled via a global list
Marius Strobl [Sun, 5 Aug 2007 11:56:44 +0000 (11:56 +0000)]
- Divorce the IOTSBs, which so far where handled via a global list
  instead of per IOMMU, so we no longer need to program all of them
  identically in systems having multiple IOMMUs. This continues the
  rototilling of the nexus(4) done about 5 months ago, which amongst
  others changed nexus(4) and the drivers for host-to-foo bridges
  to provide bus_get_dma_tag methods, allowing to handle DMA tags in
  a hierarchical way and to link them with devices.
  This still doesn't move the silicon bug workarounds for Sabre (and
  in the uncommitted schizo(4) for Tomatillo) bridges into special
  bus_dma_tag_create() and bus_dmamap_sync() methods though, as w/o
  fully newbus'ified bus_dma_tag_create() and bus_dma_tag_destroy()
  this still requires too much hackery, i.e. per-child parent DMA
  tags in the parent driver.
- Let the host-to-foo drivers supply the maximum physical address
  of the IOMMU accompanying the bridges. Previously iommu(4) hard-
  coded an upper limit of 16GB, which actually only applies to the
  IOMMUs of the Hummingbird and Sabre bridges. The Psycho variants
  as well as the U2S in fact can can translate to up to 2TB, i.e.
  translate to 41-bit physical addresses. According to the recently
  available Tomatillo documentation these bridges even translate to
  43-bit physical addresses and hints at the Schizo bridges doing
  43 bits as well.
  This fixes the issue the FreeBSD 6.0 todo list item "Max RAM on
  sparc64" was refering to and pretty much obsoletes the lack of
  support for bounce buffers on sparc64.

Thanks to Nathan Whitehorn for pointing me at the Tomatillo manual.

Approved by: re (kensmith)

17 years agoo In order to reduce bug and code duplication fold handling of NICs
Marius Strobl [Sun, 5 Aug 2007 11:28:19 +0000 (11:28 +0000)]
o In order to reduce bug and code duplication fold handling of NICs
  requiring DC_TX_ALIGN or DC_TX_COALESCE, which was previously done
  in dc_start_locked(), into dc_encap().
o In dc_encap():
  - If m_defrag() fails just drop the packet like other NIC drivers
    do. This should only happen when there's a mbuf shortage, in which
    case it was possible to end up with an IFQ full of packets which
    couldn't be processed as they couldn't be defragmented as they
    were taking up all the mbufs themselves. This includes adjusting
    dc_start_locked() to not trying to prepend the mbuf (chain) if
    dc_encap() has freed it.
  - Likewise, if bus_dmamap_load_mbuf() fails as dc_dma_map_txbuf()
    failed, free the mbuf possibly allocated by the above call to
    m_defrag() and drop the packet.
o In dc_txeof():
  - Don't clear IFF_DRV_OACTIVE unless there are at least 6 free TX
    descriptors. Further down the road dc_encap() will bail if there
    are only 5 or fewer free TX descriptors, causing dc_start_locked()
    to abort and prepend the dequeued mbuf again so it makes no sense
    to pretend we could process mbufs again when in fact we won't.
    While at it replace this magic 5 with a macro DC_TX_LIST_RSVD.
  - Just always assign idx to sc->dc_cdata.dc_tx_cons; it doesn't
    make much sense to exclude the idx == sc->dc_cdata.dc_tx_cons
    case.
o In dc_dma_map_txbuf() there's no need to set sc->dc_cdata.dc_tx_err
  to error if the latter is != 0, bus_dmamap_load_mbuf() already
  returns the same error value in that case anyway.
o For less overhead, convert to use bus_dmamap_load_mbuf_sg() for
  loading RX buffers.
o Remove some banal and/or outdated comments.

Approved by: re (kensmith)
MFC after: 1 week

17 years agoInitialize the rl_vlanctl field of the descriptors to zero (in order
Marius Strobl [Sun, 5 Aug 2007 11:20:33 +0000 (11:20 +0000)]
Initialize the rl_vlanctl field of the descriptors to zero (in order
to clear RL_TDESC_VLANCTL_TAG). This fixes sending packets in the
native VLAN when running both tagged and an untagged VLAN over the
same trunk and descriptors are recycled.

Approved by: re (kensmith)
MFC after: 1 week

17 years agoo Iomage -> Iomega.
Maxim Konovalov [Sun, 5 Aug 2007 07:39:30 +0000 (07:39 +0000)]
o Iomage -> Iomega.

PR: docs/115208
Submitted by: John Nielsen
Approved by: re (kensmith)
MFC after: 1 week

17 years agoo round-type -> round-trip.
Maxim Konovalov [Sun, 5 Aug 2007 07:38:09 +0000 (07:38 +0000)]
o round-type -> round-trip.

PR: docs/115082
Submitted by: Jordan Gordeev
Approved by: re (kensmith)
MFC after: 1 week

17 years agoDo not acquire Giant unconditionally around the calls to the cdevsw
Konstantin Belousov [Sun, 5 Aug 2007 05:40:52 +0000 (05:40 +0000)]
Do not acquire Giant unconditionally around the calls to the cdevsw
d_mmap methods. prep_cdevsw() already installs the shims that
acquire/drop Giant for the methods of a driver that specified the
D_NEEDGIANT flag.

Reviewed by: alc
Approved by: re (kensmith)

17 years ago- Ensure the path cost does not exceed 65535 in legacy STP mode.
Andrew Thompson [Sat, 4 Aug 2007 21:09:04 +0000 (21:09 +0000)]
- Ensure the path cost does not exceed 65535 in legacy STP mode.
- If the path cost is calculated when the link is down, set a pending flag so
  it is calculated again when it comes back up.
- To not use 00:00:00:00:00:00 as the bridge id, all interfaces are scanned and
  the lowest number wins. All zeros is too low.

Approved by: re (rwatson)

17 years agoRemove references to mpsafenet. This option no longer exists.
Christian S.J. Peron [Sat, 4 Aug 2007 20:35:42 +0000 (20:35 +0000)]
Remove references to mpsafenet. This option no longer exists.

Approved by: re@ (bmah)

17 years agoReplace "__asm __volatile()" by equivalent support functions from
Marcel Moolenaar [Sat, 4 Aug 2007 19:52:10 +0000 (19:52 +0000)]
Replace "__asm __volatile()" by equivalent support functions from
ia64_cpu.h. This improves readability and consistency and aids in
auditing the code.
Add instruction-serialization after writing to cr.pta.

Delay enabling interrupts until after we setup the clocks and after
we program the task priority register.

Approved by: re (blanket)

17 years agoReplace "__asm __volatile()" by equivalent support functions from
Marcel Moolenaar [Sat, 4 Aug 2007 19:36:14 +0000 (19:36 +0000)]
Replace "__asm __volatile()" by equivalent support functions from
ia64_cpu.h. This improves readability and consistency and aids in
auditing the code.
Add data-serialization after writing to the region registers and
add instruction-serialization after writing to cr.pta.

Approved by: re (blanket)

17 years agoReplace "__asm __volatile()" by equivalent support functions from
Marcel Moolenaar [Sat, 4 Aug 2007 19:33:27 +0000 (19:33 +0000)]
Replace "__asm __volatile()" by equivalent support functions from
ia64_cpu.h. This improves readability and consistency and aids in
auditing the code.
Add data-serialization after writing to cr.tpr.

Approved by: re (blanket)

17 years agoAdd required data-serialization after writing to cr.itm and cr.itv.
Marcel Moolenaar [Sat, 4 Aug 2007 19:28:19 +0000 (19:28 +0000)]
Add required data-serialization after writing to cr.itm and cr.itv.

Approved by: re (blanket)

17 years agoAdd ia64_srlz_d() and ia64_srlz_i() functions to aid in serialization.
Marcel Moolenaar [Sat, 4 Aug 2007 19:26:42 +0000 (19:26 +0000)]
Add ia64_srlz_d() and ia64_srlz_i() functions to aid in serialization.

Approved by: re (blanket)

17 years agoSet D_NEEDGIANT.
Konstantin Belousov [Sat, 4 Aug 2007 17:43:11 +0000 (17:43 +0000)]
Set D_NEEDGIANT.

Approved by: phk
Approved by: re (kensmith)

17 years agoRestore historical more(1) behavior (inhibit ti/te processing) which
Daniel Eischen [Sat, 4 Aug 2007 13:16:09 +0000 (13:16 +0000)]
Restore historical more(1) behavior (inhibit ti/te processing) which
accidently got broke during the last less(1) import.

Approved by: re(hrs), delphij

17 years ago - Fix one line that erroneously crept in my last commit.
Jeff Roberson [Sat, 4 Aug 2007 01:21:28 +0000 (01:21 +0000)]
 - Fix one line that erroneously crept in my last commit.

Approved by: re

17 years ago - Share scheduler locks between hyper-threaded cores to protect the
Jeff Roberson [Fri, 3 Aug 2007 23:38:46 +0000 (23:38 +0000)]
 - Share scheduler locks between hyper-threaded cores to protect the
   tdq_group structure.  Hyper-threaded cores won't really benefit from
   seperate locks anyway.
 - Seperate out the migration case from sched_switch to simplify the main
   switch code.  We only migrate here if called via sched_bind().
 - When preempted place the preempted thread back in the same queue at
   the head.
 - Improve the cpu group and topology infrastructure.

Tested by: many on current@
Approved by: re

17 years ago - Set SW_PREEMPT when we preempt in critical_exit().
Jeff Roberson [Fri, 3 Aug 2007 23:35:35 +0000 (23:35 +0000)]
 - Set SW_PREEMPT when we preempt in critical_exit().

Approved by: re

17 years agoOops, fix the fix for the i/o size of the fsinfo block. Its log
Bruce Evans [Fri, 3 Aug 2007 23:13:50 +0000 (23:13 +0000)]
Oops, fix the fix for the i/o size of the fsinfo block.  Its log
message explained why the size is 1 sector, but the code used a
size of 1 cluster.

I/o sizes larger than necessary may cause serious coherency problems
in the buffer cache.  Here I think there were only minor efficiency
problems, since a too-large fsinfo buffer could only get far enough
to overlap buffers for the same vnode (the device vnode), so mappings
are coherent at the page level although not at the buffer level, and
the former is probably enough due to our limited use of the fsinfo
buffer.

Approved by: re (kensmith)

17 years agoo With -x switch do not pay attention at the hardcoded limit of 3 devic...
Maxim Konovalov [Fri, 3 Aug 2007 15:45:55 +0000 (15:45 +0000)]
o With -x switch do not pay attention at the hardcoded limit of 3               devices and dump stats for all devices in the system.  User can still           limit iostat -x by -n switch.

Spotted by: Igor Sysoev
Submitted by: kensmith
Approved by: re (kensmith)
MFC after: 2 weeks

17 years agoAdd regression tests for flopen(3).
Dag-Erling Smørgrav [Fri, 3 Aug 2007 11:29:49 +0000 (11:29 +0000)]
Add regression tests for flopen(3).

Approved by: re (blanket)

17 years agoBack out previous commit until I figure out why my regression test fails.
Dag-Erling Smørgrav [Fri, 3 Aug 2007 09:20:28 +0000 (09:20 +0000)]
Back out previous commit until I figure out why my regression test fails.

Approved by: re (kensmith)

17 years agoUse fcntl(2)-style locks instead of less-portable flock(2)-style locks.
Dag-Erling Smørgrav [Fri, 3 Aug 2007 06:32:45 +0000 (06:32 +0000)]
Use fcntl(2)-style locks instead of less-portable flock(2)-style locks.

Approved by: re (kensmith)

17 years agoMFp4 - Refine locking to eliminate some potential race/panics:
Xin LI [Fri, 3 Aug 2007 06:24:31 +0000 (06:24 +0000)]
MFp4 - Refine locking to eliminate some potential race/panics:

 - Copy before testing a pointer.  This closes a race window.
 - Use msleep with the node interlock instead of tsleep.
 - Do proper locking around access to tn_vpstate.
 - Assert vnode VOP lock for dir_{atta,de}tach to capture
   inconsistent locking.

Suggested by: kib
Submitted by: delphij
Reviewed by: Howard Su
Approved by: re (tmpfs blanket)

17 years agoNew release notes: if_bridge(4) private ports, wlandebug(8).
Bruce A. Mah [Fri, 3 Aug 2007 02:26:18 +0000 (02:26 +0000)]
New release notes:  if_bridge(4) private ports, wlandebug(8).

Approved by: re (implicitly)

17 years agoMove mp_topology() from apic_init(i386) and apic_setup_local(amd64) to
Peter Wemm [Thu, 2 Aug 2007 21:17:58 +0000 (21:17 +0000)]
Move mp_topology() from apic_init(i386) and apic_setup_local(amd64) to
cpu_start_mp().  This is after we have read the cpuid registers to
calculate the hyperthreading_cpus value for the sysctl that enables or
disables hyperthread cores.  Change mp_topology() to use that information
rather than trying to do it itself.

This solves the problem of ULE being incorrectly told that dual core
Athlon64 X2 or Operton cpus are hyperthreading cores.  At the very least,
we now have a single piece of code to identify hyperthreading.

Obtained from:  jhb
Approved by:  re (kensmith)

17 years agoAdd myself as delphij's mentee.
Fukang Chen [Thu, 2 Aug 2007 15:23:01 +0000 (15:23 +0000)]
Add myself as delphij's mentee.

Approved by:    re (bmah), delphij (mentor)

17 years ago1. Move the disable-empty-zone stuff down below the first 25 lines so
Doug Barton [Thu, 2 Aug 2007 09:18:53 +0000 (09:18 +0000)]
1. Move the disable-empty-zone stuff down below the first 25 lines so
that the listen-on stuff floats up to the first "page" of text. This
makes it very obvious what's going on so that someone trying to enable
a server for use on a network can easily see how to do that.

2. Change the default behavior back to using a hint zone for the root.

3. Leave the root slave zone config as a commented out example.

4. Remove the B and F root servers from the example at the request of
their operators.

Requested by: he-who-must-not-be-named [1]
Requested by: many [2]

Approved by: re (rwatson)

17 years agoRemove fast_ipsec.4. Was merged in parts to ipsec.4.
Bjoern A. Zeeb [Thu, 2 Aug 2007 08:05:56 +0000 (08:05 +0000)]
Remove fast_ipsec.4. Was merged in parts to ipsec.4.

Approved by:    re (bmah)

17 years agoRemove the last entries to fast_ipsec.
Bjoern A. Zeeb [Thu, 2 Aug 2007 08:04:48 +0000 (08:04 +0000)]
Remove the last entries to fast_ipsec.
Merge in parts of the old fast_ipsec.4 man page to ipsec.4 and
start updating ipsec.4 man page.

Reviewed by: brueffer, sam (slightly earlier versions), bmah
Approved by: re (bmah)

17 years agoNew release note: SA-07:06.tcpdump, SA-07:07.bind.
Bruce A. Mah [Thu, 2 Aug 2007 05:19:08 +0000 (05:19 +0000)]
New release note:  SA-07:06.tcpdump, SA-07:07.bind.

Approved by: re (implicitly)

17 years agoAdd the device ID for the VIA CX700 chipset.
Kevin Lo [Thu, 2 Aug 2007 04:29:19 +0000 (04:29 +0000)]
Add the device ID for the VIA CX700 chipset.

Approved by: re (hrs)

17 years agoMFP4(123686): Fixing various ancontrol(8) related panics by dropping locks
Tai-hwa Liang [Thu, 2 Aug 2007 02:20:19 +0000 (02:20 +0000)]
MFP4(123686): Fixing various ancontrol(8) related panics by dropping locks
around copyin()/copyout().

Reviewed by: sam, thompsa
Tested by: dhw
Approved by: re (kensmith)

17 years agoWhen generating ports INDEX files from downloaded "describes" data, build
Colin Percival [Thu, 2 Aug 2007 02:05:23 +0000 (02:05 +0000)]
When generating ports INDEX files from downloaded "describes" data, build
an index for FreeBSD 7.x too.

MFC After: 1 week
Approved by: re (hrs)