FreeBSD src
Go to file
Attilio Rao 435068aab7 Fix sched_switch_migrate():
- In 8.x and above the run-queue locks are nomore shared even in the
  HTT case, so remove the special case.
- The deadlock explained in the removed comment here is still possible
  even with different locks, with the contribution of tdq_lock_pair().
  An explanation is here:
  (hypotesis: a thread needs to migrate on another CPU, thread1 is doing
  sched_switch_migrate() and thread2 is the one handling the sched_switch()
  request or in other words, thread1 is the thread that needs to migrate
  and thread2 is a thread that is going to be preempted, most likely an
  idle thread. Also, 'old' is referred to the context (in terms of
  run-queue and CPU) thread1 is leaving and 'new' is referred to the
  context thread1 is going into.  Finally, thread3 is doing tdq_idletd()
  or sched_balance() and definitively doing tdq_lock_pair())

  * thread1 blocks its td_lock. Now td_lock is 'blocked'
  * thread1 drops its old runqueue lock
  * thread1 acquires the new runqueue lock
  * thread1 adds itself to the new runqueue and sends an IPI_PREEMPT
    through tdq_notify() to the new CPU
  * thread1 drops the new lock
  * thread3, scanning the runqueues, locks the old lock
  * thread2 received the IPI_PREEMPT and does thread_lock() with td_lock
    pointing to the new runqueue
  * thread3 wants to acquire the new runqueue lock, but it can't because
    it is held by thread2 so it spins
  * thread1 wants to acquire old lock, but as long as it is held by
    thread3 it can't
  * thread2 going further, at some point wants to switchin in thread1,
    but it will wait forever because thread1->td_lock is in blocked state

This deadlock has been manifested mostly on 7.x and reported several time
on mailing lists under the voice 'spinlock held too long'.
Many thanks to des@ for having worked hard on producing suitable textdumps
and Jeff for help on the comment wording.

Reviewed by:	jeff
Reported by:	des, others
Tested by:	des, Giovanni Trematerra
		<giovanni dot trematerra at gmail dot com>
		(STABLE_7 based version)
2009-09-15 16:56:17 +00:00
bin Add NFSv4 support to setfacl(1). 2009-09-07 16:19:32 +00:00
cddl Implement __assert() for Solaris-specific code. Until now Solaris code was 2009-09-08 20:06:35 +00:00
contrib Import a vendor fix for a list overrun. 2009-09-07 09:30:37 +00:00
crypto Merge DTLS fixes from vendor-crypto/openssl/dist: 2009-08-23 16:29:47 +00:00
etc Protect cross-script invocation by checking that the target script exists. 2009-09-14 16:52:38 +00:00
games Fix several instances of spaces before commas, and one of a space 2009-07-16 20:29:36 +00:00
gnu Add support for diffs generated by Perforce. 2009-08-23 12:23:24 +00:00
include ntroduce mfiutil, a basic utility for managing LSI SAS-RAID & Dell PERC5/6 2009-08-13 23:18:45 +00:00
kerberos5 Disconnect closefrom.c as we have it as a system call. 2009-06-16 00:09:06 +00:00
lib Improve the way failure of pthread_key_create() gets detected. 2009-09-14 11:20:45 +00:00
libexec Do the first step in removing lukemftpd from the base system. Disconnect 2009-09-03 16:34:20 +00:00
release ifconfig now needs -ljail 2009-09-12 15:50:08 +00:00
rescue Add the "vnet" and "-vnet" options, to allow moving interfaces between 2009-06-24 18:21:37 +00:00
sbin Modify mount(8) to skip MNT_IGNORE file systems by default, just like df(1) 2009-09-14 21:08:22 +00:00
secure Bump the version of all non-symbol-versioned shared libraries in 2009-07-19 17:25:24 +00:00
share Last character is a space for the international currency symbol. 2009-09-13 22:17:23 +00:00
sys Fix sched_switch_migrate(): 2009-09-15 16:56:17 +00:00
tools Add regression tests for NFSv4 ACL granular permission enforcement. 2009-09-07 19:40:22 +00:00
usr.bin Add C/c/f/p/v switches plus a bunch of minor fixes and cleanups. 2009-09-08 15:55:13 +00:00
usr.sbin Add support for ND6_IFF_IFDISABLED and ND6_IFF_ACCEPT_RTADV to 2009-09-12 22:14:58 +00:00
COPYRIGHT
LOCKS
MAINTAINERS - pkg_install is maintained by portmgr. 2009-07-06 11:46:18 +00:00
Makefile
Makefile.inc1 Fix comment about KERNFAST. 2009-09-10 07:37:36 +00:00
ObsoleteFiles.inc Add entries for moved files during vesa/dpms promotion. 2009-09-10 21:42:00 +00:00
README
UPDATING - Mount ZFS snapshots with MNT_IGNORE flag, so they are not visible in regular 2009-09-14 21:10:40 +00:00

This is the top level of the FreeBSD source directory.  This file
was last revised on:
$FreeBSD$

For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
sources in this tree - please see the specific source directories for
more information).

The Makefile in this directory supports a number of targets for
building components (or all) of the FreeBSD source tree, the most
commonly used one being ``world'', which rebuilds and installs
everything in the FreeBSD system from the source tree except the
kernel, the kernel-modules and the contents of /etc.  The ``world''
target should only be used in cases where the source tree has not
changed from the currently running version.  See:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
for more information, including setting make(1) variables.

The ``buildkernel'' and ``installkernel'' targets build and install
the kernel and the modules (see below).  Please see the top of
the Makefile in this directory for more information on the
standard build targets and compile-time flags.

Building a kernel is a somewhat more involved process, documentation
for which can be found at:
   http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
And in the config(8) man page.
Note: If you want to build and install the kernel with the
``buildkernel'' and ``installkernel'' targets, you might need to build
world before.  More information is available in the handbook.

The sample kernel configuration files reside in the sys/<arch>/conf
sub-directory (assuming that you've installed the kernel sources), the
file named GENERIC being the one used to build your initial installation
kernel.  The file NOTES contains entries and documentation for all possible
devices, not just those commonly used.  It is the successor of the ancient
LINT file, but in contrast to LINT, it is not buildable as a kernel but a
pure reference and documentation file.


Source Roadmap:
---------------
bin		System/user commands.

contrib		Packages contributed by 3rd parties.

crypto		Cryptography stuff (see crypto/README).

etc		Template files for /etc.

games		Amusements.

gnu		Various commands and libraries under the GNU Public License.
		Please see gnu/COPYING* for more information.

include		System include files.

kerberos5	Kerberos5 (Heimdal) package.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

rescue		Build system for statically linked /rescue utilities.

sbin		System commands.

secure		Cryptographic libraries and commands.

share		Shared resources.

sys		Kernel sources.

tools		Utilities for regression testing and miscellaneous tasks.

usr.bin		User commands.

usr.sbin	System administration commands.


For information on synchronizing your source tree with one or more of
the FreeBSD Project's development branches, please see:

  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/synching.html