]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
13 years agoThere is no point in vm_contig_launder{,_page}() flushing held pages,
alc [Wed, 29 Dec 2010 20:35:36 +0000 (20:35 +0000)]
There is no point in vm_contig_launder{,_page}() flushing held pages,
instead skip over them.  As long as a page is held, it can't be reclaimed by
contigmalloc(M_WAITOK).  Moreover, a held page may be undergoing
modification, e.g., vmapbuf(), so even if the hold were released before the
completion of contigmalloc(), the page might have to be flushed again.

MFC after: 3 weeks

13 years agosh: Properly restore exception handler in fc.
jilles [Wed, 29 Dec 2010 19:39:51 +0000 (19:39 +0000)]
sh: Properly restore exception handler in fc.

If SIGINT arrived at exactly the right moment (unlikely), an exception
handler in a no longer active stack frame would be called.

Because the old handler was not used in the normal path, clang thought it
was a dead value and if an exception happened it would longjmp() to garbage.
This caused builtins/fc1.0 to fail if histedit.c was compiled with clang.

MFC after: 1 week

13 years agoFix several callout migration races:
attilio [Wed, 29 Dec 2010 18:17:36 +0000 (18:17 +0000)]
Fix several callout migration races:
 - Problem1:
   Hypothesis: thread1 is doing a callout_reset_on(), within his
   callout handler, willing to implicitly or explicitly migrate the
   callout.  thread2 is draining the callout.

   Thesys:
   * thread1 calls callout_lock() and locks the old callout cpu
   * thread1 performs the checks in the first path of the
     callout_reset_on()
   * thread1 hits this codepiece:
       /*
        * If the lock must migrate we have to check the state again as
        * we can't hold both the new and old locks simultaneously.
        */
       if (c->c_cpu != cpu) {
               c->c_cpu = cpu;
               CC_UNLOCK(cc);
               goto retry;
       }

     which means it will drop the lock and 'retry'
   * thread2 will callout_lock() and locks the new callout cpu.
     thread1 spins on the new lock and will not keep going for the
     moment.
   * thread2 checks that the callout is not pending (as callout is
     currently running) and that it is not on cc->cc_curr (because cc
     now refers to the new callout and the callout is running on the
     old callout cpu) thus it thinks it is done and returns.
   * thread1  will now acquire the lock and then adds the callout
     to the new callout cpu queue

   That seems an obvious race as callout_stop() falsely reports
   the callout stopped or worse, callout_drain() falsely returns
   while the callout is still in use.
 - Solution1:
   Fixing this problem would require, in general, to lock both
   callout cpus at once while switching the c_cpu field and avoid
   cyclic deadlocks between callout cpus locks.
   The concept of CPUBLOCK is then introduced (working more or less
   like the blocked_lock for thread_lock() function) meaning:
   "in callout_lock(), spin until the c->c_cpu is not different from
   CPUBLOCK". That way the "original" callout cpu, referred to the
   above mentioned code snippet, will remain blocked until the lock
   handover is over critical path will remain covered.

 - Problem2:
   Having the callout currently executed on a specific callout cpu
   and contemporary pending on another callout cpu (as it can happen
   with current code) breaks, at least, the assumption callout_drain()
   returns just once the callout cannot be referenced anymore.
 - Solution2:
   Callout migration is deferred if the current callout is already
   under execution.
   The best place to do that is in softclock() and new members are
   added to the callout cpu structure in order to specify a pending
   migration is requested. That is necessary because the callout
   cannot be trusted (not freed) the 100% of times after the execution
   of the callout handler.
   CPUBLOCK will prevent, in the "deferred migration" case, that the
   callout gets freed in this case, stopping any callout_stop() and
   callout_drain() possible activity until the migration is
   actually performed.

 - Problem3:
   There is a further race in callout_drain().
   In order to avoid a race between sleepqueue lock and callout cpu
   spinlock, in _callout_stop_safe(), the callout cpu lock is dropped,
   the sleepqueue lock is acquired and a new callout cpu lookup is
   performed.  Note that the channel used for locking the sleepqueue is
   obtained from the "current" callout cpu (&cc->cc_waiting).
   If the callout migrated in the meanwhile, callout_drain() will end up
   using the wrong wchan for the sleepqueue (the locked one will be the
   older, while the new one will not really be locked) leading to a
   lock leak and a race access to sleepqueue.
 - Solution3:
   It is enough to check if a migration happened between the operation
   of acquiring the sleepqueue lock and the new callout cpu lock and
   eventually unwind all those and try again.

This problems can lead to deathly races on moderate (4-ways) SMP
environment, leading to easy panic or deadlocks.
The 24-ways of the reporter, could easilly panic, with completely
normal workload, almost daily.
gianni@ kindly wrote the following prof-of-concept which can
panic a FreeBSD machine in less than one hour, in smaller SMP:
http://www.freebsd.org/~attilio/callout/test.c

Reported by: Nicholas Esborn <nick at desert dot net>, DesertNet
In collabouration with: gianni, pho, Nicholas Esborn
Reviewed by: jhb
MFC after: 1 week (*)

* Usually, I would aim for a larger MFC timeout, but I really want this
  in before 8.2-RELEASE, thus re@ accepted a shorter timeout as a special
  case for this patch

13 years agoSwitch mips architectures back to libgcc.
kan [Wed, 29 Dec 2010 17:12:05 +0000 (17:12 +0000)]
Switch mips architectures back to libgcc.

MIPS64 n64 binaries are broken with libcompiler_rt at this time.
Switch mips back to libgcc until the cause of breakage is analyzed
and fixed.

13 years agoOn UltraSPARC-III+ and greater take advantage of ASI_ATOMIC_QUAD_LDD_PHYS,
marius [Wed, 29 Dec 2010 16:59:33 +0000 (16:59 +0000)]
On UltraSPARC-III+ and greater take advantage of ASI_ATOMIC_QUAD_LDD_PHYS,
which takes an physical address instead of an virtual one, for loading TTEs
of the kernel TSB so we no longer need to lock the kernel TSB into the dTLB,
which only has a very limited number of lockable dTLB slots. The net result
is that we now basically can handle a kernel TSB of any size and no longer
need to limit the kernel address space based on the number of dTLB slots
available for locked entries. Consequently, other parts of the trap handlers
now also only access the the kernel TSB via its physical address in order
to avoid nested traps, as does the PMAP bootstrap code as we haven't taken
over the trap table at that point, yet. Apart from that the kernel TSB now
is accessed via a direct mapping when we are otherwise taking advantage of
ASI_ATOMIC_QUAD_LDD_PHYS so no further code changes are needed. Most of this
is implemented by extending the patching of the TSB addresses and mask as
well as the ASIs used to load it into the trap table so the runtime overhead
of this change is rather low. Currently the use of ASI_ATOMIC_QUAD_LDD_PHYS
is not yet enabled on SPARC64 CPUs due to lack of testing and due to the
fact it might require minor adjustments there.
Theoretically it should be possible to use the same approach also for the
user TSB, which already is not locked into the dTLB, avoiding nested traps.
However, for reasons I don't understand yet OpenSolaris only does that with
SPARC64 CPUs. On the other hand I think that also addressing the user TSB
physically and thus avoiding nested traps would get us closer to sharing
this code with sun4v, which only supports trap level 0 and 1, so eventually
we could have a single kernel which runs on both sun4u and sun4v (as does
Linux and OpenBSD).

Developed at and committed from: 27C3

13 years ago- Move the macros for generating load and store instructions to asmacros.h
marius [Wed, 29 Dec 2010 14:14:50 +0000 (14:14 +0000)]
- Move the macros for generating load and store instructions to asmacros.h
  so they can be shared by different source files and extend them by a
  variant for atomic compare and swap.
- Consistently use EMPTY.

13 years agoRename the "xor" parameter to "xorval" as the former is a reserved keyword
marius [Wed, 29 Dec 2010 14:11:46 +0000 (14:11 +0000)]
Rename the "xor" parameter to "xorval" as the former is a reserved keyword
in C++.

Submitted by: gahr

13 years agoMove the increment of vm object generation count into
kib [Wed, 29 Dec 2010 12:53:53 +0000 (12:53 +0000)]
Move the increment of vm object generation count into
vm_object_set_writeable_dirty().

Fix an issue where restart of the scan in vm_object_page_clean() did
not removed write permissions for newly added pages or, if the mapping
for some already scanned page changed to writeable due to fault.
Merge the two loops in vm_object_page_clean(), doing the remove of
write permission and cleaning in the same loop. The restart of the
loop then correctly downgrade writeable mappings.

Fix an issue where a second caller to msync() might actually return
before the first caller had actually completed flushing the
pages. Clear the OBJ_MIGHTBEDIRTY flag after the cleaning loop, not
before.

Calls to pmap_is_modified() are not needed after pmap_remove_write()
there.

Proposed, reviewed and tested by: alc
MFC after: 1 week

13 years agoAdd support for FS_TRIM to user-mode UFS utilities.
kib [Wed, 29 Dec 2010 12:31:18 +0000 (12:31 +0000)]
Add support for FS_TRIM to user-mode UFS utilities.

Reviewed by: mckusick, pjd, pho
Tested by: pho
MFC after: 1 month

13 years agoAdd kernel side support for BIO_DELETE/TRIM on UFS.
kib [Wed, 29 Dec 2010 12:25:28 +0000 (12:25 +0000)]
Add kernel side support for BIO_DELETE/TRIM on UFS.

The FS_TRIM fs flag indicates that administrator requested issuing of
TRIM commands for the volume. UFS will only send the command to disk
if the disk reports GEOM::candelete attribute.

Since disk queue is reordered, data block is marked as free in the bitmap
only after TRIM command completed. Due to need to sleep waiting for
i/o to finish, TRIM bio_done routine schedules taskqueue to set the
bitmap bit.

Based on the patch by: mckusick
Reviewed by: mckusick, pjd
Tested by: pho
MFC after: 1 month

13 years agoMove the definition of mkdirlisthd from header to C file.
kib [Wed, 29 Dec 2010 12:16:06 +0000 (12:16 +0000)]
Move the definition of mkdirlisthd from header to C file.

Reviewed by: mckusick
Tested by: pho

13 years agoAdd reporting of GEOM::candelete BIO_GETATTR for md(4) and geom_disk(4).
kib [Wed, 29 Dec 2010 12:11:07 +0000 (12:11 +0000)]
Add reporting of GEOM::candelete BIO_GETATTR for md(4) and geom_disk(4).
Non-zero value of attribute means that device supports BIO_DELETE.

Suggested and reviewed by: pjd
Tested by: pho
MFC after: 1 week

13 years agoAdd sysctl vm.md_malloc_wait, non-zero value of which switches malloc-backed
kib [Wed, 29 Dec 2010 11:39:15 +0000 (11:39 +0000)]
Add sysctl vm.md_malloc_wait, non-zero value of which switches malloc-backed
md(4) to using M_WAITOK malloc calls.

M_NOWAITOK allocations may fail when enough memory could be freed, but not
immediately. E.g. SU UFS becomes quite unhappy when metadata write return
error, that would happen for failed malloc() call.

Reported and tested by: pho
MFC after: 1 week

13 years agoUse a proper type for the variable holding the summary size of the inode
kib [Wed, 29 Dec 2010 11:19:39 +0000 (11:19 +0000)]
Use a proper type for the variable holding the summary size of the inode
data. Otherwise, on 32bit systems, unlinked inode which size is the
multiple of 4GB was not truncated, causing corruption.

Reported by: brucec
Reviewed by: mckusick
Tested by: pho

13 years ago- Follow r216313, the sched_unlend_user_prio is no longer needed, always
davidxu [Wed, 29 Dec 2010 09:26:46 +0000 (09:26 +0000)]
- Follow r216313, the sched_unlend_user_prio is no longer needed, always
  use sched_lend_user_prio to set lent priority.
- Improve pthread priority-inherit mutex, when a contender's priority is
  lowered, repropagete priorities, this may cause mutex owner's priority
  to be lowerd, in old code, mutex owner's priority is rise-only.

13 years agoA lack of console input is not the same thing as a byte of \0 input.
cperciva [Wed, 29 Dec 2010 05:13:21 +0000 (05:13 +0000)]
A lack of console input is not the same thing as a byte of \0 input.
Correctly return -1 from cngetc when no input is available to be read.

This fixes the '(CTRL-C to abort)' spam while dumping.

MFC after: 3 days

13 years agoDelete the nfsvno_localconflict() function in the experimental
rmacklem [Tue, 28 Dec 2010 23:50:13 +0000 (23:50 +0000)]
Delete the nfsvno_localconflict() function in the experimental
NFS server since it is no longer used and is broken.

MFC after: 2 weeks

13 years agoMIPS has lots of flavors as well
imp [Tue, 28 Dec 2010 22:49:28 +0000 (22:49 +0000)]
MIPS has lots of flavors as well

13 years agoRevert r216777, per jhb@
imp [Tue, 28 Dec 2010 22:45:29 +0000 (22:45 +0000)]
Revert r216777, per jhb@

13 years agoRevert r216775, per jhb@
imp [Tue, 28 Dec 2010 22:44:32 +0000 (22:44 +0000)]
Revert r216775, per jhb@

13 years agoFix an error in the ABI in rtld_bind_start(). When passing arguments to a
nwhitehorn [Tue, 28 Dec 2010 22:31:59 +0000 (22:31 +0000)]
Fix an error in the ABI in rtld_bind_start(). When passing arguments to a
C function, the caller's stack frame must have room to store all of the
arguments to that function. While here, fix stack frame alignment issues.

Without this change, the compiler will save r3 and r4 into the caller's
stack frame before calling setjmp() in _rtld_bind(). These would then
overwrite arguments to the newly-bound function, causing eventual failures.

13 years agosh: Don't do optimized command substitution if expansions have side effects.
jilles [Tue, 28 Dec 2010 21:27:08 +0000 (21:27 +0000)]
sh: Don't do optimized command substitution if expansions have side effects.

Before considering to execute a command substitution in the same process,
check if any of the expansions may have a side effect; if so, execute it in
a new process just like happens if it is not a single simple command.

Although the check happens at run time, it is a static check that does not
depend on current state. It is triggered by:
- expanding $! (which may cause the job to be remembered)
- ${var=value} default value assignment
- assignment operators in arithmetic
- parameter substitutions in arithmetic except ${#param}, $$, $# and $?
- command substitutions in arithmetic

This means that $((v+1)) does not prevent optimized command substitution,
whereas $(($v+1)) does, because $v might expand to something containing
assignment operators.

Scripts should not depend on these exact details for correctness. It is also
imaginable to have the shell fork if and when a side effect is encountered
or to create a new temporary namespace for variables.

Due to the $! change, the construct $(jobs $!) no longer works. The value of
$! should be stored in a variable outside command substitution first.

13 years agoComment out npx and isa from NOTES file. We don't need them here
imp [Tue, 28 Dec 2010 21:22:08 +0000 (21:22 +0000)]
Comment out npx and isa from NOTES file.  We don't need them here
since DEFAULTS already pulls them in.

13 years agoRemove mem, io, isa and npx since they are duplicative of the entries
imp [Tue, 28 Dec 2010 21:20:58 +0000 (21:20 +0000)]
Remove mem, io, isa and npx since they are duplicative of the entries
in DEFAULTS.  Saves 8 lines of warnings when we build XBOX.

13 years agoDue to the automatic inclusion of DEFAULTS everywhere, and since it
imp [Tue, 28 Dec 2010 21:18:58 +0000 (21:18 +0000)]
Due to the automatic inclusion of DEFAULTS everywhere, and since it
has device mem in it almost everywhere, we get warnings about
duplicated device almost everywhere.  Comment it out, with a note
about why, so that we don't get those warnings.

13 years agoZFS might not return monotonically increasing directory offset cookies,
pjd [Tue, 28 Dec 2010 21:12:15 +0000 (21:12 +0000)]
ZFS might not return monotonically increasing directory offset cookies,
so turn off UFS-specific hack that assumes so in ZFS case.
Before the change we can miss returning some directory entries to a
NFS client.

I believe that the hack should be moved to ufs_readdir(), but until we find
somebody who will do it, turn it off for ZFS in NFS server code.

Submitted by: rmacklem
Discussed with: rmacklem, mckusick
MFC after: 3 days

13 years agoWhen allocating memory from bootmem for the kernel to use, try to leave about
jmallett [Tue, 28 Dec 2010 20:11:54 +0000 (20:11 +0000)]
When allocating memory from bootmem for the kernel to use, try to leave about
2MB of memory in the bootmem allocator for the SDK to use internally at a later
point.  It'd be nice if there were some functions we could call before
allocating memory to let various facilities reserve some memory, but for now
this seems sufficient.  Previously some unfortunate systems could give up all
(or at least most) of their memory to the kernel from bootmem, and then
allocating command queues for packet output and the like would fail later in
the boot process (which in turn would lead to crashes even later.)

Reported by: kan

13 years agoCorrect a typo in vm_fault_quick_hold_pages().
alc [Tue, 28 Dec 2010 20:02:30 +0000 (20:02 +0000)]
Correct a typo in vm_fault_quick_hold_pages().

Reported by: Bartosz Stec

13 years agoStart sentences on a new line to ease life for translators. Tweak the
jhb [Tue, 28 Dec 2010 18:58:15 +0000 (18:58 +0000)]
Start sentences on a new line to ease life for translators.  Tweak the
wording in a few places.

MFC after: 1 week

13 years agoAdd device id for RDC M3010 which is found on Vortex86 SoC.
yongari [Tue, 28 Dec 2010 17:45:43 +0000 (17:45 +0000)]
Add device id for RDC M3010 which is found on Vortex86 SoC.

Reviewed by: mav

13 years agoOnly keep track of PTE validity statistics for pages not locked in the
nwhitehorn [Tue, 28 Dec 2010 17:02:15 +0000 (17:02 +0000)]
Only keep track of PTE validity statistics for pages not locked in the
table. The 'locked' attribute is used to circumvent the regular page table
locking for some special pages, with the result that including locked pages
here causes races when updating the stats.

13 years agoUse bus_alloc_resource_any().
jhb [Tue, 28 Dec 2010 16:57:29 +0000 (16:57 +0000)]
Use bus_alloc_resource_any().

MFC after: 2 weeks

13 years agosh: Add test for optimized command substitution.
jilles [Tue, 28 Dec 2010 14:58:08 +0000 (14:58 +0000)]
sh: Add test for optimized command substitution.

This test verifies that certain expansions without side effects do not
cause the command substitution to be executed in a child process.

This is not a correctness requirement, but it involves a nontrivial amount
of code and it would be unfortunate if it stopped working.

13 years agoRemove a "not strictly correct" (and panic-inducing) workaround for a bug
cperciva [Tue, 28 Dec 2010 14:36:32 +0000 (14:36 +0000)]
Remove a "not strictly correct" (and panic-inducing) workaround for a bug
which doesn't seem to exist.

PR: kern/141328
MFC after: 3 days

13 years agosh: Make expansion errors in optimized command substitution non-fatal.
jilles [Tue, 28 Dec 2010 13:28:24 +0000 (13:28 +0000)]
sh: Make expansion errors in optimized command substitution non-fatal.
Command substitutions consisting of a single simple command are executed in
the main shell process but this should be invisible apart from performance
and very few exceptions such as $(trap).

13 years agoAdd a comment for the ccv member of struct tcpcb.
lstewart [Tue, 28 Dec 2010 12:37:57 +0000 (12:37 +0000)]
Add a comment for the ccv member of struct tcpcb.

Sponsored by: FreeBSD Foundation
MFC after: 5 weeks
X-MFC with: r215166

13 years ago- Add some helper hook points to the TCP stack. The hooks allow Khelp modules to
lstewart [Tue, 28 Dec 2010 12:13:30 +0000 (12:13 +0000)]
- Add some helper hook points to the TCP stack. The hooks allow Khelp modules to
  access inbound/outbound events and associated data for established TCP
  connections. The hooks only run if at least one hook function is registered
  for the hook point, ensuring the impact on the stack is effectively nil when
  no TCP Khelp modules are loaded. struct tcp_hhook_data is passed as contextual
  data to any registered Khelp module hook functions.

- Add an OSD (Object Specific Data) pointer to struct tcpcb to allow Khelp
  modules to associate per-connection data with the TCP control block.

- Bump __FreeBSD_version and add a note to UPDATING regarding to ABI changes
  introduced by this commit and r216753.

In collaboration with: David Hayes <dahayes at swin edu au> and
Grenville Armitage <garmitage at swin edu au>
Sponsored by: FreeBSD Foundation
Reviewed by: bz, others along the way
MFC after: 3 months

13 years agoRevert most of r210764, now that mdocml does the right
uqs [Tue, 28 Dec 2010 10:08:50 +0000 (10:08 +0000)]
Revert most of r210764, now that mdocml does the right
thing with empty quotation macros.

Requested by: Alex Kozlov

13 years agoAllow destroying EBR in COMPAT (default) mode.
ae [Tue, 28 Dec 2010 08:42:12 +0000 (08:42 +0000)]
Allow destroying EBR in COMPAT (default) mode.

MFC after: 2 week

13 years agoMake EBR probe method less strictly to be able detect EBRs with
ae [Tue, 28 Dec 2010 08:36:44 +0000 (08:36 +0000)]
Make EBR probe method less strictly to be able detect EBRs with
small non fatal inconsistency. EBR may contain boot loader and sometimes
it just has some garbage data. Now this does not prevent FreeBSD to use
extended partitions. But since we do not support bootcode for EBR we mark
tables which have non empty boot area as corrupt. This does make them
readonly and we can not damage this data.

PR: kern/141235
MFC after: 1 month

13 years agoAdd a new sack hint to track the most recent and highest sacked sequence number.
lstewart [Tue, 28 Dec 2010 03:27:20 +0000 (03:27 +0000)]
Add a new sack hint to track the most recent and highest sacked sequence number.
This will be used by the incoming Enhanced RTT Khelp module.

Sponsored by: FreeBSD Foundation
Submitted by: David Hayes <dahayes at swin edu au>
Reviewed by: bz and others (as part of a larger patch)
MFC after: 3 months

13 years agoFix a whitespace nit introduced in r215166.
lstewart [Tue, 28 Dec 2010 01:38:52 +0000 (01:38 +0000)]
Fix a whitespace nit introduced in r215166.

Sponsored by: FreeBSD Foundation
Spotted by: bz
MFC after: 5 weeks
X-MFC with: r215166

13 years agoBuild the modules which can be built. The excluded modules fall into two
cperciva [Mon, 27 Dec 2010 23:59:27 +0000 (23:59 +0000)]
Build the modules which can be built.  The excluded modules fall into two
categories: Those which can't build with PAE because they attempt to cast
a pointer to a bus_addr_t (mostly scsi drivers); and those which can't be
built with XEN because they conflict with something in xen-os.h (e.g., in
cxgb there is a conflicting definition of test_and_clear_bit).

MFC after: 1 week

13 years agosh: Add a testcase for cmdsubst errors that already works properly.
jilles [Mon, 27 Dec 2010 23:56:03 +0000 (23:56 +0000)]
sh: Add a testcase for cmdsubst errors that already works properly.
If a command substitution consists of one special builtin and there is a
redirection error, this should not abort the outer shell.
It was fixed in r201366 by ignoring special builtin properties for command
substitutions consisting of one builtin.

13 years agoMake it possible to specify WITHOUT_MODULES in a kernel config file.
cperciva [Mon, 27 Dec 2010 23:52:40 +0000 (23:52 +0000)]
Make it possible to specify WITHOUT_MODULES in a kernel config file.

MFC after: 1 week

13 years agoAdd pidfile [1]
dougb [Mon, 27 Dec 2010 22:52:47 +0000 (22:52 +0000)]
Add pidfile [1]

While I'm here, don't run the sysctl frob unconditionally, and
s/sysctl/$SYSCTL/

PR: conf/153460 [1]
Submitted by: Grigory Rechistov <ggg_mail@inbox.ru>

13 years agosh: Simplify "stack string" code slightly.
jilles [Mon, 27 Dec 2010 22:18:27 +0000 (22:18 +0000)]
sh: Simplify "stack string" code slightly.

Maintain a pointer to the end of the stack string area instead of how much
space is left. This simplifies the macros in memalloc.h. The places where
the new variable must be updated are only where the memory area is created,
destroyed or resized.

13 years agoRemove comment bemoaning the lack of an INP_INHASHLIST above in_pcbdrop();
rwatson [Mon, 27 Dec 2010 19:38:25 +0000 (19:38 +0000)]
Remove comment bemoaning the lack of an INP_INHASHLIST above in_pcbdrop();
I fixed this in r189657 in early 2009, so the comment is OBE.

Reviewed by: bz
MFC after: 3 days

13 years agoRestore two commented-out tests from plus-minus1.0 to a new file.
emaste [Mon, 27 Dec 2010 15:57:41 +0000 (15:57 +0000)]
Restore two commented-out tests from plus-minus1.0 to a new file.

These two cases pass on -CURRENT but fail on stable/8.

Reviewed by: jilles

13 years agoFix style bug introduced in r216696.
ed [Mon, 27 Dec 2010 15:05:15 +0000 (15:05 +0000)]
Fix style bug introduced in r216696.

Additional indentation caused the line to become longer than 80 columns.

13 years agoTeach ddb "show mount" about MNTK_SUJ flag.
kib [Mon, 27 Dec 2010 12:06:38 +0000 (12:06 +0000)]
Teach ddb "show mount" about MNTK_SUJ flag.

13 years agoMove vm_object_print()'s prototype to the expected place.
alc [Mon, 27 Dec 2010 07:12:22 +0000 (07:12 +0000)]
Move vm_object_print()'s prototype to the expected place.

13 years agoFix an apparent cop-and-paste mistake in previous commit.
kan [Mon, 27 Dec 2010 00:30:29 +0000 (00:30 +0000)]
Fix an apparent cop-and-paste mistake in previous commit.

This makes dlsym(RTLD_DEFAULT) work properly again.

13 years agoRemove commented-out test that's covered in plus-minus2.0 anyway.
emaste [Sun, 26 Dec 2010 23:19:16 +0000 (23:19 +0000)]
Remove commented-out test that's covered in plus-minus2.0 anyway.

Discussed with: jilles

13 years agoFix deprecated warning about -L which said -i was deprecated.
simon [Sun, 26 Dec 2010 22:29:44 +0000 (22:29 +0000)]
Fix deprecated warning about -L which said -i was deprecated.

MFC after: 3 days

13 years agoDetect when resource is configured more than once.
pjd [Sun, 26 Dec 2010 19:08:41 +0000 (19:08 +0000)]
Detect when resource is configured more than once.

MFC after: 3 days

13 years agoWhen node-specific configuration is missing in resource section, provide
pjd [Sun, 26 Dec 2010 19:07:58 +0000 (19:07 +0000)]
When node-specific configuration is missing in resource section, provide
more useful information. Instead of:

hastd: remote address not configured for resource foo

Print the following:

No resource foo configuration for this node (acceptable node names: freefall, freefall.freebsd.org, 44333332-4c44-4e31-4a30-313920202020).

MFC after: 3 days

13 years agoDocument the syntax accepted by the `-M` option.
kaiw [Sun, 26 Dec 2010 18:15:32 +0000 (18:15 +0000)]
Document the syntax accepted by the `-M` option.

Obtained from: elftoolchain

13 years agoImprove the description of the `-q` option.
kaiw [Sun, 26 Dec 2010 18:12:13 +0000 (18:12 +0000)]
Improve the description of the `-q` option.

Obtained from: elftoolchain

13 years ago* Add mention of the `-f`, `-q`, `-S`, and `-V` options in the synopsis
kaiw [Sun, 26 Dec 2010 18:10:39 +0000 (18:10 +0000)]
* Add mention of the `-f`, `-q`, `-S`, and `-V` options in the synopsis
  section.
* Document the `-l`, `-M` and `-S` options.
* Improve the text describing the behavior of the `-r` option.
* Start a section on standard compliance.
* Indicate in the synopsis that the `-S` and `-s` options are mutually
  exclusive.

Obtained from: elftoolchain

13 years agosh: Fix integer overflow check, it checked an uninitialized variable.
jilles [Sun, 26 Dec 2010 13:41:53 +0000 (13:41 +0000)]
sh: Fix integer overflow check, it checked an uninitialized variable.

13 years agosh: Allow arbitrary large numbers in CHECKSTRSPACE.
jilles [Sun, 26 Dec 2010 13:25:47 +0000 (13:25 +0000)]
sh: Allow arbitrary large numbers in CHECKSTRSPACE.
Reduce "stack string" API somewhat and simplify code.
Add a check for integer overflow of the "stack string" length (probably
incomplete).

13 years agoLock the vm page queue mutex in pmap_pte_release around the call
cperciva [Sun, 26 Dec 2010 13:05:43 +0000 (13:05 +0000)]
Lock the vm page queue mutex in pmap_pte_release around the call
to PMAP_SET_VA; this fixes a mutex-not-held panic when a process
which called mlock(2) exits, and parallels a change made in
pmap_pte 10 months ago (svn r204160).

Note: The locking in this code is utterly broken.  We should not
be using the VM page queue mutex to protect the queue of pending
Xen page mapping hypervisor calls.  Even if it made sense to do
so, this commit and r204160 introduce LORs between the vm page
queue mutex and PMAP2mutex.

(However, a possible deadlock is better than a guaranteed panic,
and this change will hopefully make life easier for whoever fixes
the Xen pmap locking in the future.)

PR: kern/140313
MFC after: 3 days

13 years agoCorrect the order of the arguments to vm_fault_quick_hold_pages().
alc [Sun, 26 Dec 2010 01:42:52 +0000 (01:42 +0000)]
Correct the order of the arguments to vm_fault_quick_hold_pages().

13 years agoRetire vm_fault_quick(). It's no longer used.
alc [Sat, 25 Dec 2010 23:54:50 +0000 (23:54 +0000)]
Retire vm_fault_quick().  It's no longer used.

Reviewed by: kib@

13 years agoModify the experimental NFS server so that it uses LK_SHARED
rmacklem [Sat, 25 Dec 2010 21:56:25 +0000 (21:56 +0000)]
Modify the experimental NFS server so that it uses LK_SHARED
for RPC operations when it can. Since VFS_FHTOVP() currently
always gets an exclusively locked vnode and is usually called
at the beginning of each RPC, the RPCs for a given vnode will
still be serialized. As such, passing a lock type argument to
VFS_FHTOVP() would be preferable to doing the vn_lock() with
LK_DOWNGRADE after the VFS_FHTOVP() call.

Reviewed by: kib
MFC after: 2 weeks

13 years agoIntroduce and use a new VM interface for temporarily pinning pages. This
alc [Sat, 25 Dec 2010 21:26:56 +0000 (21:26 +0000)]
Introduce and use a new VM interface for temporarily pinning pages.  This
new interface replaces the combined use of vm_fault_quick() and
pmap_extract_and_hold() throughout the kernel.

In collaboration with: kib@

13 years agoo Fix -u flag description: it takes a username as an argument.
maxim [Sat, 25 Dec 2010 17:35:30 +0000 (17:35 +0000)]
o Fix -u flag description: it takes a username as an argument.

PR: docs/153416
Submitted by: Eitan Adler
MFC after: 1 week

13 years agoFix typo (Pashka -> Paskha).
osa [Sat, 25 Dec 2010 11:52:04 +0000 (11:52 +0000)]
Fix typo (Pashka -> Paskha).

13 years agoSlightly improve output of lock(1).
ed [Sat, 25 Dec 2010 11:24:27 +0000 (11:24 +0000)]
Slightly improve output of lock(1).

- Remove the /dev/ portion of the TTY name.
- In case we use lock -p, print the username that was used to obtain the
  password hash.

13 years agoImplement support for ELF filters in rtld. Both normal and auxillary
kib [Sat, 25 Dec 2010 08:51:20 +0000 (08:51 +0000)]
Implement support for ELF filters in rtld. Both normal and auxillary
filters are implemented.

Filtees are loaded on demand, unless LD_LOADFLTR environment variable
is set or -z loadfltr was specified during the linking. This forces
rtld to upgrade read-locked rtld_bind_lock to write lock when it
encounters an object with filter during symbol lookup.

Consolidate common arguments of the symbol lookup functions in the
SymLook structure.  Track the state of the rtld locks in the
RtldLockState structure. Pass local RtldLockState through the rtld
symbol lookup calls to allow lock upgrades.

Reviewed by: kan
Tested by: Mykola Dzham <i levsha me>, nwhitehorn (powerpc)

13 years agoAdd a hook to pass debug flags to the build of rtld when doing make in
kib [Sat, 25 Dec 2010 08:42:38 +0000 (08:42 +0000)]
Add a hook to pass debug flags to the build of rtld when doing make in
the rtld directory.

Reviewed by: kan

13 years agoAdd an argument to nfsvno_getattr() in the experimental
rmacklem [Fri, 24 Dec 2010 21:31:18 +0000 (21:31 +0000)]
Add an argument to nfsvno_getattr() in the experimental
NFS server, so that it can avoid calling VOP_ISLOCKED()
when the vnode is known to be locked. This will allow
LK_SHARED to be used for these cases, which happen to
be all the cases that can use LK_SHARED. This does not
fix any bug, but it reduces the number of calls to
VOP_ISLOCKED() and prepares the code so that it can be
switched to using LK_SHARED in a future patch.

Reviewed by: kib
MFC after: 2 weeks

13 years agoSimplify vnode locking in the expeimental NFS server's
rmacklem [Fri, 24 Dec 2010 20:24:07 +0000 (20:24 +0000)]
Simplify vnode locking in the expeimental NFS server's
readdir functions. In particular, get rid of two bogus
VOP_ISLOCKED() calls. Removing the VOP_ISLOCKED() calls
is the only actual bug fixed by this patch.

Reviewed by: kib
MFC after: 2 weeks

13 years agoSince VOP_READDIR() for ZFS does not return monotonically
rmacklem [Fri, 24 Dec 2010 18:46:44 +0000 (18:46 +0000)]
Since VOP_READDIR() for ZFS does not return monotonically
increasing directory offset cookies, disable the UFS related
loop that skips over directory entries at the beginning of
the block for the experimental NFS server. This loop is
required for UFS since it always returns directory entries
starting at the beginning of the block that
the requested directory offset is in. In discussion with pjd@
and mckusick@ it seems that this behaviour of UFS should maybe
change, with this fix being an interim patch until then.
This patch only fixes the experimental server, since pjd@ is
working on a patch for the regular server.

Discussed with: pjd, mckusick
MFC after: 5 days

13 years agoAlways clear flag PMUTEX_FLAG_DEFERED when unlocking, as it is only
davidxu [Fri, 24 Dec 2010 07:41:39 +0000 (07:41 +0000)]
Always clear flag PMUTEX_FLAG_DEFERED when unlocking, as it is only
significant for lock owner.

13 years agoRedirect stderr from config to /dev/null. config -m is printing lots
imp [Fri, 24 Dec 2010 04:55:56 +0000 (04:55 +0000)]
Redirect stderr from config to /dev/null.  config -m is printing lots
of annoying warnings when dealing with arm.  The arm config files need
to be fixed, but this restricts the output to a more useful place.

13 years agoIXP4XX_GPIO_{,UN}LOCK() don't take args. Remove the sc here to make
imp [Thu, 23 Dec 2010 19:28:50 +0000 (19:28 +0000)]
IXP4XX_GPIO_{,UN}LOCK() don't take args.  Remove the sc here to make
this compile again.

13 years agoDon't try to reserve a resource that is already allocated. If the ECDT
jhb [Thu, 23 Dec 2010 18:50:14 +0000 (18:50 +0000)]
Don't try to reserve a resource that is already allocated.  If the ECDT
table is present, then the acpi_ec(4) driver will allocate its resources
from nexus0 before the acpi0 device reserves resources for child devices.

Reviewed by: jkim

13 years agoDrop the icu_lock spinlock while pausing briefly after masking the
jhb [Thu, 23 Dec 2010 15:17:28 +0000 (15:17 +0000)]
Drop the icu_lock spinlock while pausing briefly after masking the
interrupt in the I/O APIC before moving it to a different CPU.  If the
interrupt had been triggered by the I/O APIC after locking icu_lock but
before we masked the pin in the I/O APIC, then this could cause the
interrupt to be pending on the "old" CPU and it would finally trigger
after we had moved the interrupt to the new CPU.  This could cause us to
panic as there was no interrupt source associated with the old IDT vector
on the old CPU.  Dropping the lock after the interrupt is masked but
before it is moved allows the interrupt to fire and be handled in this
case before it is moved.

Tested by: Daniel Braniss  danny of cs huji ac il
MFC after: 1 week

13 years agoEnlarge hash table for new condition variable.
davidxu [Thu, 23 Dec 2010 03:12:03 +0000 (03:12 +0000)]
Enlarge hash table for new condition variable.

13 years agostyle.Makefile says tab between var= and value.
delphij [Thu, 23 Dec 2010 01:45:48 +0000 (01:45 +0000)]
style.Makefile says tab between var= and value.

13 years agoThis patch fixes a soft update panic while running perl 5.12 tests
mckusick [Thu, 23 Dec 2010 00:38:57 +0000 (00:38 +0000)]
This patch fixes a soft update panic while running perl 5.12 tests
which produced:

    panic: indir_trunc: Index out of range -148 parent -2061 lbn -305164

Reported by: Dimitry Andric
Fixed by: Jeff Roberson

13 years agoAllow overriding pidfile and dumpfile.
delphij [Wed, 22 Dec 2010 23:58:21 +0000 (23:58 +0000)]
Allow overriding pidfile and dumpfile.

PR: bin/153362
Submitted by: Joe Holden <joe rewt org uk>
MFC after: 1 month

13 years agoUse resource_list_reserve() to reserve I/O port and memory resources for
jhb [Wed, 22 Dec 2010 20:27:20 +0000 (20:27 +0000)]
Use resource_list_reserve() to reserve I/O port and memory resources for
ACPI devices even if they are not allocated by a device driver since the
resources are in use and should not be allocated to another device.

13 years agoIncrease size of pcb_flags to four bytes.
jkim [Wed, 22 Dec 2010 19:57:03 +0000 (19:57 +0000)]
Increase size of pcb_flags to four bytes.

Requested by: bde, jhb

13 years agoProvide a possibility to configure the inital congestion window to the
tuexen [Wed, 22 Dec 2010 19:04:14 +0000 (19:04 +0000)]
Provide a possibility to configure the inital congestion window to the
value defined in RFC 4960.

MFC after: 3 months.

13 years agoInclude std.sentry5 from the SENTRY5 kernel configuration. This was
nwhitehorn [Wed, 22 Dec 2010 19:01:48 +0000 (19:01 +0000)]
Include std.sentry5 from the SENTRY5 kernel configuration. This was
apparently missed in r215270.

13 years agoImprove plausibility check in sctp_handle_sack().
tuexen [Wed, 22 Dec 2010 17:59:38 +0000 (17:59 +0000)]
Improve plausibility check in sctp_handle_sack().
Allow cmt_on_off to support values 0 (no CMT), 1 (CMT), and 2 (CMT/RP).

MFC after: 3 months.

13 years agoFix date, broken in r216667.
trasz [Wed, 22 Dec 2010 17:12:58 +0000 (17:12 +0000)]
Fix date, broken in r216667.

Submitted by: stefanf@

13 years agoThe 'kern.corefile="whatever"' syntax won't work with sysctl.conf; remove
trasz [Wed, 22 Dec 2010 17:02:01 +0000 (17:02 +0000)]
The 'kern.corefile="whatever"' syntax won't work with sysctl.conf; remove
the quotes to not mislead people.

MFC after: 1 month

13 years agoAdd package directories used for the upcoming 8.2 and 7.4 releases,
kensmith [Wed, 22 Dec 2010 15:44:25 +0000 (15:44 +0000)]
Add package directories used for the upcoming 8.2 and 7.4 releases,
and catch up on a few from previous releases.

13 years agoEnable build of FDT components by default. dtc is a required build tool
nwhitehorn [Wed, 22 Dec 2010 14:59:22 +0000 (14:59 +0000)]
Enable build of FDT components by default. dtc is a required build tool
for all FDT-enabled kernels, and having it off by default means that
building these kernels fails by default. This fixes FDT-related build
failures in make universe on ARM and PowerPC.

Reviewed by: imp

13 years agoAdd an option to disable the screensaver.
brucec [Wed, 22 Dec 2010 13:06:51 +0000 (13:06 +0000)]
Add an option to disable the screensaver.

13 years agoAdd IFT_L2VLAN to the list that is capable of supplying the ingredients
jhay [Wed, 22 Dec 2010 11:58:31 +0000 (11:58 +0000)]
Add IFT_L2VLAN to the list that is capable of supplying the ingredients
of the EUI64 part of an IPv6 address. Otherwise vlans will all use the
MAC address of the first ethernet interface of the system.

MFC after: 1 week

13 years agoAdd sleep queue code.
davidxu [Wed, 22 Dec 2010 05:03:24 +0000 (05:03 +0000)]
Add sleep queue code.

13 years agoMFp4:
davidxu [Wed, 22 Dec 2010 05:01:52 +0000 (05:01 +0000)]
MFp4:

- Add flags CVWAIT_ABSTIME and CVWAIT_CLOCKID for umtx kernel based
  condition variable, this should eliminate an extra system call to get
  current time.

- Add sub-function UMTX_OP_NWAKE_PRIVATE to wake up N channels in single
  system call. Create userland sleep queue for condition variable, in most
  cases, thread will wait in the queue, the pthread_cond_signal will defer
  thread wakeup until the mutex is unlocked, it tries to avoid an extra
  system call and a extra context switch in time window of pthread_cond_signal
  and pthread_mutex_unlock.

The changes are part of process-shared mutex project.

13 years agoImprove PCB flags handling and make it more robust. Add two new functions
jkim [Wed, 22 Dec 2010 00:18:42 +0000 (00:18 +0000)]
Improve PCB flags handling and make it more robust.  Add two new functions
for manipulating pcb_flags.  These inline functions are very similar to
atomic_set_char(9) and atomic_clear_char(9) but without unnecessary LOCK
prefix for SMP.  Add comments about the rationale[1].  Use these functions
wherever possible.  Although there are some places where it is not strictly
necessary (e.g., a PCB is copied to create a new PCB), it is done across
the board for sake of consistency.  Turn pcb_full_iret into a PCB flag as
it is safe now.  Move rarely used fields before pcb_flags and reduce size
of pcb_flags to one byte.  Fix some style(9) nits in pcb.h while I am in
the neighborhood.

Reviewed by: kib
Submitted by: kib[1]
MFC after: 2 months

13 years agoUse newly added NFSRV_FLAG_BUSY flag for nfsrv_fhtovp() to keep mount point
pjd [Tue, 21 Dec 2010 23:15:40 +0000 (23:15 +0000)]
Use newly added NFSRV_FLAG_BUSY flag for nfsrv_fhtovp() to keep mount point
busy. This fixes a race where we can pass invalid mount point to VFS_VGET()
via vp->v_mount when exported file system was forcibly unmounted between
nfsrv_fhtovp() and VFS_VGET().

Reviewed by: kib
MFC after: 5 days

13 years ago- Move pubflag and lockflag handling from nfsrv_fhtovp() to nfs_namei() -
pjd [Tue, 21 Dec 2010 23:12:45 +0000 (23:12 +0000)]
- Move pubflag and lockflag handling from nfsrv_fhtovp() to nfs_namei() -
  this is the only place that is different from all the other nfsrv_fhtovp()
  consumers.
  This simplifies nfsrv_fhtovp() a bit and also eliminates one
  vn_lock/VOP_UNLOCK() cycle in case of NFSv3.
- Implement NFSRV_FLAG_BUSY flag for nfsrv_fhtovp() that tells it to leave
  mount point busy.

Reviewed by: kib
MFC after: 5 days