dragonfly.git
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>
13 years agonrelease: Remove an old mk.conf in /etc.
Sascha Wildner [Wed, 26 Jan 2011 16:23:32 +0000 (17:23 +0100)]
nrelease: Remove an old mk.conf in /etc.

Reported-by: Pierre Abbat <phma@phma.optus.ru>
13 years agostyle(9) - Properly indent function prototype arguments with 4 spaces.
Joe Talbott [Thu, 27 Jan 2011 19:01:33 +0000 (14:01 -0500)]
style(9) - Properly indent function prototype arguments with 4 spaces.

Discussed-With: swildner, Studbolt, sjg

13 years agoMerge branch 'master' of git://git.theshell.com/dragonfly
Joe Talbott [Thu, 27 Jan 2011 17:52:02 +0000 (12:52 -0500)]
Merge branch 'master' of git://git.theshell.com/dragonfly

13 years agoUPROTO_BOOT_KEYBOARD is already defined in usb.h as UIPROTO_BOOT_KEYBOARD
Magliano Andrea [Tue, 25 Jan 2011 22:45:40 +0000 (23:45 +0100)]
UPROTO_BOOT_KEYBOARD is already defined in usb.h as UIPROTO_BOOT_KEYBOARD

13 years agoApple usb keybord doesn't generate an interrupt for Fn key when set to boot protocol...
Magliano Andrea [Tue, 25 Jan 2011 22:40:27 +0000 (23:40 +0100)]
Apple usb keybord doesn't generate an interrupt for Fn key when set to boot protocol, as raw Fn code from this device (0x01) is already assigned to ErrorRollOver (see 'HID Usage Tables' specification) to report keboard status/errors.

This quirk avoids ukbd driver setting Apple usb keyboard in boot protocol
mode.

13 years agoapic: Removed unused apic_eoi()
Sepherosa Ziehau [Thu, 27 Jan 2011 10:42:56 +0000 (18:42 +0800)]
apic: Removed unused apic_eoi()

13 years agointr: Remove wrongly-coded nexus_config_intr()
Sepherosa Ziehau [Thu, 27 Jan 2011 07:10:07 +0000 (15:10 +0800)]
intr: Remove wrongly-coded nexus_config_intr()

13 years agoioapic: Support upto 192 IDT entries
Sepherosa Ziehau [Thu, 27 Jan 2011 03:44:46 +0000 (11:44 +0800)]
ioapic: Support upto 192 IDT entries

13 years agointr: Enable 192 IDT entries in machine independent code
Sepherosa Ziehau [Thu, 27 Jan 2011 03:11:21 +0000 (11:11 +0800)]
intr: Enable 192 IDT entries in machine independent code

13 years agointr: Prepare to support 192 IDT entries; don't allow syscall to be taken.
Sepherosa Ziehau [Thu, 27 Jan 2011 02:59:39 +0000 (10:59 +0800)]
intr: Prepare to support 192 IDT entries; don't allow syscall to be taken.

13 years agopc32: Move ipl.s and ipl_funcs.c from isa/ to i386/
Sepherosa Ziehau [Thu, 27 Jan 2011 02:45:10 +0000 (10:45 +0800)]
pc32: Move ipl.s and ipl_funcs.c from isa/ to i386/

They are actually not ISA specific at all.

13 years agokernel: Remove some no longer used stuff in clock.c.
Sascha Wildner [Wed, 26 Jan 2011 11:50:22 +0000 (12:50 +0100)]
kernel: Remove some no longer used stuff in clock.c.

13 years agoext2fs: Remove some unused variables.
Sascha Wildner [Wed, 26 Jan 2011 10:51:01 +0000 (11:51 +0100)]
ext2fs: Remove some unused variables.

13 years agofifofs: Remove an unused variable.
Sascha Wildner [Wed, 26 Jan 2011 10:40:51 +0000 (11:40 +0100)]
fifofs: Remove an unused variable.

13 years agokernel: Remove an unused variable.
Sascha Wildner [Wed, 26 Jan 2011 10:31:14 +0000 (11:31 +0100)]
kernel: Remove an unused variable.

13 years agokernel -- lockmgr debugging.
Venkatesh Srinivas [Tue, 25 Jan 2011 12:58:54 +0000 (04:58 -0800)]
kernel -- lockmgr debugging.

* Track exclusive lockmgr locks held by a thread in a per-td stack,
  td->td_lockmgr_stack[]. The stack also tracks the depth of the lockmgr
  recursion, if any.

* Move td->td_locks count from SIMPLELOCK_DEBUG to DEBUG_LOCKS; we have not
  used a simplelock to interlock lockmgr lock updates in a very long time.

13 years agonullfs: Remove a no longer used variable.
Sascha Wildner [Tue, 25 Jan 2011 08:24:30 +0000 (09:24 +0100)]
nullfs: Remove a no longer used variable.

13 years agokernel -- tmpfs: Mark tmpfs_write MPSAFE.
Venkatesh Srinivas [Tue, 25 Jan 2011 04:52:54 +0000 (20:52 -0800)]
kernel -- tmpfs: Mark tmpfs_write MPSAFE.

Push down synchronization for tmpfs_write from VN to tmpfs. Note that
tmpfs_write still takes the MPlock.

13 years agoAdd /usr/pkg/bin to a few paths in our building infrastructure.
Sascha Wildner [Tue, 25 Jan 2011 03:51:27 +0000 (04:51 +0100)]
Add /usr/pkg/bin to a few paths in our building infrastructure.

This allows the clang static analyzer to find perl and python when run
in conjunction with one of our build* targets.

13 years agobsd-family-tree: Sync with FreeBSD.
Sascha Wildner [Tue, 25 Jan 2011 02:13:35 +0000 (03:13 +0100)]
bsd-family-tree: Sync with FreeBSD.

13 years agoSync zoneinfo database with tzdata2011a from elsie.nci.nih.gov
Sascha Wildner [Tue, 25 Jan 2011 01:34:41 +0000 (02:34 +0100)]
Sync zoneinfo database with tzdata2011a from elsie.nci.nih.gov

australasia:    8.20 -> 8.22
northamerica:   8.34 -> 8.39
Theory:         8.5  -> 8.6

* australasia: Simplification and gratuitous optimization of
    South Australia rules.

* northamerica: Changes to Hawaiian time history (from an article
    by Schmitt and Cox): abandoned local mean time in 1896 rather
    than 1900; used DST during World War II.

* Theory: Add section on scope of the database.

13 years agoclock: Remove no longer used statclock_disable and related code
Sepherosa Ziehau [Mon, 24 Jan 2011 14:41:29 +0000 (22:41 +0800)]
clock: Remove no longer used statclock_disable and related code

13 years agoClean up the cryptdisks rc script a bit.
Sascha Wildner [Mon, 24 Jan 2011 09:50:55 +0000 (10:50 +0100)]
Clean up the cryptdisks rc script a bit.

* When checking for dm(4), redirect stderr to /dev/null, too.

* Clarify the failure message.

* Remove empty REQUIRE.

* Don't check for /sbin/cryptdisks being executable, just assume it is.

* Uniformly use TAB for indenting.

13 years agoem/emx: Reserve 2 (instead of 1) TX descriptors for TX ring
Sepherosa Ziehau [Mon, 24 Jan 2011 06:51:40 +0000 (14:51 +0800)]
em/emx: Reserve 2 (instead of 1) TX descriptors for TX ring

Same as what Intel's Linux driver is doing.

13 years agokernel - Fix a case where a panic dump can stall
Matthew Dillon [Sun, 23 Jan 2011 21:34:22 +0000 (13:34 -0800)]
kernel - Fix a case where a panic dump can stall

* Change pmap_kenter_temporary() to not use IPI messaging for SMP pmap
  invalidation.  Instead the caller must call smp_invltlb() (which uses
  a dedicate IPI vector).

* This appears to reduce instances where panic dumps can stall in the
  middle and fail to complete.

Reported-by: Numerous people
13 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sun, 23 Jan 2011 21:23:18 +0000 (13:23 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

13 years agokernel: Silence an unused variable warning.
Sascha Wildner [Sun, 23 Jan 2011 18:43:54 +0000 (19:43 +0100)]
kernel: Silence an unused variable warning.

13 years agokernel - stop cpus on panic whether the debugger is entered or not
Matthew Dillon [Sun, 23 Jan 2011 08:19:22 +0000 (00:19 -0800)]
kernel - stop cpus on panic whether the debugger is entered or not

* Stop cpus on panic regardless of the state of debug.debugger_on_panic.

* Cpus were previously only stopped when entering the debugger, causing
  unattended panics not entering the debugger to often cause secondary
  panics on other cpus and lockup entirely.

13 years agoSwitch back to using CSTD=gnu89 for a number of things again.
Sascha Wildner [Sun, 23 Jan 2011 04:07:21 +0000 (05:07 +0100)]
Switch back to using CSTD=gnu89 for a number of things again.

* gcc44's libobjc
* libc_r
* gprof(1)

13 years agopppd(8): Fix some CSTD=gnu99 fallout.
Sascha Wildner [Sun, 23 Jan 2011 04:05:08 +0000 (05:05 +0100)]
pppd(8): Fix some CSTD=gnu99 fallout.

13 years agorcs(1): Raise WARNS to 2 and fix warnings.
Sascha Wildner [Sun, 23 Jan 2011 03:53:39 +0000 (04:53 +0100)]
rcs(1): Raise WARNS to 2 and fix warnings.

While here, set has_sa_sigaction to 1 in conf.h.

13 years agolibthread_xu: Raise WARNS to 5 and fix warnings.
Sascha Wildner [Sun, 23 Jan 2011 03:10:43 +0000 (04:10 +0100)]
libthread_xu: Raise WARNS to 5 and fix warnings.

13 years agosort(1): Raise WARNS to 2 and fix warnings.
Sascha Wildner [Sun, 23 Jan 2011 01:48:51 +0000 (02:48 +0100)]
sort(1): Raise WARNS to 2 and fix warnings.

13 years agoRemove another 8k PAGE_SIZE test in vm_page.h.
Venkatesh Srinivas [Sat, 22 Jan 2011 17:09:54 +0000 (09:09 -0800)]
Remove another 8k PAGE_SIZE test in vm_page.h.

13 years agomanpages: Fix some more typos.
Sascha Wildner [Sat, 22 Jan 2011 07:24:41 +0000 (08:24 +0100)]
manpages: Fix some more typos.

13 years agomanpages: Fix some typos.
Sascha Wildner [Sat, 22 Jan 2011 07:17:36 +0000 (08:17 +0100)]
manpages: Fix some typos.

13 years agolwbuf.9: Remove trailing whitespace.
Sascha Wildner [Fri, 21 Jan 2011 23:46:48 +0000 (00:46 +0100)]
lwbuf.9: Remove trailing whitespace.

13 years agokernel - Conditionalize ipiq debugging
Matthew Dillon [Fri, 21 Jan 2011 23:18:56 +0000 (15:18 -0800)]
kernel - Conditionalize ipiq debugging

* Only print cm=... debug messages if ipiq_debug is enabled.

13 years agokernel - Fix lockup when debug.ktr.resynchronize is enabled
Matthew Dillon [Fri, 21 Jan 2011 18:02:31 +0000 (10:02 -0800)]
kernel - Fix lockup when debug.ktr.resynchronize is enabled

* The TSC resynchronization code can livelock the system due to the
  manual hard loops it runs to try to synchronize the TSC's on all
  cpus.

* Change the code to use the cpusync API.  It will be less accurate but
  it should no longer result in system livelocks.

13 years agokernel -- vm_page: Remove ifdef for 8K page size.
Venkatesh Srinivas [Fri, 21 Jan 2011 11:37:57 +0000 (03:37 -0800)]
kernel -- vm_page: Remove ifdef for 8K page size.

13 years agoRemove sys/mplock2.h from more files.
Venkatesh Srinivas [Thu, 20 Jan 2011 22:44:15 +0000 (14:44 -0800)]
Remove sys/mplock2.h from more files.

13 years agoUpdate token(9) removing MPSAFE flag and adding description to lwkt_token_init.
Venkatesh Srinivas [Thu, 20 Jan 2011 10:28:05 +0000 (02:28 -0800)]
Update token(9) removing MPSAFE flag and adding description to lwkt_token_init.

13 years agoRemove mplock2.h include from files not using the mplock.
Venkatesh Srinivas [Thu, 20 Jan 2011 10:18:00 +0000 (02:18 -0800)]
Remove mplock2.h include from files not using the mplock.

13 years agopf_socket_lookup: Don't domsg, which could easily lockup network system
Sepherosa Ziehau [Thu, 20 Jan 2011 07:44:47 +0000 (15:44 +0800)]
pf_socket_lookup: Don't domsg, which could easily lockup network system

13 years agopf_socket_lookup: lwkt_domsg is to be used, don't kmalloc the msg.
Sepherosa Ziehau [Thu, 20 Jan 2011 07:30:28 +0000 (15:30 +0800)]
pf_socket_lookup: lwkt_domsg is to be used, don't kmalloc the msg.

13 years agotest - Make fsstress compile under x86-64
Matthew Dillon [Thu, 20 Jan 2011 06:41:08 +0000 (22:41 -0800)]
test - Make fsstress compile under x86-64

* Fix compile errors and warnings when compiling fsstress on x86-64

13 years agokernel - Remove mplock shims from global tokens
Matthew Dillon [Thu, 20 Jan 2011 06:40:03 +0000 (22:40 -0800)]
kernel - Remove mplock shims from global tokens

* cleanup (remove remaining sysctls).

13 years agokernel - Remove mplock shims from global tokens
Matthew Dillon [Thu, 20 Jan 2011 06:29:17 +0000 (22:29 -0800)]
kernel - Remove mplock shims from global tokens

* Remove the mplock safety shims from all global tokens.

* Remove the mplock flag and API arguments.  All tokens
  are now always MPSAFE.

13 years agoHAMMER VFS - vfs.hammer.double_buffer adjustments
Matthew Dillon [Thu, 20 Jan 2011 04:30:15 +0000 (20:30 -0800)]
HAMMER VFS - vfs.hammer.double_buffer adjustments

* Do not try to use the (currently broken) _vnode_validate() to
  validate de-dup data when double_buffer is turned on.  Use the
  device buffer cache instead.

13 years agoipflow: Use CPUMASK
Sepherosa Ziehau [Thu, 20 Jan 2011 03:39:53 +0000 (11:39 +0800)]
ipflow: Use CPUMASK

13 years agokernel -- tmpfs: MPSAFE tmpfs_getattr.
Venkatesh Srinivas [Thu, 20 Jan 2011 02:35:51 +0000 (18:35 -0800)]
kernel -- tmpfs: MPSAFE tmpfs_getattr.

Use the per-mount token to synchronize tmpfs_getattr.

13 years agoUpdate lwbuf(9) manpage for recent lwbuf_alloc change.
Venkatesh Srinivas [Thu, 20 Jan 2011 02:16:35 +0000 (18:16 -0800)]
Update lwbuf(9) manpage for recent lwbuf_alloc change.

13 years agokernel - Optimize the x86-64 lwbuf API
Matthew Dillon [Thu, 20 Jan 2011 01:27:46 +0000 (17:27 -0800)]
kernel - Optimize the x86-64 lwbuf API

* Change lwbuf_alloc(m) to lwbuf_alloc(m, &lwb_cache), passing a pointer to
  a struct lwb which lwbuf_alloc() may used if it desires.

* The x86-64 lwbuf_alloc() now just fills in the passed lwb and returns it.
  The i386 lwbuf_alloc() still uses the objcache w/ its kva mappings.  This
  removes objcache calls from the critical path.

* The x86-64 lwbuf_alloc()/lwbuf_free() functions are now inlines (ALL x86-64
  lwbuf functions are now inlines).

13 years agokernel - Fix deadlock assertion panic with mmap/read combos
Matthew Dillon [Wed, 19 Jan 2011 22:11:10 +0000 (14:11 -0800)]
kernel - Fix deadlock assertion panic with mmap/read combos

* Normally the uiomove() is called with the buffer locked.  When
  uiomove()ing into mmap'd memory this can cause a lock recursion and
  panic, or a deadlock.

* Fix the problem by adding bqhold() and bqdrop() and adjusting the use
  of the b_refs field to prevent the buffer from being invalidated,
  allowing VFS VOP_READ operations to release the buffer prior to the
  uiomove() into user memory.

* Adjust brelse() and getnewbuf() to do the right thing.  Note that there
  are two cases where b_refs can transition from 0->1.  The VFS
  release/uiomove case will only transition b_refs while the buffer is
  locked while findblk() will transition b_refs at any time (while holding
  the spin lock).  We only care about retaining the VM pages in the
  transition-during-locked case.

* Original problem reproducable with

  grep -r --mmap SomeString /usr/pkgsrc

Reported-by: YONETANI Tomokazu <qhwt.dfly@les.ath.cx>
13 years agokernel - Use atomic ops for devstat's ds->busy_count field.
Matthew Dillon [Wed, 19 Jan 2011 19:12:47 +0000 (11:12 -0800)]
kernel - Use atomic ops for devstat's ds->busy_count field.

* Use atomic ops to manage the busy_count field as these functions can
  be called MP.

* This should avoid negative busy_count transitions due to MP races on the
  field.

Reported-by: Peter Avalos <peter@theshell.com>
13 years agokernel: Some more style fixes.
Sascha Wildner [Wed, 19 Jan 2011 09:31:01 +0000 (10:31 +0100)]
kernel: Some more style fixes.

13 years agocd9660: Style fix.
Sascha Wildner [Wed, 19 Jan 2011 09:23:22 +0000 (10:23 +0100)]
cd9660: Style fix.

13 years agolibc: Fix warnings fallout from the change to CSTD=gnu99.
Sascha Wildner [Mon, 17 Jan 2011 22:42:38 +0000 (23:42 +0100)]
libc: Fix warnings fallout from the change to CSTD=gnu99.

13 years agogroff: Raise WARNS to 1.
Sascha Wildner [Mon, 17 Jan 2011 20:32:02 +0000 (21:32 +0100)]
groff: Raise WARNS to 1.

13 years agodevd(8): Raise WARNS to 5 and fix a warning.
Sascha Wildner [Mon, 17 Jan 2011 20:31:47 +0000 (21:31 +0100)]
devd(8): Raise WARNS to 5 and fix a warning.

13 years agolib/libncp: Silence some warnings that cropped up with CSTD=gnu99.
Sascha Wildner [Mon, 17 Jan 2011 20:17:50 +0000 (21:17 +0100)]
lib/libncp: Silence some warnings that cropped up with CSTD=gnu99.

13 years agocompile_et(1): Set CSTD to gnu89 (compile_et(1) is in contrib/).
Sascha Wildner [Mon, 17 Jan 2011 20:11:04 +0000 (21:11 +0100)]
compile_et(1): Set CSTD to gnu89 (compile_et(1) is in contrib/).