]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
13 years agoReserve INTR_MD[1-4] similarly to what BUS_DMA_BUS[1-4] are intended for
marius [Tue, 4 Jan 2011 16:11:32 +0000 (16:11 +0000)]
Reserve INTR_MD[1-4] similarly to what BUS_DMA_BUS[1-4] are intended for
and switch sparc64 to use the first one for bus error filter handlers of
bridge drivers instead of (ab)using INTR_FAST for that so we eventually
can get rid of the latter.

Reviewed by: jhb
MFC after: 1 month

13 years agoAdd hamfisted locking to the Xen/PV pmap code: Only allow one thread to
cperciva [Tue, 4 Jan 2011 15:55:15 +0000 (15:55 +0000)]
Add hamfisted locking to the Xen/PV pmap code: Only allow one thread to
be in {pmap_pinit, pmap_copy, pmap_release} at a time.

This reduces the rate of panics when running 'make index' from ~0.6/hour
to ~0.02/hour (p < 10^-30).

At a later date this locking will be removed, and for this reason, it is
wrapped in #ifdef HAMFISTED_LOCKING; this temporary hack is being put in
place with the intention of shipping somewhat-stable Xen bits in FreeBSD
8.2-RELEASE.

PR: kern/153672
MFC after: 3 days

13 years agoMake "options XENHVM" compile for i386, not just amd64 -- a largely
rwatson [Tue, 4 Jan 2011 14:49:54 +0000 (14:49 +0000)]
Make "options XENHVM" compile for i386, not just amd64 -- a largely
mechanical change.  This opens the door for using PV device drivers
under Xen HVM on i386, as well as more general harmonisation of i386
and amd64 Xen support in FreeBSD.

Reviewed by:    cperciva
MFC after:      3 weeks

13 years agoMake the parsing of the integer arguments for rtprio(1)/idprio(1) stricter.
kib [Tue, 4 Jan 2011 14:13:09 +0000 (14:13 +0000)]
Make the parsing of the integer arguments for rtprio(1)/idprio(1) stricter.
Style.

Based on submission by: Eitan Adler <lists eitanadler com>, keramida
Reviewed by: jhb, keramida
MFC after: 1 week

13 years agokproc_exit() is already marked __dead2 so a NOTREACHED comment here isn't
jhb [Tue, 4 Jan 2011 13:16:28 +0000 (13:16 +0000)]
kproc_exit() is already marked __dead2 so a NOTREACHED comment here isn't
needed for lint.

Submitted by: bde

13 years agoQuiet clang warnings by using string literal format strings.
emaste [Tue, 4 Jan 2011 13:02:52 +0000 (13:02 +0000)]
Quiet clang warnings by using string literal format strings.

13 years agoFinish r210923, 210926. Mark some devices as eternal.
kib [Tue, 4 Jan 2011 10:59:38 +0000 (10:59 +0000)]
Finish r210923, 210926. Mark some devices as eternal.

MFC after: 2 weeks

13 years agoInstead of incrementing freework reference counter in indir_trunc(), do
kib [Tue, 4 Jan 2011 10:25:55 +0000 (10:25 +0000)]
Instead of incrementing freework reference counter in indir_trunc(), do
it at the allocation time for journaled fs and indirect blocks, when
the allocated object is not accessible outside.

Requested and reviewed by: jeff
Tested by: pho

13 years agoBecause sleepqueue may still being used, we should always check wchan with
davidxu [Tue, 4 Jan 2011 05:35:19 +0000 (05:35 +0000)]
Because sleepqueue may still being used, we should always check wchan with
queue locked.

13 years agoQuiet clang warnings by using literal format strings for printf-like
emaste [Tue, 4 Jan 2011 02:52:22 +0000 (02:52 +0000)]
Quiet clang warnings by using literal format strings for printf-like
functions.

13 years agoo) Add MIPS_COP_0_EXC_PC accessors to <machine/cpufunc.h>.
jmallett [Tue, 4 Jan 2011 02:33:48 +0000 (02:33 +0000)]
o) Add MIPS_COP_0_EXC_PC accessors to <machine/cpufunc.h>.
o) Make the octeon_wdog driver work on multi-CPU systems and to also print more
   information on NMI that may aid debugging.  Simplify and clean up internal
   API and structure.

13 years agoo) Unmask Central Interrupt Unit interrupts on APs, too.
jmallett [Tue, 4 Jan 2011 02:11:03 +0000 (02:11 +0000)]
o) Unmask Central Interrupt Unit interrupts on APs, too.
o) There's no good reason to make the low bits of the ebase the core
   number.  While per-CPU exception bases would be nice, for now we just
   need to make ebase the same on all cores.

13 years agoMake format string a string literal. (Discovered by clang.)
emaste [Tue, 4 Jan 2011 00:39:56 +0000 (00:39 +0000)]
Make format string a string literal.  (Discovered by clang.)

MFC After: 1 week

13 years agoAdjust the critical section protecting _xen_flush_queue to cover the
cperciva [Tue, 4 Jan 2011 00:16:38 +0000 (00:16 +0000)]
Adjust the critical section protecting _xen_flush_queue to cover the
entire range where the page mapping request queue needs to be atomically
examined and modified.

Oddly, while this doesn't seem to affect the overall rate of panics
(running 'make index' on EC2 t1.micro instances, there are 0.6 +/- 0.1
panics per hour, both before and after this change), it eliminates
vm_fault from panic backtraces, leaving only backtraces going through
vmspace_fork.

13 years agoHandle failure from ftpd_popen in statfilecmd().
emaste [Tue, 4 Jan 2011 00:11:09 +0000 (00:11 +0000)]
Handle failure from ftpd_popen in statfilecmd().

Reviewed by: attilio
MFC after: 1 week

13 years agoClear GPE from a query handler if the task was deferred.
jkim [Tue, 4 Jan 2011 00:10:29 +0000 (00:10 +0000)]
Clear GPE from a query handler if the task was deferred.

13 years agoWait for commands to complete 10 times longer. This makes my A-DATA 32GB SDHC
pjd [Tue, 4 Jan 2011 00:08:39 +0000 (00:08 +0000)]
Wait for commands to complete 10 times longer. This makes my A-DATA 32GB SDHC
card being detected.

Reviewed by: imp
MFC after: 2 weeks

13 years agoFix parameters for wakeup(9) and tsleep(9).
jkim [Mon, 3 Jan 2011 23:37:42 +0000 (23:37 +0000)]
Fix parameters for wakeup(9) and tsleep(9).

MFC after: 3 days

13 years agoAdd support for R_PPC64_UADDR64 relocations.
nwhitehorn [Mon, 3 Jan 2011 23:11:52 +0000 (23:11 +0000)]
Add support for R_PPC64_UADDR64 relocations.

13 years agoNote compatibility issues with make universe and stable systems.
imp [Mon, 3 Jan 2011 23:05:20 +0000 (23:05 +0000)]
Note compatibility issues with make universe and stable systems.

13 years agoWhen TARGET_ARCH_${kernel} gets set, it is using the host's config,
imp [Mon, 3 Jan 2011 22:48:01 +0000 (22:48 +0000)]
When TARGET_ARCH_${kernel} gets set, it is using the host's config,
not the one we build as part of make world.  This means that make
universe will fail if building on a too-old current or any stable
system prior to a few days ago in weird ways (parse errors from
shell).  This copes with these old systems in two ways:

(1) Works around the WARNING: issue by filtering all warnings that
    sneak onto stdout.

(2) if TARGET_ARCH_${kernel} winds up being empty, then we error out
    immediately with a semi-useful error message.  This usually comes from
    config not groking -m.

Ideally, we'd use a buildworld's config here, but that's tricky, so
I'll leave that detail to others to fix (it has to be done post make
world for the arch rather than at the top level makefile).  This
should make 'make universe' usable from recent 8-stable systems
(recent == last few months or so) for building -current.  They have
-m, but spewed warnings out stdout.  Older systems will now at least
get a firm error early rather than a confusing error late.

13 years agoexpand checkuser() to support the propagation of error codes back to
csjp [Mon, 3 Jan 2011 21:28:12 +0000 (21:28 +0000)]
expand checkuser() to support the propagation of error codes back to
the caller.  Currently, checkuser() does not differentiate between the
failure to open the file and the absence of a user in the file.  Check
to see if there was an error opening the file.  If there are any errors,
terminate the connection.  Currently, the only exception to this rule
is ENOENT, since there is nothing that says the /etc/ftpuser
and /etc/ftpchroot has to exist.

MFC after: 3 weeks

13 years agoFix the nlm so that it no longer depends on the regular
rmacklem [Mon, 3 Jan 2011 20:37:31 +0000 (20:37 +0000)]
Fix the nlm so that it no longer depends on the regular
nfs client and, as such, can be loaded for the experimental
nfs client without the regular client.

Reviewed by: jhb
MFC after: 2 weeks

13 years agoUpdate gateworks exclusion list to match latest tree.
imp [Mon, 3 Jan 2011 20:32:08 +0000 (20:32 +0000)]
Update gateworks exclusion list to match latest tree.

13 years agoBump the media size from approx 600MB to approx 750MB. The great
imp [Mon, 3 Jan 2011 19:32:54 +0000 (19:32 +0000)]
Bump the media size from approx 600MB to approx 750MB.  The great
hob-nailed tennis shoe of progress demands it!

Submitted by: phk

13 years agoPut in the other half of the SRCCONF patch.
imp [Mon, 3 Jan 2011 19:30:47 +0000 (19:30 +0000)]
Put in the other half of the SRCCONF patch.

Submitted by: phk

13 years agoAdd a 'locked' variant of the foo_start() routine and call it directly
jhb [Mon, 3 Jan 2011 18:28:30 +0000 (18:28 +0000)]
Add a 'locked' variant of the foo_start() routine and call it directly
from interrupt handlers and watchdog routines instead of queueing a task
to call foo_start().

Reviewed by: yongari
MFC after: 1 month

13 years agoIncrease carried_error if we skip a file due to an error. This ensures
jh [Mon, 3 Jan 2011 17:17:31 +0000 (17:17 +0000)]
Increase carried_error if we skip a file due to an error. This ensures
that setfacl(1) exits with proper exit status on failure.

PR: bin/149780
Submitted by: Ævar Arnfjörð Bjarmason (original version)
Reviewed by: trasz
MFC after: 3 weeks

13 years agoSmall whitespace nits and add a comment explaining why kthread_exit() can
jhb [Mon, 3 Jan 2011 16:29:00 +0000 (16:29 +0000)]
Small whitespace nits and add a comment explaining why kthread_exit() can
call kproc_exit() that was lost earlier.

13 years agoMFp4 r186485, r186859:
mm [Mon, 3 Jan 2011 12:57:07 +0000 (12:57 +0000)]
MFp4 r186485, r186859:

Fix a race by defining two tasks in the zio structure
as we can still be returning from issue task when interrupt task is used.

Tested by: pjd
Approved by: pjd, delphij (mentor)
MFC after: 3 days

13 years agoRelease the page lock early in vm_pageout_clean(). There is no reason to
alc [Mon, 3 Jan 2011 00:41:56 +0000 (00:41 +0000)]
Release the page lock early in vm_pageout_clean().  There is no reason to
hold this lock until the end of the function.

With the aforementioned change to vm_pageout_clean(), page locks don't need
to support recursive (MTX_RECURSE) or duplicate (MTX_DUPOK) acquisitions.

Reviewed by: kib

13 years agoFix the experimental NFS server so that it doesn't leak
rmacklem [Mon, 3 Jan 2011 00:40:13 +0000 (00:40 +0000)]
Fix the experimental NFS server so that it doesn't leak
a reference count on the directory when creating device
special files.

MFC after: 2 weeks

13 years agoModify the experimental NFSv4 server so that the lookup
rmacklem [Mon, 3 Jan 2011 00:33:32 +0000 (00:33 +0000)]
Modify the experimental NFSv4 server so that the lookup
ops return a locked vnode. This ensures that the associated mount
point will always be valid for the code that follows the operation.
Also add a couple of additional checks
for non-error to the other functions that create file objects.

MFC after: 2 weeks

13 years agoAdd myself.
jpaetzel [Sun, 2 Jan 2011 23:38:05 +0000 (23:38 +0000)]
Add myself.

13 years agoDelete some cruft from the experimental NFS server that was
rmacklem [Sun, 2 Jan 2011 21:34:01 +0000 (21:34 +0000)]
Delete some cruft from the experimental NFS server that was
only used by the OpenBSD port for its pseudo-fs.

MFC after: 2 weeks

13 years agoAdd checks for VI_DOOMED and vn_lock() failures to the
rmacklem [Sun, 2 Jan 2011 19:58:39 +0000 (19:58 +0000)]
Add checks for VI_DOOMED and vn_lock() failures to the
experimental NFS server, to handle the case where an
exported file system is forced dismounted while an RPC
is in progress. Further commits will fix the cases where
a mount point is used when the associated vnode isn't locked.

Reviewed by: kib
MFC after: 2 weeks

13 years agoMFi386 r216012 by kib:
gavin [Sun, 2 Jan 2011 15:06:07 +0000 (15:06 +0000)]
MFi386 r216012 by kib:

Calling fill_fpregs() for curthread is legitimate, and ELF coredump
does this.

Discussed with: kib
MFC after: 3 days

13 years agoExtend the section in which interrupts are disabled in the TLB demap
marius [Sun, 2 Jan 2011 15:01:03 +0000 (15:01 +0000)]
Extend the section in which interrupts are disabled in the TLB demap
functions, otherwise if we get preempted after checking whether a certain
pmap is active on the current CPU but before disabling interrupts we might
operate on an outdated state as the pmap might have been deactivated in
the meantime. As the same issue may arises when the TLB demap function is
interrupted by a TLB demap IPI, just entering a critical section before
the check isn't sufficient so we have to fully disable interrupts instead.

MFC after: 3 days

13 years agoFinishing touches to fork1() - ANSIfy missed function definition, style(9)
trasz [Sun, 2 Jan 2011 12:16:57 +0000 (12:16 +0000)]
Finishing touches to fork1() - ANSIfy missed function definition, style(9)
fixes, removal of few comments that didn't really make sense and addition
of fork_findpid() locking requirements.

13 years agoBugfix: Make sure that the COMM_UP notificatin is delivered first also
tuexen [Sun, 2 Jan 2011 10:27:27 +0000 (10:27 +0000)]
Bugfix: Make sure that the COMM_UP notificatin is delivered first also
        on the passive side.

MFC after: 3 days.

13 years agoFix a typo.
tuexen [Sat, 1 Jan 2011 22:22:57 +0000 (22:22 +0000)]
Fix a typo.

MFC after: 3 months.

13 years agoAdd nodes for current and past committers that are already referenced in
gavin [Sat, 1 Jan 2011 20:17:29 +0000 (20:17 +0000)]
Add nodes for current and past committers that are already referenced in
relationships, so they are rendered as more than just a username.
Add a couple of relationships between committers who already have existing
nodes to help with the rendered output.

13 years agoAdd support for shared vnode locks for the Read operation
rmacklem [Sat, 1 Jan 2011 18:50:49 +0000 (18:50 +0000)]
Add support for shared vnode locks for the Read operation
in the experimental NFSv4 server.

Reviewed by: kib
MFC after: 2 weeks

13 years agoMake a couple refinements to r216799 and r216810. In particular, revise
alc [Sat, 1 Jan 2011 17:39:38 +0000 (17:39 +0000)]
Make a couple refinements to r216799 and r216810.  In particular, revise
a comment and move it to its proper place.

Reviewed by: kib

13 years agoThere can be more than 0x20000000 swap meta blocks allocated if a swap-backed
brucec [Sat, 1 Jan 2011 16:59:05 +0000 (16:59 +0000)]
There can be more than 0x20000000 swap meta blocks allocated if a swap-backed
md(4) device is used. Don't panic when deallocating such a device if swap
has been used.

PR: kern/133170
Discussed with: kib
MFC after: 3 days

13 years agosh: Test that exit $? replaces the original exit status in an EXIT trap.
jilles [Sat, 1 Jan 2011 15:25:15 +0000 (15:25 +0000)]
sh: Test that exit $? replaces the original exit status in an EXIT trap.

13 years agosh: Check readonly status for assignments on regular builtins.
jilles [Sat, 1 Jan 2011 13:26:18 +0000 (13:26 +0000)]
sh: Check readonly status for assignments on regular builtins.

An error message is written, the builtin is not executed, nonzero exit
status is returned but the shell does not abort.

This was already checked for special builtins and external commands, with
the same consequences except that the shell aborts for special builtins.

Obtained from: NetBSD

13 years agoo) When trying to determine whether the pcpu pointer is a managed address, check
jmallett [Sat, 1 Jan 2011 00:20:14 +0000 (00:20 +0000)]
o) When trying to determine whether the pcpu pointer is a managed address, check
   not just that it is greater than the minimal kernel virtual address, but also
   that it is less than the maximal kernel virtual address.  On n64 kernels, the
   pcpup comes out of a direct-mapped address that, with an unsigned compare, is
   rather greater than the minimal kernel virtual address.
o) Turn the panic if interrupts are disabled in cpu_idle into a KASSERT since on
   other architectures it's behind INVARIANTS anyway.
o) Add a check that not all interrupts are masked, too.
o) Add cpu_idleclock() and cpu_activeclock() use to cpu_idle as is done on other
   architectures.

13 years agoMfp4 CH177924:
bz [Fri, 31 Dec 2010 22:49:13 +0000 (22:49 +0000)]
Mfp4 CH177924:

Add and export constants of array sizes of jail parameters as compiled into
the kernel.
This is the least intrusive way to allow kvm to read the (sparse) arrays
independent of the options the kernel was compiled with.

Reviewed by: jhb (originally)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Sponsored by: CK Software GmbH

13 years agoFix endianness bug introduced in r205091.
yongari [Fri, 31 Dec 2010 22:18:41 +0000 (22:18 +0000)]
Fix endianness bug introduced in r205091.
After controller updates control word in a RX LE, driver converts
it to host byte order. The checksum value in the control word is
stored in big endian form by controller. r205091 didn't account for
the host byte order conversion such that the checksum value was
incorrectly interpreted on big endian architectures which in turn
made all TCP/UDP frames dropped. Make RX checksum offload work
on any architectures by swapping the checksum value.

Reported by: Sreekanth M. ( kanthms <> netlogicmicro dot com )
Tested by: Sreekanth M. ( kanthms <> netlogicmicro dot com )

13 years agoUse NULL rather than 0 to invalidate a pointer.
bz [Fri, 31 Dec 2010 21:57:54 +0000 (21:57 +0000)]
Use NULL rather than 0 to invalidate a pointer.

Rather than duplicating the LLE_FREE_LOCKED() macro code in LLE_FREE(),
call it directly (like we do for the RT_* macros).

Sponsored by: ISPsystem [1]
Reviewed by: julian [1]
MFC After: 1 week

[1] Early 2010.

13 years agoRemove duplicated "perfect"
yongari [Fri, 31 Dec 2010 21:52:51 +0000 (21:52 +0000)]
Remove duplicated "perfect"

Pointed out by: pluknet

13 years agoTry to catch a possible divide-by-zero as early as possible if "mtu" is 0
bz [Fri, 31 Dec 2010 21:47:11 +0000 (21:47 +0000)]
Try to catch a possible divide-by-zero as early as possible if "mtu" is 0
(also test for negative MTUs if checking it anyway).
An MTU of 0 is arguably a bug elsewhere, but this at least gives us some
more debugging hints.

Sponsored by: ISPsystem (Early 2010)
MFC after: 1 week

13 years agoPrint the vnet pointer under DDB when iterating over flowtables of each
bz [Fri, 31 Dec 2010 21:20:32 +0000 (21:20 +0000)]
Print the vnet pointer under DDB when iterating over flowtables of each
virtual network stack instance.

Sponsored by: ISPsystem [1]
Reviewed by: julian [1]
MFC after: 1 week

[1] Early 2010.

13 years agoMove the increment operation under the lock and split the condition
bz [Fri, 31 Dec 2010 21:06:52 +0000 (21:06 +0000)]
Move the increment operation under the lock and split the condition
variable into two so that we can see on which one we are waiting.
This might also more properly propagate the update of the
flowclean_cycles flag and avoid "hangs" people were seeing.

Suggested by: rwatson [1]
Sponsored by: ISPsystem [1]
Reviewed by: julian [1]
Updated by: Mikolaj Golub (to.my.trociny gmail.com)
Tested by: Mikolaj Golub (to.my.trociny gmail.com)
MFC After: 1 week

[1] Early 2010, initial version.

13 years agosh: Check if dup2 for redirection from/to a file succeeds.
jilles [Fri, 31 Dec 2010 18:20:17 +0000 (18:20 +0000)]
sh: Check if dup2 for redirection from/to a file succeeds.

A failure (e.g. caused by ulimit -n being set very low) is a redirection
error.

Example:
  ulimit -n 9; exec 9<.

13 years agoHappy New Year 2011.
bz [Fri, 31 Dec 2010 18:07:16 +0000 (18:07 +0000)]
Happy New Year 2011.

Approved by: core (kib)

13 years agoMake i386_set_ldt work on i386/XEN, step 5/5.
cperciva [Fri, 31 Dec 2010 17:42:25 +0000 (17:42 +0000)]
Make i386_set_ldt work on i386/XEN, step 5/5.

When cleaning up a thread, reset its LDT to the default LDT.

Note: Casting the LDT pointer to an int and storing it in pc_currentldt is
wildly bogus, but is harmless since pc_currentldt is a write-only variable.

MFC after: 3 days

13 years agoMake i386_set_ldt work on i386/XEN, step 4/5.
cperciva [Fri, 31 Dec 2010 17:41:14 +0000 (17:41 +0000)]
Make i386_set_ldt work on i386/XEN, step 4/5.

Use xen_update_descriptor to update the LDT rather than bcopy.  Under Xen,
pages used for holding LDTs must be read-only, so we can't make the change
ourselves.

Ths obvious alternative of "remap the page read-write, make the change, then
map it read-only again" doesn't work since Xen won't allow an LDT page to be
remapped as R/W.  An arguably better solution is used by NetBSD: They don't
modify LDTs in-place at all, but instead copy the entire LDT, modify the new
version, then atomically swap.

MFC after: 3 days

13 years agoMake i386_set_ldt work on i386/XEN, step 3/5.
cperciva [Fri, 31 Dec 2010 17:40:30 +0000 (17:40 +0000)]
Make i386_set_ldt work on i386/XEN, step 3/5.

Synchronize reality with comment: The user_ldt_alloc function is supposed to
return with dt_lock held.  Due to broken locking in i386/xen/pmap.c, we drop
dt_lock during the call to pmap_map_readonly and then pick it up again; this
can be removed once the Xen pmap locking is fixed.

MFC after: 3 days

13 years agoMake i386_set_ldt work on i386/XEN, step 2/5.
cperciva [Fri, 31 Dec 2010 17:39:58 +0000 (17:39 +0000)]
Make i386_set_ldt work on i386/XEN, step 2/5.

Don't map physical to machine page numbers in pte_load_store, since it uses
PT_SET_VA (which takes a physical page number and converts it to a machine
page number).

MFC after: 3 days

13 years agoMake i386_set_ldt work on i386/XEN, step 1/5.
cperciva [Fri, 31 Dec 2010 17:39:31 +0000 (17:39 +0000)]
Make i386_set_ldt work on i386/XEN, step 1/5.

Lock the vm page queue mutex around calls to pte_store.  As with many other
uses of the vm page queue mutex in i386/xen/pmap.c, this is bogus and needs
to be replaced at some future date by a spin lock dedicated to protecting
the queue of pending xen page mapping hypervisor calls.  (But for now, bogus
locking is better than a panic.)

MFC after: 3 days

13 years agoMove alumni committers from the active section.
gavin [Fri, 31 Dec 2010 13:07:21 +0000 (13:07 +0000)]
Move alumni committers from the active section.

13 years agoFor committers listed as alumni, add the date that their commit bit was
gavin [Fri, 31 Dec 2010 11:55:39 +0000 (11:55 +0000)]
For committers listed as alumni, add the date that their commit bit was
returned where this information is missing and easy to determine.  Move
adrian@ back to the "Active committers" section.

13 years agoThe mwl's HAL manages an array of MWL_MBSS_MAX VAPs where the first 8 are
bschmidt [Fri, 31 Dec 2010 09:50:15 +0000 (09:50 +0000)]
The mwl's HAL manages an array of MWL_MBSS_MAX VAPs where the first 8 are
supposed to be APs and the later 24 are pre-configured as STAs. A wrong
condition during initialization is responsible for not configuring the last
8 array members. This is results in being able to create more than 8,
possible uninitialized, AP-VAPs.

PR: kern/153549
Submitted by: Erik Fonnesbeck <efonnes at gmail.com>
MFC after: 2 weeks

13 years agoRemove debugging leftovers.
yongari [Fri, 31 Dec 2010 01:23:04 +0000 (01:23 +0000)]
Remove debugging leftovers.

13 years agoMake -S functional.
brian [Fri, 31 Dec 2010 01:10:42 +0000 (01:10 +0000)]
Make -S functional.

MFC after: 1 week

13 years agoAdd vte(4) man page and hook up vte(4) to the build.
yongari [Fri, 31 Dec 2010 00:46:30 +0000 (00:46 +0000)]
Add vte(4) man page and hook up vte(4) to the build.
Also add Xr to appropriate man pages.

13 years agoAdd vte(4) to the list of supported network interface.
yongari [Fri, 31 Dec 2010 00:24:08 +0000 (00:24 +0000)]
Add vte(4) to the list of supported network interface.

13 years agoAdd driver for DM&P Vortex86 RDC R6040 Fast Ethernet.
yongari [Fri, 31 Dec 2010 00:21:41 +0000 (00:21 +0000)]
Add driver for DM&P Vortex86 RDC R6040 Fast Ethernet.
The controller is commonly found on DM&P Vortex86 x86 SoC.  The
driver supports all hardware features except flow control.  The
flow control was intentionally disabled due to silicon bug.

DM&P Electronics, Inc. provided all necessary information including
sample board to write driver and answered many questions I had.
Many thanks for their support of FreeBSD.

H/W donated by: DM&P Electronics, Inc.

13 years agoAdd RDC Semiconductor R6040 10/100 PHY driver.
yongari [Thu, 30 Dec 2010 23:50:25 +0000 (23:50 +0000)]
Add RDC Semiconductor R6040 10/100 PHY driver.

13 years agosh: Avoid side effects from builtins in optimized command substitution.
jilles [Thu, 30 Dec 2010 22:33:55 +0000 (22:33 +0000)]
sh: Avoid side effects from builtins in optimized command substitution.

Change the criterion for builtins to be safe to execute in the same process
in optimized command substitution from a blacklist of only cd, . and eval to
a whitelist.

This avoids clobbering the main shell environment such as by $(exit 4) and
$(set -x).

The builtins jobid, jobs, times and trap can still show information not
available in a child process; this is deliberately permitted. (Changing
traps is not.)

For some builtins, whether they are safe depends on the arguments passed to
them. Some of these are always considered unsafe to keep things simple; this
only harms efficiency a little in the rare case they are used alone in a
command substitution.

13 years agoDefine and use SCTP_SSN_GE, SCTP_SSN_GT, SCTP_TSN_GE, SCTP_TSN_GT macros
tuexen [Thu, 30 Dec 2010 21:32:35 +0000 (21:32 +0000)]
Define and use SCTP_SSN_GE, SCTP_SSN_GT, SCTP_TSN_GE, SCTP_TSN_GT macros
and use them instead of the generic compare_with_wrap.
Retire compare_with_wrap.

MFC after: 3 months.

13 years agoThe RX path is missing a few bus_dmamap_*() calls, this results in
bschmidt [Thu, 30 Dec 2010 18:29:22 +0000 (18:29 +0000)]
The RX path is missing a few bus_dmamap_*() calls, this results in
modification of memory which was already free'd and eventually in:
wpi0: could not map mbuf (error 12)
wpi0: wpi_rx_intr: bus_dmamap_load failed, error 12
and an usuable device.

PR: kern/144898
MFC after: 3 days

13 years agoFor compatibility with Linux and Solaris add poweroff(8).
pjd [Thu, 30 Dec 2010 18:06:31 +0000 (18:06 +0000)]
For compatibility with Linux and Solaris add poweroff(8).

It is implemented as a hard link to shutdown(8) and it is equivalent of:

# shutdown -p now

While I'm here put one line of usage into one line of C code so it is easier to
grep(1) and separate unrelated code with empty line.

MFC after: 2 weeks

13 years agoCode cleanup: Use LIST_FOREACH, LIST_FOREACH_SAFE, TAILQ_FOREACH,
tuexen [Thu, 30 Dec 2010 16:56:20 +0000 (16:56 +0000)]
Code cleanup: Use LIST_FOREACH, LIST_FOREACH_SAFE, TAILQ_FOREACH,
              TAILQ_FOREACH_SAFE where appropriate.
No functional change.

MFC after: 3 months.

13 years agoFix three bugs related to the sequence number wrap-around affecting
tuexen [Thu, 30 Dec 2010 16:23:13 +0000 (16:23 +0000)]
Fix three bugs related to the sequence number wrap-around affecting
the processing of ECNE and ASCONF chunks.

Reviewed by: rrs
MFC after: 3 days.

13 years ago- Add CPUTYPE support for sparc64. The net result is that it's now possible
marius [Thu, 30 Dec 2010 15:58:23 +0000 (15:58 +0000)]
- Add CPUTYPE support for sparc64. The net result is that it's now possible
  to let the compiler optimize for the famility of UltraSPARC-III CPUs as the
  default already was to optimize for UltraSPARC-I/II and generating generic
  64-bit V9 is mainly for reference purposes. At least for SPARC64-V CPUs
  code optimized for UltraSPARC-I/II still is the most performant one.
  Thanks go to Michael Moll for testing SPARC64-V.
- Move a booke MACHINE_CPU bit into the right section.

13 years agosh: Add two tests for special cases in command substitution that already
jilles [Thu, 30 Dec 2010 15:04:59 +0000 (15:04 +0000)]
sh: Add two tests for special cases in command substitution that already
work in stable/8.

13 years agoHandle missing jremrefs when a directory is renamed overtop of
kib [Thu, 30 Dec 2010 10:52:07 +0000 (10:52 +0000)]
Handle missing jremrefs when a directory is renamed overtop of
another, deleting it.  If the directory is removed, UFS always need to
remove the .. ref, even if the ultimate ref on the parent would not
change. The new directory must have a new journal entry for that ref.
Otherwise journal processing would not properly account for the
parent's reference since it will belong to a removed directory entry.

Change ufs_rename()'s dotdot rename section to always
setup_dotdot_link(). In the tip != NULL case SUJ needs the newref dependency
allocated via setup_dotdot_link().

Stop setting isrmdir to 2 for newdirrem() in softdep_setup_remove().
Remove the isdirrem > 1 checks from newdirrem().

Reported by: many
Submitted by: jeff
Tested by: pho

13 years agoIn indir_trunc(), when processing jnewblk entries that are not written
kib [Thu, 30 Dec 2010 10:41:17 +0000 (10:41 +0000)]
In indir_trunc(), when processing jnewblk entries that are not written
to the disk, recurse to handle indirect blocks of next level that are
hidden by the corresponding entry.

In collaboration with: pho
Reviewed by: jeff, mckusick
Tested by: mckusick, pho

13 years agoFix the LINUX_SOUND_MIXER_INFO ioctl to return success after the
scf [Thu, 30 Dec 2010 02:18:04 +0000 (02:18 +0000)]
Fix the LINUX_SOUND_MIXER_INFO ioctl to return success after the
information is set to FreeBSD.  It had been falling through to the end
of linux_ioctl_sound() and returning ENOIOCTL.  Noticed when running the
Linux ALSA amixer tool.

Add a LINUX_SOUND_MIXER_READ_CAPS ioctl which is used by the Skype
v2.1.0.81 binary.

Reviewed by: gavin
MFC after: 2 weeks

13 years agoAdd xenpic_dynirq_disable_intr and set it as the .pic_disable_intr method
cperciva [Thu, 30 Dec 2010 01:28:56 +0000 (01:28 +0000)]
Add xenpic_dynirq_disable_intr and set it as the .pic_disable_intr method
for xenpic_dynirq_template.  This fixes a panic when a virtual disk is
removed, since that results in an interrupt channel being disabled and
NULL isn't very good function for disabling interrupts.

We should probably have a xenpic_pirq_disable_intr as well; I'm not adding
that here because (a) I'm not sure what uses pirqs so I don't have a test
case, and (b) the xenpic_pirq_enable_intr code is significantly more
complex than the xenpic_dynirq_enable_intr code, so I'm not sure what
should go into a xenpic_pirq_disable_intr routine.

PR: kern/153511
MFC after: 3 days

13 years agoRemove INDEX-6 from the default portsnap configuration file; the 6.x index
cperciva [Thu, 30 Dec 2010 01:13:42 +0000 (01:13 +0000)]
Remove INDEX-6 from the default portsnap configuration file; the 6.x index
bits haven't been built since December 1st, although the mirrors are still
distributing the bits as they were at the EoL.

Reminded by: Alex Kozlov

13 years agoRemove OBJ_CLEANING flag. The vfs_setdirty_locked_object() is the only
kib [Wed, 29 Dec 2010 22:26:49 +0000 (22:26 +0000)]
Remove OBJ_CLEANING flag. The vfs_setdirty_locked_object() is the only
consumer of the flag, and it used the flag because OBJ_MIGHTBEDIRTY
was cleared early in vm_object_page_clean, before the cleaning pass
was done. This is no longer true after r216799.

 Moreover, since OBJ_CLEANING is a flag, and not the counter, it could
be reset too prematurely when parallel vm_object_page_clean() are
performed.

Reviewed by: alc (as a part of the bigger patch)
MFC after: 1 month (after r216799 is merged)

13 years agoprintf: Do not use sh memory functions in sh builtin.
jilles [Wed, 29 Dec 2010 21:38:00 +0000 (21:38 +0000)]
printf: Do not use sh memory functions in sh builtin.

These functions throw exceptions if they fail, possibly causing memory
leaks. The normal out-of-memory handling suffices. The INTOFF around almost
all of printf prevents memory leaks due to SIGINT.

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