dragonfly.git
13 years agolib: Move the definition of WARNS into lib/Makefile.inc.
Sascha Wildner [Sun, 6 Feb 2011 21:09:01 +0000 (22:09 +0100)]
lib: Move the definition of WARNS into lib/Makefile.inc.

13 years agolibncp: Fix format.
Sascha Wildner [Sun, 6 Feb 2011 21:06:59 +0000 (22:06 +0100)]
libncp: Fix format.

13 years agolibc/csu: Include <machine/tls.h> for some prototypes.
Sascha Wildner [Sun, 6 Feb 2011 21:05:59 +0000 (22:05 +0100)]
libc/csu: Include <machine/tls.h> for some prototypes.

13 years agoioapic/icu: Add irqmap
Sepherosa Ziehau [Sun, 6 Feb 2011 14:06:21 +0000 (22:06 +0800)]
ioapic/icu: Add irqmap

13 years agointr: Enable ELCR by default
Sepherosa Ziehau [Sun, 6 Feb 2011 11:19:24 +0000 (19:19 +0800)]
intr: Enable ELCR by default

13 years agolibc: Raise WARNS to 6.
Sascha Wildner [Sat, 5 Feb 2011 20:44:26 +0000 (21:44 +0100)]
libc: Raise WARNS to 6.

13 years agokernel - adjust devfs mount point according to init_chroot loader variable
YONETANI Tomokazu [Wed, 2 Feb 2011 09:45:16 +0000 (18:45 +0900)]
kernel - adjust devfs mount point according to init_chroot loader variable

/dev is mounted before /sbin/init is executed, so when it chroot() itself
and execute the shell, the chroot()'ed space doesn't contain the mounted
devfs inside it and the shell gets stuck.

13 years ago<cpu/ieeefp.h>: Use single-underscore instead of double.
Peter Avalos [Sat, 5 Feb 2011 06:52:56 +0000 (20:52 -1000)]
<cpu/ieeefp.h>:  Use single-underscore instead of double.

This prevents conflicts for when someone decides to #include <fenv.h>
and <cpu/ieeefp.h>.

13 years ago<cpu/ieeefp.h>: Sync i386 with x86_64.
Peter Avalos [Sat, 5 Feb 2011 04:24:43 +0000 (18:24 -1000)]
<cpu/ieeefp.h>: Sync i386 with x86_64.

The i386 fpget*() and fpset*() functions were obfuscated, and this
change reduces complexity and makes all the fp*() functions inline.

Update comments.

Obtained-from: FreeBSD

13 years agokern - aio - Add missing flags to objcache_get()
Samuel J. Greear [Sat, 5 Feb 2011 08:25:39 +0000 (08:25 +0000)]
kern - aio - Add missing flags to objcache_get()

13 years agokern - Convert NFS from zalloc to objcache
Samuel J. Greear [Sat, 5 Feb 2011 04:17:41 +0000 (04:17 +0000)]
kern - Convert NFS from zalloc to objcache

Sponsored-By: Google Code-In
13 years agokern - Convert crypto from zalloc to objcache
Samuel J. Greear [Sat, 5 Feb 2011 04:17:15 +0000 (04:17 +0000)]
kern - Convert crypto from zalloc to objcache

Sponsored-By: Google Code-In
13 years agokern - Convert aio from zalloc to objcache
Samuel J. Greear [Sat, 5 Feb 2011 04:16:45 +0000 (04:16 +0000)]
kern - Convert aio from zalloc to objcache

Sponsored-By: Google Code-In
13 years agokern - Convert ufs dirhash from zalloc to objcache
Samuel J. Greear [Sat, 5 Feb 2011 04:15:11 +0000 (04:15 +0000)]
kern - Convert ufs dirhash from zalloc to objcache

Sponsored-By: Google Code-In
13 years agoHAMMER VFS - Fix deadlock which can occur under severe filesystem pressure
Matthew Dillon [Fri, 4 Feb 2011 19:55:02 +0000 (11:55 -0800)]
HAMMER VFS - Fix deadlock which can occur under severe filesystem pressure

* Inode reflushes (a fsync occuring while the inode is still queued for
  a prior fsync) were not ensuring that the inode got pushed to the backend
  flusher.

  This could lead to deadlocks when the process trying to issue the flush
  is the syncer itself.

* The problem typically occured under filesystem loads where a large number
  of inodes (aka due to a bulk build) are being flushed at once, and the
  flush is unable to finish running before the next syncer cycle comes
  around.

13 years agokernel - Add missing vm_page_wakeup()
Matthew Dillon [Fri, 4 Feb 2011 19:51:26 +0000 (11:51 -0800)]
kernel - Add missing vm_page_wakeup()

* Fix a long-standing issue where a VM page is improperly left PG_BUSY
  when vm_page_try_to_cache() races the Modified bit in underlying PTEs.

* This could only occur during periods of severe memory pressure and
  would typically lead to a program getting stuck in "pgtblk".

Reported-by: Peter Avalos <peter@theshell.com>
13 years agops - Adjust field widths
Matthew Dillon [Fri, 4 Feb 2011 18:38:39 +0000 (10:38 -0800)]
ps - Adjust field widths

* Reduce VSZ, RSS, RSZ by one (its still wider than the original but now
  only 6 digits).  We will have to come up with another way to represent
  process sizes >= 1GB.

* Reduce the tty column to 2 chars

13 years agops - Support unix98 ttys for -t
Matthew Dillon [Fri, 4 Feb 2011 18:37:30 +0000 (10:37 -0800)]
ps - Support unix98 ttys for -t

* Support numeric ttys, e.g. ps xt5 specifies tty /dev/pts/5

13 years agovkernel64 - Raise the memory requirements to 64MB.
Antonio Huete Jimenez [Fri, 4 Feb 2011 17:37:28 +0000 (18:37 +0100)]
vkernel64 - Raise the memory requirements to 64MB.

13 years agovkernel - Avoid appending the error message in some cases.
Antonio Huete Jimenez [Fri, 4 Feb 2011 17:16:09 +0000 (18:16 +0100)]
vkernel - Avoid appending the error message in some cases.

13 years agokern - Clarify the description of hw.physmem.
Antonio Huete Jimenez [Fri, 4 Feb 2011 16:08:07 +0000 (17:08 +0100)]
kern - Clarify the description of hw.physmem.

13 years agovm - Correct sysctl output formatting for kvm_size and kvm_free
Antonio Huete [Fri, 4 Feb 2011 11:29:05 +0000 (12:29 +0100)]
vm - Correct sysctl output formatting for kvm_size and kvm_free

13 years agokern - Properly return the number of bytes in hw.physmem sysctl.
Antonio Huete [Fri, 4 Feb 2011 13:34:05 +0000 (14:34 +0100)]
kern - Properly return the number of bytes in hw.physmem sysctl.

- Changed physmem from int to long, now it can hold a
  really high number of pages.
- Return an unsigned long value with appropiate formatting
  for hw.physmem.
- Add description for it.

Based-upon: FreeBSD

13 years agokernel - Add options VM_PAGE_DEBUG
Matthew Dillon [Fri, 4 Feb 2011 07:25:41 +0000 (23:25 -0800)]
kernel - Add options VM_PAGE_DEBUG

* Add options VM_PAGE_DEBUG for kernel configs.  This requires a full kernel
  rebuild (if you use the option) and supplies additional information in
  the vm_page structure to help track down problems.

13 years agoieeefp.h: Remove i386 specifics.
Peter Avalos [Tue, 1 Feb 2011 07:59:03 +0000 (21:59 -1000)]
ieeefp.h: Remove i386 specifics.

Move the contents of <machine/floatingpoint.h> to <machine/ieeefp.h> for
i386 to match x86_64.

While I'm here, mark which versions of these files we have for x86_64.

Obtained-from: FreeBSD

13 years agostyle(9): Remove whitespace.
Peter Avalos [Tue, 1 Feb 2011 07:17:02 +0000 (21:17 -1000)]
style(9): Remove whitespace.

13 years agofenv: Explicitly specify sizes for control and status words.
Peter Avalos [Tue, 1 Feb 2011 07:06:52 +0000 (21:06 -1000)]
fenv: Explicitly specify sizes for control and status words.

Obtained-from: FreeBSD

13 years agolibc - fix handling of temporary file used by hash(3)
YONETANI Tomokazu [Thu, 3 Feb 2011 05:29:48 +0000 (14:29 +0900)]
libc - fix handling of temporary file used by hash(3)

This fixes applications using DB_HASH, such as tsort, to unexpectedly
try to open a temporary file in the current directory and fail if it
has no write permission there.

Obtained from FreeBSD, r190485, by delphij:

  db/btree/bt_open.c: check return value of snprintf() and return value
  if the result is truncated.

  db/hash/hash_page.c: use the same way to create temporary file as
  bt_open.c; check snprintf() return value.

  Obtained from:  OpenBSD

13 years agoBuild our GCCs with CSTD=gnu89.
Sascha Wildner [Thu, 3 Feb 2011 23:20:47 +0000 (00:20 +0100)]
Build our GCCs with CSTD=gnu89.

This fixes building of the GCCs using gcc44.

Reported-by: Max Herrgard <herrgard@gmail.com> and others
Submitted-by: Max Herrgard <herrgard@gmail.com>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1978>

13 years agokernel - Fix physmap base calculation for x86-64
Matthew Dillon [Thu, 3 Feb 2011 18:52:34 +0000 (10:52 -0800)]
kernel - Fix physmap base calculation for x86-64

Reported-by: luxh, tuxillo
13 years agokernel - migrate knote from zone to kmalloc
Nicolas Thery [Fri, 28 Jan 2011 00:55:12 +0000 (01:55 +0100)]
kernel - migrate knote from zone to kmalloc

13 years agoacpi(4): Always compile the files dealing with ACPI_DEBUG into the module.
Sascha Wildner [Wed, 2 Feb 2011 18:04:16 +0000 (19:04 +0100)]
acpi(4): Always compile the files dealing with ACPI_DEBUG into the module.

Before this commit, one had to define ACPI_DEBUG as a make variable to
enable debugging support in the module, such as in:

$ make -DACPI_DEBUG buildkernel

Specifying ACPI_DEBUG in the kernel config alone did not enable it, but
our modules are supposed to honor kernel options. Also this was contrary
to what the manual page says.

So to make this work for ACPI_DEBUG too, we just put all the affected
source files into SRCS and always compile them. #ifdef's in these
source files will take care of enabling/disabling debugging support
so a module compiled without ACPI_DEBUG defined in the kernel or on the
command line will still not have support after this commit (I've checked
with nm(1)).

The only change for someone not using ACPI_DEBUG is a little bit of
additional buildkernel time.

FWIW, it is the same way in FreeBSD, too.

Reported-by: Andrea Magliano <masterblaster@tiscali.it>
13 years agointr: Further delay MachIntrABI.finalize()
Sepherosa Ziehau [Wed, 2 Feb 2011 15:55:43 +0000 (23:55 +0800)]
intr: Further delay MachIntrABI.finalize()

It only affects SMP case.  For ICU, it will be better if finalize()
is called after IMCR detection is done, though on most modern systems
IMCR does not exist.  For I/O APIC, finalize() _should_ be called
after BSP's LAPIC is initialized, since it alters BSP LAPIC's LINT0
and LINT1 configuration.

Add stabilize() ABI to MachIntrABI which is only implemented by ICU
currently and this ABI is called in the place where finalize() used
to be called.

13 years agoioapic: File renaming (apic -> ioapic)
Sepherosa Ziehau [Wed, 2 Feb 2011 13:44:25 +0000 (21:44 +0800)]
ioapic: File renaming (apic -> ioapic)

13 years agoicu: Add icu/icu_abi.h
Sepherosa Ziehau [Wed, 2 Feb 2011 13:20:48 +0000 (21:20 +0800)]
icu: Add icu/icu_abi.h

Mainly to avoid manually declaring MachIntrABI_ICU

13 years agoioapic: Function/variable renaming (apic -> ioapic)
Sepherosa Ziehau [Wed, 2 Feb 2011 12:46:18 +0000 (20:46 +0800)]
ioapic: Function/variable renaming (apic -> ioapic)

13 years agoapic_initialize: Adjust comment
Sepherosa Ziehau [Wed, 2 Feb 2011 09:41:17 +0000 (17:41 +0800)]
apic_initialize: Adjust comment

13 years agopowerd - Do a more sophisticated domain scan, use kern.usched_global_cpumask
Matthew Dillon [Wed, 2 Feb 2011 07:59:22 +0000 (23:59 -0800)]
powerd - Do a more sophisticated domain scan, use kern.usched_global_cpumask

* Do a more sophisticated domain scan, cpu domains do not necessarily start
  at 0.

* Handle the case where multiple cpus may belong to a single domain.

* Dynamically adjust kern.usched_global_cpumask to the number of cpus we
  are running at max frequency, leaving the remaining cpus set at their
  lowest frequency and left mostly idle.

* Tested on the 48-core monster and phenom x 6.

13 years agokernel - Add kern.usched_global_cpumask
Matthew Dillon [Wed, 2 Feb 2011 07:44:07 +0000 (23:44 -0800)]
kernel - Add kern.usched_global_cpumask

* Add sysctl kern.usched_global_cpumask, a global cpumask that restricts
  which cpus userland processes are allowed to run on.  This sysctl may be
  set dynamically.

* NOTE: This sysctl is intended to be used by powerd.  Setting it manually
  will only work properly if powerd is not running.

13 years agopf: Fix typo in pf_mask_del()
Sepherosa Ziehau [Wed, 2 Feb 2011 04:26:20 +0000 (12:26 +0800)]
pf: Fix typo in pf_mask_del()

Reported-by: Jan Lentfer <Jan.Lentfer@web.de>
Noticed-by: Joe Talbott <josepht@cstone.net>
13 years agokernrl: Fix LINT building for recent rn_inithead API change
Sepherosa Ziehau [Wed, 2 Feb 2011 04:14:12 +0000 (12:14 +0800)]
kernrl: Fix LINT building for recent rn_inithead API change

Reported-by: Thomas Nikolajsen <thomas.nikolajsen@mail.dk>
13 years agops - Increase selected field widths
Matthew Dillon [Tue, 1 Feb 2011 23:57:36 +0000 (15:57 -0800)]
ps - Increase selected field widths

* Increase field widths for STAT, XSTAT, VSZ, RSS, and RSZ to accomodate
  more typical program run sizes and to accomodate systems with more than
  10 cpus.

13 years agokernel64 - Greatly reduce memory probe times, remove basemem calculation
Matthew Dillon [Tue, 1 Feb 2011 22:23:29 +0000 (14:23 -0800)]
kernel64 - Greatly reduce memory probe times, remove basemem calculation

* Greatly reduce memory probe times by testing in multiples of 128K instead
  of multiples of 4K.  Also add cpu_mfence() instructions to flush the
  cpu store buffer.

  This greatly reduces the startup time for x86-64 on monster machines
  with lots of memory (tested w/64G).

* Remove the basemem calculation, it is no longer used.

13 years agopc32: Split out isa_intr.h and move isa/intr_machdep.h to include/
Sepherosa Ziehau [Tue, 1 Feb 2011 14:32:52 +0000 (22:32 +0800)]
pc32: Split out isa_intr.h and move isa/intr_machdep.h to include/

13 years agopc64: Split out isa_intr.h and move isa/intr_machdep.h to include/
Sepherosa Ziehau [Tue, 1 Feb 2011 13:49:34 +0000 (21:49 +0800)]
pc64: Split out isa_intr.h and move isa/intr_machdep.h to include/

13 years agointr: Add ELCR support
Sepherosa Ziehau [Tue, 1 Feb 2011 12:58:26 +0000 (20:58 +0800)]
intr: Add ELCR support

This device controls/shows ICU pin's trigger mode (level/edge).

Currently, it is not enabled by default.

Obtained-from: FreeBSD (jhb@freebsd.org)

13 years agoradix: Fix the non-per-cpu radix tree usage.
Sepherosa Ziehau [Tue, 1 Feb 2011 08:09:26 +0000 (16:09 +0800)]
radix: Fix the non-per-cpu radix tree usage.

- Install a mask radix tree in each radix tree, while, mask radix tree does
  not have mask radix tree (of course).
- rn_cpumaskhead() is added to provide the global per-cpu mask radix tree.
- rn_inithead() requires a mask radix tree as paramter.  Mask radix tree is
  initialized by passing NULL.  INET/INET6/ATALK pass the mask radix tree
  obtained from rn_cpumaskhead(), i.e. the old sementics.
- pf(4) now creates its own mask radix tree, and all of its internal radix
  trees will use that mask radix tree instead of the global per-cpu mask
  radix tree.  pf(4) radix tree operations are protected by its own token.
- rn_addmask() requires a mask radix tree, instead of using the global
  per-cpu mask radix tree.  For most cases, the caller has access to the
  radix tree that has a mask radix tree installed.  For _rtmask_lookup(),
  which is always called from route_output(), we could safely assume that
  global per-cpu mask radix tree is used.

This is mainly used to fix the following bug concerning global per-cpu
mask radix tree:
Before this commit, pf(4) could create mask on CPU0's mask radix tree,
while the deletion of the mask happens on other CPUs, which results pf(4)'s
radix tree operation to fail (can't locate the mask).

Dragonfly-bug: http://bugs.dragonflybsd.org/issue1969
Root-cause-found-by: Jan Lentfer <Jan.Lentfer@web.de>
13 years agokernel64 - Fix disabled interrupts during dbg/bpt trap
Matthew Dillon [Mon, 31 Jan 2011 21:40:55 +0000 (13:40 -0800)]
kernel64 - Fix disabled interrupts during dbg/bpt trap

* Interrupts were left improperly disabled during a dbg or bpt trap.
  i386 enables interrupts for these traps.  x86-64 needs to as well
  or it will hit an assertion in lwkt_switch() under certain circumstances.

* Make debug code in lwkt_switch() also require INVARIANTS to function.

  NOTE: This is temporary debug code and should be removed at some point
  after 48-core testing is complete.

13 years agokernel - Fix SMP assumption of at least 2 cpus w/TCP
Matthew Dillon [Mon, 31 Jan 2011 21:09:39 +0000 (13:09 -0800)]
kernel - Fix SMP assumption of at least 2 cpus w/TCP

* TCP was assuming at least 2 cpus on SMP builds and would panic if only
  1 cpu was available.

* Fix by testing ncpus even for SMP builds.

* This problem did not effect UP builds.

13 years agokernel - Fix stall after mountroot w/ SMP & ncpus == 1
Matthew Dillon [Mon, 31 Jan 2011 21:08:26 +0000 (13:08 -0800)]
kernel - Fix stall after mountroot w/ SMP & ncpus == 1

* Fix a degenerate case for SMP builds when ncpus == 1.  This effects
  both the vkernel and the normal kernel (when a SMP kernel is booted
  on a non-SMP box which has a LAPIC).

  The init process was not bring scheduled properly.

13 years agovkernel - Fix lwbuf build error for vkernel64
Matthew Dillon [Mon, 31 Jan 2011 07:56:13 +0000 (23:56 -0800)]
vkernel - Fix lwbuf build error for vkernel64

* Fix a compile error that was preventing vkernel64's from building.

13 years agoTurn off all warnings when compiling gdtoa sources.
Peter Avalos [Mon, 31 Jan 2011 07:37:38 +0000 (21:37 -1000)]
Turn off all warnings when compiling gdtoa sources.

Obtained-from: FreeBSD

13 years agoMerge branch 'vendor/GDTOA'
Peter Avalos [Mon, 31 Jan 2011 06:28:20 +0000 (20:28 -1000)]
Merge branch 'vendor/GDTOA'

13 years agoRemove unneeded files from contrib/gdtoa.
Peter Avalos [Mon, 31 Jan 2011 06:24:13 +0000 (20:24 -1000)]
Remove unneeded files from contrib/gdtoa.

Add a README.DELETED while I'm here.

13 years agokernel options: Add MCLSHIFT
Sepherosa Ziehau [Mon, 31 Jan 2011 05:55:00 +0000 (13:55 +0800)]
kernel options: Add MCLSHIFT

So on the system w/o wireless NICs, we could configure MCLBYTES to 2K
(options MCLSHIFT=11) instead of the default 4K

13 years agonetisr barrier: Prevent netisr_barrier_dispatch() from false wakeup
Sepherosa Ziehau [Mon, 31 Jan 2011 05:43:24 +0000 (13:43 +0800)]
netisr barrier: Prevent netisr_barrier_dispatch() from false wakeup

- Change wait states into wait flags, only test NOTDONE flag when
  being woken up.
- Simplify wakeup logic.

With-help-from: dillon@

13 years agoImport gdtoa-20101105.
Peter Avalos [Mon, 31 Jan 2011 05:00:55 +0000 (19:00 -1000)]
Import gdtoa-20101105.

13 years agonetisr barrier: Avoid lockless wakeup/tsleep race
Sepherosa Ziehau [Mon, 31 Jan 2011 03:09:35 +0000 (11:09 +0800)]
netisr barrier: Avoid lockless wakeup/tsleep race

Add a waiting state (NETISR_BR_WAITDONE), before it is set wakeup()
will not be called.  And use atomic_cmpset_int() to do the state
transition.

With-help-from: dillon@

13 years agonetisr: Make sure that netisr barrier's done is globally visible
Sepherosa Ziehau [Fri, 28 Jan 2011 06:43:05 +0000 (14:43 +0800)]
netisr: Make sure that netisr barrier's done is globally visible

13 years agonetisr: Make netisr barrier's done and cpumask volatile
Sepherosa Ziehau [Tue, 25 Jan 2011 05:35:11 +0000 (13:35 +0800)]
netisr: Make netisr barrier's done and cpumask volatile

So that the assignment to these two variables and the following wakeup()
will not get reordered.

13 years agotcp6: Set TF_SYNCACHE properly in tcp6_usr_listen()
Sepherosa Ziehau [Mon, 24 Jan 2011 08:48:04 +0000 (16:48 +0800)]
tcp6: Set TF_SYNCACHE properly in tcp6_usr_listen()

13 years agotcp: Make listen(2) socket close(2) MPSAFE
Sepherosa Ziehau [Mon, 24 Jan 2011 07:52:45 +0000 (15:52 +0800)]
tcp: Make listen(2) socket close(2) MPSAFE

- Cleanup the syncache entries on each CPU for this inp.
- Before whacking the inp, we unhook the inp wildcard hash and cleanup
  its syncache entries by using a synchronized message.
- Fix up comment.

Reported-by: pavalos@
DragonFly-bug: http://bugs.dragonflybsd.org/issue1960

13 years agotcp_usr_listen: Use domsg when duplicate listen socket's inp wildcard hash
Sepherosa Ziehau [Mon, 24 Jan 2011 07:39:54 +0000 (15:39 +0800)]
tcp_usr_listen: Use domsg when duplicate listen socket's inp wildcard hash

This makes sure that the each protocol threads sees the socket when
tcp_usr_listen() returns.

13 years agotcp: Don't abuse TF_SYNCACHE to ill-optimize syncache_destroy()
Sepherosa Ziehau [Fri, 21 Jan 2011 08:14:03 +0000 (16:14 +0800)]
tcp: Don't abuse TF_SYNCACHE to ill-optimize syncache_destroy()

- We now turn on TF_SYNCACHE when listen(2) is called.
- When a listen(2) socket is to be close(2), the syncache list on the
  current CPU is thoroughly iterated and all related syncache are marked
  to be dropped instead of the first syncache.

13 years agoudp6: Protect udbinfo by udbinfo barrier
Sepherosa Ziehau [Fri, 21 Jan 2011 05:55:36 +0000 (13:55 +0800)]
udp6: Protect udbinfo by udbinfo barrier

13 years agoinpcb: Save UDP inpcb into temporary memory during in_pcblist
Sepherosa Ziehau [Fri, 21 Jan 2011 05:30:19 +0000 (13:30 +0800)]
inpcb: Save UDP inpcb into temporary memory during in_pcblist

The temorary memory is used later to do the SYSCTL_OUT without
the udbinfo serializer being held.  Mainly to avoid deadlock
triggered by holding serializer and copyout.

Reminded-by: dillon@
13 years agoudp_getcred: Release serializer when doing SYSCTL_OUT
Sepherosa Ziehau [Fri, 21 Jan 2011 02:44:35 +0000 (10:44 +0800)]
udp_getcred: Release serializer when doing SYSCTL_OUT

Mainly to avoid deadlock during copyout

Reminded-by: dillon@
13 years agoudp: pcb list/hashtable protection stage 2/2
Sepherosa Ziehau [Thu, 23 Dec 2010 08:03:08 +0000 (16:03 +0800)]
udp: pcb list/hashtable protection stage 2/2

- Use serializer to protect pcb list/hashtable iteration not running
  in netisrs.
- Don't use marker pcb, so except for the functions running in netisr0,
  no other functions will alter pcb list.

13 years agoinpcb: Add pcblist sysctl helper function w/o using marker inpcb
Sepherosa Ziehau [Thu, 23 Dec 2010 08:01:41 +0000 (16:01 +0800)]
inpcb: Add pcblist sysctl helper function w/o using marker inpcb

13 years agoudp: pcb list/hashtable protection stage 1/2
Sepherosa Ziehau [Thu, 23 Dec 2010 05:27:51 +0000 (13:27 +0800)]
udp: pcb list/hashtable protection stage 1/2

Use netisr barrier make sure that netisr will not iterating pcb list or
hashtable when adding or removing pcb

Add assertion that all UDP pru functions run in netisr0.

13 years agonetisr: Add netisr barrier which stalls all netisrs
Sepherosa Ziehau [Thu, 23 Dec 2010 05:12:39 +0000 (13:12 +0800)]
netisr: Add netisr barrier which stalls all netisrs

netisr_barrier_set()
  Set a netisr barrier, which stalls all netisr.  Currently it must be
  called from netisr0.

netisr_barrier_rem()
  Remove the netisr barrier, which unstalls all netisr.  Currently it
  must be called from netisr0.

These interfaces could be used to work out a lockless pcb lookup or
iteration (on network hotpath e.g. input/output) at the cost of
relatively expensive pcb adding and removing (e.g. connect(2)).

13 years agokernel - Revert last commit for a better upcoming fix
Matthew Dillon [Mon, 31 Jan 2011 01:39:24 +0000 (17:39 -0800)]
kernel - Revert last commit for a better upcoming fix

* Revert this fix, a better one is going to be committed soon.

13 years agokernel - Fix syncache vs close(listen_socket) race
Matthew Dillon [Mon, 31 Jan 2011 00:19:40 +0000 (16:19 -0800)]
kernel - Fix syncache vs close(listen_socket) race

* Attempt to fix a race where a listen socket is closed with an active
  syncache.  The tcpcb is detached prior to the syncache being destroyed
  resulting in a race where a new incoming connection can complete and
  attempt to dive the listen socket's tcpcb.

* Detach the tcpcb after the syncache is destroyed rather than before.

13 years agolibc: Remove some unneeded inclusions of <sys/cdefs.h>.
Sascha Wildner [Sun, 30 Jan 2011 21:51:42 +0000 (22:51 +0100)]
libc: Remove some unneeded inclusions of <sys/cdefs.h>.

13 years agoFix up <utmp.h> and <utmpx.h> for C++ programs.
Sascha Wildner [Sun, 30 Jan 2011 21:51:27 +0000 (22:51 +0100)]
Fix up <utmp.h> and <utmpx.h> for C++ programs.

__BEGIN_DECLS and __END_DECLS are absolutely needed around prototypes
so the functions can be called from C++ code (see the definition of
__BEGIN_DECLS in <sys/ctype.h>).

While here, put non-standard stuff in __BSD_VISIBLE instead of just
noting it in a comment.

This fixes at least x11/rxvt-unicode.

Tested-by: tuxillo
13 years agolibc - Fix bogus pthread_getspecific() return value due to bug in nmalloc
Matthew Dillon [Sun, 30 Jan 2011 21:44:11 +0000 (13:44 -0800)]
libc - Fix bogus pthread_getspecific() return value due to bug in nmalloc

* nmalloc was calling pthread_set_specific() prior to calling
  pthread_key_create(), causing it to use key 0 which might already
  have been allocated for other purposes.

* Reorder initializations in _nmalloc_thr_init() to solve the problem.

* This also solves certain application crashes (mail/milter-greylist).

Reported-by: Francois Tigeot <ftigeot@wolfpond.org>
13 years agoicu: Split out icu/icu.c
Sepherosa Ziehau [Sun, 30 Jan 2011 09:44:26 +0000 (17:44 +0800)]
icu: Split out icu/icu.c

13 years agoicu: Put ICU_IMR_OFFSET into machine_base/icu/icu.h
Sepherosa Ziehau [Sun, 30 Jan 2011 08:31:29 +0000 (16:31 +0800)]
icu: Put ICU_IMR_OFFSET into machine_base/icu/icu.h

13 years agoioapic/icu: Rework PIC selection code
Sepherosa Ziehau [Sun, 30 Jan 2011 06:33:52 +0000 (14:33 +0800)]
ioapic/icu: Rework PIC selection code

- In the early stage, before I/O APIC is detected and setup, ICU controls
  interrupts, so all IDT entries should be set to ICU's intr code.
- Switch to I/O APIC only after ICU is completely disconnected, i.e. after
  IMCR is set and LINT0 is masked.

13 years agokernel - Have the crypto subsystem use the new mpipe_alloc_callback() API
Matthew Dillon [Sun, 30 Jan 2011 02:59:32 +0000 (18:59 -0800)]
kernel - Have the crypto subsystem use the new mpipe_alloc_callback() API

* The crypto subsystem can deadlock on blocked mpipe operations while
  holding a CAM lockmgr lock.

* Change the subsystem to use the new mpipe_alloc_callback() mechanism,
  avoiding any deadlocks.

Reported-by: Peter Avalos <peter@theshell.com>
13 years agokernel - Add callback API for mpipe
Matthew Dillon [Sun, 30 Jan 2011 02:57:09 +0000 (18:57 -0800)]
kernel - Add callback API for mpipe

* Add a callback API for mpipe which uses a dedicated kthread,
  allowing clients to avoid deadlocks related to held locks during
  strategy calls.

* Add mpipe_alloc_callback().  Use of this function also requires
  that MPF_CALLBACK be supplied to mpipe_init().

* Add mpipe_wait().  This function may be used for clients which
  which to roll their own mpipe retry loop (or already have their
  own thread(s) to deal with it in a safe manner).

13 years agocpu_sfence: Don't use sfence
Sepherosa Ziehau [Sun, 30 Jan 2011 02:36:11 +0000 (10:36 +0800)]
cpu_sfence: Don't use sfence

As suggested by dillon@, it will create many unnecessary stalls

13 years agokernel - Run emergency interrupt handlers in critical section
Matthew Dillon [Sat, 29 Jan 2011 21:56:00 +0000 (13:56 -0800)]
kernel - Run emergency interrupt handlers in critical section

* Handlers run from the emergency interrupt polling thread
  (kern.emergency_intr_enable=1) are now run inside a critical
  section, just like the normal interrupt thread runs its handlers.

* This may or may not help stability issues reported when emergency
  interrupt polling is enabled.

13 years agokernel - Fix parent process signaling race during exit
Matthew Dillon [Sat, 29 Jan 2011 21:20:43 +0000 (13:20 -0800)]
kernel - Fix parent process signaling race during exit

* Fix a lwpsignal race when an exiting child signals its parent
  while the child is in the process of being reparented to process 1
  (due to the parent itself exiting).

Reported-by: YONETANI Tomokazu <y0n3t4n1@gmail.com>
13 years agokernel - More sound kmalloc adjustments.
Matthew Dillon [Sat, 29 Jan 2011 18:05:31 +0000 (10:05 -0800)]
kernel - More sound kmalloc adjustments.

* All remaining kmalloc()'s switched to M_WAITOK.  None of these should be
  using M_NOWAIT.

13 years agokernel - More sound kmalloc adjustments.
Matthew Dillon [Sat, 29 Jan 2011 17:50:06 +0000 (09:50 -0800)]
kernel - More sound kmalloc adjustments.

* Numerous additional kmalloc()s should not be using M_NOWAIT.

13 years agokernel - Fix /dev/dsp failure after a few days of uptime
Matthew Dillon [Sat, 29 Jan 2011 17:45:02 +0000 (09:45 -0800)]
kernel - Fix /dev/dsp failure after a few days of uptime

* Numerous kmalloc()s should not be using M_NOWAIT.

Submitted-by: Rumko <rumcic@gmail.com>
13 years agoRevert "devfs: Populate si_umajor, too."
Sascha Wildner [Sat, 29 Jan 2011 07:26:26 +0000 (08:26 +0100)]
Revert "devfs: Populate si_umajor, too."

This reverts commit 2c2ab0446f99e9b6f7cae69d99b4491fdf60e6f3.

It was causing the read/write remount of the root filesystem
to fail upon booting. I'll investigate a better fix.

Reported-by: Rumko <rumcic@gmail.com>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1973>

13 years agoUpdate build for file-5.05 import.
Peter Avalos [Sat, 29 Jan 2011 01:22:56 +0000 (15:22 -1000)]
Update build for file-5.05 import.

13 years agoMerge branch 'vendor/FILE'
Peter Avalos [Sat, 29 Jan 2011 00:55:01 +0000 (14:55 -1000)]
Merge branch 'vendor/FILE'

13 years agoImport file-5.05.
Peter Avalos [Sat, 29 Jan 2011 00:31:58 +0000 (14:31 -1000)]
Import file-5.05.

13 years agofstat(1): Raise WARNS to 6 and fix all warnings.
Sascha Wildner [Fri, 28 Jan 2011 10:04:38 +0000 (11:04 +0100)]
fstat(1): Raise WARNS to 6 and fix all warnings.

13 years agofstat(1): Add devfs support.
Sascha Wildner [Fri, 28 Jan 2011 09:36:51 +0000 (10:36 +0100)]
fstat(1): Add devfs support.

13 years agolwkt_synchronize_ipiqs: Add volatile to cpumask
Sepherosa Ziehau [Fri, 28 Jan 2011 09:45:40 +0000 (17:45 +0800)]
lwkt_synchronize_ipiqs: Add volatile to cpumask

Mainly to make sure compiler will not over-optimize it.

13 years agoi386: Add CPU_HAS_SSE2 and CPU_HAS_FXSR options
Sepherosa Ziehau [Fri, 28 Jan 2011 09:07:51 +0000 (17:07 +0800)]
i386: Add CPU_HAS_SSE2 and CPU_HAS_FXSR options

Currently:
CPU_HAS_SSE2 enables the use of lfence and mfence
CPU_HAS_FXSR enables the use of sfence

They should be better than the locked instruction.

13 years agodevfs: Populate si_umajor, too.
Sascha Wildner [Fri, 28 Jan 2011 08:55:18 +0000 (09:55 +0100)]
devfs: Populate si_umajor, too.

Pointed-out-by: alexh
13 years agokernel cleanup: Remove unnecessary inclusion of machine/isa/intr_machdep.h
Sepherosa Ziehau [Fri, 28 Jan 2011 03:37:09 +0000 (11:37 +0800)]
kernel cleanup: Remove unnecessary inclusion of machine/isa/intr_machdep.h

13 years agoicu_init: Cleanup
Sepherosa Ziehau [Fri, 28 Jan 2011 03:08:54 +0000 (11:08 +0800)]
icu_init: Cleanup

13 years agointr: Function renaming
Sepherosa Ziehau [Fri, 28 Jan 2011 02:33:48 +0000 (10:33 +0800)]
intr: Function renaming

13 years agoinstaller: Add /usr/pkg/etc to sources.conf.
Sascha Wildner [Thu, 27 Jan 2011 19:26:16 +0000 (20:26 +0100)]
installer: Add /usr/pkg/etc to sources.conf.

Previously, the installer did not copy this directory due to it being
on a separate (read/write) mount point and cpdup not crossing mount
point boundaries.

This should also fix (for newly installed systems) the XML catalog
problems various people were reporting.

A better solution would be to make the installer's installation
function to take this case into account.

Reported-by: Pierre Abbat <phma@phma.optus.ru>