dragonfly.git
4 years agouipc: Fix lockless unp_conn accessing and uipc_detach() race.
Sepherosa Ziehau [Wed, 26 Aug 2015 12:32:03 +0000 (20:32 +0800)]
uipc: Fix lockless unp_conn accessing and uipc_detach() race.

           THREAD1                         THREAD2

  uipc_send(unp)                    uipc_detach(unp2)
  {                                 {
    lock(unp);                        unp_free(unp2)
    unp2 = unp->unp_conn;             {
      :                                 /* unp2 ref is 0 */
    unp_reference(unp2);                unp_detach(unp2); (***)
    /* unp2 ref is 1 */               }
      :                             }
    unp_free(unp2)                            :
    {                                         :
       /* unp2 ref is 0 */                    :
       unp_detach(unp2); (***)                :
    }                                         :
    unlock(unp);                              :
  }                                           :

Two calls of unp_detach() on unp2!

To fix this race, we drop all connections before calling unp_free()
on uipc_detach() and uipc_abort() path.

4 years agouipc: Assert global token is held in unp_connect_pair
Sepherosa Ziehau [Wed, 26 Aug 2015 12:31:37 +0000 (20:31 +0800)]
uipc: Assert global token is held in unp_connect_pair

4 years agoregex.3: Add LIBRARY section.
Sascha Wildner [Wed, 26 Aug 2015 16:32:01 +0000 (18:32 +0200)]
regex.3: Add LIBRARY section.

4 years agouipc: Return error from unp_connect_pair() if one of unps is not attached
Sepherosa Ziehau [Tue, 25 Aug 2015 15:12:42 +0000 (23:12 +0800)]
uipc: Return error from unp_connect_pair() if one of unps is not attached

4 years agouipc: Don't abuse unp_conn for unconnect DGRAM unix sockets.
Sepherosa Ziehau [Tue, 25 Aug 2015 14:06:57 +0000 (22:06 +0800)]
uipc: Don't abuse unp_conn for unconnect DGRAM unix sockets.

Use unp_find_lockref() to located the target unp instead.

4 years agouipc: Fix various races on unp_connect() path.
Sepherosa Ziehau [Tue, 25 Aug 2015 14:05:14 +0000 (22:05 +0800)]
uipc: Fix various races on unp_connect() path.

And factor out unp_find_lockref(), which will be used to avoid
abusing unpcb.unp_conn on uipc_send() for unconnected DGRAM
unix sockets.

4 years agokernel: Sync sys/conf/files with recent drm(4) and radeonkms(4) updates.
Sascha Wildner [Tue, 25 Aug 2015 17:38:46 +0000 (19:38 +0200)]
kernel: Sync sys/conf/files with recent drm(4) and radeonkms(4) updates.

This fixes building drm into the kernel.

4 years agodrm: Make the hlist API compatible with Linux 3.17
François Tigeot [Tue, 25 Aug 2015 11:45:44 +0000 (13:45 +0200)]
drm: Make the hlist API compatible with Linux 3.17

* Replace hlist_add_after_rcu by hlist_add_behind_rcu

* hlist_for_each_entry() now only uses 3 arguments

4 years agokernel/linux: Add hweight64()
François Tigeot [Tue, 25 Aug 2015 05:32:42 +0000 (07:32 +0200)]
kernel/linux: Add hweight64()

4 years agokernel: Add bitcount64 to sys/systm.h
François Tigeot [Tue, 25 Aug 2015 05:15:27 +0000 (07:15 +0200)]
kernel: Add bitcount64 to sys/systm.h

Obtained-from: FreeBSD

4 years agouipc: Use flag to indicate that the unpcb was detached/aborted.
Sepherosa Ziehau [Mon, 24 Aug 2015 14:02:20 +0000 (22:02 +0800)]
uipc: Use flag to indicate that the unpcb was detached/aborted.

Since unpcb detach (so->so_pcb set to NULL) could be delayed by
extra references, we use a flag to indicate that the unpcb was
detached/aborted.  And hold per-unpcb token in uipc_detach() and
uipc_abort(), since this flag is also checked in other uipc_userreq
methods, e.g. uipc_send().

This commit makes uipc_abort() reentrant.

4 years agouipc: Use atomic operation for unp_flags
Sepherosa Ziehau [Mon, 24 Aug 2015 13:52:18 +0000 (21:52 +0800)]
uipc: Use atomic operation for unp_flags

4 years agosort.1: Clean up mdoc.
Sascha Wildner [Mon, 24 Aug 2015 18:15:15 +0000 (20:15 +0200)]
sort.1: Clean up mdoc.

While here, set WITHOUT_NLS in the Makefile.

4 years agotcpdrop.8: Remove unneeded .Nm arguments.
Sascha Wildner [Mon, 24 Aug 2015 18:01:18 +0000 (20:01 +0200)]
tcpdrop.8: Remove unneeded .Nm arguments.

4 years agoSort SEE ALSO in various manual pages.
Sascha Wildner [Mon, 24 Aug 2015 16:59:03 +0000 (18:59 +0200)]
Sort SEE ALSO in various manual pages.

4 years agomdoc.local: Add 4.0 version so it can be used in manpages (procctl(2)).
Sascha Wildner [Mon, 24 Aug 2015 16:58:30 +0000 (18:58 +0200)]
mdoc.local: Add 4.0 version so it can be used in manpages (procctl(2)).

This is one of the rare cases where a new feature appeared "first" in
a release (i.e. was MFC'd).

4 years agoAdd MLINKS for 3 kernel functions documented on the led(4) manpage.
Sascha Wildner [Mon, 24 Aug 2015 16:56:46 +0000 (18:56 +0200)]
Add MLINKS for 3 kernel functions documented on the led(4) manpage.

4 years agolibusbhid: Add missing MLINK for hid_get_report_id().
Sascha Wildner [Mon, 24 Aug 2015 16:51:39 +0000 (18:51 +0200)]
libusbhid: Add missing MLINK for hid_get_report_id().

4 years agoAdd MLINKS for recently added tree(3) macros.
Sascha Wildner [Mon, 24 Aug 2015 16:48:41 +0000 (18:48 +0200)]
Add MLINKS for recently added tree(3) macros.

4 years agombintowcr.3: Further mdoc cleanup.
Sascha Wildner [Mon, 24 Aug 2015 16:30:00 +0000 (18:30 +0200)]
mbintowcr.3: Further mdoc cleanup.

4 years agombintowcr.3: Mention missing functions.
Sascha Wildner [Mon, 24 Aug 2015 16:16:34 +0000 (18:16 +0200)]
mbintowcr.3: Mention missing functions.

4 years ago<xlocale/_wchar.h>: Fix wrong prototype.
Sascha Wildner [Mon, 24 Aug 2015 15:57:37 +0000 (17:57 +0200)]
<xlocale/_wchar.h>: Fix wrong prototype.

4 years agodrm/radeon: Update temperature sensor support after update to Linux 3.17
Imre Vadász [Sun, 23 Aug 2015 21:09:43 +0000 (23:09 +0200)]
drm/radeon: Update temperature sensor support after update to Linux 3.17

We can apparently just use the rdev->pm.dpm.thermal.min_temp and
rdev->pm.dpm.thermal.min_temp values as WARN and CRIT threshholds
respectively.

4 years agouipc: Factor out unp_getsocktoken()/unp_reltoken()
Sepherosa Ziehau [Sun, 23 Aug 2015 14:44:49 +0000 (22:44 +0800)]
uipc: Factor out unp_getsocktoken()/unp_reltoken()

Streamline the code a little bit.  This also paves the way to make
uipc_abort() reentrant.

4 years agolibc: Add missing futimens(2) manual page link.
Sascha Wildner [Sun, 23 Aug 2015 23:24:51 +0000 (01:24 +0200)]
libc: Add missing futimens(2) manual page link.

4 years agodrm: Move DMI definitions to their usual Linux headers
François Tigeot [Sun, 23 Aug 2015 20:11:16 +0000 (22:11 +0200)]
drm: Move DMI definitions to their usual Linux headers

4 years agodrm/linux: Improve the workqueue subsystem
François Tigeot [Sun, 23 Aug 2015 19:52:29 +0000 (21:52 +0200)]
drm/linux: Improve the workqueue subsystem

Adding some APIs used by the drm/i915 code from Linux 3.17

4 years agosys/vfs/hammer: Don't fail to downgrade cursor
Tomohiro Kusumi [Sun, 23 Aug 2015 11:53:50 +0000 (20:53 +0900)]
sys/vfs/hammer: Don't fail to downgrade cursor

7ef2d7b should have placed end: before
hammer_cursor_downgrade(cursor);.

If hammer volume-del starts to reblock because of non-empty
volume, and first reblocks data, but skips reblock for btree
node as the node was not in that volume (data and btree node
stored in different volume which is usually a rare case),
then volume-del returns from hammer_reblock_helper() without
donwgrading upgraded lock.

This could happen only on volume-del, but not hammer reblock
command since hammer reblock command never hits goto end;.

4 years agosys/vfs/hammer: Fix wrong comment
Tomohiro Kusumi [Sun, 23 Aug 2015 11:12:49 +0000 (20:12 +0900)]
sys/vfs/hammer: Fix wrong comment

It doesn't return EDEADLK.

4 years agosys/vfs/hammer: Fix possible panic with vfs.hammer.debug_general=0x4000
Tomohiro Kusumi [Sun, 23 Aug 2015 10:53:33 +0000 (19:53 +0900)]
sys/vfs/hammer: Fix possible panic with vfs.hammer.debug_general=0x4000

bc996e6 needed to check NULL-elm case for node reblock
when (vfs.hammer.debug_general & 0x4000) != 0.

The above sysctl has 0 by default, so nothing will happen
as long as keeping a default value when reblock starts.

4 years agosys/vfs/hammer: Minor cleanups
Tomohiro Kusumi [Sun, 23 Aug 2015 05:49:33 +0000 (14:49 +0900)]
sys/vfs/hammer: Minor cleanups

Nothing changes, but this probably has better readability
(and also better for grep) as it doesn't make code looks
like it's about inode. nnode and nnode->ondisk must exist
at this point.

Also sync a comment between internal and leaf.
Also add a comment on internal and leaf reblock.

4 years agodrm/radeon: Wrong authorship in previous commit
François Tigeot [Sat, 22 Aug 2015 21:26:26 +0000 (23:26 +0200)]
drm/radeon: Wrong authorship in previous commit

The big drm/radeon update to Linux 3.17 was really made by Rimvydas
Jasinskas but pushed by myself.

I must have changed the authorship unknowingly while rebasing a
bugfix and pushed the commit without noticing :-(

4 years agodrm/radeon: Update to Linux 3.17 (v2)
François Tigeot [Sat, 22 Aug 2015 16:20:38 +0000 (18:20 +0200)]
drm/radeon: Update to Linux 3.17 (v2)

Catch up with recent updates in i915kms driver.
While there perform some cleaning in drm and drm/ttm too.

This smallish(1.2MB) diff between Linux v3.12..v3.17 brings
few improvements for radeon cards support on DragonFly BSD.

Driver is VERY experimental even if FF 720p "Hey Mamma"
looks much more pleasing to the eyes on my Xeon box.

Me being Fortran developer(who wants to run OpenCL on BSDs too)
was literally throwing diffs at the fan to see what sticks on.
After cleaning up the mess a bit, these features seems to behave:
  kms-syscons switching on R7 240 and 5770 JUNIPER;
  current DPorts Xorg;
  Xorg-next(1.17.2) + Mesa-next(glamor for radeonsi);
  2D tiling now works out of the box on OLAND;
  glxgears/cubemap/cuberender mesa demos;
  firefox youtube videos(still some blinking on overlays);
  mpv -vo vdpau --hwdec=vdpau bsd-0088.mp4 (--vo=opengl too);
  UVD (decoding limited to 1080p frame streams);
  fragging in OpenArena maxed-out(even ttys[0-8] to quickly check mail);
  hdmi audio;
  DPM (enabled by default);
  gpu temperature monitoring through hw.sensors framework;
  automatic firmware loading.

TODO:
  update drm/ttm, any help would be really appreciated;
  ww_mutex, yep still good old "homegrown" locks;
  vma, newer shrinker api;
  dma_buf/prime;
  iic/i2c rework;
  kldunload radeonkms;
  better gart sizes support;
  newer firmware format support;
  fix failing ring sync test to ring-5(UVD);
  check how driver supports X2 and IGP cards;
  better OpenCL through Clover;
  many more.

Thanks goes to:
  ftigeot@efnet for opportunity and i915 work
  YRabbit@efnet for extensive testing of hdmi A/V on TURKS
  ivadasz@efnet for temperature sensors support
  mneumann@efnet for testing on HAWAII

  AMD for investing time and effort in opensource drivers
  NetBSD and Linux gpu developers

Special thanks to:
  everyone behind freebsd-ports-graphics/opencl (keep pushing the mngt!)

  and that Sweet special girl out there.

4 years agodrm: Reintroduce drm_kms_free()
François Tigeot [Sat, 22 Aug 2015 18:21:31 +0000 (20:21 +0200)]
drm: Reintroduce drm_kms_free()

* The Linux version of kfree() is a macro with one argument.

* The real kfree() function takes two arguments.

* kfree() cannot be simply called via a function pointer from
  Linux code.

* Re-add the special purpose drm_kms_free() wrapper function
  to handle this situation. It was wrongly removed during one of the
  drm_crtc.c syncs with Linux.

Reported-by: ivadasz
4 years agodrm/radeon: Add pcie_get_readrq(), pcie_set_readrq() functions
zrj [Sat, 15 Aug 2015 07:08:52 +0000 (10:08 +0300)]
drm/radeon: Add pcie_get_readrq(), pcie_set_readrq() functions

pcie_set_readrq() needs something more clever(clear and set).

Extracted-from: drm/radeon/evergreen.c

4 years agosys/vfs/hammer: Add hammer_move_node()
Tomohiro Kusumi [Sat, 22 Aug 2015 07:59:11 +0000 (16:59 +0900)]
sys/vfs/hammer: Add hammer_move_node()

Procedures to move internal and leaf node are basically the same.

Also sync some comments between internal and leaf.

4 years agosbin/hammer: Print total bytes of reblocked nodes
Tomohiro Kusumi [Sat, 22 Aug 2015 04:01:08 +0000 (13:01 +0900)]
sbin/hammer: Print total bytes of reblocked nodes

just like it shows both "data elements" and "data bytes"
in the next two lines.

"btree bytes" is kind of obvious since btree nodes are
all 4KB, and there isn't a field for "btree bytes" in
struct hammer_ioc_reblock as well, however this isn't
obvious for users so it should print it.

4 years agosys/vfs/hammer: Change obsolete hammer_ioc_reblock fields to reserved
Tomohiro Kusumi [Sat, 22 Aug 2015 03:52:34 +0000 (12:52 +0900)]
sys/vfs/hammer: Change obsolete hammer_ioc_reblock fields to reserved

record_count and record_moves fields in
hammer_ioc_reblock are not used and not necessary.

These fields were used when there was a distinction
between data and meta reblock (see bf686dbe). Meta
reblock is now a part of data reblock, so these two
are no longer used.

4 years agosys/vfs/hammer: Don't try to reblock everything on volume-del
Tomohiro Kusumi [Fri, 21 Aug 2015 12:13:40 +0000 (21:13 +0900)]
sys/vfs/hammer: Don't try to reblock everything on volume-del

Add volume# option to reblock ioctl and use that on hammer
volume-del instead of trying to reblock every data/node that
the reblocker has faced.

This is only used internally by hammer volume-del ioctl when
it finds the volume-to-remove is not empty and needs to get
reblocked. hammer reblock command does not provide an option
to specify volume# since it shouldn't be necessary for users
in general.

This makes huge difference as it cuts extra and unnecessary
i/o from reblocking, especially when the volume to remove
only has small amount data in it. The following examples show
much of the time spent on reblocking on volume-del comes from
unnecessary i/o. Example1 spent most of the time moving data
in /dev/da1 which wasn't necessary.

Example 1 - before this commit
  # newfs_hammer -L TEST /dev/da1 /dev/da2 /dev/da3 >/dev/null
  # mount_hammer /dev/da1:/dev/da2:/dev/da3 /HAMMER
  # dd if=/dev/zero of=/HAMMER/out bs=1000000 count=120000 >/dev/null 2>&1
  # sync; sync; sync; sync
  # df -Th /HAMMER
  Filesystem  Type     Size   Used  Avail Capacity  Mounted on
  TEST        hammer   334G   112G   222G    34%    /HAMMER
  # hammer -f /dev/da1:/dev/da2:/dev/da3 blockmap | grep -A2 layer1
    layer1 4000000000000000 @2000000000800000 blocks-free 0
          4000000000000000 zone=4  app=8388608 free=0
          4000000000800000 zone=4  app=8388608 free=0
  --
    layer1 4010000000000000 @2010000000000000 blocks-free 14145
          4010000000000000 zone=4  app=8388608 free=0
          4010000000800000 zone=10 app=8388608 free=0
  --
    layer1 4020000000000000 @2020000000000000 blocks-free 14268
          4020000000000000 zone=4  app=8388608 free=0
          4020000000800000 zone=0  app=0       free=8388608
  /* /dev/da1 is 100% used
     /dev/da2 is partially used
     /dev/da3 is 0% used */
  # hammer volume-blkdevs /HAMMER
  /dev/da1:/dev/da2:/dev/da3
  # time hammer volume-del /dev/da2 /HAMMER

  real    14m29.119s
  user    0m0.000s
  sys     7m14.388s
  # hammer volume-blkdevs /HAMMER
  /dev/da1:/dev/da3

Example 2 - with this commit
  # newfs_hammer -L TEST /dev/da1 /dev/da2 /dev/da3 >/dev/null
  # mount_hammer /dev/da1:/dev/da2:/dev/da3 /HAMMER
  # dd if=/dev/zero of=/HAMMER/out bs=1000000 count=120000 >/dev/null 2>&1
  # sync; sync; sync; sync
  # df -Th /HAMMER
  Filesystem  Type     Size   Used  Avail Capacity  Mounted on
  TEST        hammer   334G   112G   222G    34%    /HAMMER
  # hammer -f /dev/da1:/dev/da2:/dev/da3 blockmap | grep -A2 layer1
    layer1 4000000000000000 @2000000000800000 blocks-free 0
          4000000000000000 zone=4  app=8388608 free=0
          4000000000800000 zone=4  app=8388608 free=0
  --
    layer1 4010000000000000 @2010000000000000 blocks-free 14145
          4010000000000000 zone=4  app=8388608 free=0
          4010000000800000 zone=10 app=8388608 free=0
  --
    layer1 4020000000000000 @2020000000000000 blocks-free 14268
          4020000000000000 zone=4  app=8388608 free=0
          4020000000800000 zone=0  app=0       free=8388608
  /* /dev/da1 is 100% used
     /dev/da2 is partially used
     /dev/da3 is 0% used */
  # hammer volume-blkdevs /HAMMER
  /dev/da1:/dev/da2:/dev/da3
  # time hammer volume-del /dev/da2 /HAMMER

  real    0m8.139s
  user    0m0.000s
  sys     0m4.177s
  # hammer volume-blkdevs /HAMMER
  /dev/da1:/dev/da3

4 years agosys/vfs/hammer: Remove unnecessary error check
Tomohiro Kusumi [Fri, 21 Aug 2015 12:13:05 +0000 (21:13 +0900)]
sys/vfs/hammer: Remove unnecessary error check

error is always ==0 at this point.

4 years agosys/vfs/hammer: Don't repeat layer1 blockmap check of volume-to-remove
Tomohiro Kusumi [Fri, 21 Aug 2015 12:12:06 +0000 (21:12 +0900)]
sys/vfs/hammer: Don't repeat layer1 blockmap check of volume-to-remove

hammer's blockmap allocator can simply skip the whole volume
without going through unnecessary goto;s when the allocator's
current zone2 offset is in the volume-to-remove.

This is similar to 0871ec5 except that this commit does not
need to check layer1->phys_offset because that volume is what
hammer volume-del is wanting to remove.

4 years agosys/vfs/hammer: Adjust hammer_debug_general
Tomohiro Kusumi [Thu, 20 Aug 2015 14:46:56 +0000 (23:46 +0900)]
sys/vfs/hammer: Adjust hammer_debug_general

Change hammer_debug_general in hammer_blockmap_getfree()
to 0x4000 which is the same value as those in
sys/vfs/hammer/hammer_reblock.c.

This is better since hammer_blockmap_getfree() is made
for reblock and only used by reblock (0x0800 picks up
other debug kprintfs that aren't related to reblock).

Also note that hammer_debug_general values are randomly
picked based on use cases rather than fixed value for
each file/etc.

Add some comments on the conditionals that are used to
start data/node reblock since this part is not too easy
to understand.

4 years agosbin/hammer: Move two blockmap functions to hammer/blockmap.c
Tomohiro Kusumi [Thu, 20 Aug 2015 10:55:25 +0000 (19:55 +0900)]
sbin/hammer: Move two blockmap functions to hammer/blockmap.c

from hammer/ondisk.c.
See sys/vfs/hammer/hammer_blockmap.c for details.

alloc_blockmap() should be in hammer/blockmap.c than
hammer/ondisk.c considering alloc_blockmap() is the
userspace version of hammer_blockmap_alloc() in
sys/vfs/hammer/hammer_blockmap.c which basically does
the same thing. If blockmap_lookup() is located in
hammer/blockmap.c then this one should be too.

alloc_bigblock() is the userspace only function that is
only used by newfs_hammer when newfs_hammer initially
allocates the whole 8MB chunks, however since the idea
of alloc_bigblock() is the same as alloc_blockmap()
(difference in allocation size), it makes better sense
to have this in hammer/blockmap.c as well.

(There are other blockmap related functions but those
are more of formatting initial ondisk image based on
blockmap info than blockmap handling itself, so those
should stay in hammer/ondisk.c)

4 years agosbin/hammer: Cleanup pwrite(2) wrapper
Tomohiro Kusumi [Thu, 20 Aug 2015 10:22:42 +0000 (19:22 +0900)]
sbin/hammer: Cleanup pwrite(2) wrapper

Just make writehammerbuf() return 0 or -1 instead of void,
just like readhammerbuf() returns 0 or -1.

4 years agosbin/hammer: Cleanup hammer show
Tomohiro Kusumi [Thu, 20 Aug 2015 10:22:06 +0000 (19:22 +0900)]
sbin/hammer: Cleanup hammer show

Also change "=%d" to "=B%d" on error to clearly distinct
from non-error case "=%d%%".

'B' usually represents error (bad) in hammer show.

4 years agosbin/newfs_hammer: Explicitly tell which volume is root volume
Tomohiro Kusumi [Wed, 19 Aug 2015 16:13:48 +0000 (01:13 +0900)]
sbin/newfs_hammer: Explicitly tell which volume is root volume

hammer volume-del says "Cannot remove root-volume" if one
tries to remove the root volume, however no hammer commands
actually tell which one is the root volume.

This commit makes newfs_hammer printf the root volume name,
followed by the existing undo/etc info of the root volume.
Also refer to the root volume in manpages.

(It may be helpful if other hammer commands like info or
volume-list show the root volume name just like newfs_hammer,
however it's not too trivial to do that. One reason is because
hammer seems to have been designed that way so users don't
need to care about any detail of underlying fs volumes.
This commit is trivial since newfs_hammer code knows which
one is the root volume)

4 years agosys/vfs/hammer: Minor fix on volume format on volume-add
Tomohiro Kusumi [Wed, 19 Aug 2015 14:58:05 +0000 (23:58 +0900)]
sys/vfs/hammer: Minor fix on volume format on volume-add

It's better to just copy volume relative offset from
the existing root volume than having the magic number
"HAMMER_BUFSIZE * 16" in both kernel and userspace.

4 years agosbin/hammer: Merge check_volume()
Tomohiro Kusumi [Wed, 19 Aug 2015 12:31:40 +0000 (21:31 +0900)]
sbin/hammer: Merge check_volume()

There are two check_volume() that basically do the same.
The one in sbin/hammer/cmd_volume.c is copied from newfs_hammer.
Merge them into one.

4 years agosbin/newfs_hammer: Fix minor memory leak
Tomohiro Kusumi [Wed, 19 Aug 2015 12:03:13 +0000 (21:03 +0900)]
sbin/newfs_hammer: Fix minor memory leak

vol->fd is supposed to be already opened by setup_volume()
by the time check_volume(vol) is called.

4 years agosys/vfs/hammer: Remove obsolete code and comments
Tomohiro Kusumi [Tue, 18 Aug 2015 11:32:28 +0000 (20:32 +0900)]
sys/vfs/hammer: Remove obsolete code and comments

from very early stage of hammer development.

4 years agosys/vfs/hammer: Fix wrong function name in kprintf
Tomohiro Kusumi [Wed, 19 Aug 2015 10:05:09 +0000 (19:05 +0900)]
sys/vfs/hammer: Fix wrong function name in kprintf

Use the right name.
Allocating tid isn't always start of transaction.

4 years agosys/vfs/hammer: Add hammer_flush_dirty()
Tomohiro Kusumi [Tue, 18 Aug 2015 13:08:05 +0000 (22:08 +0900)]
sys/vfs/hammer: Add hammer_flush_dirty()

4 years agosys/vfs/hammer: Use HAMMER_OBJID_ROOT for root inode#
Tomohiro Kusumi [Tue, 18 Aug 2015 11:25:04 +0000 (20:25 +0900)]
sys/vfs/hammer: Use HAMMER_OBJID_ROOT for root inode#

instead of hardcoded 1.

4 years agosys/vfs/ufs: Fix typo in variable name
Tomohiro Kusumi [Tue, 18 Aug 2015 11:08:21 +0000 (20:08 +0900)]
sys/vfs/ufs: Fix typo in variable name

4 years agosys/vfs/hammer: Check ronly when overwriting volume header
Tomohiro Kusumi [Tue, 18 Aug 2015 10:11:04 +0000 (19:11 +0900)]
sys/vfs/hammer: Check ronly when overwriting volume header

Check readonly mount before overwriting volume header
with non-NULL data on load/unload.

(hammer volume-add|del ioctls which are the only cases
with non-NULL data do have readonly mount check before
load/unload, so there isn't any issue without ronly==0
but the check should be done here too)

4 years agosys/vfs/hammer: Use either HAMMER: or hammer:
Tomohiro Kusumi [Tue, 18 Aug 2015 10:06:59 +0000 (19:06 +0900)]
sys/vfs/hammer: Use either HAMMER: or hammer:

Should be either of the following.
kprintf("HAMMER: ...\n");
kprintf("hammer: ...\n");

The existing code mostly uses "HAMMER:" so use "HAMMER:".
Assuming no one or no userspace triggers anything via
"hammer:" string in dmesg.

4 years agodrm/linux: Add pci_bus compat structure
zrj [Thu, 13 Aug 2015 06:37:44 +0000 (09:37 +0300)]
drm/linux: Add pci_bus compat structure

4 years agodrm/linux: Expand pdev structure
zrj [Thu, 13 Aug 2015 06:26:52 +0000 (09:26 +0300)]
drm/linux: Expand pdev structure

Will be used to reduce direct dependency on drm functions in radeon.
Also will help a lot when updating drm itself.

4 years agodrm: Really remove the old implementation of list_sort()
François Tigeot [Sat, 22 Aug 2015 15:28:46 +0000 (17:28 +0200)]
drm: Really remove the old implementation of list_sort()

4 years agodrm: Use the NetBSD implementation of list_sort()
François Tigeot [Sat, 22 Aug 2015 13:53:03 +0000 (15:53 +0200)]
drm: Use the NetBSD implementation of list_sort()

* The NetBSD import is more similar to the Linux version and doesn't
  do dynamic memory allocation

* Remove the old incomplete FreeBSD implementation

* It wasn't even using M_DRM with its kmalloc() calls, potentially
  leaking memory

4 years agodrm/linux: Add list_sort() implementation
zrj [Mon, 17 Aug 2015 12:49:08 +0000 (15:49 +0300)]
drm/linux: Add list_sort() implementation

Taken-from: NetBSD

4 years agouipc: Wrap unp test with UNP_ISATTACHED()
Sepherosa Ziehau [Sat, 22 Aug 2015 14:05:18 +0000 (22:05 +0800)]
uipc: Wrap unp test with UNP_ISATTACHED()

4 years agosocket: Allow keeping a reference on the new socket in sonewconn_faddr
Sepherosa Ziehau [Sat, 22 Aug 2015 13:19:38 +0000 (21:19 +0800)]
socket: Allow keeping a reference on the new socket in sonewconn_faddr

It will be used to fix unix socket races.

4 years agodrm: Implement gcd64.h math function
zrj [Sat, 15 Aug 2015 14:26:17 +0000 (17:26 +0300)]
drm: Implement gcd64.h math function

Adapted-from: lib/libc/stdlib/getopt_long.c

4 years agodrm/linux: Implement simple capable() priv helper
zrj [Sun, 16 Aug 2015 09:32:55 +0000 (12:32 +0300)]
drm/linux: Implement simple capable() priv helper

4 years agodrm/linux: Add define for jiffies_64 compat
zrj [Mon, 17 Aug 2015 11:35:11 +0000 (14:35 +0300)]
drm/linux: Add define for jiffies_64 compat

Likely is wrong, but better than nothing

4 years agodrm/linux: Implement atomic64_add/atomic64_sub macros
zrj [Mon, 17 Aug 2015 12:15:54 +0000 (15:15 +0300)]
drm/linux: Implement atomic64_add/atomic64_sub macros

4 years agombintowcr.3: Remove unneeded .Pp
Sascha Wildner [Sat, 22 Aug 2015 08:36:18 +0000 (10:36 +0200)]
mbintowcr.3: Remove unneeded .Pp

4 years agomkregtable: Sync script to Linux v3.14
zrj [Sun, 16 Aug 2015 14:03:48 +0000 (17:03 +0300)]
mkregtable: Sync script to Linux v3.14

This fixes sscanf handling vulnerability

Taken-from: Linux drm/radeon/mkregtable.c

4 years agodrm: const'ify ioctls table (v2)
zrj [Mon, 3 Aug 2015 08:01:17 +0000 (11:01 +0300)]
drm: const'ify ioctls table (v2)

Because, there is no reason for it not to be const.
We never modify the contents of drm_ioctls, so make it const.

4 years agokernel/nfs: Fix up the per-export address lists.
Matthew Dillon [Fri, 21 Aug 2015 21:23:15 +0000 (14:23 -0700)]
kernel/nfs: Fix up the per-export address lists.

* Use a pool token to properly protect access to both the radix
  trees and the mask tree.

* Also free the mask tree when freeing the address list trees.

* Fix a few bugs in the original work (ne_inethead and ne_inet6head
  were not assigned, *prnh not set to NULL on free, and ne_maskhead
  was being unconditionally freed even if it wasn't initialized.

Reported-by: profmakx
Lots-of-help-from: sephe, dillon
Submitted-by: Nuno Antunes <nuno.antunes@gmail.com>
4 years agokernel/acpica: Put back debugger/disassembler code disabling at file level.
Sascha Wildner [Fri, 21 Aug 2015 20:33:10 +0000 (22:33 +0200)]
kernel/acpica: Put back debugger/disassembler code disabling at file level.

Removing those in the last ACPICA upgrade led to too much code going
into the acpi.ko module which is actually only needed when ACPI_DEBUG
is in the config.

Reported-by: profmakx, jh32
4 years agoi386 removal, part 37/x: Remove more i386 related small bits and pieces.
Sascha Wildner [Fri, 21 Aug 2015 16:16:58 +0000 (18:16 +0200)]
i386 removal, part 37/x: Remove more i386 related small bits and pieces.

4 years agosocket: Reorder state setting a little bit in sonewconn_faddr()
Sepherosa Ziehau [Fri, 21 Aug 2015 15:14:10 +0000 (23:14 +0800)]
socket: Reorder state setting a little bit in sonewconn_faddr()

This prevents several possible races.

4 years agosocket: Move accept queues flush into sofree()
Sepherosa Ziehau [Fri, 21 Aug 2015 13:23:10 +0000 (21:23 +0800)]
socket: Move accept queues flush into sofree()

Prepare to fix unix socket races.

4 years agoi386 removal, part 36/x: Remove the i386 specific kgzip(8) utility.
Sascha Wildner [Fri, 21 Aug 2015 15:11:27 +0000 (17:11 +0200)]
i386 removal, part 36/x: Remove the i386 specific kgzip(8) utility.

It was used to compress kernels to be loaded without the loader.

For our standard loader it is enough to just gzip the kernel (i.e.,
create /boot/kernel/kernel.gz). This doesn't work with modules
unfortunately.

4 years agoSync ACPICA with Intel's version 20150818.
Sascha Wildner [Fri, 21 Aug 2015 14:25:11 +0000 (16:25 +0200)]
Sync ACPICA with Intel's version 20150818.

* Disassembler and debugger are now standalone components without
  cross-component dependencies.

* Various fixes: BZ 1186, BZ 1192, BZ 1135, BZ 1015, BZ 794, BZ 1176,
  BZ 1185, BZ 1184, BZ 1188, BZ 1190, BZ 1187, BZ 1189, BZ 1191.

* More small fixes without BZ IDs.

* In the debugger, "objects" without arguments now displays a summary
  of the current namespace objects.

* In acpinames(8), the new -x option can be used to set the debug level,
  just like in acpiexec(8).

* aapits test has been removed.

4 years agokernel - Fix several low memory+swap pageout/killproc issues
Matthew Dillon [Thu, 20 Aug 2015 23:45:27 +0000 (16:45 -0700)]
kernel - Fix several low memory+swap pageout/killproc issues

* Add significant slop to the PQAVERAGE() calculation in the
  pageout daemon and increase the slop in the vm_paging_target()
  test the pageout daemon makes to determine if it can stop early.

  These adjustments fix a degenerate case when no swap is configured
  and a large number of clean pages are present in the inactive queue
  which could prevent the pageout daemon from cleaning a sufficient number
  of pages and cause it to start killing processes even when plenty of
  freeable memory exists.

* Impose a one-second delay when killing processes due to insufficient
  memory + swap.  This reduces the chance that multiple processes will
  be killed even if the first one would have been sufficient by giving
  the kernel more time to dipose of the process.

* Fix a bug in vm_page_alloc().  When v_free_count exactly matches
  v_free_reserved it successfully passes the vm_page_count_target()
  test but vm_page_alloc() will still fail.  This results in a livelock
  in vm_fault_object() and will livelock the pageout daemon vs a user
  process stuck in vm_fault(), causing the machine to lock.

  Fixed by adjusting the conditional test in vm_page_alloc().

Reported-by: luxh
4 years agolgamma.3: There is no lgammal_r() function in libm.
Sascha Wildner [Thu, 20 Aug 2015 21:19:56 +0000 (23:19 +0200)]
lgamma.3: There is no lgammal_r() function in libm.

4 years agolibc/regex: Fix up the regex upgrade.
Sascha Wildner [Thu, 20 Aug 2015 20:33:12 +0000 (22:33 +0200)]
libc/regex: Fix up the regex upgrade.

* Fix typo in 3 function names: s/regnw/regwn/.

* Add missing overriding #defines for 4 further functions to <regex.h>.

4 years ago<math.h>: Fix visibility of scalb(), which was removed from Issue 7.
Sascha Wildner [Thu, 20 Aug 2015 16:59:20 +0000 (18:59 +0200)]
<math.h>: Fix visibility of scalb(), which was removed from Issue 7.

4 years agologb.3: There is no scalbl() function in libm.
Sascha Wildner [Thu, 20 Aug 2015 16:47:32 +0000 (18:47 +0200)]
logb.3: There is no scalbl() function in libm.

4 years agovkernel.7: Sort -d alphabetically.
Sascha Wildner [Thu, 20 Aug 2015 11:45:08 +0000 (13:45 +0200)]
vkernel.7: Sort -d alphabetically.

4 years agombintowcr.3: Add missing types.
Sascha Wildner [Thu, 20 Aug 2015 11:43:56 +0000 (13:43 +0200)]
mbintowcr.3: Add missing types.

4 years agoprocctl.2: Clean up a bit.
Sascha Wildner [Thu, 20 Aug 2015 11:43:54 +0000 (13:43 +0200)]
procctl.2: Clean up a bit.

4 years agonetinet{,6}: Assert in{,6}_inithead() are only used for system routing tables.
Nuno Antunes [Wed, 19 Aug 2015 07:46:07 +0000 (15:46 +0800)]
netinet{,6}: Assert in{,6}_inithead() are only used for system routing tables.

Suggested-by: sephe
4 years agokernel/nfs: Remove old hack abusing dom_rtattach.
Nuno Antunes [Wed, 19 Aug 2015 04:55:21 +0000 (12:55 +0800)]
kernel/nfs: Remove old hack abusing dom_rtattach.

* Mostly obtained from FreeBSD. Here's the relevant part of the
  original commit message.

    According to IANA RPC uaddr registry, there are no AFs
    except IPv4 and IPv6, so it's not worth being too abstract here.

    Remove ne_rtable[AF_MAX+1] and use explicit per-AF radix tries.
    Use own initialization without relying on domattach code.

    While I admit that this was one of the rare places in kernel
    networking code which really was capable of doing multi-AF
    without any AF-depended code, it is not possible anymore to
    rely on dom* code.

* Give netexports their own mask radix tree.

Reviewed-by: sephe, dillon
Tested-by: dillon
4 years agoqueue: Log 'last' ptr in addition to 'head'
Sepherosa Ziehau [Wed, 19 Aug 2015 12:53:23 +0000 (20:53 +0800)]
queue: Log 'last' ptr in addition to 'head'

4 years agosocket: Assert SS_{INCOMP,COMP} before deq/enq so_{comp,incomp}
Sepherosa Ziehau [Wed, 19 Aug 2015 12:51:43 +0000 (20:51 +0800)]
socket: Assert SS_{INCOMP,COMP} before deq/enq so_{comp,incomp}

Suggested-by: dillon@
4 years agosocket: Don't define SS_ISCLOSING same as SS_INCOMP
Sepherosa Ziehau [Wed, 19 Aug 2015 12:50:25 +0000 (20:50 +0800)]
socket: Don't define SS_ISCLOSING same as SS_INCOMP

4 years agoiasl.8: Clarify the -in option a bit better.
Sascha Wildner [Wed, 19 Aug 2015 20:25:41 +0000 (22:25 +0200)]
iasl.8: Clarify the -in option a bit better.

4 years agofdisk(8): Raise WARNS to 6 and fix warnings.
Sascha Wildner [Wed, 19 Aug 2015 20:17:40 +0000 (22:17 +0200)]
fdisk(8): Raise WARNS to 6 and fix warnings.

4 years agoboot - Fix CD booting
Matthew Dillon [Wed, 19 Aug 2015 19:23:26 +0000 (12:23 -0700)]
boot - Fix CD booting

* Recent changes to move the loader's heap to high-memory broke the
  CD I/O code due to being beyond the BIOS'es segmentation range.  The
  HDD code was already using bounce buffers, but the CD code was not.

* Adjust the CD I/O code to use bounce buffers too.

Reported-by: numerous.
Testing-by: swildner
4 years agocorepower.4: Explain what the package power usage value means.
Imre Vadász [Tue, 18 Aug 2015 20:40:02 +0000 (22:40 +0200)]
corepower.4: Explain what the package power usage value means.

4 years agopowerd: Restore backlight when powerd exits
Sepherosa Ziehau [Mon, 17 Aug 2015 12:46:10 +0000 (20:46 +0800)]
powerd: Restore backlight when powerd exits

4 years agoinet6: Limit the # of fragments in addition to the # of fragmented packets
Sepherosa Ziehau [Mon, 17 Aug 2015 12:38:59 +0000 (20:38 +0800)]
inet6: Limit the # of fragments in addition to the # of fragmented packets

Obtained-from: KAME via FreeBSD

4 years agoinet6: Send initial NS in a timely fashion.
Sepherosa Ziehau [Mon, 17 Aug 2015 12:31:01 +0000 (20:31 +0800)]
inet6: Send initial NS in a timely fashion.

The call of nd6_rtrequest() in nd6_output() sets the newly created
neighbor cache entry expire to time_uptime, which prevents the NS
output at the end of nd6_output().  Though the NS will be sent when
the neighbor cache times out, it will cause large delay (0~1s).

4 years agondp: Fix neighbor cache entry expire time logging
Sepherosa Ziehau [Mon, 17 Aug 2015 12:27:51 +0000 (20:27 +0800)]
ndp: Fix neighbor cache entry expire time logging

4 years agokernel/vmm: Use "(a & b) == 0" instead of "!(a & b)".
Sascha Wildner [Mon, 17 Aug 2015 18:58:59 +0000 (20:58 +0200)]
kernel/vmm: Use "(a & b) == 0" instead of "!(a & b)".

Poked-by: dillon
4 years agokernel/vmm: Use __func__ and adjust whitespace.
Sascha Wildner [Mon, 17 Aug 2015 18:46:03 +0000 (20:46 +0200)]
kernel/vmm: Use __func__ and adjust whitespace.