dragonfly.git
12 years agoUpdate files for OpenSSL-1.0.0f import.
Peter Avalos [Thu, 5 Jan 2012 00:25:38 +0000 (16:25 -0800)]
Update files for OpenSSL-1.0.0f import.

12 years agoMerge branch 'vendor/OPENSSL'
Peter Avalos [Thu, 5 Jan 2012 00:20:06 +0000 (16:20 -0800)]
Merge branch 'vendor/OPENSSL'

12 years agoImport OpenSSL-1.0.0f.
Peter Avalos [Thu, 5 Jan 2012 00:06:12 +0000 (16:06 -0800)]
Import OpenSSL-1.0.0f.

      o Fix for DTLS plaintext recovery attack CVE-2011-4108
      o Clear block padding bytes of SSL 3.0 records CVE-2011-4576
      o Only allow one SGC handshake restart for SSL/TLS CVE-2011-4619
      o Check parameters are not NULL in GOST ENGINE CVE-2012-0027
      o Check for malformed RFC3779 data CVE-2011-4577

12 years agokernel: Use NULL for pointers.
Sascha Wildner [Tue, 3 Jan 2012 21:22:30 +0000 (22:22 +0100)]
kernel: Use NULL for pointers.

12 years agodma(8): Upgrade to v0.7.
Sascha Wildner [Tue, 3 Jan 2012 14:31:49 +0000 (15:31 +0100)]
dma(8): Upgrade to v0.7.

For the change log, see:

https://github.com/corecode/dma/blob/master/debian/changelog

Tested-by: luxh
Submitted-by: corecode
12 years agoRun VFS_START() for the root mount point.
Francois Tigeot [Thu, 25 Aug 2011 09:39:18 +0000 (11:39 +0200)]
Run VFS_START() for the root mount point.

The namecache has to be initialized properly for that. Use code
taken from start_init()

12 years agogold linker v2.22: Remove unnecessary assertions
John Marino [Tue, 3 Jan 2012 16:51:24 +0000 (17:51 +0100)]
gold linker v2.22: Remove unnecessary assertions

Fixes this error: internal error in relocate_tls
Reported as binutils bug 13359
<http://sourceware.org/bugzilla/show_bug.cgi?id=13359>
Applied to trunk 2011-10-31
Backported to 2.22 branch on 2011-12-19

12 years agogold linker v2.22: Fix constructor handling
John Marino [Tue, 3 Jan 2012 10:50:54 +0000 (11:50 +0100)]
gold linker v2.22: Fix constructor handling

Starting with gold 2.22, gold looks for contructors in DT_INIT_ARRAY by
default, but gcc defines them in a .ctors section.  Apparently the
presence of crtbegin and crtend with their .init sections are confusing
gold, but not gnu ld.

To combat this, a new option "--no-ctors-in-init-array" was added to
emulate gnu ld behavior of looking for constructors in the .ctors
section provided by gcc.  This commit makes this new option the default
behavior on DragonFly's gold.

Without this modification, a gold-built world is unbootable!

12 years agokernel - Fix a case in if_re which could lockup the system
Matthew Dillon [Tue, 3 Jan 2012 17:18:28 +0000 (09:18 -0800)]
kernel - Fix a case in if_re which could lockup the system

* if_re's re_start function was not always properly setting IFF_OACTIVE
  in situations where packets would be left on the if_snd queue, causing
  if_start_dispatch() to get into an endless message loop.

* Add debugging to device_printf() when the case occurs.

12 years agoispfw(4): Add MODULE_VERSION()s.
Sascha Wildner [Tue, 3 Jan 2012 14:36:35 +0000 (15:36 +0100)]
ispfw(4): Add MODULE_VERSION()s.

12 years agoispfw(4): Correct case in module name.
Sascha Wildner [Tue, 3 Jan 2012 13:52:47 +0000 (14:52 +0100)]
ispfw(4): Correct case in module name.

12 years agokernel/vfs: enable accounting for ro mounts
François Tigeot [Tue, 3 Jan 2012 13:10:16 +0000 (14:10 +0100)]
kernel/vfs: enable accounting for ro mounts

* Some filesystems may be first mounted read-only and then upgraded
  to read-write status

* The VFS layer has no provision for signaling VFSes of status change,
  mount-point specific initialization code can only be run for the
  initial mount

* VFS accounting was thus never enabled on a ro->rw mount point transition

* Bite the bullet and run vq_init() unconditionally for both read-only
  and read-write mounts, the cost is only a few variables set to NULL
  or zero anyway.

12 years agoisp(4): Sync with FreeBSD.
Sascha Wildner [Tue, 3 Jan 2012 12:29:09 +0000 (13:29 +0100)]
isp(4): Sync with FreeBSD.

Adds support for some newer cards:

* Qlogic ISP 2322 PCI FC-AL Adapter

* Qlogic ISP 2422 PCI FC-AL Adapter

* Qlogic ISP 2432 PCI FC-AL Adapter

* Qlogic ISP 2532 PCI FC-AL Adapter

* Qlogic ISP 5432 PCI FC-AL Adapter

* Qlogic ISP 6312 PCI FC-AL Adapter

* Qlogic ISP 6322 PCI FC-AL Adapter

Also isp(4) can now be loaded as a module. The firmwares have been
separated into per-firmware modules, too.

It was tested with an old DEC KZPBA-CX (1040 based) SCSI adapter.

12 years agokernel/mchain: Fix a NULL check.
Sascha Wildner [Tue, 3 Jan 2012 09:22:00 +0000 (10:22 +0100)]
kernel/mchain: Fix a NULL check.

12 years agokernel - Fix swapcache inefficiency related to the PQ_INACTIVE queue
Matthew Dillon [Tue, 3 Jan 2012 05:25:47 +0000 (21:25 -0800)]
kernel - Fix swapcache inefficiency related to the PQ_INACTIVE queue

* The swapcache was still coded with the assumption of just one
  PQ_INACTIVE queue.  Even though it scans all 256 queues the
  end-of-queue code could trigger early and prevent later queue
  indices from being scanned, causing a large percentage of eligible
  VM pages to not get written to the swapcache.

  Now all queues must signal that they have reached the end before the
  code sets the end-of-queue condition and loops up to the 1/10 second
  sleep.

* The full count/scount was being applied to each queue individually instead
  of to all queues uniformly, allowing more pages to be laundered than
  desired.  Divide out and add a bit of slop.

12 years agokernel - Use atomic ops to update hammer_count_refedbufs
Matthew Dillon [Mon, 2 Jan 2012 19:27:56 +0000 (11:27 -0800)]
kernel - Use atomic ops to update hammer_count_refedbufs

* This global is used only for statistical reporting via sysctl and has
  no operational effect.

* Use atomic ops to avoid tracking errors from multiple hammer mounts.

12 years agohammer - Pass -S option to remote mirror-read
Matthew Dillon [Mon, 2 Jan 2012 18:10:52 +0000 (10:10 -0800)]
hammer - Pass -S option to remote mirror-read

* When doing a mirror or mirror-stream via pull from the remote pass the
  -S option to the remote end, otherwise the remote will just use the
  default split size.

Reported-by: ftigeot
12 years agoktr.9: Adjust for the recent ktr work by aggelos.
Sascha Wildner [Mon, 2 Jan 2012 16:48:23 +0000 (17:48 +0100)]
ktr.9: Adjust for the recent ktr work by aggelos.

12 years agotest/cocci/NELEM.cocci: Oops, wrong comment character.
Sascha Wildner [Mon, 2 Jan 2012 02:15:26 +0000 (03:15 +0100)]
test/cocci/NELEM.cocci: Oops, wrong comment character.

12 years agoExpand the comments in the coccinelle patches a bit more.
Sascha Wildner [Mon, 2 Jan 2012 02:10:46 +0000 (03:10 +0100)]
Expand the comments in the coccinelle patches a bit more.

12 years agoAdd a coccinelle patch to find missing lock release before return.
Sascha Wildner [Mon, 2 Jan 2012 02:03:24 +0000 (03:03 +0100)]
Add a coccinelle patch to find missing lock release before return.

12 years agokernel/i4b: Instead of returning, goto fail (for crit_exit()).
Sascha Wildner [Mon, 2 Jan 2012 01:28:15 +0000 (02:28 +0100)]
kernel/i4b: Instead of returning, goto fail (for crit_exit()).

12 years agodpt(4): Add a missing crit_exit().
Sascha Wildner [Mon, 2 Jan 2012 01:27:17 +0000 (02:27 +0100)]
dpt(4): Add a missing crit_exit().

12 years agokernel/disk drivers: Add some missing crit_exit()s.
Sascha Wildner [Mon, 2 Jan 2012 01:26:29 +0000 (02:26 +0100)]
kernel/disk drivers: Add some missing crit_exit()s.

12 years agoed(4): Replace a forgotten crit_exit() with lwkt_serialize_exit().
Sascha Wildner [Mon, 2 Jan 2012 00:06:34 +0000 (01:06 +0100)]
ed(4): Replace a forgotten crit_exit() with lwkt_serialize_exit().

Only cosmetical as this code is not enabled.

12 years agovkernel - Unbreak 32-bit vkernel builds by fixing broken assertion
Matthew Dillon [Sun, 1 Jan 2012 23:08:37 +0000 (15:08 -0800)]
vkernel - Unbreak 32-bit vkernel builds by fixing broken assertion

* [ASSERT_]MP_LOCK_HELD() was not properly handling the new token
  t_count format.

* Rename and document the functions a bit better.  Currently our
  more expansive token test for (shared or exclusive) is not
  a perfect test because we don't want to eat cpu time iterating
  the thread's token array to check for shared tokens.  So we just
  check for a shared count.

  Works well for assertions, wouldn't work very well for conditional
  acquisition (of a shared token).

* Exclusive token tests are perfect.

Reported-by: tuxillo
12 years agokernel - Fix ENOBUFS related panic in tcp_output
Matthew Dillon [Sun, 1 Jan 2012 20:14:40 +0000 (12:14 -0800)]
kernel - Fix ENOBUFS related panic in tcp_output

* If the tcp_output code gets all the way to the end but then has to
  'goto again', it fails to NULL out the (th) pointer.  If the mbuf fails
  on the retry (m == NULL), the non-NULL (th) winds up causing the code to
  believe that the mbuf is good and results in a null-pointer dereference.

12 years agohammer(8): fix an obsolete comment
François Tigeot [Sun, 1 Jan 2012 15:01:30 +0000 (16:01 +0100)]
hammer(8): fix an obsolete comment

12 years agokgdb: Fix double-free bug
John Marino [Sun, 1 Jan 2012 12:00:29 +0000 (13:00 +0100)]
kgdb: Fix double-free bug

It was a mistake to reuse target sections for each inferior.  Leaving the
default section for each program space eliminates the redundant xfrees.
The exec.c function "resize_table_sections" code was painful to look at with
unused variables and unnecessary memory reallocations, so it was altered
at the same time.

12 years agokernel/tws: Add a missing lockmgr(...,LK_RELEASE).
Sascha Wildner [Sun, 1 Jan 2012 01:48:53 +0000 (02:48 +0100)]
kernel/tws: Add a missing lockmgr(...,LK_RELEASE).

12 years agokernel/gpio: Add a missing lockmgr(...,LK_RELEASE).
Sascha Wildner [Sun, 1 Jan 2012 01:47:24 +0000 (02:47 +0100)]
kernel/gpio: Add a missing lockmgr(...,LK_RELEASE).

12 years agokernel/vfs_quota: Add a missing spin_unlock().
Sascha Wildner [Sun, 1 Jan 2012 01:31:11 +0000 (02:31 +0100)]
kernel/vfs_quota: Add a missing spin_unlock().

12 years agokernel/netgraph: Add a missing lwkt_reltoken().
Sascha Wildner [Sun, 1 Jan 2012 01:02:26 +0000 (02:02 +0100)]
kernel/netgraph: Add a missing lwkt_reltoken().

12 years agokernel/cam: Add two missing lockmgr(...,LK_RELEASE)'s.
Sascha Wildner [Sun, 1 Jan 2012 00:35:16 +0000 (01:35 +0100)]
kernel/cam: Add two missing lockmgr(...,LK_RELEASE)'s.

12 years agoBump copyright. Happy new year!!
Sascha Wildner [Sat, 31 Dec 2011 23:51:55 +0000 (00:51 +0100)]
Bump copyright. Happy new year!!

12 years agoMerge branch 'vendor/FILE'
Peter Avalos [Sat, 31 Dec 2011 20:44:00 +0000 (12:44 -0800)]
Merge branch 'vendor/FILE'

12 years agoImport file-5.10.
Peter Avalos [Sat, 31 Dec 2011 20:32:20 +0000 (12:32 -0800)]
Import file-5.10.

Changes are documented in ChangeLog.

12 years agoReduce differences between our VKERNEL and VKERNEL64 configurations.
Sascha Wildner [Sat, 31 Dec 2011 11:36:16 +0000 (12:36 +0100)]
Reduce differences between our VKERNEL and VKERNEL64 configurations.

* Removes KTR from VKERNEL.

* Removes VM_PAGE_DEBUG from VKERNEL64.

* Some whitespace adjustments.

12 years agoVKERNEL64: Adjust for the ktr changes (to fix build).
Sascha Wildner [Sat, 31 Dec 2011 11:17:55 +0000 (12:17 +0100)]
VKERNEL64: Adjust for the ktr changes (to fix build).

12 years agolibdl -- Stub libdl.
Venkatesh Srinivas [Sat, 31 Dec 2011 10:21:05 +0000 (05:21 -0500)]
libdl -- Stub libdl.

DragonFly BSD (and FreeBSD) have the dlopen/dlfcn/... routines located in
libc. However many applications and their configure scripts look for these
routines in libdl. This adds a stub libdl with no subroutines, so that the
configure scripts pass. The dl* routines are automatically available via
libc.

12 years agokernel -- nfsserver: Allow for some reordering of RPCs before decaying seqcount.
Venkatesh Srinivas [Sat, 31 Dec 2011 05:27:01 +0000 (00:27 -0500)]
kernel -- nfsserver: Allow for some reordering of RPCs before decaying seqcount.

Before decaying sequential heuristic, allow a limited amount of RPC reordering.
After that, decay by half for each out-of-order RPC rather than immediately
dropping to 1.

From FreeBSD r228185.

12 years agokernel -- KTR: Fix vkernel32 build.
Venkatesh Srinivas [Sat, 31 Dec 2011 05:21:51 +0000 (00:21 -0500)]
kernel -- KTR: Fix vkernel32 build.

KTR_INFO needed to be updated for the typesafe KTR patchset.

12 years agokernel: Fix two NULL dereference issues.
Sascha Wildner [Sat, 31 Dec 2011 03:38:52 +0000 (04:38 +0100)]
kernel: Fix two NULL dereference issues.

12 years agokernel/acpi: Add a missing file to the 'files' files (fixes LINT* build).
Sascha Wildner [Sat, 31 Dec 2011 03:37:30 +0000 (04:37 +0100)]
kernel/acpi: Add a missing file to the 'files' files (fixes LINT* build).

12 years agovkernel/intr: Pin vkernel "hardware interrupts" to CPU0
Sepherosa Ziehau [Sat, 31 Dec 2011 03:29:32 +0000 (11:29 +0800)]
vkernel/intr: Pin vkernel "hardware interrupts" to CPU0

Due to the nondeterminsm of CPU to which SIGIO will be delivered,
we can't depend on "hardware interrupts" of vkernel always happen
on the registered CPU.  We now pin the vkernel "hardware interrupts"
to CPU0, so the interrupt scheduling code could always know the
correct ithread to be scheduled.

Reported-by: tuxillo vsrinivas
12 years agoAdjust ktrdump(8) for the ktr(4) changes
Aggelos Economopoulos [Fri, 30 Dec 2011 13:44:21 +0000 (05:44 -0800)]
Adjust ktrdump(8) for the ktr(4) changes

- On i386, we need to extend logged integers to be at least
  int-sized like vprintf expects.
- On x86_64, we unpack the logged arguments into a va_list according
  to the x86_64 ABI rules and then pass it to kvprintf.

12 years agoModify ktr(4) to be typesafe
Aggelos Economopoulos [Fri, 30 Dec 2011 13:38:34 +0000 (05:38 -0800)]
Modify ktr(4) to be typesafe

- Use a struct copy to place the logged values directly into the
  destination buffer without forcing a memcpy.
- This also fixes event logging on x86_64, as we no longer rely
  on the i386 calling convention for functions with a variable
  number of arguments.
- Verify that the arguments match the specified format.
- Update callsites.

Note that this requires userspace changes! ktrdump(8) needs to be
adjusted even on i386 (%c and %hd are no longer promoted as per the
C rules). We need very special handling on x86_64 too.

12 years agoIntroduce sys/cpputil.h for our cpp metaprogramming needs
Aggelos Economopoulos [Fri, 30 Dec 2011 17:00:44 +0000 (09:00 -0800)]
Introduce sys/cpputil.h for our cpp metaprogramming needs

12 years agokernel/drm: Move a NULL check to the proper place.
Sascha Wildner [Fri, 30 Dec 2011 16:39:11 +0000 (17:39 +0100)]
kernel/drm: Move a NULL check to the proper place.

12 years agokernel/altq: Move a dereference below the NULL check.
Sascha Wildner [Fri, 30 Dec 2011 16:13:32 +0000 (17:13 +0100)]
kernel/altq: Move a dereference below the NULL check.

12 years agoacpi/cpu: Missing one 'O' in the macro name
Sepherosa Ziehau [Thu, 29 Dec 2011 11:01:27 +0000 (19:01 +0800)]
acpi/cpu: Missing one 'O' in the macro name

12 years agoacpi/cpu: Report that Turbo Boost is enabled on Intel CPUs
Sepherosa Ziehau [Thu, 29 Dec 2011 10:36:41 +0000 (18:36 +0800)]
acpi/cpu: Report that Turbo Boost is enabled on Intel CPUs

If Turbo Boost is enabled, the current CPU frequencies reported by
hw.acpi.cpu are not correct, sigh.

12 years agoacpi/pstate: Print coordination
Sepherosa Ziehau [Thu, 29 Dec 2011 09:26:44 +0000 (17:26 +0800)]
acpi/pstate: Print coordination

12 years agoacpi/pstate: Fix the long standing P-State detection problem on Intel CPUs
Sepherosa Ziehau [Thu, 29 Dec 2011 08:33:11 +0000 (16:33 +0800)]
acpi/pstate: Fix the long standing P-State detection problem on Intel CPUs

- Rename the ACPI_CAP to ACPI_PDC according to Intel's document.
  While I'm here, update the document revision.
- Remove unapplied comment about _OSC and _PDC's revision; Intel's
  document states clearly that it should be 1
- Fix the 'Count' argument for _OSC evaluation; the intergers in
  'Capabilities buffer' argument is 2
- Fix the buffer length of _OSC's 'Capabilities buffer'; we only
  pass 2 intergers.
- Perfer _OSC evaluation, fall back to _PDC evaluation only if _OSC
  evaluation fails.
- Add MD cpu features, so MD code could deliver proper settings.
  For AMD CPUs, the old configuration just works (AMD actually has
  no documents about _PDC and _OSC).
  For Intel CPUs w/ EST, it looks like P-State's _PCT will appear
  only when bit0 (P-State MSR), bit5 (P-State software coordination)
  and bit11 (P-State hardware coordination) are turned on.

12 years agox86_64: Add MSI support for ICU MachIntrABI
Sepherosa Ziehau [Thu, 29 Dec 2011 05:56:31 +0000 (13:56 +0800)]
x86_64: Add MSI support for ICU MachIntrABI

12 years agointr: Remove no longer correct ithread_cpuid; use rman_get_cpuid instead
Sepherosa Ziehau [Thu, 29 Dec 2011 03:04:19 +0000 (11:04 +0800)]
intr: Remove no longer correct ithread_cpuid; use rman_get_cpuid instead

12 years agolibmagic: Update Makefile.
Peter Avalos [Wed, 28 Dec 2011 22:40:49 +0000 (14:40 -0800)]
libmagic:  Update Makefile.

-Use SHAREDIR from bsd.own.mk instead of hardcoding it.
-Get rid of -I nonsense that was required when we used to patch the
vendor's .h, but we need to turn off warnings when building mkmagic.nx.

Inspired-by: http://bugs.dragonflybsd.org/issues/2206
12 years agobce: Add workaround for the lost of MSI on 5706/5708
Sepherosa Ziehau [Wed, 28 Dec 2011 14:44:08 +0000 (22:44 +0800)]
bce: Add workaround for the lost of MSI on 5706/5708

While I'm here use ramn_get_cpuid to extract interrupt's target CPU

Obtained-from: bnx2

12 years agoem: rman_get_cpuid should be used to get the interrupt's target CPU
Sepherosa Ziehau [Wed, 28 Dec 2011 13:53:41 +0000 (21:53 +0800)]
em: rman_get_cpuid should be used to get the interrupt's target CPU

12 years agoem: Use MSI, if device supports it
Sepherosa Ziehau [Wed, 28 Dec 2011 05:09:13 +0000 (13:09 +0800)]
em: Use MSI, if device supports it

12 years agobce: Split out frontend for interrupt handler
Sepherosa Ziehau [Wed, 28 Dec 2011 04:07:22 +0000 (12:07 +0800)]
bce: Split out frontend for interrupt handler

For non-oneshot MSI, we don't need to make sure that status block has
been updated and we don't need extra register read to flush the ACK_CMD;
MSI has already made sure about those.

For oneshot MSI, we don't even need to ACK the interrupt

Obtaied-from: bnx2

12 years agopci: Factor out pci_alloc_1intr()
Sepherosa Ziehau [Wed, 28 Dec 2011 02:49:50 +0000 (10:49 +0800)]
pci: Factor out pci_alloc_1intr()

This function will properly setup rid and flags for "legacy" interrupt.
If MSI is enabled, then this function will try allocate 1 MSI message
and setup rid and flags properly for MSI based interrupt resource.

12 years agoether_ioctl: Command type is u_long not int
Sepherosa Ziehau [Tue, 27 Dec 2011 10:15:26 +0000 (18:15 +0800)]
ether_ioctl: Command type is u_long not int

12 years agotaskqueue -- Register swi_taskq_mp as an MP-safe SWI.
Venkatesh Srinivas [Wed, 28 Dec 2011 01:38:12 +0000 (17:38 -0800)]
taskqueue -- Register swi_taskq_mp as an MP-safe SWI.

The swi_taskqueue for mpsafe tasks was still getting the mplock. Remove it.
There are no real users of this queue in kernel though.

12 years agotest - Do not report bogus object pointer in vmpageinfo
Matthew Dillon [Tue, 27 Dec 2011 22:18:34 +0000 (14:18 -0800)]
test - Do not report bogus object pointer in vmpageinfo

* If m.object is NULL do not report the previously loaded object's
  data in the output.

12 years agokernel - Fix swap space leak
Matthew Dillon [Tue, 27 Dec 2011 22:15:50 +0000 (14:15 -0800)]
kernel - Fix swap space leak

* swp_pager_meta_free_callback() had a bug where the last swap block
  in the swblock{} structure was not being freed from the swap bitmap.

* Also fix two rare race conditions.  swp_pager_freeswapspace() can
  block, causing the VM object token to be temporarily unlocked.  Deal
  with the race by not decrementing the swb_count field until after
  swp_pager_freeswapspace() is called.

Reported-by: sephe
12 years agoi386: Pass cpuid to pcib_alloc_msi and pcib_map_msi
Sepherosa Ziehau [Tue, 27 Dec 2011 08:19:17 +0000 (16:19 +0800)]
i386: Pass cpuid to pcib_alloc_msi and pcib_map_msi

This also unbreaks kernel building on i386

12 years agobce: Use MSI, if device supports it
Sepherosa Ziehau [Tue, 27 Dec 2011 06:38:13 +0000 (14:38 +0800)]
bce: Use MSI, if device supports it

12 years agoemx: emx_detach will correctly handle IRQ resource allocation failure
Sepherosa Ziehau [Tue, 27 Dec 2011 06:37:24 +0000 (14:37 +0800)]
emx: emx_detach will correctly handle IRQ resource allocation failure

12 years agoemx: Use MSI, if device supports it
Sepherosa Ziehau [Tue, 27 Dec 2011 05:43:09 +0000 (13:43 +0800)]
emx: Use MSI, if device supports it

12 years agoahci: Use MSI if device support it.
Sepherosa Ziehau [Tue, 27 Dec 2011 05:42:44 +0000 (13:42 +0800)]
ahci: Use MSI if device support it.

12 years agomsi: Put old MSI code under OLD_MSI
Sepherosa Ziehau [Tue, 27 Dec 2011 05:41:31 +0000 (13:41 +0800)]
msi: Put old MSI code under OLD_MSI

12 years agox86_64: Don't allocate MSI if LAPIC is not enabled
Sepherosa Ziehau [Tue, 27 Dec 2011 05:09:38 +0000 (13:09 +0800)]
x86_64: Don't allocate MSI if LAPIC is not enabled

12 years agomsi/pci: Adjust pci_alloc_msi method interface
Sepherosa Ziehau [Tue, 27 Dec 2011 03:23:03 +0000 (11:23 +0800)]
msi/pci: Adjust pci_alloc_msi method interface

- The requested number of MSI messages is no longer adjusted in
  pci_alloc_msi_method(), instead, caller should adjust it.
- rids of the MSI SYS_RES_IRQ are explicitly returned to caller,
  instead of letting caller fill them based on the implied rules.
- MSI messages' target CPU auto-selection.
- Intead of reallocation using reduced number of MSI messages,
  we try to allocate the requested amount of MSI messages on
  different CPUs, if the desired CPU does not have enough vectors.
- The requested amount of MSI messages must be sane.

12 years agox86_64/msi: Add hw.ioapic.msi_start tunable
Sepherosa Ziehau [Mon, 26 Dec 2011 13:26:34 +0000 (21:26 +0800)]
x86_64/msi: Add hw.ioapic.msi_start tunable

This is mainly used to test MSI allocation over the whole valid
hardware interrupt space.

12 years agox86_64: Add MSI support for IOAPIC MachIntrABI
Sepherosa Ziehau [Sun, 25 Dec 2011 14:13:13 +0000 (22:13 +0800)]
x86_64: Add MSI support for IOAPIC MachIntrABI

12 years agopci: Remove extra bus_generic_teardown_intr
Sepherosa Ziehau [Sun, 25 Dec 2011 14:02:23 +0000 (22:02 +0800)]
pci: Remove extra bus_generic_teardown_intr

This is the left over of 79af06ab6b5a6581a07d0a6bc0735f6aa82a7947

12 years agomsi: Add setup/map function
Sepherosa Ziehau [Sun, 25 Dec 2011 11:46:03 +0000 (19:46 +0800)]
msi: Add setup/map function

- msi_setup, setup the IDT entry properly
- msi_map, return the MSI address and MSI data according to the
  'intr' and 'cpuid'

The various MSI macros forming MSI address/data are taken from FreeBSD

12 years agomsi: Generate vectors 0~15
Sepherosa Ziehau [Sun, 25 Dec 2011 11:24:27 +0000 (19:24 +0800)]
msi: Generate vectors 0~15

12 years agomsi/pci: Pass cpuid to pcib_map_msi method
Sepherosa Ziehau [Sun, 25 Dec 2011 10:38:25 +0000 (18:38 +0800)]
msi/pci: Pass cpuid to pcib_map_msi method

12 years agox86_64: Add setidt(), which setup an IDT entry on the specified cpu
Sepherosa Ziehau [Sat, 24 Dec 2011 16:27:40 +0000 (00:27 +0800)]
x86_64: Add setidt(), which setup an IDT entry on the specified cpu

12 years agomsi/pci: Pass cpuid to pcib_release_msi method
Sepherosa Ziehau [Sat, 24 Dec 2011 14:11:10 +0000 (22:11 +0800)]
msi/pci: Pass cpuid to pcib_release_msi method

12 years agopci: We must not enable pci_do_msix currently
Sepherosa Ziehau [Sat, 24 Dec 2011 12:12:07 +0000 (20:12 +0800)]
pci: We must not enable pci_do_msix currently

12 years agomsi/pci: Pass cpuid to pci_alloc_msi and pcib_alloc_msi methods
Sepherosa Ziehau [Sat, 24 Dec 2011 12:09:18 +0000 (20:09 +0800)]
msi/pci: Pass cpuid to pci_alloc_msi and pcib_alloc_msi methods

12 years agonetif: MSI actually never worked, so comment out the pci_alloc_msi
Sepherosa Ziehau [Sat, 24 Dec 2011 12:08:24 +0000 (20:08 +0800)]
netif: MSI actually never worked, so comment out the pci_alloc_msi

12 years agomsi: Enable all PCI related code
Sepherosa Ziehau [Fri, 23 Dec 2011 15:02:45 +0000 (23:02 +0800)]
msi: Enable all PCI related code

12 years agomsi: Add interrupt vectors
Sepherosa Ziehau [Fri, 23 Dec 2011 14:41:17 +0000 (22:41 +0800)]
msi: Add interrupt vectors

This is larged based on apic/apic_vector.s

12 years agoUPDATING: Note that mkdir(1) and install(1) need updating before building.
Sascha Wildner [Tue, 27 Dec 2011 02:47:45 +0000 (03:47 +0100)]
UPDATING: Note that mkdir(1) and install(1) need updating before building.

12 years agoinstaller: Don't say the installer is experimental.
Sascha Wildner [Tue, 27 Dec 2011 02:33:26 +0000 (03:33 +0100)]
installer: Don't say the installer is experimental.

Noticed-by: vsrinivas
12 years agokernel - Add vm.swapcache.maxscan
Matthew Dillon [Mon, 26 Dec 2011 20:01:49 +0000 (12:01 -0800)]
kernel - Add vm.swapcache.maxscan

* Add vm.swapcache.maxscan as a separate counter from vm.swapcache.maxlaunder.

* Defaults to 4x maxlaunder.

* Should hopefully fix another cpu hogging issue that was noticed on
  avalon when most VM pages wind up being cached in the swapcache
  but still get cycled in the PQ_INACTIVE VM page queue due to apache
  activity.

12 years agokernel -- Per-mount syncer thread infrastructure.
Venkatesh Srinivas [Mon, 26 Dec 2011 08:12:14 +0000 (00:12 -0800)]
kernel -- Per-mount syncer thread infrastructure.

Introduce infrastructure to create per-mount periodic filesystem syncer threads.

For a filesystem flagged MNTK_THR_SYNC, create a thread to periodically
synchronize dirty vnodes and the entire filesystem via VOP_FSYNC and
VFS_SYNC. This thread subsumes that responsibility from the global syncer.
The thread will be created at mount time and torn down at unmount.

For filesystems not flagged, the global syncer thread (syncer0) is still used.
The global syncer thread is also used for the bioops_sync(NULL) call, to
invoke every filesystem's bioops_sync path. This is primarily a concern for
UFS/softdep. The global syncer is also the only syncer thread to respond to
speedup_syncer / rushjob requests; this is again a consideration for softdep.

Future work will consider the relative phase of the syncer thread clocks,
so that they may wake together; this may result in more work done per
wakeup.

Currently no filesystems are flagged MNTK_THR_SYNC, so there should be no
functional change associated with this commit.

12 years agokernel - Fix missing chain wait
Matthew Dillon [Sun, 25 Dec 2011 22:32:29 +0000 (14:32 -0800)]
kernel - Fix missing chain wait

* Fix a missing chain wait prior to adding a ref to the VM object in the
  sysv shm code.

Reported-by: lentferj
12 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sun, 25 Dec 2011 22:32:19 +0000 (14:32 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

12 years ago<math.h>: Add prototypes for llrintl() and nearbyintl().
Sascha Wildner [Sun, 25 Dec 2011 21:42:11 +0000 (22:42 +0100)]
<math.h>: Add prototypes for llrintl() and nearbyintl().

12 years ago<math.h>: Add FP_ILOGB0 and FP_ILOGBNAN.
Sascha Wildner [Sun, 25 Dec 2011 21:41:15 +0000 (22:41 +0100)]
<math.h>: Add FP_ILOGB0 and FP_ILOGBNAN.

12 years agokernel - Correct sysctl variable type for kern.stackgap_random
Matthew Dillon [Sun, 25 Dec 2011 22:06:29 +0000 (14:06 -0800)]
kernel - Correct sysctl variable type for kern.stackgap_random

* Correct the sysctl variable type for kern.stackgap_random from an
  unsigned int to a signed int.

12 years agogcc-4.4: Add workaround for probable AMD cpu bug
Matthew Dillon [Sun, 25 Dec 2011 22:02:24 +0000 (14:02 -0800)]
gcc-4.4: Add workaround for probable AMD cpu bug

* Add a workaround to add a nop to the end of gcc-4.4's fill_sons_in_loop()
  function just prior to its return (to its multi-register pop and ret
  sequence).

  This works around what appears to be a aMD cpu bug in contemporary
  AMD cpus.

12 years agokernel - Add workaround support for a probable AMD cpu bug related to cc1
Matthew Dillon [Sun, 25 Dec 2011 21:47:39 +0000 (13:47 -0800)]
kernel - Add workaround support for a probable AMD cpu bug related to cc1

* Add supporting inlines and a #define.  See the followup commit to
  the gcc-4.4 code in the DFly codebase.

* This bit of code is used to add a single NOP instruction just prior to
  the pop/ret sequence in cc1's fill_sons_in_loop() which works around
  what we believe to be a very difficult to reproduce AMD cpu bug.  The
  bug appears to be present on contemporary AMD cpus and was replicated
  on a Phenom(tm) II X4 820 Processor (Origin = "AuthenticAMD"  Id = 0x100f42
  Stepping = 2) and on an opteron 12-core cpu AMD Opteron(tm) Processor 6168
  (Origin = "AuthenticAMD"  Id = 0x100f91  Stepping = 1).

* The bug is extremely sensitive to %rip and %rsp values as well as
  stack memory use patterns and appears to cause either the %rip or the
  %rsp to become corrupt during the multi-register-pop/ret sequence at
  the end of fill_sons_in_loop() in the GCC 4.4.7 codebase.  This
  procedure is called as part of a deep tree recursion which exercises both
  the AMD RAS (Return Address Stack) hardware circuitry and probably also
  the write combining circuitry.

* I have so far only been able to reproduce the bug on DragonFly but have
  to the best of my ability eliminated the OS as a possible source of the
  problem over the last few months.  I am currently attempting to reproduce
  the bug running FreeBSD on the same hardware but it's virtually impossible
  to replicate the exact environment without adding DragonFly binary emulation
  to FreeBSD (which I just might have to do to truly verify that the bug is
  not a DragonFly OS bug).

* Bug reproducability: DragonFly utilizes a 0-1023 (~16 byte aligned)
  random stack gap.  Under normal buildworld -j 25 or similar conditions
  it can take anywhere up to 2 days to cause a failure.  Using a fixed
  stack gap of 904 (sysctl kern.stackgap_random=-904) on a particular cc1
  line during the compilation of gcc-4.4 using gcc-4.4, compiling gcc/mcf.c,
  with a carefully constructed environment and command path (to replicate
  a precise starting stack %rsp of  for main() of 0x7fffffffe818), I was
  able to replicate the bug in around a 60-second time frame with
  approximately one out of every 16 compiles hitting the the bug and failing.

* Changing the stackgap and/or modifying the code in any way (e.g. causing a
  shift in the %rpc values) changes the characteristics of the bug, sometimes
  causing it to stop appearing entirely.

  It was found that an adjustment of the stackgap in 32768 byte increments
  starting at the gap known to fail also reproduces the bug with the same
  consistency as the original stackgap value.

* Only the fill_sons_in_loop() function in cc1 in a few particular cases
  appears to be able to trigger the bug, across all the compiles we've
  done over a year.

12 years agosh: Add tests for lines that look like heredoc delimiters but are not.
Peter Avalos [Sun, 25 Dec 2011 18:02:37 +0000 (10:02 -0800)]
sh: Add tests for lines that look like heredoc delimiters but are not.

Obtained-from:  FreeBSD 221887

12 years agosh: Add tests for some somewhat obscure aspects of function definitions.
Peter Avalos [Sun, 25 Dec 2011 18:01:22 +0000 (10:01 -0800)]
sh: Add tests for some somewhat obscure aspects of function definitions.

Obtained-from:  FreeBSD 222512