dragonfly.git
14 years agolint(1): Set WARNS from xlint/Makefile.inc for all subdirs.
Sascha Wildner [Sun, 10 May 2009 13:43:44 +0000 (15:43 +0200)]
lint(1): Set WARNS from xlint/Makefile.inc for all subdirs.

14 years agotip(1): Set WARNS from tip/Makefile.inc for all subdirs and fix a warning.
Sascha Wildner [Sun, 10 May 2009 13:40:42 +0000 (15:40 +0200)]
tip(1): Set WARNS from tip/Makefile.inc for all subdirs and fix a warning.

14 years agolocate(1): Set WARNS from locate/Makefile.inc for all subdirs.
Sascha Wildner [Sun, 10 May 2009 13:38:31 +0000 (15:38 +0200)]
locate(1): Set WARNS from locate/Makefile.inc for all subdirs.

14 years agolex(1): Make WARNS cover libl too.
Sascha Wildner [Sun, 10 May 2009 13:35:17 +0000 (15:35 +0200)]
lex(1): Make WARNS cover libl too.

14 years agoinstaller: ../Makefile.inc is included via bsd.init.mk, no need to repeat.
Sascha Wildner [Sun, 10 May 2009 13:31:13 +0000 (15:31 +0200)]
installer: ../Makefile.inc is included via bsd.init.mk, no need to repeat.

14 years agoSync fetch(1) with FreeBSD.
Sascha Wildner [Sun, 10 May 2009 01:23:44 +0000 (03:23 +0200)]
Sync fetch(1) with FreeBSD.

14 years agoSync libfetch(3) with FreeBSD.
Sascha Wildner [Sun, 10 May 2009 01:23:30 +0000 (03:23 +0200)]
Sync libfetch(3) with FreeBSD.

14 years agobsd-family-tree: Sync with FreeBSD
Sascha Wildner [Sun, 10 May 2009 01:22:48 +0000 (03:22 +0200)]
bsd-family-tree: Sync with FreeBSD

14 years agosmp.4: List the SMP options in the SYNOPSIS.
Sascha Wildner [Sat, 9 May 2009 22:44:42 +0000 (00:44 +0200)]
smp.4: List the SMP options in the SYNOPSIS.

14 years agomalloc.3: Add missing section in .Xr.
Sascha Wildner [Sat, 9 May 2009 14:08:23 +0000 (16:08 +0200)]
malloc.3: Add missing section in .Xr.

14 years agoinstaller: Set WARNS to 1 for now.
Sascha Wildner [Sat, 9 May 2009 07:26:13 +0000 (09:26 +0200)]
installer: Set WARNS to 1 for now.

14 years agoinstaller: def_capacity is not used, remove it.
Sascha Wildner [Sat, 9 May 2009 06:21:50 +0000 (08:21 +0200)]
installer: def_capacity is not used, remove it.

14 years agoinstaller: Remove some unused defines.
Sascha Wildner [Sat, 9 May 2009 06:14:26 +0000 (08:14 +0200)]
installer: Remove some unused defines.

14 years agopkgsrc.7: Reference pkgsrc-wip's sourceforge URL
Sascha Wildner [Sat, 9 May 2009 19:42:08 +0000 (21:42 +0200)]
pkgsrc.7: Reference pkgsrc-wip's sourceforge URL

14 years agopkgsrc.7: mention /usr/Makefile
Sascha Wildner [Sat, 9 May 2009 19:35:53 +0000 (21:35 +0200)]
pkgsrc.7: mention /usr/Makefile

14 years agoSync the aac(4) manual page with FreeBSD RELENG_6_2.
Sascha Wildner [Fri, 8 May 2009 20:13:51 +0000 (22:13 +0200)]
Sync the aac(4) manual page with FreeBSD RELENG_6_2.

Unfortunately, the FreeBSD CVS IDs were not updated in Peter's most
recent code sync with FreeBSD. Neither was the manual page. Having
to research which state the code is in afterwards in order to choose
the correct manual page is a pain, so don't blame me if it doesn't
match the driver's current state in DragonFly 100%. :-)

Reported-by: Archimedes Gaviola <archimedes.gaviola@gmail.com>
14 years agoSwitch one shot timer, if user allows C3 state to be entered.
Sepherosa Ziehau [Fri, 8 May 2009 12:03:45 +0000 (20:03 +0800)]
Switch one shot timer, if user allows C3 state to be entered.

Snooping systimer left time and using one shot timer sleep/wake reloading
during C3 state transition does not achieve maximum powersaving effect...

14 years agoMerge branch 'master' of git://chlamydia.fs.ei.tum.de/dragonfly
Aggelos Economopoulos [Thu, 7 May 2009 20:44:49 +0000 (23:44 +0300)]
Merge branch 'master' of git://chlamydia.fs.ei.tum.de/dragonfly

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Thu, 7 May 2009 20:46:16 +0000 (13:46 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoAdd sanity check: Assert (gd_spinlocks_wr > 0) prior to decrementing it.
Matthew Dillon [Thu, 7 May 2009 20:45:34 +0000 (13:45 -0700)]
Add sanity check: Assert (gd_spinlocks_wr > 0) prior to decrementing it.

Submitted-by: Antonio Huete Jimenez <ahuete.devel@gmail.com>
14 years agokill a bit of dead code in nfs
Aggelos Economopoulos [Thu, 7 May 2009 19:12:48 +0000 (22:12 +0300)]
kill a bit of dead code in nfs

14 years agoRoll DragonFly 2.3.1 v2.3.1
Simon Schubert [Thu, 7 May 2009 07:36:22 +0000 (09:36 +0200)]
Roll DragonFly 2.3.1

14 years agoReplace Debugger() entry with a kprintf().
Matthew Dillon [Thu, 7 May 2009 03:09:35 +0000 (20:09 -0700)]
Replace Debugger() entry with a kprintf().

Reported-by: trevorjk
14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Thu, 7 May 2009 00:36:22 +0000 (17:36 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoFix O_NOFOLLOW and do not follow softlinks if O_EXCL.
Matthew Dillon [Thu, 7 May 2009 00:27:58 +0000 (17:27 -0700)]
Fix O_NOFOLLOW and do not follow softlinks if O_EXCL.

A bug in sys_open() set NLC_FOLLOW bit for the nlookup() call unconditionally.
Removing the setting allows vn_open() to properly set NLC_FOLLOW conditionally
when both O_EXCL and O_NOFOLLOW are not set.

14 years agoHAMMER VFS - Limit recursion for long directory chains, update mtime/ctime
Matthew Dillon [Thu, 7 May 2009 00:05:09 +0000 (17:05 -0700)]
HAMMER VFS - Limit recursion for long directory chains, update mtime/ctime

A long chain of directory dependencies can blow out the kernel stack.  Limit
the recursion to 20 levels.  If the depth is exceeded the flushing of the
deep inodes is delayed until the higher dependencies are taken care of.

Update mtime/ctime accordingly based on the fstest stress test from FreeBSD.
Note however that we cannot update the ctime on directories for file creates,
renames, and deletes within the directory without rolling a new inode,
which is too expensive to do for that situation.  We can, and do, update the
mtime.

14 years agofstest regression fixes - POSIX error codes.
Matthew Dillon [Wed, 6 May 2009 23:57:44 +0000 (16:57 -0700)]
fstest regression fixes - POSIX error codes.

Deal with most of the issues found by FreeBSD's fstest regression test:
    * Limit path components to 255 characters.  Return ENAMETOOLONG if
      the limit is exceeded.

    * Return EEXIST, EINVAL, and ENOTEMPTY as appropriate when the user
      attempts to create, delete, or rename "." or "..", instead of EINVAL.

    * Return EISDIR if an attempt is made to open a directory for writing,
      instead of EINVAL.

    * Return EACCES if an attempt is made to open a file O_TRUNC without
      O_RDWR or O_WRONLY, instead of silently dropping the O_TRUNC.

    * Implement O_NOFOLLOW semantics generally instead of just with O_EXCL.

Not dealt with:
    * DragonFly clears SGID AND SUID on uid or gid change, if not root.
      If root is doing the operation SGID/SUID is not cleared.

    * HAMMER cannot modify the ctime without rolling a new inode, which
      is very expensive, and does not do so when entries are added or
      removed from a directory.  mtime is modified.

14 years agoncal: specify month with -m month argument
Simon Schubert [Wed, 6 May 2009 09:28:17 +0000 (11:28 +0200)]
ncal: specify month with -m month argument

Ncal only supports specification of a month together with a year, which is
silly.  Using the -m argument, you can now specify a month in the current
year.

Obtained-from:  FreeBSD

14 years agoncal: interpret a `.' as current year
Simon Schubert [Wed, 6 May 2009 09:21:14 +0000 (11:21 +0200)]
ncal: interpret a `.' as current year

There doesn't seem to be an easy way to refer to the current year, for
instance if I wanted to show the calendar of this year's June.  Now
there is:  ncal 6 .

14 years agoncal: always generate full lines to enable today hilight in year view
Simon Schubert [Wed, 6 May 2009 09:00:23 +0000 (11:00 +0200)]
ncal: always generate full lines to enable today hilight in year view

Ncal would only fill lines up to the last day in a month and use a printf
padding later to align all output nicely (when using year view).  This
breaks when using a hilight, because the ANSI sequences consume additional
characters which are of zero print width.  Instead of letting printf do
the padding, generate padded lines ourselves.

Also avoid code duplication in the hilight code and switch on hilighting
for the year view.

14 years agoncal: hilight current day
Simon Schubert [Tue, 5 May 2009 22:27:34 +0000 (00:27 +0200)]
ncal: hilight current day

This lets ncal and cal hilight the current day in the month view, if its
output is connected to a terminal.  The year view can not yet use
highlighting.

Obtained-from: FreeBSD

14 years agoAllow USCHED_DEL_CPU for non-superuser processes
Aggelos Economopoulos [Wed, 6 May 2009 21:15:58 +0000 (00:15 +0300)]
Allow USCHED_DEL_CPU for non-superuser processes

14 years agoHAMMER VFS - Refactor merged search function to try to avoid missed entries
Matthew Dillon [Wed, 6 May 2009 20:38:22 +0000 (13:38 -0700)]
HAMMER VFS - Refactor merged search function to try to avoid missed entries

Refactor the merged B-Tree + In-Memory search function to try to avoid races
where an in-memory record is flushed to the media during a search, causing
the search to miss the record.

Add another flag to hammer_record_t to indicate that the record was deleted
because it was committed to the media (verses simply being deleted).

Better-separate HAMMER_RECF_DELETED_FE and HAMMER_RECF_DELETED_BE.  These
flags indicate whether the frontend or backend deleted an in-memory record.
The backend ignores frontend deletions that occur after the record has been
associated with a flush group.

Remove some console Warnings that are no longer applicable.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Wed, 6 May 2009 02:17:10 +0000 (19:17 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoAdd kernel-layer support for chflags checks, remove (most) from the VFS layer.
Matthew Dillon [Wed, 6 May 2009 02:14:31 +0000 (19:14 -0700)]
Add kernel-layer support for chflags checks, remove (most) from the VFS layer.

Give nlookup() and nlookup_va() the tools to do nearly all chflags related
activities.  Here are the rules:

Immutable (uchg, schg)

    If set on a directory no files associated with the directory may
    be created, deleted, linked, or renamed.  In addition, any files open()ed
    via the directory will be immutable whether they are flagged that
    way or not.

    If set on a file or directory the file or directory may not be
    written to, chmodded, chowned, chgrped, or renamed.  The file can
    still be hardlinked and the file/directory can still be chflagged.
    If you do not wish the file to be linkable then set the immutable bit
    on all directories containing a link of the file.  Once you form
    this closure no further links will be possible.

    NOTE ON REASONING:  Security scripts should check link counts anyway,
    depending on a file flag which can be changed as a replacement for
    checking the link count is stupid.  If you are secure then your closures
    will hold.  If you aren't then nothing will save you.

    This feature is not recursive.  If the directory contains
    subdirectories they must be flagged immutable as well.

Undeletable (uunlnk, sunlnk)

    If set on a file or directory that file or directory cannot be removed
    or renamed.  The file can still otherwise be manipulated, linked, and
    so forth.  However, it should be noted that any hardlinks you create
    will also not be deletable :-)

    If set on a directory this flag has no effect on the contents
    of the directory (yet).  See APPEND-ONLY on directories for what
    you want.

Append-only (uappnd/sappnd)

    If set on a directory no file within the directory may be deleted or
    renamed.  However, new files may be created in the directory and
    the files in the directory can be modified or hardlinked without
    restriction.

    If set on a file the file cannot be truncated, random-written, or
    deleted.  It CAN be chmoded, chowned, renamed, and appended to
    with O_APPEND etc.

    If you do not wish the file to be renameable then you must also
    set the Undeletable flag.  Setting the append-only flag will ensure
    that the file doesn't disappear from the filesystem, but does not
    prevent it from being moved about the filesystem.

Security fix - futimes()

    futimes() could be called on any open descriptor.  Restrict
    it to just those files you own or have write permission on.

Security fix - Hardlinks

    Users can no longer hardlink foreign-owned files which they do not
    have write access to.  The user must now have write permission on
    the file being hardlinked or the user must own the file, or be root.

Security fix - fcntl()

    fcntl() can no longer be used to turn of O_APPEND mode if the file
    was flagged append-only.

NOTE - DIFFERENCES WITH FREEBSD

    * Append-only on directories

    * Immutable on directories to control set-in-stone & hardlinking

    * Immutable files can be hardlinked on DragonFly, not on FreeBSD.

    * User must be the owner of the file or have write access to the
      file being hardlinked.

14 years agodocument kvm_open*() support for live vkernels
Aggelos Economopoulos [Tue, 5 May 2009 20:34:18 +0000 (23:34 +0300)]
document kvm_open*() support for live vkernels

14 years agodoscmd(1): Still warnings with -DNO_X. Take back WARNS to 1 for now.
Sascha Wildner [Tue, 5 May 2009 18:38:26 +0000 (20:38 +0200)]
doscmd(1): Still warnings with -DNO_X. Take back WARNS to 1 for now.

14 years agoteach libkvm about vkernels
Aggelos Economopoulos [Mon, 4 May 2009 20:19:19 +0000 (23:19 +0300)]
teach libkvm about vkernels

Add support for accessing a running vkernel's memory by
reading its /proc/$pid/mem file.

14 years agoAdd tunable to _not_ register i8254 interrupt if lapic timer is used.
Sepherosa Ziehau [Mon, 4 May 2009 11:13:23 +0000 (19:13 +0800)]
Add tunable to _not_ register i8254 interrupt if lapic timer is used.

14 years agoMake dev.cpu.X.cx_usage sysctl also report current average of sleep time.
Hasso Tepper [Mon, 4 May 2009 08:47:30 +0000 (11:47 +0300)]
Make dev.cpu.X.cx_usage sysctl also report current average of sleep time.

14 years agoRework a CPU C-state selection logic a bit.
Hasso Tepper [Mon, 4 May 2009 08:45:16 +0000 (11:45 +0300)]
Rework a CPU C-state selection logic a bit.

Avoid comparing negative signed to positive unsignad values. It was
leading to a bug, when C-state does not decrease on sleep shorter then
declared transition latency. Fixing this deprecates workaround for broken
C-states on some hardware.

By the way, change state selecting logic a bit. Instead of last sleep
time use short-time average of it. Global interrupts rate in system is a
quite random value, to corellate subsequent sleeps so directly.

Obtained-from: FreeBSD

14 years agoMove the code to update cpu_cx_count out of acpi_cpu_generic_cx_probe().
Hasso Tepper [Mon, 4 May 2009 08:43:29 +0000 (11:43 +0300)]
Move the code to update cpu_cx_count out of acpi_cpu_generic_cx_probe().

Put it into acpi_cpu_startup() which is where all the other code to update
this global variable lives.  This fixes a bug where cpu_cx_count was not
updated correctly if acpi_cpu_generic_cx_probe() returned early.

Obtained-from: FreeBSD

14 years agoacpi_cpu: fixup for PIIX4E PCI config related to C2.
Hasso Tepper [Mon, 4 May 2009 08:41:24 +0000 (11:41 +0300)]
acpi_cpu: fixup for PIIX4E PCI config related to C2.

If you have seen
cpu0: too many short sleeps, backing off to C1
with this chipset before you may want to try cx_lowest of C2 again.

Obtained-from: FreeBSD

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Mon, 4 May 2009 06:15:18 +0000 (23:15 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoThe kernel permissions check code was not checking deletability for
Matthew Dillon [Mon, 4 May 2009 06:08:19 +0000 (23:08 -0700)]
The kernel permissions check code was not checking deletability for
the rename source or the directory sticky bit for rename targets which
existed.

This only effected HAMMER which assumes the kernel is responsible for
permissions checks.

Reported-by: YONETANI Tomokazu <qhwt+dfly@les.ath.cx>
14 years agonanosleep: don't overwrite error with copyout success status
Simon Schubert [Sun, 3 May 2009 21:06:53 +0000 (23:06 +0200)]
nanosleep: don't overwrite error with copyout success status

When nanosleep gets interrupted, it returns EINTR.  In the case of a
non-zero error status, sys_nanosleep will copyout() the remaining sleep
time.  However it would overwrite the nanosleep error status with the
error status of copyout() -- which is 0 (success) most of the time.  This
means the important error status of nanosleep (EINTR) would be overwritten
by 0.  Follow FreeBSD and NetBSD and only return the copyout status if it
failed.

Reported-by: walt
14 years agoinstaller: Sync ASCII Fred with loader menu pic.
Sascha Wildner [Sun, 3 May 2009 15:39:09 +0000 (17:39 +0200)]
installer: Sync ASCII Fred with loader menu pic.

14 years agoinstaller: Move the installer from contrib/ to usr.sbin/.
Sascha Wildner [Sun, 3 May 2009 15:22:33 +0000 (17:22 +0200)]
installer: Move the installer from contrib/ to usr.sbin/.

Fix trailing whitespace while I'm doing it.

14 years agoacpi: Select proper one shot timer based on CPUs' C3 state.
Sepherosa Ziehau [Sun, 3 May 2009 08:42:11 +0000 (16:42 +0800)]
acpi: Select proper one shot timer based on CPUs' C3 state.

14 years agoAllow one shot timer to be switched on a running system between i8254 and
Sepherosa Ziehau [Sun, 3 May 2009 07:36:56 +0000 (15:36 +0800)]
Allow one shot timer to be switched on a running system between i8254 and
lapic timer:

- Always register "clk" interrupt.
- Add cputimer_intr_switch(), which could switch one shot timer between
  i8254 and lapic timer on a running system.  It could be used to select
  a proper one shot timer duing ACPI C3 transition:
  e.g. ->C3 use i8254, C3-> use lapic timer
- Add sysctl node hw.cputimer_intr_type to test cputimer_intr_switch().

14 years agohpet: Veto Sx state transition, if hpet is the sys_cputimer, since
Sepherosa Ziehau [Sun, 3 May 2009 05:53:52 +0000 (13:53 +0800)]
hpet: Veto Sx state transition, if hpet is the sys_cputimer, since
hpet is not required to function under S1-S5.  Add comment about
the reference to the related hpet standard items.

14 years agolapic timer: Improve lapic timer vector code
Sepherosa Ziehau [Sun, 3 May 2009 04:49:15 +0000 (12:49 +0800)]
lapic timer: Improve lapic timer vector code

- Check for a non-zero td->td_nest_count before allowing the processing
  to occur.  Mainly to allow interrupt thread preemption to work for
  slow interrupts
- Increment V_INTR statistic, so vm.stats.sys.v_intr shows correct value,
  i.e. 'Int' field in systat -vm

Submitted-by: dillon@
14 years agoinstaller: Deactivate "Install extra software packages" option.
Sascha Wildner [Sun, 3 May 2009 08:51:40 +0000 (10:51 +0200)]
installer: Deactivate "Install extra software packages" option.

Our installation unconditionally cpdups the CD/DVD's /usr/pkg to the
disk so this option doesn't make sense and only confused people in the
past.

Leave "Remove software packages" in, though, since it actually seems to
work.

14 years agoinstaller: Fix various issues related to MFS backed partitions.
Sascha Wildner [Sun, 3 May 2009 07:25:44 +0000 (09:25 +0200)]
installer: Fix various issues related to MFS backed partitions.

* The size of the MFS should be what the user specified, and not be
  based on slice size.

* On the fstab line, specify block and fragment size too. Softupdates
  is ignored as it doesn't seem to play nice with MFS.

* MFS backed partitions don't need to be mounted at installation time
  but the mount points have to be created anyway.

* While here, perform some minor cleanup.

14 years agoinstaller: Fix typo that prevented the creation of MFS backed partitions.
Sascha Wildner [Sat, 2 May 2009 20:42:08 +0000 (22:42 +0200)]
installer: Fix typo that prevented the creation of MFS backed partitions.

A bit late, but it was hard to spot. :)

Reported-by: Alec Berryman <alec@thened.net>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue34>

14 years agoinstaller: Remove some OpenBSD specific code.
Sascha Wildner [Sat, 2 May 2009 07:57:27 +0000 (09:57 +0200)]
installer: Remove some OpenBSD specific code.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sat, 2 May 2009 17:52:18 +0000 (10:52 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoposix_memalign.3: Add implementation notes from malloc.3
Stathis Kamperis [Sat, 2 May 2009 18:54:09 +0000 (18:54 +0000)]
posix_memalign.3: Add implementation notes from malloc.3

Reviewed-by: swildner@
14 years agoposix_memalign.3: Import manual page from FreeBSD.
Stathis Kamperis [Sat, 2 May 2009 12:30:14 +0000 (12:30 +0000)]
posix_memalign.3: Import manual page from FreeBSD.

Reviewed-by: swildner@
14 years agoFix sticky bit directory handling for deletions.
Matthew Dillon [Sat, 2 May 2009 17:49:58 +0000 (10:49 -0700)]
Fix sticky bit directory handling for deletions.

Properly check the sticky bit and disallow deletions if set on a directory
and the user doing the deletion does not own the directory or the file.

This check is now being done by the kernel layer, VFSs do not need to do
this check any more.

Reported-by: YONETANI Tomokazu <qhwt+dfly@les.ath.cx>
14 years agoUnbreak VKERNEL compile: Add missing symbol
Sepherosa Ziehau [Sat, 2 May 2009 13:59:29 +0000 (21:59 +0800)]
Unbreak VKERNEL compile: Add missing symbol

14 years agolapic timer: Correct AMD C1E handling
Sepherosa Ziehau [Sat, 2 May 2009 13:35:59 +0000 (21:35 +0800)]
lapic timer: Correct AMD C1E handling

It turns out that AMD C1E only happens after ACPI-CA module is
running, so we will have to broadcast IPI at the end of the ACPI-CA
attach to clear the C1E related bits and kick start the possible
stalled lapic timer.

Tested-with: TL-58

14 years agolapic timer: Finish the lapic timer support
Sepherosa Ziehau [Sat, 2 May 2009 09:41:23 +0000 (17:41 +0800)]
lapic timer: Finish the lapic timer support

- Add lapic_timer_process_oncpu(), which fires per-cpu systimer queue.
- Add lapic_timer_intr_reload(), which restart/start lapic timer.
- Change cputimer_intr_reload to function pointer, so it could be
  overridden when needed.  It is original cputimer_intr_reload function
  on amd64 and vkernel.  On i386, APIC initialization will set it to
  lapic_timer_intr_reload if lapic_timer_enable tunable is set to 1,
  else i8254_intr_reload (origial cputimer_intr_reload) will be used.
- If lapic_timer_enable is 1, then don't try to register "clk" interrupt
  handler at all.

As of this commit, lapic timer support is done.  It is not enabled by
default, set 'hw.lapci_timer_enable' to enable it.

14 years agolapic timer: Improve lapic timer testing
Sepherosa Ziehau [Sat, 2 May 2009 08:26:22 +0000 (16:26 +0800)]
lapic timer: Improve lapic timer testing

- Add lapic_timer_oneshot_intr_enable(), which set lapic timer into
  one shot mode and enable lapic timer interrupt.  It is called
  during per-cpu systimers initialization.
- Add lapic_timer_oneshot_quick(), which only set lapic timer's ICR

14 years agosystimer/cputimer: Add {systimer,cputimer}_intr_enable()
Sepherosa Ziehau [Sat, 2 May 2009 07:57:28 +0000 (15:57 +0800)]
systimer/cputimer: Add {systimer,cputimer}_intr_enable()

14 years agolapic timer: Add lapic timer interrupt delivery testing
Sepherosa Ziehau [Sat, 2 May 2009 07:28:50 +0000 (15:28 +0800)]
lapic timer: Add lapic timer interrupt delivery testing

14 years agolapic timer: Add necessary bits for lapic timer interrupt delivery
Sepherosa Ziehau [Sat, 2 May 2009 05:50:34 +0000 (13:50 +0800)]
lapic timer: Add necessary bits for lapic timer interrupt delivery

The implementation in ipl.s and apic_vector.s is based on our ipiq
processing.

14 years agolapic timer: Setup AP lapic timer's divisor
Sepherosa Ziehau [Sat, 2 May 2009 04:45:41 +0000 (12:45 +0800)]
lapic timer: Setup AP lapic timer's divisor

14 years agoMove sysbeepstop_ch initialization to the beginning of cpu_initclocks()
Sepherosa Ziehau [Sat, 2 May 2009 04:33:19 +0000 (12:33 +0800)]
Move sysbeepstop_ch initialization to the beginning of cpu_initclocks()

14 years agoi8254: Adjust cpu_initclocks() a little bit.
Sepherosa Ziehau [Sat, 2 May 2009 04:24:21 +0000 (12:24 +0800)]
i8254: Adjust cpu_initclocks() a little bit.

- Factor out i8254_intr_reload(), and use it in cpu_initclocks()
- In i8254 interrupt delivery testing, add assertion to make sure
  that the current sys_cputimer is i8254

14 years agoclocks.7: Mention HPET cpu timer.
Stathis Kamperis [Sat, 2 May 2009 11:23:25 +0000 (11:23 +0000)]
clocks.7: Mention HPET cpu timer.

Based on the commit message of bea6e27816f976132ff7ad7446c0e90406378f9b.
Also, replace .Sy macros with .Va when refering to sysctl variables.

Discussed-with: sephe@
Reviewed-by: swildner@
14 years agoRaise some WARNS in usr.bin.
Sascha Wildner [Fri, 1 May 2009 22:20:25 +0000 (00:20 +0200)]
Raise some WARNS in usr.bin.

14 years agodoscmd(1): Raise WARNS to 6 and silence all warnings.
Sascha Wildner [Fri, 1 May 2009 20:00:12 +0000 (22:00 +0200)]
doscmd(1): Raise WARNS to 6 and silence all warnings.

14 years agoclocks(7): tsc frequency is found with hw.tsc_frequency now
Stathis Kamperis [Fri, 1 May 2009 21:50:58 +0000 (21:50 +0000)]
clocks(7): tsc frequency is found with hw.tsc_frequency now

Also mention hw.tsc_present sysctl for determining its presence.

14 years agolapic timer: Reimplement set_apic_timer using lapic_timer_oneshot
Sepherosa Ziehau [Fri, 1 May 2009 10:18:42 +0000 (18:18 +0800)]
lapic timer: Reimplement set_apic_timer using lapic_timer_oneshot

14 years agoRemove dead apic timer code.
Sepherosa Ziehau [Fri, 1 May 2009 09:48:30 +0000 (17:48 +0800)]
Remove dead apic timer code.

14 years agolapic timer: Disable C1 Enhanced mode on AMD K8 Family Revision F
Sepherosa Ziehau [Fri, 1 May 2009 09:14:58 +0000 (17:14 +0800)]
lapic timer: Disable C1 Enhanced mode on AMD K8 Family Revision F
and above to keep local APIC timer alive.

Obtained-from: FreeBSD (ariff@freebsd.org)
See-also: FreeBSD PR i386/104678

14 years agolapic timer: Save lapic timer frequency
Sepherosa Ziehau [Fri, 1 May 2009 08:55:35 +0000 (16:55 +0800)]
lapic timer: Save lapic timer frequency

14 years agolapic timer: Add lapic timer calibration code.
Sepherosa Ziehau [Fri, 1 May 2009 07:00:31 +0000 (15:00 +0800)]
lapic timer: Add lapic timer calibration code.

The calibrated information is not used yet.

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

14 years agohpet: Bark loud if 1024B hpet register space couldn't be mapped
Sepherosa Ziehau [Fri, 1 May 2009 04:48:10 +0000 (12:48 +0800)]
hpet: Bark loud if 1024B hpet register space couldn't be mapped

14 years agoPrepare lapic timer: Patch the hardware bug in nForce2 chipset,
Sepherosa Ziehau [Fri, 1 May 2009 04:26:05 +0000 (12:26 +0800)]
Prepare lapic timer: Patch the hardware bug in nForce2 chipset,
which could hang the lapic timer.

"Workaround a hang on some nForce2 systems that can happen if the
 CPU goes into and out of the halt state very quickly."

Obtained-from: FreeBSD rev158881
See-also: FreeBSD PR i386/97785

14 years agoacpi_timer: Timer name change.
Sepherosa Ziehau [Fri, 1 May 2009 03:59:57 +0000 (11:59 +0800)]
acpi_timer: Timer name change.

ACPI-safe   -- 32bit counter
ACPI-safe24 -- 24bit counter

14 years agoFix comment
Sepherosa Ziehau [Fri, 1 May 2009 02:46:24 +0000 (10:46 +0800)]
Fix comment

14 years agoacpi.4: Add debug.acpi.enabled; mention hpet there
Sepherosa Ziehau [Fri, 1 May 2009 02:39:28 +0000 (10:39 +0800)]
acpi.4: Add debug.acpi.enabled; mention hpet there

14 years agoktrdump: ignore ts=0 when searching for earliest_ts()
Simon Schubert [Thu, 30 Apr 2009 10:59:47 +0000 (12:59 +0200)]
ktrdump: ignore ts=0 when searching for earliest_ts()

When merge-printing multiple cpu buffers, we already treat ts=0 as
a condition to prefer a more recent entry.  However when searching for
the first entry, ts=0 (empty) will be treated regularly.  This can lead
to a situation that ktrdump would only print entries from the last CPU:

Assume you had 4 CPUs, and the buffer for CPU #2 and #3 started out with
empty entries (which would not be ignored by earliest_ts()).  When
searching for the next entry, the empty (ts=0) entry of CPU #2 would
always be selected as the first entry.  However a ts=0 entry of CPU #3
would override this.  In this case only the index of CPU #3 would
advance until full entries would be printed.  Once in this situation,
processing the ts of CPU #2 would always reset ts to 0, and this would
be treated as "not found" when processing CPU #3's entries, leading to
an output that only contains CPU #3 entries.

14 years agomalloc(3) manual page: Adjust to our new malloc() implementation.
Sascha Wildner [Thu, 30 Apr 2009 10:56:08 +0000 (12:56 +0200)]
malloc(3) manual page: Adjust to our new malloc() implementation.

The "IMPLEMENTATION NOTES" section was submitted by Matt Dillon.

14 years agonmalloc - Further optimize posix_memalign()
Matthew Dillon [Thu, 30 Apr 2009 03:07:07 +0000 (20:07 -0700)]
nmalloc - Further optimize posix_memalign()

Align the requested size to the nearest alignment to improve our chances
of coming up with a power-of-2.

Greatly improve the fitting algorithm for oddly sized requests, e.g.

(1) 32 byte alignment on a 1026 size.  In this case the zone for 1026
    already has a chunking (128) that exceeds the requested alignment,
    so we just do a _slaballoc().

(2) A 256 byte alignment on a 513 byte size.  In this case the zone
    for 513 has a chunking of 64, which is not sufficient, so we
    find the nearest power-of-2 >= 513 and allocate that.  In our
    case we would find 1024.  Since _slaballoc() guarantees that
    power-of-2 allocations within the zone limit will be on the
    same-sized boundary, we then just allocate the nearest power of 2.

14 years agoHAMMER Utility: Update mirror-dump, mirror-read to reflect protocol changes.
Matthew Dillon [Wed, 29 Apr 2009 22:44:14 +0000 (15:44 -0700)]
HAMMER Utility: Update mirror-dump, mirror-read to reflect protocol changes.

The mirror-dump command now ignores PFSD records instead of complaining
and aborting.

The mirror-read command now includes handling for CRC-errored records.

14 years agoHAMMER VFS - Better CRC handling, bad-file handling.
Matthew Dillon [Wed, 29 Apr 2009 22:34:59 +0000 (15:34 -0700)]
HAMMER VFS - Better CRC handling, bad-file handling.

Data CRC errors should now generate EIO instead of panic()ing the system.
B-Tree CRC errors might still panic() and freemap CRC errors WILL still
panic().

Continuing from DDB on a B-Tree node CRC error when debugging is enabled
now no longer marks the B-Tree node as good.

The mirror-read command will now transfer data records with bad CRCs
instead of aborting the transfer, identifying them with a new type field.
The mirror-write ioctl currently ignores such records.

If a directory entry is encountered and the related inode cannot be
looked up, generate a dummy in-memory inode of type FIFO to placemark
the bad directory entry, allowing it to be removed.  Currently it is
possible for a directory entry to be synced to the media in a different
transaction then the related inode (a bug which needs to be fixed).
If a crash occurs at the wrong time the recovery code can leave the media
in a state where the directory entry exists but the inode does not.  This
change allows the bad directory entry to be removed.

Reported-by: Antonio Huete Jimenez
14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Wed, 29 Apr 2009 17:38:19 +0000 (10:38 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoAs per POSIX, unconstify if_name in <net/if.h>.
Sascha Wildner [Wed, 29 Apr 2009 15:36:13 +0000 (17:36 +0200)]
As per POSIX, unconstify if_name in <net/if.h>.

14 years agoAdd HPET cputimer.
Sepherosa Ziehau [Wed, 29 Apr 2009 14:27:27 +0000 (22:27 +0800)]
Add HPET cputimer.

HPET - High Precision Event Timers.  Only main counter is used
currently.  This cputimer should be faster than ACPI-fast24 and
ACPI-safe, so give it highest priority.

HPET is not enabled by default.  You could add "hpet" to
debug.acpi.enabled to enable it.

Obtained-from: FreeBSD
Submitted-by: Dmitry Komissaroff <aunoor@gmail.com> w/ mod from me
Local change:
Try mapping 0x100 bytes HPET register space, if broken ACPI tables
are encountered (like one of my testing box); 0x100 is large enough
to cover the main counter.

14 years agoSplit out core kern_clock_*() calls for the clock_*() system calls.
Matthew Dillon [Wed, 29 Apr 2009 01:28:56 +0000 (18:28 -0700)]
Split out core kern_clock_*() calls for the clock_*() system calls.

Submitted-by: Mohd Farid Kamarudin <mokamaru@gmail.com>
14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Tue, 28 Apr 2009 23:52:31 +0000 (16:52 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoFix short allocation in libc RTLD for static-compiled programs.
Matthew Dillon [Tue, 28 Apr 2009 23:49:30 +0000 (16:49 -0700)]
Fix short allocation in libc RTLD for static-compiled programs.

libc's __libc_allocate_tls() (weakly bound to _rtld_allocate_tls()) was not
allocating enough space for the TLS segments in statically-compiled
threaded applications.

The old malloc allocated lots of extra space and masked the bug.  The new
slab malloc doesn't and revealed the bug.

Reproduced-by: Sepherosa Ziehau <sepherosa@gmail.com>
14 years agoktrdump: remove debug output
Simon Schubert [Tue, 28 Apr 2009 18:24:23 +0000 (20:24 +0200)]
ktrdump: remove debug output

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Tue, 28 Apr 2009 16:34:46 +0000 (09:34 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoAdd posix_memalign(), fix minor bug in nmalloc.
Matthew Dillon [Tue, 28 Apr 2009 16:30:10 +0000 (09:30 -0700)]
Add posix_memalign(), fix minor bug in nmalloc.

Add the posix_memalign() function in all of its glory.  Our new slab
allocator already does most of the job perfectly, particularly when
alignment < size (for things like cache-line aligned allocations).

Correct a bug in _vmem_alloc() for the case where (size) is much larger
then (alignment).  The hack to get mmap() to return an aligned address
was not properly unmapping temporarily-mapped space.

Reformulate how errno is set to support posix_memalign(), which is defined
by the standard to return the error rather then set errno.

Requested-by: Hasso Tepper <hasso@estpak.ee>
14 years agoemx(4): __cachealign struct emx_rxdata
Sepherosa Ziehau [Tue, 28 Apr 2009 15:03:37 +0000 (23:03 +0800)]
emx(4): __cachealign struct emx_rxdata

14 years agoserializer: Revoke PROFILE_SERIALIZER kernel option
Sepherosa Ziehau [Tue, 28 Apr 2009 13:46:49 +0000 (21:46 +0800)]
serializer: Revoke PROFILE_SERIALIZER kernel option

This kernel is added by me to do preliminary serializer contention
profiling.  It is kinda invasive and expands struct lwkt_serialize
considerably.  Need to find a better way...