Brooks Davis [Thu, 10 Jul 2008 17:45:57 +0000 (17:45 +0000)]
id_t is a 64-bit integer and thus is passed as two arguments like off_t is.
As a result, those arguments must be recombined before calling the real
syscal implementation. This change fixes 32-bit compatibility for
cpuset_getid(), cpuset_setid(), cpuset_getaffinity(), and
cpuset_setaffinity().
David E. O'Brien [Thu, 10 Jul 2008 16:03:24 +0000 (16:03 +0000)]
Use 'CSCOPE_ARCHDIR' to change the default architecture directories to
cscope. After the addition of sys/modules/dtrace/dtrace, setting
'ARCHDIR' in /etc/src.conf breaks the build.
Robert Watson [Thu, 10 Jul 2008 09:45:28 +0000 (09:45 +0000)]
Apply the MAC label to an outgoing UDP packet when other inpcb properties are
processed, meaning that we avoid the cost of MAC label assignment if we're
going to drop the packet due to mbuf exhaustion, etc.
Peter Wemm [Thu, 10 Jul 2008 02:08:00 +0000 (02:08 +0000)]
Merge gnu cpio 2.6 -> 2.8 changes. Unfortunately, we have massive
conflicts due to radically different approaches to security and bug fixes.
In some cases I re-started from the vendor version and reimplemented our
patches. Fortunately, this is not enabled by default in -current.
Add a new program to the multicast test suite. The mcgrab program
is used to grab and hold some number of multicast addresses in order
to test what happens when an interface goes over the number of multicast
addresses it can filter in hardware.
Peter Wemm [Wed, 9 Jul 2008 19:44:37 +0000 (19:44 +0000)]
Band-aid a problem with 32 bit selector setup.
Initialize %ds, %es, and %fs during CPU startup. Otherwise a garbage
value could leak to a 32-bit process if a process migrated to a different
CPU after exec and the new CPU had never exec'd a 32-bit process.
A more complete fix is needed, but this mitigates the most frequent
manifestations.
Robert Watson [Wed, 9 Jul 2008 18:41:31 +0000 (18:41 +0000)]
Rather than checking for a NULL so_pcb in raw_attach(), assert that
it's non-NULL, as all callers can and should already do the required
checking. Update comments a bit more to talk about rawcb allocation
for consumers.
Robert Watson [Wed, 9 Jul 2008 18:39:55 +0000 (18:39 +0000)]
Add sysctl subtree net.raw for generic raw socket infrastructure;
expose default send and receive socket buffer sizes using sysctls
so that they can be administered centrally.
Warner Losh [Wed, 9 Jul 2008 16:47:55 +0000 (16:47 +0000)]
Improve the EEPROM parsing, based on finding a datasheet that describes
it in detail.
When setting media, don't error out when a specific media is selected.
# Note: There may be some issues still here since the EtherJet PC Card doesn't
# conform to the datasheet. Many different kinds of dongles can be plugged in
# and it is unknown how to ask which one it is.
Also, add a /* bad! */ comment to a 1/2 second delay after we set the
DC/DC parameters. This should be a *sleep of some sort for !cold.
Fortunately it is the only one and is only used when setting media, so
the benefit from removing it is small. Unfortunately, it likely
serves as an exemplar of good programming techniques, which it isn't.
Randall Stewart [Wed, 9 Jul 2008 16:45:30 +0000 (16:45 +0000)]
1) Adds the rest of the VIMAGE change macros
2) Adds some __UserSpace__ on some of the common defines that
the user space code needs
3) Fixes a bug when we send up data to a user that failed. We
need to a) trim off the data chunk headers, if present, and
b) make sure the frag bit is communicated properly for the
msgs coming off the stream queues... i.e. we see if some
of the msg has been taken.
Obtained from: jeli contributed the VIMAGE changes on this pass Thanks Julain!
Robert Watson [Wed, 9 Jul 2008 15:48:16 +0000 (15:48 +0000)]
Remove unused support for local and foreign addresses in generic raw
socket support. These utility routines are used only for routing and
pfkey sockets, neither of which have a notion of address, so were
required to mock up fake socket addresses to avoid connection
requirements for applications that did not specify their own fake
addresses (most of them).
Quite a bit of the removed code is #ifdef notdef, since raw sockets
don't support bind() or connect() in practice. Removing this
simplifies the raw socket implementation, and removes two (commented
out) uses of dtom(9).
Fake addresses passed to sendto(2) by applications are ignored for
compatibility reasons, but this is now done in a more consistent way
(and with a comment). Possibly, EINVAL could be returned here in
the future if it is determined that no applications depend on the
semantic inconsistency of specifying a destination address for a
protocol without address support, but this will require some amount
of careful surveying.
NB: This does not affect netinet, netinet6, or other wire protocol
raw sockets, which provide their own independent infrastructure with
control block address support specific to the protocol.
Add driver support for RTL8102E and RTL8102EL which is the second
generation of RTL810x PCIe fast ethernet controller. Note, Tx/Rx
descriptor format is different from that of first generation of
RTL8101E series. Jumbo frame is not supported for RTL810x
family.
Tested by: NAGATA Shinya ( maya AT negeta DOT com )
Coleman Kane [Wed, 9 Jul 2008 00:10:55 +0000 (00:10 +0000)]
Fix a mutex LOR introduced by the conversion of if_ndis from spinlocks to
mutexes and replacing the obsolete if_watchdog interface. The ndis_ticktask
function calls into ieee80211_new_state under one condition with NDIS_LOCK
held. The ieee80211_new_state would call into ndis_start in some cases too,
resulting in the occasional case where ndis_start acquires NDIS_LOCK from
inside the NDIS_LOCK held by ndis_ticktask.
Obtained from: Paul B. Mahol <onemda@gmail.com>
MFC after: 1 week
Alan Cox [Tue, 8 Jul 2008 22:59:17 +0000 (22:59 +0000)]
Eliminate pmap_growkernel()'s dependence on create_pagetables() preallocating
page directory pages from VM_MIN_KERNEL_ADDRESS through the end of the
kernel's bss. Specifically, the dependence was in pmap_growkernel()'s one-
time initialization of kernel_vm_end, not in its main body. (I could not,
however, resist the urge to optimize the main body.)
Reduce the number of preallocated page directory pages to just those needed
to support NKPT page table pages. (In fact, this allows me to revert a
couple of my earlier changes to create_pagetables().)
Queue decapsulated packed instead of performing direct dispatch. Some
execution pathes might hit stack limit under certain circumstances
(e.g. ng_mppc).
- Simplify the procedure of retrieving XML-data from the kernel.
- Fix a number of potential memory leaks in libgeom related to doing realloc
without freeing old pointer if things go wrong.
- Fix a number of places in libgeom where malloc and calloc return values
were not checked.
- Check malloc return value and provide sufficient warning messages when XML
parsing fails.
PR: kern/83464
Submitted by: Dan Lukes <dan - at - obluda.cz>
Approved by: kib (mentor)
Alan Cox [Tue, 8 Jul 2008 04:00:22 +0000 (04:00 +0000)]
Rev 180333, ``Change create_pagetables() and pmap_init() so that many fewer
page table pages have to be preallocated ...'', violates an assumption made
by minidumpsys(): kernel_vm_end is the highest virtual address that has ever
been used by the kernel. Now, however, the kernel code, data, and bss may
reside at addresses beyond kernel_vm_end. This revision modifies the upper
bound on minidumpsys()'s two page table traversals to account for this
possibility.
Move cpuset_refroot and cpuset_refbase functions up, grouping the
cpuset_ref* functions together. Will make it easier to read and
add code without forward declarations.
No functional changes.
Add inline function ia64_fc_i() to abstract inline assembly.
Use the new inline function in ia64_invalidate_icache().
While there, add proper synchronization so that we know
the fc.i instructions have taken effect when we return.
Alan Cox [Mon, 7 Jul 2008 17:25:09 +0000 (17:25 +0000)]
In FreeBSD 7.0 and beyond, pmap_growkernel() should pass VM_ALLOC_INTERRUPT
to vm_page_alloc() instead of VM_ALLOC_SYSTEM. VM_ALLOC_SYSTEM was the
logical choice before FreeBSD 7.0 because VM_ALLOC_INTERRUPT could not
reclaim a cached page. Simply put, there was no ordering between
VM_ALLOC_INTERRUPT and VM_ALLOC_SYSTEM as to which "dug deeper" into the
cache and free queues. Now, there is; VM_ALLOC_INTERRUPT dominates
VM_ALLOC_SYSTEM.
While I'm here, teach pmap_growkernel() to request a prezeroed page.
When making release with NOPORTS, we'll checkout only the
mininal set of ports required to make the docs. However,
we also need ports/sysutils/cdrtools in order to make the
ISO images. When a platform doesn't have packages, the
release will fail in that case. Add ports/sysutils/cdrtools
to RELEASEPORTSMODULE for the DOMINIMALDOCPORTS case to
handle the NOPORTS release build.
Note that this change doesn't try to handle the NOPORTS with
NODOC case. For we have NOPORTSATALL set and it seems wrong
to check out a ports module in that case.
Robert Watson [Mon, 7 Jul 2008 12:27:55 +0000 (12:27 +0000)]
Allow udp_notify() to accept read, as well as write, locks on the passed
inpcb. When directly invoking udp_notify() from udp_ctlinput(), acquire
only a read lock; we may still see write locks in udp_notify() as the
in_pcbnotifyall() routine is shared with TCP and always uses a write lock
on the inpcb being notified.
Robert Watson [Mon, 7 Jul 2008 12:14:10 +0000 (12:14 +0000)]
Add additional udbinfo and inpcb locking assertions to udp_output(); for
some code paths, global or inpcb write locks are required, but for other
code paths, read locks or no locking at all are sufficient for the data
structures.
Robert Watson [Mon, 7 Jul 2008 10:56:55 +0000 (10:56 +0000)]
First step towards parallel transmit in UDP: if neither a specific
source or a specific destination address is requested as part of a send
on a UDP socket, read lock the inpcb rather than write lock it. This
will allow fully parallel transmit down to the IP layer when sending
simultaneously from multiple threads on a connected UDP socket.
Parallel transmit for more complex cases, such as when sendto(2) is
invoked with an address and there's already a local binding, will
follow.
Robert Watson [Mon, 7 Jul 2008 10:11:17 +0000 (10:11 +0000)]
Drop read lock on udbinfo earlier during delivery to the last matching
UDP socket for a datagram; the inpcb read lock is sufficient to provide
inpcb stability during udp6_append().
The kqueue_register() function assumes that it is called from the top of
the syscall code and acquires various event subsystem locks as needed.
The handling of the NOTE_TRACK for EVFILT_PROC is currently done by
calling the kqueue_register() from filt_proc() filter, causing recursive
entrance of the kqueue code. This results in the LORs and recursive
acquisition of the locks.
Implement the variant of the knote() function designed to only handle
the fork() event. It mostly copies the knote() body, but also handles
the NOTE_TRACK, removing the handling from the filt_proc(), where it
causes problems described above. The function is called from the fork1()
instead of knote().
When encountering NOTE_TRACK knote, it marks the knote as influx
and drops the knlist and kqueue lock. In this context call to
kqueue_register is safe from the problems.
An error from the kqueue_register() is reported to the observer as
NOTE_TRACKERR fflag.
Robert Watson [Mon, 7 Jul 2008 09:26:52 +0000 (09:26 +0000)]
Drop read lock on udbinfo earlier during delivery to the last matching
UDP socket for a datagram; the inpcb read lock is sufficient to provide
inpcb stability during udp_append().
David Malone [Mon, 7 Jul 2008 09:25:49 +0000 (09:25 +0000)]
Add a new ioctl for changing the read filter (BIOCSETFNR). This is
just like BIOCSETF but it doesn't drop all the packets buffered on
the discriptor and reset the statistics.
Also, when setting the write filter, don't drop packets waiting to
be read or reset the statistics.
The r178914 I erronously put the setting of the KQ_FLUXWAIT flag before
KQ_FLUX_WAKEUP(). Since the later macro clears the KQ_FLUXWAIT, the
kqueue_scan() thread may be not woken up.
Move the setting of KQ_FLUXWAIT after wakeup to correct the issue.
Warner Losh [Sun, 6 Jul 2008 21:09:29 +0000 (21:09 +0000)]
As discussed on IRC and at BSDcan, move the mips32/* directories up a
level. The distinction was artificial. Some more movement around the
deck charis is likely depending on the fallout from this one.
Paths were corrected after the svn mv. Hope that's OK.
Daniel Gerzo [Sun, 6 Jul 2008 17:03:37 +0000 (17:03 +0000)]
- This code was intially obtained from NetBSD, but it's missing licence
statement. Add the one from the current NetBSD version.
- Also bump a date to reflect my content changes I have done in previous
revision
Warner Losh [Sun, 6 Jul 2008 06:17:39 +0000 (06:17 +0000)]
Merge from NetBSD's pcmciadev file (rev ~1.208 - 1.226) where
appropriate (versions not appropriate to merge omitted):
o 1.226 imp nop, save for NetBSD string (minor merging the other way)
o 1.225 jnemeth Coreage LAPCCTXD
o 1.224 martin (remove 3rd and 4th clauses)
o 1.223 kiyohara (TDK bluetooth PC Card)
o 1.222 kiyohara (Anycom BlueCard)
o 1.221 ichiro (NEC Infrontia AX420N)
o 1.219 jmcneill (EDIMAX EP-4101)
o 1.213 tsutsui (TEAC IDECARDII entry fix)
Also, while I'm here, fix some tab problems that have crept in.
Rui Paulo [Sat, 5 Jul 2008 23:19:37 +0000 (23:19 +0000)]
Use config_intrhook API to create the dev.cpu.N.temperature sysctl node.
Our hook creates the sysctl node before root is mounted, but after cpu
is probed. It seems that k8temp can be loaded before the cpu module and,
in those cases, dev.cpu.0.temperature was not created.
Alan Cox [Sat, 5 Jul 2008 20:44:55 +0000 (20:44 +0000)]
Increase the kernel map's size to 7GB, making room for a kmem map of size
greater than 4GB. (Auto-sizing will set the ceiling on the kmem map size
to 4.2GB.)
Make sure we are clearing the ZBUF_FLAG_IMMUTABLE any time a free buffer
is reclaimed by the kernel. This fixes a bug resulted in the kernel
over writing packet data while user-space was still processing it when
zerocopy is enabled. (Or a panic if invariants was enabled).
Robert Watson [Sat, 5 Jul 2008 19:12:55 +0000 (19:12 +0000)]
Clarify comments and prototypes in raw_cb.h:
- the protosw entries are used directly
- the usrreq functions are library routines, generally wrapped by
consumers rather than being used directly
- the usrreq structure entries are likewise typically wrapped
Remove the rather incorrect #if 0'd pr_input_t prototype for raw_input.