Jason Evans [Thu, 3 Jan 2008 23:22:13 +0000 (23:22 +0000)]
Enable both sbrk(2)- and mmap(2)-based memory acquisition methods by
default. This has the disadvantage of rendering the datasize resource
limit irrelevant, but without this change, legitimate uses of more
memory than will fit in the data segment are thwarted by default.
Fix chunk_alloc_mmap() to work correctly if initial mapping is not
chunk-aligned and mapping extension fails.
Add an internal utility function to simplify the many, many places where
the number of bytes read is actually not important as long as we have at
least what we ask for. Illustrate its benefits by using it throughout
the ZIP support code, except for the few cases where it doesn't apply.
ffs_balloc_ufsX() routines, in the case of recovering from the failed
allocation, free the indirect blocks before clearing the disk pointers,
that could lead to the softupdate inconsistencies in the case of the
machine or disk crash at the wrong time.
Rearrange the recover code to do the ffs_blkfree() after the second
ffs_syncvnode(), that clears the pointers chain.
Proposed and reviewed by: tegge
Tested by: Peter Holm
MFC after: 3 weeks
Jeff Roberson [Thu, 3 Jan 2008 01:26:59 +0000 (01:26 +0000)]
- In sysctl_kern_file skip fdps with negative lastfiles. This can
happen if there are no files open. Accounting for these can
eventually return a negative value for olenp causing sysctl to
crash with a bad malloc.
Alan Cox [Wed, 2 Jan 2008 08:54:39 +0000 (08:54 +0000)]
Provide a legitimate pindex to vm_page_alloc() in pmap_growkernel()
instead of writing apologetic comments. As it turns out, I need every
kernel page table page to have a legitimate pindex to support superpage
promotion on kernel memory.
Correct a nearby style error: Pointers should be compared to NULL.
Alan Cox [Wed, 2 Jan 2008 04:43:47 +0000 (04:43 +0000)]
Defer setting either PG_CACHED or PG_FREE until after the free page
queues lock is acquired. Otherwise, the state of a reservation's
pages' flags and its population count can be inconsistent. That could
result in a page being freed twice.
Tim Kientzle [Wed, 2 Jan 2008 00:27:14 +0000 (00:27 +0000)]
A couple of miscellaneous fixes:
* prototypes for optarg/optind on platforms that don't already have them
* Disambiguate version number macros
* Remove unnecessary PACKAGE_NAME macro
* Hook for forthcoming bsdtar test suite
* Sync version number up with the portable distribution
Tim Kientzle [Wed, 2 Jan 2008 00:21:27 +0000 (00:21 +0000)]
Use archive_entry_strmode() instead of a local bsdtar_strmode().
(This does a couple of things that the standard library's strmode()
doesn't; it proved useful in bsdcpio as well, so I pushed it down
into libarchive.)
Tim Kientzle [Tue, 1 Jan 2008 22:28:04 +0000 (22:28 +0000)]
Extensive improvements to the libarchive_test test program that
exercises and verifies the libarchive APIs:
* Improved error reporting; hexdumps are now provided for
many file/memory content differences.
* Overall status more clearly counts "tests" and "assertions"
* Reference files can now be stored on disk instead of having
to be compiled into the test program itself. A couple of
tests have been converted to this more natural structure.
* Several memory leaks corrected so that leaks within libarchive
itself can be more easily detected and diagnosed.
* New test: GNU tar compatibility
* New test: Zip compatibility
* New test: Zero-byte writes to a compressed archive entry
* New test: archive_entry_strmode() format verification
* New test: mtree reader
* New test: write/read of large (2G - 1TB) entries to tar archives
(thanks to recent performance work, this test only requires a few seconds)
* New test: detailed format verification of cpio odc and newc writers
* Many minor additions/improvements to existing tests as well.
Tim Kientzle [Tue, 1 Jan 2008 06:15:57 +0000 (06:15 +0000)]
Add the mtree.5 manpage. I'll come back soon and
remove the format specification from mtree.8.
I also need to reconcile a few issues between this
mtree.5 and what is actually implemented in FreeBSD's
mtree utility.
Ken Smith [Tue, 1 Jan 2008 03:59:17 +0000 (03:59 +0000)]
Change sysinstall's handling of X11 stuff. Doing it in pieces was
probably the right thing to do a while ago but xorg has progressed
to the point that for novice users (who are the ones expected to think
installing X11 during an install...) it's best to just install the
whole x11/xorg metaport for them. This removes the X11 sub-menus
and sets it up so you just select whether or not you want X11. While
here garbage collect an X11 configuration menu I missed removing when
I removed support for attempting xorg configuration from inside sysinstall
a while ago.
Discussed with: rwatson, kris
No objection from: re
Release build tested by: rwatson
Jeff Roberson [Tue, 1 Jan 2008 01:46:42 +0000 (01:46 +0000)]
- Place the fhold() in unp_internalize_fp to be more consistent with refs.
- Clear all of the gc flags before doing a run. Stale flags were causing
us to skip some descriptors.
- If a unp socket has been marked REF in a gc pass it can't be dead.
Julian Elischer [Mon, 31 Dec 2007 23:48:06 +0000 (23:48 +0000)]
Don't duplicate the whole of arpresolve to arpresolve 2 for the sake
of two compares against 0. The negative effect of cache flushing
is probably more than the gain by not doing the two compares (the
value is almost certainly in register or at worst, cache).
Note that the uses of m_freem() are in error cases and m_freem()
handles NULL anyhow. So fast-path really isn't changed much at all.
John Baldwin [Mon, 31 Dec 2007 21:12:05 +0000 (21:12 +0000)]
Add very basic support for the kernel to export a list of features. Each
feature is represented by a node in the new 'kern.features' sysctl node.
A feature is present if the corresponding node is present and evaluates to
true.
A FEATURE() wrapper macro is added which takes the sysctl node name and
a description of the feature as the sole arguments and creates a read-only
sysctl node with a value of 1.
Robert Watson [Mon, 31 Dec 2007 20:58:50 +0000 (20:58 +0000)]
Update netisr comment for the SMPng world order: netisr is no longer
implemented using the ISR facility, and cannot be triggered by calling
splnet()/splx().
Robert Watson [Mon, 31 Dec 2007 16:45:27 +0000 (16:45 +0000)]
Add regression tests for UNIX domain socket garbage collection. Should be
run from single-user mode, as they look at global open file and inflight
descriptor counts to check for leaks.
John Baldwin [Mon, 31 Dec 2007 15:56:03 +0000 (15:56 +0000)]
Use devclass_get_count() instead of devclass_get_maxunit() to get the
correct number of acpi_thermalX devices. Having this wrong caused the
acpi_thermal thread to realloc the array of devices on each loop iteration.
MFC after: 1 week
PR: kern/118497
Submitted by: Pasi Parviainen
Jason Evans [Mon, 31 Dec 2007 06:19:48 +0000 (06:19 +0000)]
Fix a major chunk-related memory leak in chunk_dealloc_dss_record(). [1]
Clean up DSS-related locking and protect all pertinent variables with
dss_mtx (remove dss_chunks_mtx). This fixes race conditions that could
cause chunk leaks.
Jeff Roberson [Mon, 31 Dec 2007 03:45:51 +0000 (03:45 +0000)]
- Pause a while after disabling lock profiling and before resetting it
to be sure that all participating CPUs have stopped updating it.
- Restore the behavior of printing the name of the lock type in the output.
Warner Losh [Mon, 31 Dec 2007 03:29:02 +0000 (03:29 +0000)]
Add Winbond W89C940F to the list. Also, stub in some entries for two
Holtek cards that will need some special support later, but leave them
commented out for now.
These ID's are transcribed from the Linux ne2k-pci.c
Jason Evans [Mon, 31 Dec 2007 00:59:16 +0000 (00:59 +0000)]
Fix a bug related to sbrk() calls that could cause address space leaks.
This is a long-standing bug, but until recent changes it was difficult
to trigger, and even then its impact was non-catastrophic, with the
exception of revision 1.157.
Optimize chunk_alloc_mmap() to avoid the need for unmapping pages in the
common case. Thanks go to Kris Kennaway for a patch that inspired this
change.
Do not maintain a record of previously mmap'ed chunk address ranges.
The original intent was to avoid the extra system call overhead in
chunk_alloc_mmap(), which is no longer a concern. This also allows some
simplifications for the tree of unused DSS chunks.
Introduce huge_mtx and dss_chunks_mtx to replace chunks_mtx. There was
no compelling reason to use the same mutex for these disjoint purposes.
Avoid memset() for huge allocations when possible.
Maintain two trees instead of one for tracking unused DSS address
ranges. This allows scalable allocation of multi-chunk huge objects in
the DSS. Previously, multi-chunk huge allocation requests failed if the
DSS could not be extended.
Warner Losh [Sun, 30 Dec 2007 05:53:45 +0000 (05:53 +0000)]
Rather than not redirting the bp when we get ENXIO, only redirty it
when the error is EIO. This catches a much larger class of errors
that are unlikely to succeed if retried.
Tim Kientzle [Sun, 30 Dec 2007 04:58:22 +0000 (04:58 +0000)]
Update libarchive to 2.4.10. This includes a number of improvements
that I've been working on but put off committing until after the
RELENG_7 branch, including:
* New manpages: cpio.5 mtree.5
* New archive_entry_strmode()
* New archive_entry_link_resolver()
* New read support: mtree format
* Internal API change: read format auction only runs once
* Running the auction only once allowed simplifying a lot of bid logic.
* Cpio robustness: search for next header after a sync error
* Support device nodes on ISO9660 images
* Eliminate a lot of unnecessary copies for uncompressed archives
* Corrected handling of new GNU --sparse --posix formats
* Correctly handle a zero-byte write to a compressed archive
* Fixed memory leaks
Many of these improvements were motivated by the upcoming bsdcpio
front-end.
There have also been extensive improvements to the libarchive_test
test harness, which I'll commit separately.
Jeff Roberson [Sun, 30 Dec 2007 01:43:51 +0000 (01:43 +0000)]
- Update kvm_deadfiles to be compatible with the new system which has no
global list of all files.
- Mark kvm_getfiles() as broken since the live version exports struct xfile
with no filelist at the head and does so incorrectly and the deadfiles
version exports struct file with a filelist at the head. It is not known
if either version works or complies to the manpage.
Jeff Roberson [Sun, 30 Dec 2007 01:42:15 +0000 (01:42 +0000)]
Remove explicit locking of struct file.
- Introduce a finit() which is used to initailize the fields of struct file
in such a way that the ops vector is only valid after the data, type,
and flags are valid.
- Protect f_flag and f_count with atomic operations.
- Remove the global list of all files and associated accounting.
- Rewrite the unp garbage collection such that it no longer requires
the global list of all files and instead uses a list of all unp sockets.
- Mark sockets in the accept queue so we don't incorrectly gc them.
Marius Strobl [Sun, 30 Dec 2007 01:32:03 +0000 (01:32 +0000)]
o In preparation for basing a new driver on this one:
- ANSIfy
- try to bring closer to style(9)
- remove banal comments.
o Add my copyright for having done lots of fixes and improvements.
Marius Strobl [Sun, 30 Dec 2007 00:23:38 +0000 (00:23 +0000)]
Correct the comments in am7990_intr() and am79900_intr(); it's not
possible to end up in the interrupt handler again while processing the
previous RX interrupt in ifp->if_input() because the MD interrupt code
disables the delivery of the respective interrupt until all associated
handlers were called (in the INTR_FILTER case the MI code supposedly
does the same). Toggling the NIC interrupt enable bit in these handlers
still is necessary though as some chips (f.e. the VMware emulated one)
require this to be done in order to keep issuing interrupts.
Replace explicit calls to video methods with their respective variants
implemented with macros. This patch improves code readability. Reasoning
behind vidd_* is a sort of "video discipline".
List of macros is supposed to be complete--all methods of video_switch
ought to have their respective macros from now on.
Functionally, this code should be no-op. My intention is to leave current
behaviour of touched code as is.
No objections: rwatson
Silence on: freebsd-current@
Approved by: cognet
Remove explicit calls to keyboard methods with their respective variants
implemented with macros. This patch improves code readability. Reasoning
behind kbdd_* is a "keyboard discipline".
List of macros is supposed to be complete--all methods of keyboard_switch
should have their respective macros from now on.
Functionally, this code should be no-op. My intention is to leave current
behaviour of code as is.
Alan Cox [Sat, 29 Dec 2007 19:53:04 +0000 (19:53 +0000)]
Add the superpage reservation system. This is "part 2 of 2" of the
machine-independent support for superpages. (The earlier part was
the rewrite of the physical memory allocator.) The remainder of the
code required for superpages support is machine-dependent and will
be added to the various pmap implementations at a later date.
Initially, I am only supporting one large page size per architecture.
Moreover, I am only enabling the reservation system on amd64. (In
an emergency, it can be disabled by setting VM_NRESERVLEVELS to 0
in amd64/include/vmparam.h or your kernel configuration file.)
Alexander Motin [Sat, 29 Dec 2007 19:44:41 +0000 (19:44 +0000)]
Add support for optional "AC-Name\Service-Name" syntax at NGM_PPPOE_CONNECT
argument. It allows ppp, mpd or any other node consumer to request
connection to specified access concentrator.
Proposed by: Alexander A. Burylov <burylov@mail.ru>
Comments fixing
"month names" -> "months names"
typo
"Long months names (alternative)" or "in alternative form" ->
"(without case ending)"
"Long months names" -> "Long months names (as in a date)"
to not confuse developers on what purpose those sections are
Apply the LCONVPATH() to the (old) linux_stat() and linux_lstat() syscalls.
Without it, code has two problems:
- behaviour of the old and new [l]stat are different with regard of
the /compat/linux
- directly accessing the userspace data from the kernel asks for
the panics.
Reported and tested by: Peter Holm
Reviewed by: rdivacky
MFC after: 3 days
The ffs_balloc() routines, whan allocating the indirect blocks for
the inode, do the rollback in case the allocation failed (due to
insufficient free space or quota limits). But, the code does leaves the
buffers corresponding to the inoirect blocks on the vnode bufobj list.
This causes several assertion failures (for instance, "ffs_truncate3"
in ffs_truncate()) to fail, and could result in the indirect block
aliasing problem, like writing the context of such blocks to random
disk location.
Remove the buffers from the bufobj properly.
Reported and tested by: Peter Holm
Reviewed by: tegge
MFC after: 3 weeks
Warner Losh [Sat, 29 Dec 2007 05:15:54 +0000 (05:15 +0000)]
Some systems need the types defined in sys/types.h, but lack the
sys/types.h polution that FreeBSD has in one of its include files.
Since this is a bootstrap tool, include more than is strictly
necessary for FreeBSD.
Ken Smith [Sat, 29 Dec 2007 04:56:07 +0000 (04:56 +0000)]
Plug a memory leak. Once any given package (e.g. perl) was installed
we would leak a saved screen for every other package we tried to install
that listed perl as one of its dependencies. When installing things
like gnome and kde that wound up being a LOT of leaked memory.
Insta-MFC request coming so this can be tested as part of 6.3-RC2...
Colin Percival [Fri, 28 Dec 2007 20:39:18 +0000 (20:39 +0000)]
Attempt to reduce the rate of foot-shooting injuries by adding a new
paragraph clarifying that portsnap does not behave the same way as
cvs and cvsup where local modifications are concerned.
Submitted by: peter
Feet shot: peter, kris, obrien, + many others
Jason Evans [Fri, 28 Dec 2007 07:24:19 +0000 (07:24 +0000)]
Maintain two trees instead of one (old_chunks --> old_chunks_{ad,szad}) in
order to support re-use of multi-chunk unused regions within the DSS for
huge allocations. This generalization is important to correct function
when mmap-based allocation is disabled.
Avoid zeroing re-used memory in the DSS unless it really needs to be
zeroed.
Ken Smith [Fri, 28 Dec 2007 05:08:54 +0000 (05:08 +0000)]
The limit on datasize in the install environment is 128M. That's a bit
too small for today's standards. While loading packages sysinstall
blows past this by a LOT but I think (hope...) that's caused by other
bugs. I'll look more into why sysinstall's memory use has gotten so
out of control as it loads packages but independent of that there really
is no reason to leave the limits on datasize and stacksize in place. And
they can cause problems for some of the things "modern packages" might
be doing via pkg_add which gets run by sysinstall and would inherit the
limits.
Another insta-MFC probably coming, this is holding up 6.3-RC2. Sysinstall's
memory use is so out of control it blows past the current limit before it
finishes loading either of the meta-packages kde or gnome...
Robert Watson [Fri, 28 Dec 2007 00:47:31 +0000 (00:47 +0000)]
In "show lockedvnods" DDB command, use db_printf() rather than printf()
so that the results end up in the DDB output stream rather than the
console output stream.
This should likely also be done for the vprint() function it calls.