Commit Graph

158810 Commits

Author SHA1 Message Date
Warner Losh
c9489e0d75 Minor tweaks in compression support:
o We need an eval here to get the right expansion of the command
o bs=128k doesn't work in some cases, so eliminate it and cope with the
  minor performance hit.

Submitted by:	john hixson
2010-10-21 22:33:50 +00:00
Robert Watson
73e5f76349 Universally use uintmax_t in syscall_timing; rearrange arithmetic to
suffer fewer rounding errors with smaller numbers; fix argc validation
so multiple tests run on a single command line.

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-21 21:08:12 +00:00
Xin LI
5e5fd037d6 Call chainevh callback when we are invoked with neither MOD_LOAD nor
MOD_UNLOAD.  This makes it possible to add custom hooks for other module
events.

Return EOPNOTSUPP when there is no callback available.

Pointed out by:	jhb
Reviewed by:	jhb
MFC after:	1 month
2010-10-21 20:31:50 +00:00
Gleb Smirnoff
283e21dd32 Fix typo in last commit.
Submitted by:	bcr
2010-10-21 20:22:00 +00:00
Pawel Jakub Dawidek
3ac01bc2ae Free opencrypto sessions on suspend, as they also might keep encryption keys. 2010-10-21 19:44:28 +00:00
Bernhard Schmidt
9f95314538 The firmware always sets bit 14 and 15, to get the real associd we need
to clear those bits.

MFC after:	1 week
2010-10-21 19:30:55 +00:00
Bernhard Schmidt
f3c95fe748 Instead of calling return when reaching the end of the assoc notification
break the loop instead. We want to run the code after the while loop
to set an associd and capinfo. If we don't do this net80211 will drop
frames because it assumes the node has not yet been associated.

MFC after:	1 week
2010-10-21 19:28:52 +00:00
John Baldwin
d680caab73 - When disabling ktracing on a process, free any pending requests that
may be left.  This fixes a memory leak that can occur when tracing is
  disabled on a process via disabling tracing of a specific file (or if
  an I/O error occurs with the tracefile) if the process's next system
  call is exit().  The trace disabling code clears p_traceflag, so exit1()
  doesn't do any KTRACE-related cleanup leading to the leak.  I chose to
  make the free'ing of pending records synchronous rather than patching
  exit1().
- Move KTRACE-specific logic out of kern_(exec|exit|fork).c and into
  kern_ktrace.c instead.  Make ktrace_mtx private to kern_ktrace.c as a
  result.

MFC after:	1 month
2010-10-21 19:17:40 +00:00
Robert Watson
4e20912ad8 Add Cambridge/Google tag since the copyright has been updated.
MFC after:	2 weeks
2010-10-21 19:03:24 +00:00
Robert Watson
c4cc2fbf5c Further syscall_timing improvements: allow an arbitrary "path" string
argument to be passed on the command line, allowing file-related tests
to be pointed at wherever desired.

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-21 19:01:59 +00:00
Rick Macklem
8a1b5ade5f Modify the experimental NFS server in a manner analagous to
r214049 for the regular NFS server, so that it will not do
a VOP_LOOKUP() of ".." when at the root of a file system
when performing a ReaddirPlus RPC.

MFC after:	10 days
2010-10-21 18:49:12 +00:00
Benedict Reuschling
a8af8b783a Document strtonum()s behavior of setting errno to 0 when no error is found.
PR:             docs/143330
Submitted by:   Efstratios Karatzas (gpf dot kira at gmail dot com)
Discussed with: ru@
MFC after:      7 days
2010-10-21 18:30:48 +00:00
Benedict Reuschling
e9e38bc2e7 Sync with OpenBSD rev. 1.13:
strtonum does not require limits.h

Obtained from:  OpenBSD
Discussed with: ru@
MFC after:      5 days
2010-10-21 18:21:19 +00:00
John Baldwin
fb2439a6f6 Clarify a misleading comment. The test in pci_reserve_map() was meant to
ignore BARs that are invalid due to having a size of zero, not to ignore
BARs with an existing base of zero.  While here, reorganize the code
slightly to make the intent clearer.

Reported by:	avg
MFC after:	1 week
2010-10-21 17:46:23 +00:00
Robert Watson
3e36aa656e Fix bug in recent syscall_timing change: measure the number of iterations
each loop, rather than once up front.  The distinction is unimportant
when doing a fix iteration count, but when using a timer, it should vary.

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-21 17:35:08 +00:00
John Baldwin
1a587ef2a5 - Make 'vm_refcnt' volatile so that compilers won't be tempted to treat
its value as a loop invariant.  Currently this is a no-op because
  'atomic_cmpset_int()' clobbers all memory on current architectures.
- Use atomic_fetchadd_int() instead of an atomic_cmpset_int() loop to drop
  a reference in vmspace_free().

Reviewed by:	alc
MFC after:	1 month
2010-10-21 17:29:32 +00:00
Warner Losh
e964661666 Left over from prior patch removed.
Submitted by: John Hixon
PR: 151442 (but the patch was backwards there)
2010-10-21 17:29:18 +00:00
Robert Watson
1dca6a2844 Further enhancements to syscall_timing:
- Use getopt rather than hand-parsed arguments
- Allow iterations to be specified and/or a new number of seconds bound
  on the number of iterations
- Fix printout of timer resolution
- Add new tests, such as TCP and UDP socket creation, and open/read/close
  of /dev/zero and /dev/null.

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-21 17:27:39 +00:00
Warner Losh
b459a68591 This patch will only list components if the directory exists. The
directory exist on PC-BSD but not FreeBSD, so an extra check is made.

Submitted by: John Hixson
PR: 151461
2010-10-21 17:23:48 +00:00
Gleb Smirnoff
f3d45e1409 Document possibility to read from stdin. 2010-10-21 17:23:09 +00:00
Warner Losh
a919280d8b This is an updated patch to the last patch to do this which fixes a
local variable issue. This patch decompresses compressed images to the
stdout when writing to a device to avoid running out of space issues.

Submitted by: John Hixson
Pr: 151049
2010-10-21 17:20:37 +00:00
Warner Losh
c4201e3f33 This small patch updates the "geli setkey" flags pc-sysinstall uses
when saving a users passphrase, to make it work in HEAD with recent
geli improvements.

Submitted by: Kris Moore
PR: 151002
2010-10-21 17:14:44 +00:00
Gleb Smirnoff
85080d2d68 Make it possible to read input from stdin.
Without this change I don't see a way to
unpack a multivolume archive without wasting
disk space for a temporary file.
2010-10-21 17:05:15 +00:00
Sergey Kandaurov
9af74f3d68 Reshuffle SIOCGIFCONF32 handler from r155224.
- move all the chunks into one file, which allows to hide SIOCGIFCONF32
  global definition as well.
- replace __amd64__ with proper COMPAT_FREEBSD32 around.
- handle 32bit capacity before going into the handler itself instead of
  doing internal 32bit specific changes within it (e.g. as it's done for
  SIOCGDEFIFACE32_IN6).
- use explicitely sized types for ABI compat.

Approved by:	kib (mentor)
MFC after:	2 weeks
2010-10-21 16:20:48 +00:00
Robert Watson
37931439fd Improve the structure and implementation of the syscall_timing
microbenchmark suite:

- Use common benchmark_start/benchmark_stop routines to simplify
  individual benchmarks.
- Add a central table of tests with names, where new tests can be
  hooked in easily.
- Add new benchmarks for dup, shm_open, shm_open + fstat, fork,
  vfork, vfork + exec, chroot, setuid.
- Accept a number of loops, not just a number of iterations.
- Report results more usefully in a table.

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-21 16:08:31 +00:00
Ed Schouten
9301df8179 Fix error handling logic of pututxline(3).
Instead of only returning NULL when the entry is invalid and can't be
matched against the current database, also return it when it cannot open
the log files properly.
2010-10-21 15:10:35 +00:00
Pawel Jakub Dawidek
738ffa9780 Fix a bug introduced in r213067 where we use authentication key before
initializing it.
2010-10-21 12:58:26 +00:00
Ulrich Spörlein
2914feeb7e mdoc: make pages render with mandoc
It's a bit more pedantic regarding .Bl list elements. This has an added
benefit of unbreaking the ipfw(8) manpage, where groff was silently
skipping one list element.
2010-10-21 12:27:13 +00:00
Sergey Kandaurov
08f2463092 Enable copyback and system PD states.
Reviewed by:	jhb
Approved by:	avg (mentor)
MFC after:	1 week
X-MFC-After:	r214130
2010-10-21 10:46:18 +00:00
Sergey Kandaurov
d63e9da300 Update PD state firmware definitions: add copyback, system.
Reviewed by:	jhb
Approved by:	avg (mentor)
MFC after:	1 week
2010-10-21 10:38:52 +00:00
Pawel Jakub Dawidek
42e2e8990a Remove code duplication by introducing static gctl_param_add() function which
is now used by both gctl_ro_param() and gctl_rw_param().
2010-10-21 10:38:14 +00:00
Pawel Jakub Dawidek
91cca30d9c - Simplify gctl_get_handle() a bit.
- Prefer 'unsigned int' over 'u_int' in userland code.
2010-10-21 10:36:36 +00:00
Xin LI
00e3c12e03 In syscall_module_handler(): all switch branches return, remove
unreached code as pointed out in a Chinese forum [1].

[1] http://www.freebsdchina.org/forum/viewtopic.php?t=50619

Pointed out by:		btw616 <btw s qq com>
MFC after:		1 month
2010-10-21 08:57:25 +00:00
Edwin Groothuis
e782099404 Fix printing of files located on ZFS filesystem with an st_dev or
st_ino larger than 2**31.

From the PR:

   Printing from a ZFS filesystem using 'lp' fails and returns an
   email reporting "Your printer job was not printed because it was
   not linked to the original file".

   In order to protect against files being switched when files
   are printed using 'lp' or 'lpr -s', the st_dev and st_ino
   values for the original file are saved by lpr and verified
   by lpd before the file is printed. Unfortunately, lpr prints
   both values using '%d' (although both fields are unsigned)
   and lpd(8) assumes a string of decimal digits.

   ZFS (at least) generates st_dev values greater than 2^31-1,
   resulting in negative values being printed - which lpd cannot
   parse, leading it to report that the file has been switched.

   A similar problem would occur with large inode numbers.

   How-To-Repeat:

   Find a file with either st_dev or st_ino greater than 2^31-1
   (stat(1) will report both numbers) and print it with 'lpq -s'.
   This should generate an email reporting that the file could
   not be printed because it was not linked to the original file

PR:		bin/151567
Submitted by:	Peter Jeremy <Peter.Jeremy@alcatel-lucent.com>
MFC after:	1 week
2010-10-21 06:52:14 +00:00
Jung-uk Kim
d815d0abb7 Update PCI power management registers per PCI Bus Power Management Interface
Specification Rev. 1.2.  Rename pp_pcmcsr field of PM capabilities to pp_bse
to avoid further confusions and adjust some comments accordingly.  The real
PMCSR (Power Management Control/Status Register) is PCIR_POWER_STATUS and
it is actually BSE (PCI-to-PCI Bridge Support Extensions) register.
2010-10-20 23:41:16 +00:00
Pawel Jakub Dawidek
6c71649c5f Use closefrom(2) instead of close(2) in a loop.
MFC after:	1 week
2010-10-20 21:10:01 +00:00
Pawel Jakub Dawidek
5ad4a7c74a Bring in geli suspend/resume functionality (finally).
Before this change if you wanted to suspend your laptop and be sure that your
encryption keys are safe, you had to stop all processes that use file system
stored on encrypted device, unmount the file system and detach geli provider.

This isn't very handy. If you are a lucky user of a laptop where suspend/resume
actually works with FreeBSD (I'm not!) you most likely want to suspend your
laptop, because you don't want to start everything over again when you turn
your laptop back on.

And this is where geli suspend/resume steps in. When you execute:

	# geli suspend -a

geli will wait for all in-flight I/O requests, suspend new I/O requests, remove
all geli sensitive data from the kernel memory (like encryption keys) and will
wait for either 'geli resume' or 'geli detach'.

Now with no keys in memory you can suspend your laptop without stopping any
processes or unmounting any file systems.

When you resume your laptop you have to resume geli devices using 'geli resume'
command. You need to provide your passphrase, etc. again so the keys can be
restored and suspended I/O requests released.

Of course you need to remember that 'geli suspend' won't clear file system
cache and other places where data from your geli-encrypted file system might be
present. But to get rid of those stopping processes and unmounting file system
won't help either - you have to turn your laptop off. Be warned.

Also note, that suspending geli device which contains file system with geli
utility (or anything used by 'geli resume') is not very good idea, as you won't
be able to resume it - when you execute geli(8), the kernel will try to read it
and this read I/O request will be suspended.
2010-10-20 20:50:55 +00:00
Pawel Jakub Dawidek
056638c469 - Add missing comments.
- Make a comment consistent with others.
2010-10-20 20:01:45 +00:00
Ed Schouten
587250b286 Get rid of hand-rolled closefrom(3). 2010-10-20 19:53:29 +00:00
Pawel Jakub Dawidek
ab05568beb Correct typos. 2010-10-20 19:52:27 +00:00
Jung-uk Kim
f3e0b10973 Introduce a new tunable 'hw.pci.do_power_suspend'. This tunable lets you
avoid PCI power state transition from D0 to D3 for suspending case.  Default
is 1 or enabled.
2010-10-20 16:47:09 +00:00
Jung-uk Kim
347263c935 Do not apply do_power_resume for suspending P2P bridge as we did in r214064. 2010-10-20 16:40:14 +00:00
Jayachandran C.
7850efa68d Network driver updates
- Fix network driver issue on a XLS eval board (major# 8).
- Fix issue uncovered by r213475 in check for XGMII

Submitted by:	Sriram Gorti (srgorti at netlogicmicro dot com)
2010-10-20 09:50:11 +00:00
Jayachandran C.
18ad6a4db2 On uniprocessor, warn and fixup hardware cpu mask if more than on CPU
is enabled by the bootloader.
2010-10-20 09:41:36 +00:00
Ed Schouten
a2995e0d9b Remove setpgid() call before executing child process.
Using a separate process group here is bad, since (for example) job
control in the TTY layer prevents interaction with the TTY, causing the
child process to hang.

Mentioned on:	current@
MFC after:	2 weeks
2010-10-20 09:35:20 +00:00
Alexander Motin
6c87235098 Workaround strange situation when EDMA_RESQIP register returns zero instead
of proper value. It caused bunch of "EMPTY CRPB" messages and potentially
may cause premature requests completion, which could cause data corruption.
For most cases it seems enough to just reread register to get proper value.
To protect against worse cases - erase processed queue entries with
impossible values and ignore them if problem still happen.
2010-10-20 07:47:31 +00:00
Alexander Motin
c0609c547a Some style cleanup:
- remove commented debugging code;
- wrap long lines.
2010-10-20 07:22:34 +00:00
Andriy Gapon
7f0ab7f026 catch up manual pages with rename of vm_page_sleep_busy to vm_page_sleep_if_busy
Suggested by:	alc
MFC after:	4 days
2010-10-20 06:29:11 +00:00
Andriy Gapon
c3fdd2de24 VOP_GETPAGES.9: clarify and correct description of parameters and requirements
In cooperation with alc and kib, who provided valuable insights and
suggestions.

Reviewed by:	alc, kib (earlier version)
MFC after:	4 days
2010-10-20 05:57:54 +00:00
Andriy Gapon
55144670c2 PG_BUSY -> VPO_BUSY, PG_WANTED -> VPO_WANTED in manual pages and comments
Reviewed by:	alc
MFC after:	4 days
2010-10-20 05:17:23 +00:00