summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
...
* If new callout scheduled to another CPU and we are using global timer,mav2010-09-211-3/+7
| | | | | there is high probability that timer is already programmed by some other CPU. Especially by one that registered this callout, and so active now.
* Remember last kern.eventtimer.periodic value, explicitly set by user.mav2010-09-211-2/+5
| | | | | | If timer capabilities forcing us to change periodicity mode, try to restore it back later, as soon as new choosen timer capable to do it. Without this, timer change like HPET->RTC->HPET always results in enabling periodic mode.
* Fix exec_imgact_shell()'s handling of two error cases: (1) Previously, ifalc2010-09-211-12/+16
| | | | | | | | | | | | | | | | | | | | | | | the first line of a script exceeded MAXSHELLCMDLEN characters, then exec_imgact_shell() silently truncated the line and passed on the truncated interpreter name or argument. Now, exec_imgact_shell() will fail and return ENOEXEC, which is the commonly used errno among Unix variants for this type of error. (2) Previously, exec_imgact_shell()'s check on the length of the interpreter's name was ineffective. In other words, exec_imgact_shell() could not possibly fail and return ENAMETOOLONG. The reason being that the length of the interpreter name had to exceed MAXSHELLCMDLEN characters in order that ENAMETOOLONG be returned. But, the search for the end of the interpreter name stops after at most MAXSHELLCMDLEN - 2 characters are scanned. (In the end, this particular error is eventually discovered outside of exec_imgact_shell() and ENAMETOOLONG is returned. So, the real effect of this second change is that the error is detected earlier, in exec_imgact_shell().) Update the definition of MAXINTERP to the actual limit on the size of the interpreter name that has been in effect since r142453 (from 2005). In collaboration with: kib
* kdb_backtrace: stack(9)-based code to print backtrace without any backendavg2010-09-211-0/+11
| | | | | | | | | | The idea is to add KDB and KDB_TRACE options to GENERIC kernels on stable branches, so that at least the minimal information is produced for non-specific panics like traps on page faults. The GENERICs in stable branches seem to already include STACK option. Reviewed by: attilio MFC after: 2 weeks
* Until hardclock() and respectively tc_windup() called first time, systemmav2010-09-211-0/+1
| | | | | | | | | | | is running on "dummy" time counter. But to function properly in one-shot mode, event timer management code requires working time counter. Slow moving "dummy" time counter delays first hardclock() call by few seconds on my systems, even though timer interrupts were correctly kicking kernel. That causes few seconds delay during boot with one-shot mode enabled. To break this loop, explicitly call tc_windup() first time during initialization process to let it switch to some real time counter.
* First step at adopting FreeBSD to support PSARC/2010/029. This makestrasz2010-09-201-0/+77
| | | | | | acl_is_trivial_np(3) properly recognize the new trivial ACLs. From the user point of view, that means "ls -l" no longer shows plus signs for all the files when running ZFS v28.
* Just make callout devices and /dev/console force CLOCAL on open().ed2010-09-191-6/+7
| | | | | | | | | Instead of adding custom checks to wait for DCD on open(), just modify the termios structure to set CLOCAL. This means SIGHUP is no longer generated when losing DCD as well. Reviewed by: kib@ MFC after: 1 week
* Ignore DCD handling on /dev/console entirely.ed2010-09-191-1/+2
| | | | | | | | | This makes /dev/console more fail-safe and prevents a potential console lock-up during boot. Discussed on: stable@ Tested by: koitsu@ MFC after: 1 week
* With reworking of the socket life cycle in 7.x, the need for a "sotryfree()"rwatson2010-09-181-5/+5
| | | | | | | | | was eliminated: all references to sockets are explicitly managed by sorele() and the protocols. As such, garbage collect sotryfree(), and update sofree() comments to make the new world order more clear. MFC after: 3 days Reported by: Anuranjan Shukla <anshukla at juniper dot net>
* kern.sched.topology_spec sysctl: use step of 1 for group levels numerationavg2010-09-181-1/+1
| | | | | | | | | | This is just a cosmetic change for prettier output. 'indent' variable/parameter serves two purposes: it specifies whitespace indentation level and also implies cpu group level/depth. It would have been better to split those two uses, but for now just a simple change. MFC after: 1 week
* When global timer used at SMP system, update nextevent field on BSP beforemav2010-09-181-4/+4
| | | | | | sending IPI to other CPUs. Otherwise, other CPUs will try to honor stale value, programming timer for zero interval. If timer is fast enough, it caused extra interrupt before timer correctly reprogrammed by BSP.
* By popular demand, kill all the non GIANT related interrupt messages.imp2010-09-171-9/+0
| | | | | | They are confusing and add little value. Reviewed by: jhb@
* Re-add r212370 now that the LOR in powerpc64 has been resolved:mdf2010-09-166-90/+51
| | | | | | | | | | | | Add a drain function for struct sysctl_req, and use it for a variety of handlers, some of which had to do awkward things to get a large enough SBUF_FIXEDLEN buffer. Note that some sysctl handlers were explicitly outputting a trailing NUL byte. This behaviour was preserved, though it should not be necessary. Reviewed by: phk (original patch)
* Fix panic on NULL dereference possible after r212541.mav2010-09-141-1/+2
|
* Make kern_tc.c provide minimum frequency of tc_ticktock() calls, requiredmav2010-09-144-7/+16
| | | | | | to handle current timecounter wraps. Make kern_clocksource.c to honor that requirement, scheduling sleeps on first CPU for no more then specified period. Allow other CPUs to sleep up to 1/4 second (for any case).
* Replace spin lock with the set of atomics. It is impractical for onemav2010-09-141-10/+14
| | | | tc_ticktock() call to wait for another's completion -- just skip it.
* Add some foot shooting protection by checking singlemul value correctness.mav2010-09-141-4/+5
| | | | | | Rephrase sysctls descriptions. Suggested by: edmaste
* Revert r212370, as it causes a LOR on powerpc. powerpc does a fewmdf2010-09-136-51/+90
| | | | | | | unexpected things in copyout(9) and so wiring the user buffer is not sufficient to perform a copyout(9) while holding a random mutex. Requested by: nwhitehorn
* bus_add_child: add specialized default implementation that calls panicavg2010-09-131-1/+11
| | | | | | | | | | | | | | | | | | If a kobj method doesn't have any explicitly provided default implementation, then it is auto-assigned kobj_error_method. kobj_error_method is proper only for methods that return error code, because it just returns ENXIO. So, in the case of unimplemented bus_add_child caller would get (device_t)ENXIO as a return value, which would cause the mistake to go unnoticed, because return value is typically checked for NULL. Thus, a specialized null_add_child is added. It would have sufficied for correctness to return NULL, but this type of mistake was deemed to be rare and serious enough to call panic instead. Watch out for this kind of problem with other kobj methods. Suggested by: jhb, imp MFC after: 2 weeks
* Refactor timer management code with priority to one-shot operation mode.mav2010-09-137-328/+744
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main goal of this is to generate timer interrupts only when there is some work to do. When CPU is busy interrupts are generating at full rate of hz + stathz to fullfill scheduler and timekeeping requirements. But when CPU is idle, only minimum set of interrupts (down to 8 interrupts per second per CPU now), needed to handle scheduled callouts is executed. This allows significantly increase idle CPU sleep time, increasing effect of static power-saving technologies. Also it should reduce host CPU load on virtualized systems, when guest system is idle. There is set of tunables, also available as writable sysctls, allowing to control wanted event timer subsystem behavior: kern.eventtimer.timer - allows to choose event timer hardware to use. On x86 there is up to 4 different kinds of timers. Depending on whether chosen timer is per-CPU, behavior of other options slightly differs. kern.eventtimer.periodic - allows to choose periodic and one-shot operation mode. In periodic mode, current timer hardware taken as the only source of time for time events. This mode is quite alike to previous kernel behavior. One-shot mode instead uses currently selected time counter hardware to schedule all needed events one by one and program timer to generate interrupt exactly in specified time. Default value depends of chosen timer capabilities, but one-shot mode is preferred, until other is forced by user or hardware. kern.eventtimer.singlemul - in periodic mode specifies how much times higher timer frequency should be, to not strictly alias hardclock() and statclock() events. Default values are 2 and 4, but could be reduced to 1 if extra interrupts are unwanted. kern.eventtimer.idletick - makes each CPU to receive every timer interrupt independently of whether they busy or not. By default this options is disabled. If chosen timer is per-CPU and runs in periodic mode, this option has no effect - all interrupts are generating. As soon as this patch modifies cpu_idle() on some platforms, I have also refactored one on x86. Now it makes use of MONITOR/MWAIT instrunctions (if supported) under high sleep/wakeup rate, as fast alternative to other methods. It allows SMP scheduler to wake up sleeping CPUs much faster without using IPI, significantly increasing performance on some highly task-switching loads. Tested by: many (on i386, amd64, sparc64 and powerc) H/W donated by: Gheorghe Ardelean Sponsored by: iXsystems, Inc.
* Do not print "frequency 0 Hz", when frequency is unknown.mav2010-09-111-3/+9
|
* Add missing pointer increment to sbuf_cat.kan2010-09-111-1/+1
|
* Protect mnt_syncer with the sync_mtx. This prevents a (rare) vnode leakkib2010-09-112-15/+33
| | | | | | | | | | | when mount and update are executed in parallel. Encapsulate syncer vnode deallocation into the helper function vfs_deallocate_syncvnode(), to not externalize sync_mtx from vfs_subr.c. Found and reviewed by: jh (previous version of the patch) Tested by: pho MFC after: 3 weeks
* Merge some SCHED_ULE features to SCHED_4BSD:mav2010-09-111-4/+28
| | | | | | | | | | - Teach SCHED_4BSD to inform cpu_idle() about high sleep/wakeup rate to choose optimized handler. In case of x86 it is MONITOR/MWAIT. Also it will be needed to bypass forthcoming idle tick skipping logic to not consume resources on events rescheduling when it won't give any benefits. - Teach SCHED_4BSD to wake up idle CPUs without using IPI. In case of x86, when MONITOR/MWAIT is active, it require just single memory write. This doubles performance on some heavily switching test loads.
* Don't exit kern_jail_set without freeing options when enforce_statfsjamie2010-09-101-5/+8
| | | | | | has an illegal value. MFC after: 3 days
* Replace sbuf_overflowed() with sbuf_error(), which returns any errormdf2010-09-102-29/+26
| | | | | | code associated with overflow or with the drain function. While this function is not expected to be used often, it produces more information in the form of an errno that sbuf_overflowed() did.
* Do not IPI CPU that is already spinning for load. It doubles effect ofmav2010-09-101-4/+11
| | | | spining (comparing to MWAIT) on some heavly switching test loads.
* bus_add_child: change type of order parameter to u_intavg2010-09-102-2/+2
| | | | | | | | | | This reflects actual type used to store and compare child device orders. Change is mostly done via a Coccinelle (soon to be devel/coccinelle) semantic patch. Verified by LINT+modules kernel builds. Followup to: r212213 MFC after: 10 days
* Add a drain function for struct sysctl_req, and use it for a variety ofmdf2010-09-096-90/+51
| | | | | | | | | | handlers, some of which had to do awkward things to get a large enough FIXEDLEN buffer. Note that some sysctl handlers were explicitly outputting a trailing NUL byte. This behaviour was preserved, though it should not be necessary. Reviewed by: phk
* Add drain functionality to sbufs. The drain is a function that ismdf2010-09-091-6/+99
| | | | | | | | | | | | | | | | | called when the sbuf internal buffer is filled. For kernel sbufs with a drain, the internal buffer will never be expanded. For userland sbufs with a drain, the internal buffer may still be expanded by sbuf_[v]printf(3). Sbufs now have three basic uses: 1) static string manipulation. Overflow is marked. 2) dynamic string manipulation. Overflow triggers string growth. 3) drained string manipulation. Overflow triggers draining. In all cases the manipulation is 'safe' in that overflow is detected and managed. Reviewed by: phk (the previous version)
* Refactor sbuf code so that most uses of sbuf_extend() are in a newmdf2010-09-091-25/+69
| | | | | | | sbuf_put_byte(). This makes it easier to add drain functionality when a buffer would overflow as there are fewer code points. Reviewed by: phk
* Fix two bugs in DTrace:rpaulo2010-09-091-9/+15
| | | | | | | * when the process exits, remove the associated USDT probes * when the process forks, duplicate the USDT probes. Sponsored by: The FreeBSD Foundation
* Remove VI_MOUNT flag from vnode on VFS_MOUNT() failure.pjd2010-09-091-0/+3
|
* Doing first mount and updating mount points are both handled by the samepjd2010-09-081-220/+268
| | | | | | | | syscall and the same function, but are very different and share almost no code. To make it easier to read and analyze, split vfs_domount() into vfs_domount_first() and vfs_domount_update(). Reviewed by: kib
* - Log all the problems in devfs_fixup().pjd2010-09-081-2/+14
| | | | | | | | | - Correct error paths. The system will be useless on devfs_fixup() failure, so why bother? Maybe for the same reason why a dead body is washed and dressed in a nice suit before it is put into a coffin? Maybe system's last will is to panic without any locks held? Reviewed by: kib
* subr_bus: use hexadecimal representation for bit flagsavg2010-09-081-8/+8
| | | | | | | | | It seems that this format is more custom in our code, and it is more convenient too. Suggested by: jhb No objection: imp MFC after: 1 week
* Implement correct handling of address parameter andtuexen2010-09-051-4/+2
| | | | | | sendinfo for SCTP send calls. MFC after: 4 weeks.
* Initialize buffer for case of empty string. Happens only on non-refactoredmav2010-09-051-0/+1
| | | | platforms.
* struct device: widen type of flags and order fields to u_intavg2010-09-041-5/+4
| | | | | | | | | | | | | Also change int -> u_int for order parameter in device_add_child_ordered. There should not be any ABI change as struct device is private to subr_bus.c and the API change should be compatible. To do: change int -> u_int for order parameter of bus_add_child method and its implementations. The change should also be API compatible, but is a bit more churn. Suggested by: imp, jhb MFC after: 1 week
* Use a better #if guard.mdf2010-09-031-1/+1
| | | | Suggested by pluknet <pluknet at gmail dot com>.
* Style(9) fixes and eliminate the use of min().mdf2010-09-031-12/+15
|
* Fix user-space libsbuf build. Why isn't CTASSERT available tomdf2010-09-031-0/+2
| | | | user-space?
* Fix brain fart when converting an if statement into a KASSERT.mdf2010-09-031-1/+1
|
* Use math rather than iteration when the desired sbuf size is larger thanmdf2010-09-031-5/+9
| | | | SBUF_MAXEXTENDSIZE.
* Correct bioq_disksort so that bioq_insert_tail() offers barrier semantic.gibbs2010-09-021-10/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the BIO_ORDERED flag for struct bio and update bio clients to use it. The barrier semantics of bioq_insert_tail() were broken in two ways: o In bioq_disksort(), an added bio could be inserted at the head of the queue, even when a barrier was present, if the sort key for the new entry was less than that of the last queued barrier bio. o The last_offset used to generate the sort key for newly queued bios did not stay at the position of the barrier until either the barrier was de-queued, or a new barrier (which updates last_offset) was queued. When a barrier is in effect, we know that the disk will pass through the barrier position just before the "blocked bios" are released, so using the barrier's offset for last_offset is the optimal choice. sys/geom/sched/subr_disk.c: sys/kern/subr_disk.c: o Update last_offset in bioq_insert_tail(). o Only update last_offset in bioq_remove() if the removed bio is at the head of the queue (typically due to a call via bioq_takefirst()) and no barrier is active. o In bioq_disksort(), if we have a barrier (insert_point is non-NULL), set prev to the barrier and cur to it's next element. Now that last_offset is kept at the barrier position, this change isn't strictly necessary, but since we have to take a decision branch anyway, it does avoid one, no-op, loop iteration in the while loop that immediately follows. o In bioq_disksort(), bypass the normal sort for bios with the BIO_ORDERED attribute and instead insert them into the queue with bioq_insert_tail(). bioq_insert_tail() not only gives the desired command order during insertion, but also provides barrier semantics so that commands disksorted in the future cannot pass the just enqueued transaction. sys/sys/bio.h: Add BIO_ORDERED as bit 4 of the bio_flags field in struct bio. sys/cam/ata/ata_da.c: sys/cam/scsi/scsi_da.c Use an ordered command for SCSI/ATA-NCQ commands issued in response to bios with the BIO_ORDERED flag set. sys/cam/scsi/scsi_da.c Use an ordered tag when issuing a synchronize cache command. Wrap some lines to 80 columns. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c sys/geom/geom_io.c Mark bios with the BIO_FLUSH command as BIO_ORDERED. Sponsored by: Spectra Logic Corporation MFC after: 1 month
* Fix UP build.mdf2010-09-021-0/+2
| | | | MFC after: 2 weeks
* Fix a bug with sched_affinity() where it checks td_pinned of anothermdf2010-09-011-11/+13
| | | | | | | | | | | | | | | thread in a racy manner, which can lead to attempting to migrate a thread that is pinned to a CPU. Instead, have sched_switch() determine which CPU a thread should run on if the current one is not allowed. KASSERT in sched_bind() that the thread is not yet pinned to a CPU. KASSERT in sched_switch() that only migratable threads or those moving due to a sched_bind() are changing CPUs. sched_affinity code came from jhb@. MFC after: 2 weeks
* rmlock(9) two additions and one change/fix:mlaier2010-09-011-37/+90
| | | | | | | | | | | | - add rm_try_rlock(). - add RM_SLEEPABLE to use sx(9) as the back-end lock in order to sleep while holding the write lock. - change rm_noreadtoken to a cpu bitmask to indicate which CPUs need to go through the lock/unlock in order to synchronize. As a side effect, this also avoids IPI to CPUs without any readers during rm_wlock. Discussed with: ups@, rwatson@ on arch@ Sponsored by: Isilon Systems, Inc.
* As long as we are going to panic anyway, there's no need to hide additionalemaste2010-09-011-2/+0
| | | | information behind DIAGNOSTIC.
* rescure comments from RELENG_4.davidxu2010-09-011-0/+12
|
OpenPOWER on IntegriCloud