edwin [Tue, 4 Dec 2007 00:30:07 +0000 (00:30 +0000)]
MFV of tzdata2007j
Timezone data changes in this import:
- Add America/St_Barthelemy (BL) and America/Marigot (MF)
- Venezuela will move to -4:30 on 9 December 2007 instead of 31 December 2007
MFCs will be done after the code freezes have stopped.
thompsa [Mon, 3 Dec 2007 21:51:28 +0000 (21:51 +0000)]
Remove compatibilty defines to simplify reading the code, this is around 10% of
the total LOC. These are mostly for the 6.x branch and it will be easier to
cherrypick any changes (if at all).
rwatson [Mon, 3 Dec 2007 21:21:15 +0000 (21:21 +0000)]
Display per-thread command line in TDNAME field for -k and -t; if
no per-thread name is available or the name is identical to the
process name, display "-" instead. Very slightly shrink the COMM
entry to make a bit more room, although this doesn't help with
stack traces much.
das [Mon, 3 Dec 2007 17:48:55 +0000 (17:48 +0000)]
Make sure we set the locale to "C" when testing thousands' separator
support, rather than just "", which refers to the system default based
on the environment.
rwatson [Mon, 3 Dec 2007 14:44:35 +0000 (14:44 +0000)]
When a symbol name can't be resolved, return "??" as the name, rather
than "Unknown func", in order to avoid putting spaces in what ideally
is a string separated by white space.
kib [Mon, 3 Dec 2007 14:02:27 +0000 (14:02 +0000)]
Do not allow the SNPSTTY ioctl for the snoop device that has a tty
attached. Otherwise, the snp->snp_tty would be overwritten, while the
tty line discipline still set to the snpdisc. Then snplwrite() causes
panic because ttytosnp() cannot find the snp.
jkoshy [Mon, 3 Dec 2007 10:29:49 +0000 (10:29 +0000)]
When printing the contents of a HWPMC log in human readable form:
- Print a warning if the version number recorded in the log is not what the
tool expects.
- Print a tidier error message when an unrecognized event is encountered
in the log.
- Don't print a spurious 'Unknown error: 0' when exiting after a parse
error.
dougb [Mon, 3 Dec 2007 08:26:34 +0000 (08:26 +0000)]
Update this file so that BIND on ARM can actually work. I quote:
The problem was, isc_atomic_cmpxchg() is almost like our
atomic_cmpset_32(), except it expects the old value to be
returned, whereas our atomic_cmpset_32 returns 1 on success,
or 0 on failure. So I re-implemented something suitable.
rwatson [Sun, 2 Dec 2007 23:31:45 +0000 (23:31 +0000)]
Add procstat(1), a process inspection utility. This provides both some
of the missing functionality from procfs(4) and new functionality for
monitoring and debugging specific processes. procstat(1) operates in
the following modes:
-b Display binary information for the process.
-c Display command line arguments for the process.
-f Display file descriptor information for the process.
-k Display the stacks of kernel threads in the process.
-s Display security credential information for the process.
-t Display thread information for the process.
-v Display virtual memory mappings for the process.
Further revision and modes are expected.
Testing, ideas, etc: cognet, sam, Skip Ford <skip at menantico dot com>
Wesley Shields <wxs at atarininja dot org>
rwatson [Sun, 2 Dec 2007 21:52:18 +0000 (21:52 +0000)]
Add another new sysctl in support of the forthcoming procstat(1) to
support its -k argument:
kern.proc.kstack - dump the kernel stack of a process, if debugging
is permitted.
This sysctl is present if either "options DDB" or "options STACK" is
compiled into the kernel. Having support for tracing the kernel
stacks of processes from user space makes it much easier to debug
(or understand) specific wmesg's while avoiding the need to enter
DDB in order to determine the path by which a process came to be
blocked on a particular wait channel or lock.
rwatson [Sun, 2 Dec 2007 20:40:35 +0000 (20:40 +0000)]
Break out stack(9) from ddb(4):
- Introduce per-architecture stack_machdep.c to hold stack_save(9).
- Introduce per-architecture machine/stack.h to capture any common
definitions required between db_trace.c and stack_machdep.c.
- Add new kernel option "options STACK"; we will build in stack(9) if it is
defined, or also if "options DDB" is defined to provide compatibility
with existing users of stack(9).
Add new stack_save_td(9) function, which allows the capture of a stacktrace
of another thread rather than the current thread, which the existing
stack_save(9) was limited to. It requires that the thread be neither
swapped out nor running, which is the responsibility of the consumer to
enforce.
cognet [Sun, 2 Dec 2007 15:26:30 +0000 (15:26 +0000)]
Fix a potential bug in pmap :
We used to allocate the domains 0-14 for userland, and leave the domain 15
for the kernel. Now supersections requires the use of domain 0, so we
switched the kernel domain to 0, and use 1-15 for userland.
How it's done currently, the kernel domain could be allocated for a
userland process.
So switch back to the previous way we did things, set the first available
domain to 0, and just add 1 to get the real domain number in the struct pmap.
Reported by: Mark Tinguely <tinguely AT casselton DOT net>
MFC After: 3 days
guido [Sun, 2 Dec 2007 13:00:47 +0000 (13:00 +0000)]
Consider the following situation:
1. A packet comes in that is to be forwarded
2. The destination of the packet is rewritten by some firewall code
3. The next link's MTU is too small
4. The packet has the DF bit set
Then the current code is such that instead of setting the next
link's MTU in the ICMP error, ip_next_mtu() is called and a guess
is sent as to which MTU is supposed to be tried next. This is because
in this case ip_forward() is called with srcrt set to 1. In that
case the ia pointer remains NULL but it is needed to get the MTU
of the interface the packet is to be sent out from.
Thus, we always set ia to the outgoing interface.
cognet [Sun, 2 Dec 2007 12:49:28 +0000 (12:49 +0000)]
Close a race.
The RAS implementation would set the end address, then the start
address. These were used by the kernel to restart a RAS sequence if
it was interrupted. When the thread switching code ran, it would
check these values and adjust the PC and clear them if it did.
However, there's a small flaw in this scheme. Thread T1, sets the end
address and gets preempted. Thread T2 runs and also does a RAS
operation. This resets end to zero. Thread T1 now runs again and
sets start and then begins the RAS sequence, but is preempted before
the RAS sequence executes its last instruction. The kernel code that
would ordinarily restart the RAS sequence doesn't because the PC isn't
between start and 0, so the PC isn't set to the start of the sequence.
So when T1 is resumed again, it is at the wrong location for RAS to
produce the correct results. This causes the wrong results for the
atomic sequence.
The window for the first race is 3 instructions. The window for the
second race is 5-10 instructions depending on the atomic operation.
This makes this failure fairly rare and hard to reproduce.
Mutexs are implemented in libthr using atomic operations. When the
above race would occur, a lock could get stuck locked, causing many
downstream problems, as you might expect.
Also, make sure to reset the start and end address when doing a syscall, or
a malicious process could set them before doing a syscall.
Reviewed by: imp, ups (thanks guys)
Pointy hat to: cognet
MFC After: 3 days
rwatson [Sun, 2 Dec 2007 10:10:27 +0000 (10:10 +0000)]
Add two new sysctls in support of the forthcoming procstat(1) to support
its -f and -v arguments:
kern.proc.filedesc - dump file descriptor information for a process, if
debugging is permitted, including socket addresses, open flags, file
offsets, file paths, etc.
kern.proc.vmmap - dump virtual memory mapping information for a process,
if debugging is permitted, including layout and information on
underlying objects, such as the type of object and path.
These provide a superset of the information historically available
through the now-deprecated procfs(4), and are intended to be exported
in an ABI-robust form.
rwatson [Sat, 1 Dec 2007 22:04:16 +0000 (22:04 +0000)]
Modify stack(9) stack_print() and stack_sbuf_print() routines to use new
linker interfaces for looking up function names and offsets from
instruction pointers. Create two variants of each call: one that is
"DDB-safe" and avoids locking in the linker, and one that is safe for
use in live kernels, by virtue of observing locking, and in particular
safe when kernel modules are being loaded and unloaded simultaneous to
their use. This will allow them to be used outside of debugging
contexts.
Modify two of three current stack(9) consumers to use the DDB-safe
interfaces, as they run in low-level debugging contexts, such as inside
lockmgr(9) and the kernel memory allocator.
peter [Sat, 1 Dec 2007 20:39:47 +0000 (20:39 +0000)]
Based in info gleaned from the web and other drivers (including the Linux
sx driver), change a magic value in the PLX bridge chip. Apparently later
builds of the PCI cards had corrected values in the configuration eeprom.
This change supposedly fixes some pci bus problems.
rwatson [Sat, 1 Dec 2007 19:24:28 +0000 (19:24 +0000)]
The kernel linker includes a number of utility functions to look up symbol
information in support of DDB(4); these functions bypass normal linker
locking as they may run in contexts where locking is unsafe (such as the
kernel debugger).
Add a new interface linker_ddb_search_symbol_name(), which looks up a
symbol name and offset given an address, and also
linker_search_symbol_name() which does the same but *does* follow the
locking conventions of the linker.
Unlike existing functions, these functions place the name in a
caller-provided buffer, which is stable even after linker locks have been
released. These functions will be used in upcoming revisions to stack(9)
to support kernel stack trace generation in contexts as part of a live,
rather than suspended, kernel.
rwatson [Sat, 1 Dec 2007 14:24:44 +0000 (14:24 +0000)]
For un-prototyped static inline functions declared in pthread_md.h on
sparc64, use ANSI function headers and specifically indicate the lack of
arguments with 'void'. Otherwise, warnings are generated at WARNS=3 for
libkse, leading to a compile failure with -Werror.
rwatson [Sat, 1 Dec 2007 14:23:29 +0000 (14:23 +0000)]
For un-prototyped static inline functions declared in pthread_md.h on
ia64, powerpc, and sparc64, use ANSI function headers and specifically
indicate the lack of arguments with 'void'. Otherwise, warnings are
generated at WARNS=3, leading to a compile failure with -Werror.
kensmith [Sat, 1 Dec 2007 13:12:43 +0000 (13:12 +0000)]
Fix a broken check that recently became more annoying because it now
gets enabled when INVARIANTS is on instead of DIAGNOSTIC (which apparently
nobody uses). From Tor's description:
This happens when the block range spans two block maps, the first in the
inode (mapping up to NDADDR direct blocks) and the second being the first
indirect block. The current check assumes that both block maps are
indirect blocks.
bz [Fri, 30 Nov 2007 23:41:51 +0000 (23:41 +0000)]
Move call to tcp_signature_compute() after we adjusted the payload offset
in the tcp header. With relevant parts of the tcp header changing after
the 'signature' was computed, the signature becomes invalid.
Reviewed by: tools/regression/netinet/tcpconnect
MFC after: 3 days
Tested by: Nick Hilliard (see net@)
marius [Fri, 30 Nov 2007 23:02:42 +0000 (23:02 +0000)]
- Add the PCI side of the HOST-PCI bridge itself to the bus. This
is required by the X.Org PCI domains code and additionally needs
a workaround for Hummingbird and Sabre bridges as these don't
allow their config headers to be read at any width, which is an
unusual behavior.
- In psycho(4) take advantage of DEFINE_CLASS_0 and use more
appropriate types for some softc members.
peter [Fri, 30 Nov 2007 21:45:07 +0000 (21:45 +0000)]
Allow the sio acpi attachment to be disabled (ie: use hints only). This
hack means you can get the units and flags to match up more easily with
serial consoles on machines with acpi tables that cause the com ports
to be probed in the wrong order (and hence get the wrong sio unit number).
This replaces the common alternative hack of editing the code to comment
out the acpi attachment. This could go away entirely when device wiring
patches are committed.
peter [Fri, 30 Nov 2007 21:36:12 +0000 (21:36 +0000)]
Add sio_puc_kludge_unit() to stop sio devices originating from puc
stomping on the units intended for the motherboard sio ports. This is
no real substitute for the not-yet-committed device wiring enhancements.
peter [Fri, 30 Nov 2007 21:29:08 +0000 (21:29 +0000)]
Add sysctl_rename_oid() to support device_set_unit() usage. Otherwise,
when unit numbers are changed, the sysctl devinfo tree gets out of sync
and duplicate trees are attempted to be attached with the original name.
alc [Fri, 30 Nov 2007 07:14:42 +0000 (07:14 +0000)]
Improve get_pv_entry()'s handling of low-memory conditions. After page
allocation fails and pv entries are reclaimed, there may be an unused pv
entry in a pv chunk that survived the reclamation. However, previously,
after reclamation, get_pv_entry() did not look for an unused pv entry in
a surviving pv chunk; it simply retried the page allocation. Now, it
does look for an unused pv entry before retrying the page allocation.
Note: This only applies to RELENG_7. Earlier branches use a different
pv entry allocator.
brooks [Thu, 29 Nov 2007 21:49:08 +0000 (21:49 +0000)]
To reduce the impact of possible removal of the syscalls required by
libkse in FreeBSD 8.0, do not build or install static versions of libkse
(i.e. libkse*.a) in the default case. Static versions will be built and
installed if libthr is not built or if libkse is the default threading
library.
jkoshy [Thu, 29 Nov 2007 06:43:58 +0000 (06:43 +0000)]
Revert revision 1.4.
Intel CPUs with family 0x6, model 0xE and later (i.e., Intel Core(TM))
have a PMC architecture that differs somewhat from previous CPUs in
family 0x6. Even though the basic programming model is similar, the
documented set of legal values that may be loaded into their PMC MSRs
differs from that of the previous PMCs in family 0x6 and reusing bit
values valid for the older PMCs could result in undefined behaviour in
the general case.
peter [Thu, 29 Nov 2007 06:34:30 +0000 (06:34 +0000)]
Move the shared cp_time array (counts %sys, %user, %idle etc) to the
per-cpu area. cp_time[] goes away and a new function creates a merged
cp_time-like array for things like linprocfs, sysctl etc. The
atomic ops for updating cp_time[] in statclock go away, and the scope
of the thread lock is reduced.
sysctl kern.cp_time returns a backwards compatible cp_time[] array.
A new kern.cp_times sysctl returns the individual per-cpu stats.
I have pending changes to make top and vmstat optionally show per-cpu
stats.
I'm very aware that there are something like 5 or 6 other versions "out
there" for doing this - but none were handy when I needed them.
I did merge my changes with John Baldwin's, and ended up replacing a
few chunks of my stuff with his, and stealing some other code.
bde [Thu, 29 Nov 2007 02:01:21 +0000 (02:01 +0000)]
Don't use plain "ret" instructions at targets of jump instructions,
since the branch caches on at least Athlon XP through Athlon 64 CPU's
don't understand such instructions and guarantee a cache miss taking
at least 10 cycles. Use the documented workaround "ret $0" instead
("nop; ret" also works, but "ret $0" is probably faster on old CPUs).
Normal code (even asm code) doesn't branch to "ret", since there is
usually some cleanup to do, but the __mcount, .mcount and .mexitcount
entry points were optimized too well to have the minimum number of
instructions (3 instructions each if profiling is not enabled) and
they did this. I didn't see a significant number of cache misses for
.mexitcount, but for the shared "ret" for __mcount and .mcount I
observed cache misses costing 26 cycles each. For a send(2) syscall
that makes about 70 function calls, the cost of these cache misses
alone increased the syscall time from about 4000 cycles to about 7000
cycles. 4000 is for a profiling (GUPROF) kernel with profiling disabled;
after this fix, configuring profiling only costs about 600 cycles in the
4000, which is consistent with almost perfect branch prediction in the
mcounting calls.
bde [Thu, 29 Nov 2007 01:15:03 +0000 (01:15 +0000)]
Remove entry points for -finstrument functions since they are currently
unused except to obfuscate disassemblies. -mprofiler-epilogue is
currently with gcc-4 (it does too little), but -finstrument-functions
is broken in a different way (it does too much).
amd64 version: meger whitespace fixes from i386 version.
jfv [Wed, 28 Nov 2007 23:04:11 +0000 (23:04 +0000)]
Add COHERENT to descriptor mem allocation for the
benefit of ARM (request from Olivier Houchard), its
a noop on most architectures and goodness on those
that use it.
jb [Wed, 28 Nov 2007 22:58:09 +0000 (22:58 +0000)]
Remove _SOLARIS_C_SOURCE now that it doesn't do anything in FreeBSD
headers. All OpenSolaris compatibility comes via the set of specific
compatibility headers in src/compat/opensolaris and
src/sys/compat/opensolaris.
cperciva [Wed, 28 Nov 2007 22:45:09 +0000 (22:45 +0000)]
Add /root/, /.cshrc, and /.profile to the default UpdateIfUnmodified
directive. Users get irritated if FreeBSD Update steps on these while
upgrading to a new release.
alc [Wed, 28 Nov 2007 22:41:14 +0000 (22:41 +0000)]
Account for pv entry pages in the total number of wired pages. (Note: pv
entry pages have always been included in the total number of wired pages
on i386 just not amd64.)
bz [Wed, 28 Nov 2007 22:35:48 +0000 (22:35 +0000)]
Update man page to reflect latest work on enc(4):
- added sysctls to if_enc(4) to control whether the firewalls or
bpf will see inner and outer headers or just inner headers
for incoming and outgoing IPsec packets.
bz [Wed, 28 Nov 2007 22:33:53 +0000 (22:33 +0000)]
Add sysctls to if_enc(4) to control whether the firewalls or
bpf will see inner and outer headers or just inner or outer
headers for incoming and outgoing IPsec packets.
This is useful in bpf to not have over long lines for debugging
or selcting packets based on the inner headers.
It also properly defines the behavior of what the firewalls see.
Last but not least it gives you if_enc(4) for IPv6 as well.
[ As some auxiliary state was not available in the later
input path we save it in the tdbi. That way tcpdump can give a
consistent view of either of (authentic,confidential) for both
before and after states. ]
Discussed with: thompsa (2007-04-25, basic idea of unifying paths)
Reviewed by: thompsa, gnn