dragonfly.git
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 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.

15 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>
15 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

15 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>
15 years agoktrdump: remove debug output
Simon Schubert [Tue, 28 Apr 2009 18:24:23 +0000 (20:24 +0200)]
ktrdump: remove debug output

15 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

15 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>
15 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

15 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...

15 years agoRemove unneeded .Pp before .Rs in various manual pages.
Sascha Wildner [Tue, 28 Apr 2009 13:02:19 +0000 (15:02 +0200)]
Remove unneeded .Pp before .Rs in various manual pages.

15 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Tue, 28 Apr 2009 05:28:56 +0000 (22:28 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

15 years agoFix type-o, the file $syscompatdcldf12 file was not being properly touched.
Matthew Dillon [Tue, 28 Apr 2009 03:44:04 +0000 (20:44 -0700)]
Fix type-o, the file $syscompatdcldf12 file was not being properly touched.

Submitted-by: Mohd Farid Kamarudin <mokamaru@gmail.com>
15 years agoSync zoneinfo database with tzdata2009g from elsie.
Sascha Wildner [Mon, 27 Apr 2009 18:19:43 +0000 (20:19 +0200)]
Sync zoneinfo database with tzdata2009g from elsie.

africa:         8.18 -> 8.19

Due to Ramadan shifting through the Gregorian calendar it will end before
the fourth Thursday in September in 2009 and the next couple of years, so
Egypt is expected to end DST on the last Thursday in September.

15 years agoifpoll: Unbreak UP LINT building
Sepherosa Ziehau [Mon, 27 Apr 2009 13:15:50 +0000 (21:15 +0800)]
ifpoll: Unbreak UP LINT building

15 years agoAdd IFPOLL_ENABLE to LINT
Sepherosa Ziehau [Mon, 27 Apr 2009 12:25:10 +0000 (20:25 +0800)]
Add IFPOLL_ENABLE to LINT

15 years agoemx(4): If error happens, we must hold all of the serializers instead
Sepherosa Ziehau [Mon, 27 Apr 2009 12:22:25 +0000 (20:22 +0800)]
emx(4): If error happens, we must hold all of the serializers instead
of trying to hold them, since the register content changes upon next
call.

15 years agoifpoll: Fix comment
Sepherosa Ziehau [Mon, 27 Apr 2009 12:15:42 +0000 (20:15 +0800)]
ifpoll: Fix comment

15 years agoifpoll: Reorganize TX/RX polling sysctl tree
Sepherosa Ziehau [Mon, 27 Apr 2009 11:08:01 +0000 (19:08 +0800)]
ifpoll: Reorganize TX/RX polling sysctl tree

15 years agoifpoll: Use rdtsc() whenever possible to calculate time related states.
Sepherosa Ziehau [Sun, 26 Apr 2009 12:05:13 +0000 (20:05 +0800)]
ifpoll: Use rdtsc() whenever possible to calculate time related states.

15 years agoifpoll: Expose kernel time fraction; currenly for debugging only.
Sepherosa Ziehau [Sun, 26 Apr 2009 11:05:31 +0000 (19:05 +0800)]
ifpoll: Expose kernel time fraction; currenly for debugging only.

15 years agoifpoll: Put pollmore under crit section
Sepherosa Ziehau [Sun, 26 Apr 2009 06:42:56 +0000 (14:42 +0800)]
ifpoll: Put pollmore under crit section

15 years agoifpoll: crit_{enter,exit}() -> crit_{enter,exit}_gd()
Sepherosa Ziehau [Sun, 26 Apr 2009 06:12:47 +0000 (14:12 +0800)]
ifpoll: crit_{enter,exit}() -> crit_{enter,exit}_gd()

15 years agoifpoll: Let callers of sched_* enter/exit crit section
Sepherosa Ziehau [Sun, 26 Apr 2009 06:01:56 +0000 (14:01 +0800)]
ifpoll: Let callers of sched_* enter/exit crit section

15 years agoifpoll: Put iteration of polling handlers under crit section.
Sepherosa Ziehau [Sun, 26 Apr 2009 05:13:28 +0000 (13:13 +0800)]
ifpoll: Put iteration of polling handlers under crit section.

15 years agoAdd ifpoll, which support hardware TX/RX queues based polling.
Sepherosa Ziehau [Sun, 26 Apr 2009 03:04:18 +0000 (11:04 +0800)]
Add ifpoll, which support hardware TX/RX queues based polling.
The implementation is mainly based on the polling(4) code.

Difference to the polling(4):
- Instead of registering one polling handler for both TX/RX and status,
  drivers could register multiple polling handlers for TX/RX polling
  handler on different CPU based on its own needs.  And drivers could
  register one status check handler, which is always polled on CPU0.
- TX could be polled at lower frequency than RX; normally we don't
  need high frequency polling for TX, but for RX, we may need relative
  higher polling frequency.
- Better serializer integration.

ifnet changes:
- ifnet.if_qpoll is added, which should be implemented by driver which
  supports ifpoll.
- IFF_NPOLLING is added to indicate that the driver is using ifpoll.

ifconfig(8):
- Add 'npolling' and '-npolling'; they are used to turn on/off ifpoll
  on the specified interface.

Drivers:
- emx(4) is converted to use the ifpoll.  Coexistance of ifpoll and
  polling(4) in one driver requires extra effort in driver itself;
  drop polling(4) support in emx(4) for now.

IFPOLL_ENABLE kernel option is added, which is not enabled by default.

15 years agoUse STDERR_FILENO for stderr messages.
Hasso Tepper [Mon, 27 Apr 2009 03:28:55 +0000 (06:28 +0300)]
Use STDERR_FILENO for stderr messages.

15 years agoFix recursive lock in detached close of /dev/tty.
Matthew Dillon [Sun, 26 Apr 2009 19:26:16 +0000 (12:26 -0700)]
Fix recursive lock in detached close of /dev/tty.

A recursive lock and vp-held-after-release issue when close()ing a /dev/tty
descriptor was resulting in a panic.

Reported-by: Hasso Tepper <hasso@estpak.ee>
15 years agoUse MAP_TRYFIXED instead of MAP_FIXED when mapping the red zone.
Matthew Dillon [Sat, 25 Apr 2009 18:43:15 +0000 (11:43 -0700)]
Use MAP_TRYFIXED instead of MAP_FIXED when mapping the red zone.

We want to fail if the user program already faulted through the zone,
though in reality the red zone init occurs before main() is even run so
there is no practical difference.

15 years agoAdd cpdup feature - allow uid/gid/flags changes to fail if running as user
Matthew Dillon [Sat, 25 Apr 2009 18:39:45 +0000 (11:39 -0700)]
Add cpdup feature - allow uid/gid/flags changes to fail if running as user

If running as a user instead of root uid, gid, and flags changes are allowed
to fail and also, if running as a user, no longer force a copy if they
differ but the mtime and size are the same.  Generate a single warning
instead.

Reorder the call to setutimes to occur after chown/chmod instead of before,
and to occur after a chflags call if IMMUTABLE is not set.

15 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Sat, 25 Apr 2009 17:42:30 +0000 (10:42 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

15 years agoFix an installworld failure due to kernel fixes and a libthread_xu issue.
Matthew Dillon [Sat, 25 Apr 2009 17:36:03 +0000 (10:36 -0700)]
Fix an installworld failure due to kernel fixes and a libthread_xu issue.

Build the bootstrap version of cpdup without threading to work around a
bug in libthread_xu.  Libthread_xu was trying to map the original user
stack's red zone without using MAP_FIXED or MAP_TRYFIXED or MAP_STACK,
a behavior which the kernel now prohibits.

This fixes running installworld after rebooting with a new kernel.

Sepherosa Ziehau <sepherosa@gmail.com>

15 years agopktgenctl: Update according to recent libc changes
Sepherosa Ziehau [Sat, 25 Apr 2009 11:40:24 +0000 (19:40 +0800)]
pktgenctl: Update according to recent libc changes

15 years agoAdd a dummy offset to the arrays generated by genassym to avoid ary[0]
Matthew Dillon [Sat, 25 Apr 2009 00:11:10 +0000 (17:11 -0700)]
Add a dummy offset to the arrays generated by genassym to avoid ary[0]

The dummy offset avoids the generation of dummy arrays of size zero.
This whole code path is a hack, but after a lot of messing around
Alex and I determined that it was easier to hack it then to try to
redo the code due to complications introduced by cross-compiled
environments.

Submitted-by: Alex Hornung <ahornung@gmail.com>
15 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Fri, 24 Apr 2009 19:23:31 +0000 (12:23 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

15 years agoFix the backslashes in a __asm line's interference with an #ifdef
Matthew Dillon [Fri, 24 Apr 2009 19:21:49 +0000 (12:21 -0700)]
Fix the backslashes in a __asm line's interference with an #ifdef

Reported-by: Hasso Tepper
15 years agoNo barriers and spinlocks.
Hasso Tepper [Fri, 24 Apr 2009 18:59:40 +0000 (21:59 +0300)]
No barriers and spinlocks.

15 years agoWe don't support barriers and spinlocks yet.
Hasso Tepper [Fri, 24 Apr 2009 18:30:36 +0000 (21:30 +0300)]
We don't support barriers and spinlocks yet.

Fixes a lot of problems with thirdparty software.

15 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Fri, 24 Apr 2009 17:21:45 +0000 (10:21 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

15 years agoFix various clang compile issues
Alex [Fri, 24 Apr 2009 12:54:22 +0000 (13:54 +0100)]
Fix various clang compile issues

1) remove uses of __label__, which is not supported by llvm/clang
2) remove uses of register type var __asm("ecx") and other variable
register-binding as it is not supported by llvm/clang and is superfluous
3) add an ugly hack, conditionalized on __clang__, to allow correct
compilation of atomic_intr_cond_try()

Submitted-by: Alex Hornung
Cherry-Picked-From: Alex Hornung's leaf repo

15 years agounvis(3) manual page: s/RFCxxxx/RFC xxxx/
Sascha Wildner [Fri, 24 Apr 2009 06:47:11 +0000 (08:47 +0200)]
unvis(3) manual page: s/RFCxxxx/RFC xxxx/

15 years agoypclient(3) manual page: .Pp not needed here.
Sascha Wildner [Fri, 24 Apr 2009 06:46:44 +0000 (08:46 +0200)]
ypclient(3) manual page: .Pp not needed here.

15 years agoDon't call vm_map_findspace() when MAP_TRYFIXED is specified.
Matthew Dillon [Thu, 23 Apr 2009 22:18:10 +0000 (15:18 -0700)]
Don't call vm_map_findspace() when MAP_TRYFIXED is specified.

MAP_TRYFIXED is intended to return the requested address or an error.

15 years agoFix logic when using the umtx_*_err() functions. With these functions
Matthew Dillon [Thu, 23 Apr 2009 22:16:51 +0000 (15:16 -0700)]
Fix logic when using the umtx_*_err() functions.  With these functions
a positive error value is returned, not -1.

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

15 years agoMake adjustments to how MAP_STACK works to prevent improper mmap()s.
Matthew Dillon [Thu, 23 Apr 2009 21:41:28 +0000 (14:41 -0700)]
Make adjustments to how MAP_STACK works to prevent improper mmap()s.

Record that a vm_map_entry is a stack mapping.  When locating free space
do not allow non-MAP_STACK mappings to use space reserved by MAP_STACK
mappings, unless MAP_FIXED is used of course.

Previously MAP_STACK mappings implied MAP_FIXED, which is not how they are
supposed to work.  Implement proper hinting without MAP_FIXED.

Do not allow a normal mmap() call to use space reserved by a MAP_STACK
mapping (unless MAP_FIXED is used of course).

The proper method of making a MAP_STACK mapping inside another MAP_STACK
mapping is to use MAP_STACK | MAP_TRYFIXED.  For now, though, we silently
imply MAP_TRYFIXED when MAP_STACK is specified and it will work without it.

Document MAP_TRYFIXED and make it also relax additional requirements imposed
by MAP_STACK mappings inside of MAP_STACK mappings.

Adjust libthread_xu to use MAP_STACK | MAP_TRYFIXED.

15 years agocxm(4): Fix a crash by warning if no firmware is compiled in.
Sascha Wildner [Thu, 23 Apr 2009 20:38:03 +0000 (22:38 +0200)]
cxm(4): Fix a crash by warning if no firmware is compiled in.

15 years agoFix libthread_xu's use of MAP_STACK. Guards were not being setup properly.
Matthew Dillon [Thu, 23 Apr 2009 20:05:24 +0000 (13:05 -0700)]
Fix libthread_xu's use of MAP_STACK.  Guards were not being setup properly.

MAP_STACK mappings do not immediately extend down to their base, so calling
mprotect() on the base is basically a NOP.  Instead of calling mprotect() we
call mmap() with MAP_FIXED to force the guard.

Properly use MAP_FIXED when setting up the primary guard on the original
user stack.  The address specified in the mmap() is only a hint when MAP_FIXED
is not used, and will not properly map the anonymous area.  Also, new kernels
do not allow non-MAP_STACK mappings to override MAP_STACK mappings and the
user stack area is a MAP_STACK mapping, so use of MAP_FIXED is mandatory here.

15 years agoAdd a definition for POSIX.1-2008 to mdoc.local (from FreeBSD).
Sascha Wildner [Thu, 23 Apr 2009 19:46:34 +0000 (21:46 +0200)]
Add a definition for POSIX.1-2008 to mdoc.local (from FreeBSD).

15 years agoAdd missing files from umtx errno fixes commit.
Matthew Dillon [Thu, 23 Apr 2009 19:14:30 +0000 (12:14 -0700)]
Add missing files from umtx errno fixes commit.

15 years agoFix VM panic. Add required overflow check for MAP_STACK and MAP_FIXED mmaps
Matthew Dillon [Thu, 23 Apr 2009 18:54:47 +0000 (11:54 -0700)]
Fix VM panic.  Add required overflow check for MAP_STACK and MAP_FIXED mmaps

Certain mmap() calls were not properly checking that (addr + size) does not
overflow, causing a kernel panic.

Reported-by: Alex Hornung <ahornung@gmail.com>
15 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Thu, 23 Apr 2009 17:35:47 +0000 (10:35 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

15 years agoFix an errno leak in libthread_xu's calls to umtx.
Matthew Dillon [Thu, 23 Apr 2009 17:34:34 +0000 (10:34 -0700)]
Fix an errno leak in libthread_xu's calls to umtx.

Add a syscall entry point that returns errno instead of loading the
errno variable and use it to make umtx calls deep in libthread_xu,
avoiding the whole errno issue and fixing the leak.

Submitted-by: Alex Hornung
15 years agoAdd fpsetsticky() documentation (from NetBSD).
Sascha Wildner [Thu, 23 Apr 2009 08:59:46 +0000 (10:59 +0200)]
Add fpsetsticky() documentation (from NetBSD).

15 years agoAdd xdr_int64_t()/xdr_u_int64_t() documentation (from OpenBSD).
Sascha Wildner [Thu, 23 Apr 2009 08:58:23 +0000 (10:58 +0200)]
Add xdr_int64_t()/xdr_u_int64_t() documentation (from OpenBSD).

15 years agoAdd strnlen()/wcsnlen() documentation (from FreeBSD).
Sascha Wildner [Thu, 23 Apr 2009 08:56:48 +0000 (10:56 +0200)]
Add strnlen()/wcsnlen() documentation (from FreeBSD).

15 years agoAdd wcstof()/wcstold() documentation (from NetBSD).
Sascha Wildner [Thu, 23 Apr 2009 08:55:46 +0000 (10:55 +0200)]
Add wcstof()/wcstold() documentation (from NetBSD).

15 years agoAdd strunvisx() documentation (from FreeBSD).
Sascha Wildner [Thu, 23 Apr 2009 08:54:34 +0000 (10:54 +0200)]
Add strunvisx() documentation (from FreeBSD).

15 years agoBring in ypclnt(3) manual page (from NetBSD).
Sascha Wildner [Thu, 23 Apr 2009 08:53:13 +0000 (10:53 +0200)]
Bring in ypclnt(3) manual page (from NetBSD).

15 years agoFreeBSD-SA-09:05.telnet - fix environment based code execution vulnerability
Matthew Dillon [Thu, 23 Apr 2009 00:57:21 +0000 (17:57 -0700)]
FreeBSD-SA-09:05.telnet - fix environment based code execution vulnerability

15 years agoApply FreeBSD-SA-09:07.libc - fix information leak in db(3)
Matthew Dillon [Wed, 22 Apr 2009 23:09:06 +0000 (16:09 -0700)]
Apply FreeBSD-SA-09:07.libc - fix information leak in db(3)

Obtained-from: FreeBSD

15 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Wed, 22 Apr 2009 21:51:29 +0000 (14:51 -0700)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

15 years agoIncrease the number of internal spinlocks available to libc from 20 to 128
Matthew Dillon [Wed, 22 Apr 2009 21:50:37 +0000 (14:50 -0700)]
Increase the number of internal spinlocks available to libc from 20 to 128

Fix an issue where the new malloc wants to use more internal spinlocks
then libthread_xu declares.

15 years agoFix a bug in krealloc(). Note that krealloc() is very rarely used.
Matthew Dillon [Wed, 22 Apr 2009 20:04:23 +0000 (13:04 -0700)]
Fix a bug in krealloc().  Note that krealloc() is very rarely used.

krealloc() was improperly calling zoneindex() when transitioning from
zone-controlled memory to non-zone-controlled (big) memory.

15 years agoFix vkernel issues - enable ithread preemption, races, and more.
Matthew Dillon [Wed, 22 Apr 2009 19:56:37 +0000 (12:56 -0700)]
Fix vkernel issues - enable ithread preemption, races, and more.

signalintr() was improperly entering a critical section, preventing
sched_ithd() from being able to preempt the current thread.  Adjust
so the code matches the pc32 code.

lwp0 was being assigned cpu_heavy_switch instead of cpu_lwkt_switch,
which works fine on pc32 but blows up the vkernel if process 0 gets
preempted, because vkernel LWKT processes are not assigned vmspaces.
Properly use cpu_lwkt_switch() to fix the problem.

We were not checking for pending reschedule requests when the
vmspace_ctl() call got interrupted by a signal.  NOTE:  There is
still a race after the check prior to re-entry into vmspace_ctl()
which needs to be closed.

Tracked-down-by: corecode, dillon
15 years agoReplace the old BSD malloc code with a port of our slab allocator.
Matthew Dillon [Wed, 22 Apr 2009 19:18:07 +0000 (12:18 -0700)]
Replace the old BSD malloc code with a port of our slab allocator.

This should give us a better base with which we can work up a
more thread-friendly user malloc.  Buildworld performance is about
the same (just slightly faster).  malloc performance is about twice as
fast as the original.

15 years agotcp/ip4 mapped address: Add tcp6_soport()
Sepherosa Ziehau [Wed, 22 Apr 2009 13:49:40 +0000 (21:49 +0800)]
tcp/ip4 mapped address: Add tcp6_soport()

For IPv6 v6 only address or inp's address family is not known yet,
e.g. before connect(2) is called on the INET6 socket, this function
acts exactly the same as cpu0_soport() (the soport function before
this commit).  If a INET6 socket is connected to IPv4 mapped address,
then this function simply falls back to tcp_soport().

15 years agotcp/ipv4 mapped address: Make sure that tcp_output is done on inpcb's owner CPU
Sepherosa Ziehau [Wed, 22 Apr 2009 12:54:12 +0000 (20:54 +0800)]
tcp/ipv4 mapped address: Make sure that tcp_output is done on inpcb's owner CPU

15 years agotcp_timer: Add assertion to make sure that tcp timers are only accessed
Sepherosa Ziehau [Tue, 21 Apr 2009 14:09:24 +0000 (22:09 +0800)]
tcp_timer: Add assertion to make sure that tcp timers are only accessed
on their pcb's owner CPU