Doug Barton [Sat, 16 May 2009 22:22:31 +0000 (22:22 +0000)]
Enhance the safety of the -U option:
1. In several places make sure that the mtree database is not empty using
the -s argument to test instead of -f. (I thought I'd already changed this,
but obviously not.)
2. When deriving the list of changed files use a colon-delimited list.
3. If the list of changed files is empty, unset the variable, and test
for a non-empty CHANGED in diff_loop() before entering that routine.
Enhance the speed of the -U option by using an internal case statement
instead of echoing the variable to an external grep for every file.
Doug Barton [Sat, 16 May 2009 20:55:28 +0000 (20:55 +0000)]
1. New feature; option to have the script loop until a specified hostname
(localhost by default) can be successfully looked up. Off by default.
2. New feature: option to create a forwarder configuration file based on
the contents of /etc/resolv.conf. This allows you to utilize a local
resolver for better performance, less network traffic, custom zones, etc.
while still relying on the benefits of your local network resolver.
Off by default.
3. Add named-checkconf into the startup routine. This will prevent named
from trying to start in a situation where it would not be possible to do
so.
Rick Macklem [Sat, 16 May 2009 03:12:55 +0000 (03:12 +0000)]
Fixed the Null callback RPCs so that they work with the new krpc. This
required two changes: setting the program and version numbers before
connect and fixing the handling of the Null Rpc case in newnfs_request().
Rick Macklem [Fri, 15 May 2009 19:33:59 +0000 (19:33 +0000)]
Move the nfsstat structure and proc/op number definitions on the
experimental nfs subsystem from sys/fs/nfs/nfs.h and sys/fs/nfs/nfsproto.h
to sys/fs/nfs/nfsport.h and rename nfsstat to ext_nfsstat. This was done
so that src/usr.bin/nfsstat.c could use it alongside the regular nfs
include files and struct nfsstat.
Devfs replaces file ops vector with devfs-specific one in devfs_open(),
before the struct file is fully initialized in vn_open(), in particular,
fp->f_vnode is NULL. Other thread calling file operation before f_vnode
is set results in NULL pointer dereference in devvn_refthread().
Initialize f_vnode before calling d_fdopen() cdevsw method, that might
set file ops too.
Reported and tested by: Chris Timmons <cwt networks cwu edu>
(RELENG_7 version)
MFC after: 3 days
Revert r192094. The revision caused problems for sysctl(3) consumers
that expect that oldlen is filled with required buffer length even when
supplied buffer is too short and returned error is ENOMEM.
Redo the fix for kern.proc.filedesc, by reverting the req->oldidx when
remaining buffer space is too short for the current kinfo_file structure.
Also, only ignore ENOMEM. We have to convert ENOMEM to no error condition
to keep existing interface for the sysctl, though.
Ed Schouten [Fri, 15 May 2009 14:30:37 +0000 (14:30 +0000)]
Turn consolectl into a simple device node, not a TTY.
Apart from the 16 virtual terminals, Syscons allocates two device nodes
that should not really be TTYs, even though they are. One of them is
consolectl. In RELENG_7 and before, these device nodes are used in
single user mode. After I simplified input path, we only use this device
node to call ioctl() on (moused, Xorg, vidcontrol).
When you call ioctl() on consolectl, it will behave the same as being
called on the first window.
Xin LI [Thu, 14 May 2009 23:09:33 +0000 (23:09 +0000)]
As the comment says, close() frees the variable, record. So we obtain
the length by evaluating the value from the copy, cbuf instead. This
fixes a crash caused by previous commit (use-after-free)
Submitted by: Dimitry Andric <dimitry andric com>
Pointy hat to: delphij
Xin LI [Thu, 14 May 2009 22:33:37 +0000 (22:33 +0000)]
Try to workaround a race where bge_stop() may sneak in when bge_rxeof()
drops and re-grabs the softc mutex in the middle, resulting in kernel
trap 12. This may happen when a lot of traffic is being hammered on
one bge(4) interface while the system is shutting down.
John Baldwin [Thu, 14 May 2009 22:01:32 +0000 (22:01 +0000)]
- Use a separate sx lock to try to limit the number of concurrent userland
sysctl requests to avoid wiring too much user memory. Only grab this
lock if the user's old buffer is larger than a page as a tradeoff to
allow more concurrency for common small requests.
- Just use a shared lock on the sysctl tree for user sysctl requests now.
John Baldwin [Thu, 14 May 2009 21:53:35 +0000 (21:53 +0000)]
Trim the default set of device hints on i386 and amd64:
- Remove vga0 and the disabled uart2/uart3 hints from both platforms.
- Remove hints for ISA adv0, bt0, aha0, aic0, ed0, cs0, sn0, ie0, fe0, and
le0 from i386. All these hints were marked 'disabled' and thus already
did not work "out of the box".
Rick Macklem [Thu, 14 May 2009 21:39:08 +0000 (21:39 +0000)]
Apply changes to the experimental nfs server so that it uses the security
flavors as exported in FreeBSD-CURRENT. This allows it to use a
slightly modified mountd.c instead of a different utility.
Rick Macklem [Thu, 14 May 2009 20:39:09 +0000 (20:39 +0000)]
Change the file names in the comments in sys/fs/nfs/nfs_var.h so
that they are the names used in FreeBSD-CURRENT. Also shuffled a
few entries around, so that they under the correct comment.
Attilio Rao [Thu, 14 May 2009 17:43:00 +0000 (17:43 +0000)]
FreeBSD right now support 32 CPUs on all the architectures at least.
With the arrival of 128+ cores it is necessary to handle more than that.
One of the first thing to change is the support for cpumask_t that needs
to handle more than 32 bits masking (which happens now). Some places,
however, still assume that cpumask_t is a 32 bits mask.
Fix that situation by using always correctly cpumask_t when needed.
While here, remove the part under STOP_NMI for the Xen support as it
is broken in any case.
Additively make ipi_nmi_pending as static.
Reviewed by: jhb, kmacy
Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com>
Rafal Jaworowski [Thu, 14 May 2009 16:48:25 +0000 (16:48 +0000)]
PowerPC common SMP startup and time base rework.
- make mftb() shared, rewrite in C, provide complementary mttb()
- adjust SMP startup per the above, additional comments, minor naming
changes
- eliminate redundant TB defines, other minor cosmetics
Sam Leffler [Thu, 14 May 2009 16:23:24 +0000 (16:23 +0000)]
correct handling of ctl frames: the sender's address is always i_addr2 for
frames we should expect to process (old code was trying to handle frames
we should never see--like ACK)
John Baldwin [Thu, 14 May 2009 14:57:13 +0000 (14:57 +0000)]
- Add a void pointer to the ata-pci controller softc to allow
chipset-specific code to attach chipset-specific data.
- Use chipset-specific data in the acard and promise chipsets rather than
changing the ivars of ATA PCI devices. ivars are reserved for use by the
parent bus driver and are _not_ available for use by devices directly.
This fixes a panic during sysctl -a with certain Promise controllers with
ACPI enabled.
Reviewed by: mav
Tested by: Magnus Kling (kingfon @ gmail) (on 7)
MFC after: 3 days
Do not advance req->oldidx when sysctl_old_user returning an
error due to copyout failure or short buffer.
The later breaks the usermode iterators of the sysctl results that pack
arbitrary number of variable-sized structures. Iterator expects that
kernel filled exactly oldlen bytes, and tries to interpret half-filled
or garbage structure at the end of the buffer. In particular,
kinfo_getfile(3) segfaulted.
Craig Rodrigues [Thu, 14 May 2009 08:26:20 +0000 (08:26 +0000)]
Set crashinfo_enable to "YES" by default.
During bootup, if /etc/rc.d/savecore detects a core dump file
on the dump device, the core file will be saved, and the crashinfo
script will be run to generate a human-readable report.
This will make it easier for end-users to provide feedback to
developers about kernel crashes.
Jeff Roberson [Thu, 14 May 2009 03:24:22 +0000 (03:24 +0000)]
- Implement a lockless file descriptor lookup algorithm in
fget_unlocked().
- Save old file descriptor tables created on expansion until
the entire descriptor table is freed so that pointers may be
followed without regard for expanders.
- Mark the file zone as NOFREE so we may attempt to reference
potentially freed files.
- Convert several fget_locked() users to fget_unlocked(). This
requires us to manage reference counts explicitly but reduces
locking overhead in the common case.
Nathan Whitehorn [Thu, 14 May 2009 00:34:26 +0000 (00:34 +0000)]
Factor out platform dependent things unrelated to device drivers into a
new platform module. These are probed in early boot, and have the
responsibility of determining the layout of physical memory, determining
the CPU timebase frequency, and handling the zoo of SMP mechanisms
found on PowerPC.
Rick Macklem [Wed, 13 May 2009 21:18:34 +0000 (21:18 +0000)]
Apply a one line change to nfs_clbio.c (which is largely a copy
of sys/nfsclient/nfs_bio.c) to track the change recently committed
by acl for nfs_bio.c.
John Baldwin [Wed, 13 May 2009 17:53:04 +0000 (17:53 +0000)]
Implement simple machine check support for amd64 and i386.
- For CPUs that only support MCE (the machine check exception) but not MCA
(i.e. Pentium), all this does is print out the value of the machine check
registers and then panic when a machine check exception occurs.
- For CPUs that support MCA (the machine check architecture), the support is
a bit more involved.
- First, there is limited support for decoding the CPU-independent MCA
error codes in the kernel, and the kernel uses this to output a short
description of any machine check events that occur.
- When a machine check exception occurs, all of the MCx banks on the
current CPU are scanned and any events are reported to the console
before panic'ing.
- To catch events for correctable errors, a periodic timer kicks off a
task which scans the MCx banks on all CPUs. The frequency of these
checks is controlled via the "hw.mca.interval" sysctl.
- Userland can request an immediate scan of the MCx banks by writing
a non-zero value to "hw.mca.force_scan".
- If any correctable events are encountered, the appropriate details
are stored in a 'struct mca_record' (defined in <machine/mca.h>).
The "hw.mca.count" is a count of such records and each record may
be queried via the "hw.mca.records" tree by specifying the record
index (0 .. count - 1) as the next name in the MIB similar to using
PIDs with the kern.proc.* sysctls. The idea is to export machine
check events to userland for more detailed processing.
- The periodic timer and hw.mca sysctls are only present if the CPU
supports MCA.
Robert Watson [Wed, 13 May 2009 17:22:33 +0000 (17:22 +0000)]
Garbage collect now-unused NETISR_FORCEQUEUE, which overrode the global
direct dispatch policy for specific protocols (NETISR_USB). We leave
the additional 'flags' argument to netisr_register() for the time being,
even though it is no longer required.
Warner Losh [Wed, 13 May 2009 14:43:26 +0000 (14:43 +0000)]
ifp->if_softc is managed entirely by the driver. We never set it to
NULL or change it. We initialize it before we set if_ioctl. It can
therefore never be NULL, and most other drivers don't bother with this
sanity check.
Nathan Whitehorn [Wed, 13 May 2009 14:25:55 +0000 (14:25 +0000)]
Add a short delay after programming PHY registers to give some time for
the engine to catch up. This prevents a machine check exception from
illegal memory requests with a BCM4318.
Alan Cox [Wed, 13 May 2009 07:42:53 +0000 (07:42 +0000)]
Correct a rare use-after-free error in pmap_copy(). This error was
introduced in amd64 revision 1.540 and i386 revision 1.547. However, it
had no harmful effects until after a recent change, r189698, on amd64.
(In other words, the error is harmless in RELENG_7.)
The error is triggered by the failure to allocate a pv entry for the one
and only mapping in a page table page. I am addressing the error by
changing pmap_copy() to abort if either pv entry allocation or page
table page allocation fails. This is appropriate because the creation of
mappings by pmap_copy() is optional. They are a (possible) optimization,
and not a requirement.
Correct a nearby whitespace error in the i386 pmap_copy().
Alan Cox [Wed, 13 May 2009 05:39:39 +0000 (05:39 +0000)]
Eliminate page queues locking from bufdone_finish() through the
following changes:
Rename vfs_page_set_valid() to vfs_page_set_validclean() to reflect
what this function actually does. Suggested by: tegge
Introduce a new version of vfs_page_set_valid() that does no more than
what the function's name implies. Specifically, it does not update
the page's dirty mask, and thus it does not require the page queues
lock to be held.
Update two of the three callers to the old vfs_page_set_valid() to
call vfs_page_set_validclean() instead because they actually require
the page's dirty mask to be cleared.
Stanislav Sedov [Tue, 12 May 2009 21:28:41 +0000 (21:28 +0000)]
- Resurrect the debug printf message I accidentally dropped
in the previous commit.
- Use device_printf instead of printf.
- Put all printfs in the interrupt handler under bootverbose.
Stanislav Sedov [Tue, 12 May 2009 21:14:36 +0000 (21:14 +0000)]
- Eliminate extra register reads by using a variable to store
registers contents.
- Use memory barriers to preserve the order of buffer space operations.
This might be needed if we'll ever use this driver on architectures
where ordering is not guaranteed.