dragonfly.git
8 years agortadvd - Import newer rtadvd, add rtadvctl from FreeBSD-10
Matthew Dillon [Mon, 21 Sep 2015 00:59:44 +0000 (17:59 -0700)]
rtadvd - Import newer rtadvd, add rtadvctl from FreeBSD-10

* This patch updates the rtvdvd daemon and adds the rtadvctl
  utility to the base system. Both of these are from
  FreeBSD-10.2-RELEASE.  The intent is to add RFC 6106 functionality
  (DNS information distributed via router advertisements) to the
  system

Submitted-by: Charles Musser <cmusser@sonic.net>
8 years agokernel/vga: Remove a no longer needed variable.
Sascha Wildner [Sun, 20 Sep 2015 10:21:20 +0000 (12:21 +0200)]
kernel/vga: Remove a no longer needed variable.

It was used until 4e193d20af and I oversaw that it could be removed.

8 years agoi386 removal, part 43/x: Remove/change i386 specific info in manual pages.
Sascha Wildner [Sat, 19 Sep 2015 23:40:47 +0000 (01:40 +0200)]
i386 removal, part 43/x: Remove/change i386 specific info in manual pages.

8 years agoiwm - DragonFly cleanup (no functional changes)
Matthew Dillon [Fri, 18 Sep 2015 20:38:29 +0000 (13:38 -0700)]
iwm - DragonFly cleanup (no functional changes)

* Cleanup and document iwm work.

* Remove test fences that aren't needed.

8 years agouipc: Rework unp_pcblist() to make it MPSAFE
Sepherosa Ziehau [Fri, 18 Sep 2015 11:42:29 +0000 (19:42 +0800)]
uipc: Rework unp_pcblist() to make it MPSAFE

8 years agouipc: Make unp_discard MPSAFE by deferring closef to a dedicated taskqueue
Sepherosa Ziehau [Fri, 18 Sep 2015 11:41:46 +0000 (19:41 +0800)]
uipc: Make unp_discard MPSAFE by deferring closef to a dedicated taskqueue

8 years agoAdd iwm.4 and iwmfw.4 manual pages (taken from FreeBSD).
Sascha Wildner [Fri, 18 Sep 2015 08:27:59 +0000 (10:27 +0200)]
Add iwm.4 and iwmfw.4 manual pages (taken from FreeBSD).

8 years agoi915kms.4: Add missing .El
Sascha Wildner [Fri, 18 Sep 2015 08:27:34 +0000 (10:27 +0200)]
i915kms.4: Add missing .El

8 years agokernel: Make iwm compilable into the kernel and add it to LINT64.
Sascha Wildner [Fri, 18 Sep 2015 08:14:46 +0000 (10:14 +0200)]
kernel: Make iwm compilable into the kernel and add it to LINT64.

8 years agoiwm - DragonFly modifications and a bug fix
Matthew Dillon [Fri, 18 Sep 2015 05:56:20 +0000 (22:56 -0700)]
iwm - DragonFly modifications and a bug fix

* Modifications to make iwm build for DragonFly.

* Fix a serious bug, iwm_stop_device() must clear the rxq stat
  data primarily to reset to hw rx ring index to 0.  Otherwise
  all packets already handled from 0 to the current hw rx ring index
  will be reprocessed on restart.

* Implement iwmsleep() instead of using msleep().  iwmsleep() will
  handle exiting and re-entering the wlan_serializer.  Without this
  we can easily deadlock on the double lock.

* Implement Makefile infrastructure.

* Revert the FreeBSD patch to remove the per-debvice netif, since our
  802.11 infrastructure has not yet been updated for that.

* Purge the ifq on start if the interface is not running.

* Misc other DragonFly adjustments.

8 years agowlan - Import if_iwm from FreeBSD (base)
Matthew Dillon [Fri, 18 Sep 2015 05:53:32 +0000 (22:53 -0700)]
wlan - Import if_iwm from FreeBSD (base)

8 years agowlan - Minor updates for if_iwm import.
Matthew Dillon [Fri, 18 Sep 2015 05:49:41 +0000 (22:49 -0700)]
wlan - Minor updates for if_iwm import.

* Add PCIM_STATUS_INTxSTATE

* Expose ieee80211broadcastaddr[]

8 years agoi386 removal, part 42/x: Remove i386 info from the syscall(9) manpage.
Sascha Wildner [Thu, 17 Sep 2015 12:37:43 +0000 (14:37 +0200)]
i386 removal, part 42/x: Remove i386 info from the syscall(9) manpage.

8 years agoRemove libcom_err.so{,.3} via 'make upgrade' too.
Sascha Wildner [Thu, 17 Sep 2015 12:09:29 +0000 (14:09 +0200)]
Remove libcom_err.so{,.3} via 'make upgrade' too.

8 years agokernel/dup: Correct dup{,2}()'s fd params to int in the syscall glue.
Sascha Wildner [Wed, 16 Sep 2015 22:35:57 +0000 (00:35 +0200)]
kernel/dup: Correct dup{,2}()'s fd params to int in the syscall glue.

8 years agouipc: Allow fdalloc() to fail in unp_externalize()
Sepherosa Ziehau [Tue, 15 Sep 2015 14:42:11 +0000 (22:42 +0800)]
uipc: Allow fdalloc() to fail in unp_externalize()

While I'm here, add comment about never reached code.

8 years agouipc: White space
Sepherosa Ziehau [Tue, 15 Sep 2015 13:14:52 +0000 (21:14 +0800)]
uipc: White space

8 years agokernel: Use fhold() instead of increasing f_count manually
Sepherosa Ziehau [Tue, 15 Sep 2015 12:49:30 +0000 (20:49 +0800)]
kernel: Use fhold() instead of increasing f_count manually

8 years agokernel/syscons: Fix compilation without ddb in the config.
Sascha Wildner [Tue, 15 Sep 2015 21:52:35 +0000 (23:52 +0200)]
kernel/syscons: Fix compilation without ddb in the config.

8 years agoUpdate the pciconf(8) database.
Sascha Wildner [Tue, 15 Sep 2015 06:49:04 +0000 (08:49 +0200)]
Update the pciconf(8) database.

September 10, 2015 snapshot from http://pciids.sourceforge.net/

8 years agoatomic: Add atomic_testandclear_int()
Sepherosa Ziehau [Mon, 14 Sep 2015 14:56:34 +0000 (22:56 +0800)]
atomic: Add atomic_testandclear_int()

8 years agodevfs: Protect f_data1 properly and revoke the meanless FCDEVPRIV f_flag
Sepherosa Ziehau [Sun, 13 Sep 2015 15:02:42 +0000 (23:02 +0800)]
devfs: Protect f_data1 properly and revoke the meanless FCDEVPRIV f_flag

8 years agounp: Fix falloc() failure in unp_fp_externalize()
Sepherosa Ziehau [Sun, 13 Sep 2015 12:58:33 +0000 (20:58 +0800)]
unp: Fix falloc() failure in unp_fp_externalize()

fx will be NULL, if falloc() fails.

While I'm here, move local variables near their usage.

8 years agouipc: Protect proc.p_fd access properly in unp_internalize()
Sepherosa Ziehau [Fri, 11 Sep 2015 14:54:47 +0000 (22:54 +0800)]
uipc: Protect proc.p_fd access properly in unp_internalize()

8 years agotest: Add test for unix socket file descriptor passing
Sepherosa Ziehau [Fri, 11 Sep 2015 14:37:53 +0000 (22:37 +0800)]
test: Add test for unix socket file descriptor passing

8 years agoshare/ctype: Improved makefile allows symlinks to be removed
John Marino [Sun, 13 Sep 2015 15:56:35 +0000 (17:56 +0200)]
share/ctype: Improved makefile allows symlinks to be removed

The makefile, which is generated, now can generate all LC_CTYPE
output files without the use of symlinks and still manages to avoid
source file duplication.  The symlinks might cause issues for
repositories cloned to a MS Windows system.

Requested-by: bapt@FreeBSD.org

8 years agocldr2def: Improve ctype makefile generation to avoid symlinks
John Marino [Sun, 13 Sep 2015 15:52:56 +0000 (17:52 +0200)]
cldr2def: Improve ctype makefile generation to avoid symlinks

I was informed that symlinks in repository might cause problems
when the repository is extracted to windows.  The generated ctype
makefile was improved to work without symlinks at all.  (The symlinks
were there to avoid multiple copies of the same exact file, some of
which were greater than 1 Mb in size).

8 years agomake.conf: Remove unused variable.
Sascha Wildner [Sun, 13 Sep 2015 12:02:14 +0000 (14:02 +0200)]
make.conf: Remove unused variable.

8 years agoi386 removal, part 41/x: Remove POWERFAIL_NMI kernel option.
Sascha Wildner [Sun, 13 Sep 2015 11:33:23 +0000 (13:33 +0200)]
i386 removal, part 41/x: Remove POWERFAIL_NMI kernel option.

It was only used in i386 specific code.

8 years agodrm/i915: drm/i915: Ignore SURFLIVE and flip counter when the GPU gets reset
François Tigeot [Sun, 13 Sep 2015 11:21:42 +0000 (13:21 +0200)]
drm/i915: drm/i915: Ignore SURFLIVE and flip counter when the GPU gets reset

This is commit 7cb9a79e3ee6e414d7f413cd1785d630ace9a1b0 from Linux 3.17.8
Original author: Ville Syrjälä <ville.syrjala@linux.intel.com>
0riginal commit message:

commit bdfa7542d40e6251c232a802231b37116bd31b11 upstream.

During a GPU reset we need to get pending page flip cleared out
since the ring contents are gone and flip will never complete
on its own. This used to work until the mmio vs. CS flip race
detection came about. That piece of code is looking for a
specific surface address in the SURFLIVE register, but as
a flip to that address may never happen the check may never
pass. So we should just skip the SURFLIVE and flip counter
checks when the GPU gets reset.

intel_display_handle_reset() tries to effectively complete
the flip anyway by calling .update_primary_plane(). But that
may not satisfy the conditions of the mmio vs. CS race
detection since there's no guarantee that a modeset didn't
sneak in between the GPU reset and intel_display_handle_reset().
Such a modeset will not wait for pending flips due to the ongoing GPU
reset, and then the primary plane updates performed by
intel_display_handle_reset() will already use the new surface
address, and thus the surface address the flip is waiting for
might never appear in SURFLIVE. The result is that the flip
will never complete and attempts to perform further page flips
will fail with -EBUSY.

During the GPU reset intel_crtc_has_pending_flip() will return
false regardless, so the deadlock with a modeset vs. the error
work acquiring crtc->mutex was avoided. And the reset_counter
check in intel_crtc_has_pending_flip() actually made this bug
even less severe since it allowed normal modesets to go through
even though there's a pending flip.

This is a regression introduced by me here:
 commit 75f7f3ec600524c9544cc31695155f1a9ddbe1d9
 Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
 Date:   Tue Apr 15 21:41:34 2014 +0300

    drm/i915: Fix mmio vs. CS flip race on ILK+

Testcase: igt/kms_flip/flip-vs-panning-vs-hang
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodrm/i915: drop WaSetupGtModeTdRowDispatch:snb
François Tigeot [Sun, 13 Sep 2015 11:14:05 +0000 (13:14 +0200)]
drm/i915: drop WaSetupGtModeTdRowDispatch:snb

This is commit 454a87ce581cec28d88da251f85b4bcfe5938a0f from Linux 3.17.8
Original author: Daniel Vetter <daniel.vetter@ffwll.ch>
0riginal commit message:

commit 2208d655a91f9879bd9a39ff9df05dd668b3512c upstream.

This reverts the regressing

commit 6547fbdbfff62c99e4f7b4f985ff8b3454f33b0f
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Fri Dec 14 23:38:29 2012 +0100

    drm/i915: Implement WaSetupGtModeTdRowDispatch

that causes GPU hangs immediately on boot.

Reported-by: Leo Wolf <jclw@ymail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79996
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
[Jani: amended the commit message slightly.]
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodrm/i915: Disable caches for Global GTT.
François Tigeot [Sun, 13 Sep 2015 11:06:16 +0000 (13:06 +0200)]
drm/i915: Disable caches for Global GTT.

This is commit 76d0c9869b8cdbdb978caa4e13bc98840daafa2b from Linux 3.17.8
Original author: Rodrigo Vivi <rodrigo.vivi@intel.com>
Original commit message:

commit d6a8b72edc92471283925ceb4ba12799b67c3ff8 upstream.

Global GTT doesn't have pat_sel[2:0] so it always point to pat_sel = 000;
So the only way to avoid screen corruptions is setting PAT 0 to Uncached.

MOCS can still be used though. But if userspace is trusting PTE for
cache selection the safest thing to do is to let caches disabled.

BSpec: "For GGTT, there is NO pat_sel[2:0] from the entry,
so RTL will always use the value corresponding to pat_sel = 000"

- System agent ggtt writes (i.e. cpu gtt mmaps) already work before
this patch, i.e. the same uncached + snooping access like on gen6/7
seems to be in effect.
- So this just fixes blitter/render access. Again it looks like it's
not just uncached access, but uncached + snooping. So we can still
hold onto all our assumptions wrt cpu clflushing on LLC machines.

v2: Cleaner patch as suggested by Chris.
v3: Add Daniel's comment

Reference: https://bugs.freedesktop.org/show_bug.cgi?id=85576
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: James Ausmus <james.ausmus@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@intel.com>
Tested-by: James Ausmus <james.ausmus@intel.com>
Reviewed-by: James Ausmus <james.ausmus@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodrm/i915: properly reenable gen8 pipe IRQs
François Tigeot [Sun, 13 Sep 2015 10:46:59 +0000 (12:46 +0200)]
drm/i915: properly reenable gen8 pipe IRQs

This is commit 18c22448d791a5c329528e495f19b639dd7a3dec from Linux 3.17.8
Original author: Paulo Zanoni <paulo.r.zanoni@intel.com>
Original commit message:

commit 1180e20606fd7c5d76dc5b2a1594fa51ba5a0f31 upstream.

We were missing the pipe B/C vblank bits! Take a look at
gen8_de_irq_postinstall for a comparison.

This should fix a bunch of IGT tests.

There are a few more things we could improve on this code, but this
should be the minimal fix to unblock us.

v2: s/extra_iir/extra_ier/ because IIR doesn't make sense (Ville)

Bugzilla:https://bugs.freedesktop.org/show_bug.cgi?id=83640
Testcase: igt/*
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoi386 removal, part 40/x: Remove BOOTP_NFSV3 kernel option.
Sascha Wildner [Sun, 13 Sep 2015 10:51:03 +0000 (12:51 +0200)]
i386 removal, part 40/x: Remove BOOTP_NFSV3 kernel option.

NFS root mounts default to NFSv3 since b9a7a2bd9ad2 from 2009. The only
other place where it was used until recently was in i386's locore.s,
which got removed in f4c88b0b86f1.

8 years agolocale/UTF-8: Fixed upper bound logic
John Marino [Sun, 13 Sep 2015 10:08:10 +0000 (12:08 +0200)]
locale/UTF-8: Fixed upper bound logic

The upper bound for UTF-8 is 0x10FFFF.  Using two's complement to check
this range is wrong.  Valid values such as 0x20000, 0x40000 and 0x80000
were wrongly failing will illegal sequence errors.  Using simple
comparison operators should fix the logic.

8 years agodrm/i915: Reduce diff to Linux 3.17 in i915/intel_dp.c
Imre Vadász [Sat, 12 Sep 2015 10:09:44 +0000 (12:09 +0200)]
drm/i915: Reduce diff to Linux 3.17 in i915/intel_dp.c

Replaces intel_dp_aux_native_* calls by the corresponding drm_dp_dpcd_*
calls used in the Linux 3.17 code, and removes the intel_dp_aux_native_*
functions.

intel_dp_aux_native_read_retry() became intel_dp_dpcd_read_wake().
One operator precedence typo which wasn't synced from Linux 3.17 code
yet, and some whitespace diff fixes

8 years agodrm/i915: Adapt i2c handling a bit closer to Linux 3.17, Makes PSR work
Imre Vadász [Fri, 11 Sep 2015 23:18:55 +0000 (01:18 +0200)]
drm/i915: Adapt i2c handling a bit closer to Linux 3.17, Makes PSR work

Adds the intel_dp_aux_init and intel_dp_aux_transfer methods as in the
Linux 3.17 code, to properly initialize the intel_dp->aux struct.

Panel self refresh can now be enabled by setting "drm.i915.enable_psr=1"
in /boot/loader.conf.

8 years agoActivate symbol versioning on libc (bump DF version)
John Marino [Sat, 12 Sep 2015 12:48:25 +0000 (14:48 +0200)]
Activate symbol versioning on libc (bump DF version)

The symbol maps for libc have been verified to work as expected, thus
symbol versioning has been activated for libc.  The major version of
libc remains at 8 indefinitely.

The previously built packages and programs should continue to function
normally.  Future packages built on latest master (400304+) will not
run on DragonFly with version 400303 or earlier due to missing symbol
errors by rtld.  The plan is to archive current packages under a new
directory of mirror-master to continue (static) support for older versions
of master until those machines can be upgraded.

The DF version is changed to 400304 with this commit.

8 years agoinstallworld: When installing libraries, install libc first
John Marino [Sat, 12 Sep 2015 14:07:41 +0000 (16:07 +0200)]
installworld: When installing libraries, install libc first

The libraries have to be built in a specific order.  The way the makefile
is written, the libraries are installed in the same order as they are
built.  However, this dynamic made it impossible to install an new libc
that signficantly impacts other libraries in-place.  For example,
libncurses is significantly impacted by libc versioning, and it is
installed before libc which causes immediate failure in programs like
"ln" and "install" because rtld can't find new symbols.

The solution is update the lib makefile to put libc at the beginning
of the installation queue.  This simple change ensures libc changes
will not break world installation.

8 years agoRemove /usr/include/emulation/posix4 (empty since 2007) via 'make upgrade'.
Sascha Wildner [Fri, 11 Sep 2015 23:21:54 +0000 (01:21 +0200)]
Remove /usr/include/emulation/posix4 (empty since 2007) via 'make upgrade'.

8 years agoRemove some additional files via 'make upgrade'.
Sascha Wildner [Fri, 11 Sep 2015 23:15:01 +0000 (01:15 +0200)]
Remove some additional files via 'make upgrade'.

8 years agolibc: Add stack protector support back
John Marino [Fri, 11 Sep 2015 08:11:53 +0000 (10:11 +0200)]
libc: Add stack protector support back

Based on regressions indicated by dports bulk build (< 10), it appears
that the deactivated stack_protector.c code was used with static stack
protection (e.g. -lssp_nonshared).

FreeBSD moved the file to its own area less than a month ago, which is
why I thought it had been removed.  The plan is to put all security
related code in the same area, so I'm going to follow suit.  While here,
remove the stack_smash_handler, which I believe is obsolete, and reduce
differences with FreeBSD.

8 years agoRemove libcom_err and compile_et.
Sascha Wildner [Fri, 11 Sep 2015 08:19:00 +0000 (10:19 +0200)]
Remove libcom_err and compile_et.

They were part of kerberos and only ever used for it and associated
pam modules, all of which were removed long ago. So this is just
forgotten cleanup.

Ports seem to take care of themselves, too. All ports mentioning
either com_err or compile_et anywhere built without the versions
in base.

8 years agokernel/bus: Change function definitions to static (to match declaration).
Sascha Wildner [Thu, 10 Sep 2015 21:27:58 +0000 (23:27 +0200)]
kernel/bus: Change function definitions to static (to match declaration).

8 years agokernel/net: Change function definitions to static (to match declaration).
Sascha Wildner [Thu, 10 Sep 2015 21:27:35 +0000 (23:27 +0200)]
kernel/net: Change function definitions to static (to match declaration).

8 years agoi386 removal, part 39/x: Remove est(4) driver.
Sascha Wildner [Thu, 10 Sep 2015 20:43:41 +0000 (22:43 +0200)]
i386 removal, part 39/x: Remove est(4) driver.

Of the 36 CPUs it supports, only one supports Intel 64 (aka AMD64),
namely the Intel Core 2 Duo T7500, released in May 2007. The rest,
Intel Pentium Ms and two Intel Core CPUs, were 32 bit only.

If someone is still using a T7500 with DragonFly and our regular
ACPI P-state support doesn't work with it, we'd be interested in
hearing about it. As a last resort, there's always cpucontrol(8)
to set the MSRs manually. :)

Also, estd isn't in ports or dports.

8 years agotaskqueue: Fix taskqueue locking issues
Sepherosa Ziehau [Thu, 10 Sep 2015 15:10:05 +0000 (23:10 +0800)]
taskqueue: Fix taskqueue locking issues

- wakeup/wakeup_one should be called w/o spinlock (taskqueue lock).
- Callout needs to lock taskqueue before calling taskqueue_enqueue_locked.

8 years agortld.1: Improve _rtld_functrace example
John Marino [Thu, 10 Sep 2015 13:10:52 +0000 (15:10 +0200)]
rtld.1: Improve _rtld_functrace example

The man page was written at a time that gcc was "leaking" headers.
Now <unistd.h> is required for this example to compile.

8 years agosys/param.h: Fix typo in comment
John Marino [Wed, 9 Sep 2015 22:04:34 +0000 (00:04 +0200)]
sys/param.h: Fix typo in comment

8 years agobump __DragonFly_version for environ, __progname change
John Marino [Wed, 9 Sep 2015 21:46:54 +0000 (23:46 +0200)]
bump __DragonFly_version for environ, __progname change

The "environ" and "__progname" symbols no longer appear in libc.
Certain linker flags can result in a link failure on these symbols.  This
has been seen in llvm (likely requiring a patch for all versions to treat
DragonFly like FreeBD).  Since this is a behavior change, I think it is
worth a version bump in case makefiles have to check the version to
adjust.

8 years agoSimplify redundant __*_VISIBLE checks in various header files.
Sascha Wildner [Wed, 9 Sep 2015 18:39:10 +0000 (20:39 +0200)]
Simplify redundant __*_VISIBLE checks in various header files.

* __BSD_VISIBLE implies __XSI_VISIBLE and __POSIX_VISIBLE.

* __XSI_VISIBLE implies __POSIX_VISIBLE.

None of these functions/defines are actually XSI. No functional change
expected.

8 years agokernel: Remove pci_pir.c, which was not built.
Sascha Wildner [Wed, 9 Sep 2015 16:07:57 +0000 (18:07 +0200)]
kernel: Remove pci_pir.c, which was not built.

According to sephe, this is no longer relevant these days.

8 years agoi386 removal, part 38/x: Un-document no longer existing functions in bios.9.
Sascha Wildner [Wed, 9 Sep 2015 16:07:42 +0000 (18:07 +0200)]
i386 removal, part 38/x: Un-document no longer existing functions in bios.9.

8 years agolibc: fix environ symbol by syncing getenv.c with FreeBSD
John Marino [Wed, 9 Sep 2015 10:49:38 +0000 (12:49 +0200)]
libc: fix environ symbol by syncing getenv.c with FreeBSD

The environ symbol can't be found by rtld with libc symbol versioning.
On Release 4.2, readelf produces this output, indicating "environ" is
classified as an object:

> readelf -a /lib/libc.so.8 | grep environ
00000032af20  01ed00000006 R_X86_64_GLOB_DAT 0000000000351380 environ + 0
   493: 0000000000351380     8 OBJECT  GLOBAL DEFAULT   24 environ
  1636: 0000000000351380     8 OBJECT  GLOBAL DEFAULT   24 environ

After this commit:

> readelf -a /lib/libc.so.8 | grep environ
000000330c78  000700000006 R_X86_64_GLOB_DAT 0000000000000000 environ + 0
     7: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND environ
  1660: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND environ

The above is the desired output.

8 years agolib/dlfcn: whitespace cleanup, remove unnecessary prototype
John Marino [Wed, 9 Sep 2015 10:39:12 +0000 (12:39 +0200)]
lib/dlfcn: whitespace cleanup, remove unnecessary prototype

8 years agolibc: Complete conversion to _getprogname from __progname
John Marino [Wed, 9 Sep 2015 09:54:17 +0000 (11:54 +0200)]
libc: Complete conversion to _getprogname from __progname

The initial work to eliminate direct use of __progname was done years ago,
but two items were missed: an extern keyword and libc_r conversion.  As a
result, the symbol was classified as an object.  Before commit (R4.2):

> readelf -a /lib/libc.so.8 | grep __progname
00000032ac80  077600000006 R_X86_64_GLOB_DAT 00000000003506d0 __progname+0
  1910: 00000000003506d0     8 OBJECT  GLOBAL DEFAULT   24 __progname
   537: 00000000003506d0     8 OBJECT  GLOBAL DEFAULT   24 __progname

After commit:

>  readelf -a /lib/libc.so.8 | grep __progname
0000003309c0  000400000006 R_X86_64_GLOB_DAT 0000000000000000 __progname+0
     4: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __progname
   545: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND __progname

The issue was reveal with libc symbol version testing, which also revealed
the "environ" symbol has a similar issue.  The change matches how the
FreeBSD analog works.

8 years agokernel - Fix multi-threaded coredump
Matthew Dillon [Wed, 9 Sep 2015 03:11:00 +0000 (20:11 -0700)]
kernel - Fix multi-threaded coredump

* Recent commits to freeze threads on a coredump introduced a bug
  where threads entering a wait state could stall the coredump
  indefinitely.

* Fix by counting such threads as being stopped before entering the
  wait state, allowing the coredump to proceed.  Do not try to issue
  an early signal which could disrupt the state the coredump is trying
  to save.

Reported-by: Justin C. Sherrill <justin@shiningsilence.com>
8 years agoAdd missing dummy _rtld_thread_init (weak symbol)
John Marino [Tue, 8 Sep 2015 23:19:14 +0000 (01:19 +0200)]
Add missing dummy _rtld_thread_init (weak symbol)

The thread library uses it, but apparently has been getting it from rtld,
so this addition is basically future capability.  FreeBSD has it too.

8 years agolibc symbols bound to rtld must have matching version numbers
John Marino [Tue, 8 Sep 2015 23:04:15 +0000 (01:04 +0200)]
libc symbols bound to rtld must have matching version numbers

Reset the version of symbols bound to rtld back to DF306.0 version.
While here, remove definition for __progname and environ which cannot
be versioned.

8 years agocorepower(4): Fix units -> microwatt conversion on Valleyview Atom CPUs
Imre Vadász [Tue, 8 Sep 2015 21:51:38 +0000 (23:51 +0200)]
corepower(4): Fix units -> microwatt conversion on Valleyview Atom CPUs

Add cpu model 0x4d (C2000 Atom CPUs), which might also show correct
values with this fix.

This Valleyview Atom specific encoding of the MSR_RAPL_POWER_UNIT
MSR is described in tables 35-7 and 35-9 (for regular silvermont
Atom and C2000 Atom CPUs respectively).

Tested-by: swildner
8 years ago<dirent.h>: Move fdopendir() under __POSIX_VISIBLE >= 200809.
Sascha Wildner [Tue, 8 Sep 2015 17:35:16 +0000 (19:35 +0200)]
<dirent.h>: Move fdopendir() under __POSIX_VISIBLE >= 200809.

It is new in Issue 7 of the standard. It is of course still visible in
our default environment.

8 years ago<dirent.h>/<string.h>: Remove redundant __XSI_VISIBLE checks.
Sascha Wildner [Tue, 8 Sep 2015 16:37:53 +0000 (18:37 +0200)]
<dirent.h>/<string.h>: Remove redundant __XSI_VISIBLE checks.

__XSI_VISIBLE implies __POSIX_VISIBLE, and none of these functions is
XSI.

No functional changes (expected).

8 years ago<string.h>: memccpy() is XSI.
Sascha Wildner [Tue, 8 Sep 2015 16:29:43 +0000 (18:29 +0200)]
<string.h>: memccpy() is XSI.

8 years ago<stdio.h>: Sort some prototypes.
Sascha Wildner [Tue, 8 Sep 2015 16:14:04 +0000 (18:14 +0200)]
<stdio.h>: Sort some prototypes.

8 years agolibc/gen Symbol map - rtld tweaks
John Marino [Tue, 8 Sep 2015 18:26:51 +0000 (20:26 +0200)]
libc/gen Symbol map - rtld tweaks

The libc symbol versioning is preventing rtld from binding weak symbols,
or something like that.  I haven't discovered the actual problem yet but
here are issues I fixed on the way.

8 years agolibc/gen symbol map: Remove exposure to dummy tls functions
John Marino [Tue, 8 Sep 2015 07:14:12 +0000 (09:14 +0200)]
libc/gen symbol map: Remove exposure to dummy tls functions

These libc tls functions are just dummies meant to be overridden by their
weak reference definitions (by rtld).

8 years agoFix libc symbol maps after build test
John Marino [Sun, 6 Sep 2015 18:06:42 +0000 (20:06 +0200)]
Fix libc symbol maps after build test

The following modifications (typos, bugs, missing symbols,
extra symbols) allows buildworld to complete with libc versioning
turned on (a first).  After performance verification via dports
bulk build, the versioning will be activated.

8 years agoFinished thorough pass of libc symbol maps
John Marino [Sun, 6 Sep 2015 15:47:17 +0000 (17:47 +0200)]
Finished thorough pass of libc symbol maps

Before versioning of libc can be turned on, it requires through testing.
1) It's got to complete a full buildworld, of course
2) It's got to complete a dports bulk build without significant fallout

8 years agolibc: For first time, loads in non-executable stack
John Marino [Sun, 6 Sep 2015 10:17:14 +0000 (12:17 +0200)]
libc: For first time, loads in non-executable stack

I missed one assembly file from libc/x86_64 yesterday (I am not sure how),
and adding a GNU-stack note to it enables the GNU-stack ELF program
header to be set to "RW" instead of "RWE" for the first time ever.  After
the syscall file generation fix, exect.S was the last assembly file
holding this back.

8 years agolibc/syscalls: Add GNU-stack ELF note to generated assembly files
John Marino [Sun, 6 Sep 2015 10:04:16 +0000 (12:04 +0200)]
libc/syscalls: Add GNU-stack ELF note to generated assembly files

This fixes 282x2 objects files for libc and libc_rtld that were preventing
libc from loading on non-executable stack.  It appears there is only one
more object file to fix after this commit.  Similar code exists on the
libc/sys Makefile on FreeBSD.

8 years agolibcrypto: Enable library to be loaded in non-executable stack
John Marino [Sun, 6 Sep 2015 08:58:37 +0000 (10:58 +0200)]
libcrypto: Enable library to be loaded in non-executable stack

I scanned my system for libraries that were loading on executable sections
of the stack and found two: libc and libcrypto.  After adding a GNU-stack
ELF note to each assembly file, the result is the crypto library now loads
in a non-executable stack.

8 years agoFix sys/conf/files to unbreak LINT64 for the recent drm changes.
Sascha Wildner [Sun, 6 Sep 2015 08:00:32 +0000 (10:00 +0200)]
Fix sys/conf/files to unbreak LINT64 for the recent drm changes.

8 years agouipc: Simplify unp_ino generation
Sepherosa Ziehau [Thu, 3 Sep 2015 12:55:20 +0000 (20:55 +0800)]
uipc: Simplify unp_ino generation

8 years agolibc/x86-64: Add GNU-stack ELF notes to many assembly files
John Marino [Sat, 5 Sep 2015 21:39:43 +0000 (23:39 +0200)]
libc/x86-64: Add GNU-stack ELF notes to many assembly files

Most of the assembly files in libc/x86-64 were missing GNU-stack ELF
notes (they never had them) which means libc and every program that
links with it has required an executable stack.  I need to determine
a way to check which object files are missing this section and make
sure every single libc object file is covered.

8 years agoMore libc Symbol map refinements (nearing completion now)
John Marino [Sat, 5 Sep 2015 21:37:28 +0000 (23:37 +0200)]
More libc Symbol map refinements (nearing completion now)

8 years agolibc: Sync open_memstream(3) with FreeBSD. Also add open_wmemstream(3).
Sascha Wildner [Sat, 5 Sep 2015 18:48:49 +0000 (20:48 +0200)]
libc: Sync open_memstream(3) with FreeBSD. Also add open_wmemstream(3).

Their open_memstream(3) implementation is more compliant than ours was.

Taken-from: FreeBSD

8 years agoReworked (significantly) symbol map for locales
John Marino [Sat, 5 Sep 2015 18:33:58 +0000 (20:33 +0200)]
Reworked (significantly) symbol map for locales

8 years agolibc/locale: Remove unused source files
John Marino [Sat, 5 Sep 2015 16:25:05 +0000 (18:25 +0200)]
libc/locale: Remove unused source files

Only the "iconv" versions are built.  Unlike FreeBSD, it is not possible to
build a version of libc without iconv support.

8 years ago/usr/Makefile: Fix typo in a message about the pkg bootstrap.
Sascha Wildner [Sat, 5 Sep 2015 17:14:36 +0000 (19:14 +0200)]
/usr/Makefile: Fix typo in a message about the pkg bootstrap.

8 years agoContinue working on libc symbol maps
John Marino [Sat, 5 Sep 2015 14:10:48 +0000 (16:10 +0200)]
Continue working on libc symbol maps

8 years agoAdd static keyword to four functions to match prototype (libc)
John Marino [Sat, 5 Sep 2015 14:09:13 +0000 (16:09 +0200)]
Add static keyword to four functions to match prototype (libc)

8 years agodrm: drm_fb_cma_helper.c has a restrictive license, remove it
François Tigeot [Sat, 5 Sep 2015 07:25:11 +0000 (09:25 +0200)]
drm: drm_fb_cma_helper.c has a restrictive license, remove it

8 years agosys/vfs/hammer: Rename btree_set_parent() to btree_set_parent_of_child()
Tomohiro Kusumi [Thu, 3 Sep 2015 17:15:17 +0000 (02:15 +0900)]
sys/vfs/hammer: Rename btree_set_parent() to btree_set_parent_of_child()

This commit renames btree_set_parent() to btree_set_parent_of_child()
since btree_set_parent() is counter-intuitive.

1. btree_get_parent(node)
returns node's parent, but
2. btree_set_parent(node, elm)
sets its child's parent to node instead of setting node's parent
to something, which isn't quite expected behavior from the way
these two functions are named.

8 years agosys/vfs/hammer: #if0 cursor_exclreq_count of inode and node
Tomohiro Kusumi [Wed, 2 Sep 2015 17:38:45 +0000 (02:38 +0900)]
sys/vfs/hammer: #if0 cursor_exclreq_count of inode and node

hammer code that refers to 'cursor_exclreq_count' is #if0'd,
so #if0 this field from struct definitions as well.

Since #if0'd code aren't logically obsolete but just disabled,
it's probably better not to remove them at this point.

The change does not affect abi as these structs and fields
are not size/position/ondisk-layout sensitive.

8 years agosys/vfs/hammer: Cleanup incore record tree lookup
Tomohiro Kusumi [Tue, 1 Sep 2015 11:27:37 +0000 (20:27 +0900)]
sys/vfs/hammer: Cleanup incore record tree lookup

8 years agosys/vfs/hammer: Cleanup parent inode dereferenced by record
Tomohiro Kusumi [Tue, 1 Sep 2015 11:27:09 +0000 (20:27 +0900)]
sys/vfs/hammer: Cleanup parent inode dereferenced by record

8 years agosbin/hammer: Add some assertions
Tomohiro Kusumi [Sun, 30 Aug 2015 14:00:36 +0000 (23:00 +0900)]
sbin/hammer: Add some assertions

8 years agosbin/hammer: Fix boundary test on hammer show [3/3]
Tomohiro Kusumi [Sun, 30 Aug 2015 09:25:12 +0000 (18:25 +0900)]
sbin/hammer: Fix boundary test on hammer show [3/3]

Separate child node test info RBN and non-RBN. hammer must
have set subtree_offset=0 for RBN and is considered error
if !=0.

8 years agosbin/hammer: Fix boundary test on hammer show [2/3]
Tomohiro Kusumi [Sun, 30 Aug 2015 07:50:18 +0000 (16:50 +0900)]
sbin/hammer: Fix boundary test on hammer show [2/3]

get_elm_flags() using HAMMER_BTREE_TYPE_INTERNAL for btype
of RBN of an internal node is not correct because btype of
RBN is actually not specified. It could be internal or leaf
or possibly 0, while RBN has no child regardless of the btype
value.

This results in get_elm_flags() having incorrect (but does
not fail with 'B' mark) condition for left/right elm test
for internal node. The correct way is to separate RBN case
from non-RBN case. RBN logically has no child node (hammer
erases child node offset with 0 on node split, if not zero
clears the whole elm), so it can't be handled in the same
switch(btype) cases like others are.

Separating RBN from non-RBN (normal ELM) makes possible for
each elm in an internal node to have correct left/right test.
* non-RBN is the same as leaf node, so add test_lr() and
  use this in both internal and leaf node.
* RBN needs to be handled differently, so add test_rbn_lr()
  and use this for RBN. The difference is that in RBN
  hammer_btree_cmp(&elm->base, right_bound) == 0
  could happen, so test_rbn_lr() can not set FLAG_TOOFARRIGHT
  when it's ==0. Below is some details on how this happens
  on RBN but not on non-RBN.

==========
(A)
This is what happens on internal split.

before split
I
0 1 2 3 ...     n
E E E E E E E E E R
           /
          /
         I                   62
         0 1 2 s ...       61|
         E E E E E E E E E E R

after split
I                 n+1
0 1 2 3 ...   p   |
E E E E E E E E E E R
           /   \
          /     \
         I       I           62-s-1
         0 1 2 s 0 1 2 ...   |
         E E E R=E E E E E E E R

From the way hammer_split_internal() is implemented,
E[p].base which points to the new child node is a copy of
E[0].base in the new child node. Given that this E[0] is
a copy of R(RBN) in the original child node (that was E[s]
before internal split and was src of bcopy()), E[p].base
also equals this R.base.

Therefore
hammer_btree_cmp(&elm->base, right_bound) == 0
does happen for a right boundary elm where elm is R(RBN)
and right_bound is &E[p].base. For non-RBN elms this is
considered error for the same reason as leaf split case
explained below.

==========
(B)
This is what happens on leaf split which is similar to above
but not the same.
before split
I
0 1 2 3 ...     n
E E E E E E E E E R
           /
          /
         L
         0 1 2 s ...         62
         E E E E E E E E E E E

after split
I                 n+1
0 1 2 3 ...   p   |
E E E E E E E E E E R
           /   \
          /     \
         L       L             62-s-1
         0 1 2 s 0 1 2 ...     |
         E E E   E E E E E E E E

hammer_leaf_split() basically does the same as internal,
but the difference is that E[s] in the original child node
does not become a boundary, nor does it point to a child.
E[s] is just a junk space just like all the rest of the
elms in the original child node.

(Also leaf split tries to make E[p].base <= E[0].base of
the new child node, instead of just copying E[0].base to
E[p].base and make them equal like internal split does.
See hammer_make_separator() for details.)

This makes
hammer_btree_cmp(&elm->base, right_bound) == 0
not happen and considered error if it happens, where elm
is either of E[0]..E[s-1] in the original child node and
right_bound is &E[p].base.

8 years agosbin/hammer: Fix boundary test on hammer show [1/3]
Tomohiro Kusumi [Sun, 30 Aug 2015 07:07:20 +0000 (16:07 +0900)]
sbin/hammer: Fix boundary test on hammer show [1/3]

This commit actually doesn't fix anything, but just to make
get_elm_flags() take elm index instead of btype.

get_elm_flags() needs elm index to correctly test boundary
and non-boundary elements. btype can be retrieved from elm
itself, so it doesn't need to be passed as an argument.

XXX part is where it needs to be fixed.

8 years agosbin/hammer: Make hammer show test node count
Tomohiro Kusumi [Sat, 29 Aug 2015 16:03:18 +0000 (01:03 +0900)]
sbin/hammer: Make hammer show test node count

8 years agosbin/hammer: Make hammer blockmap|checkmap|show print # of 'B' on -v
Tomohiro Kusumi [Sat, 29 Aug 2015 11:40:34 +0000 (20:40 +0900)]
sbin/hammer: Make hammer blockmap|checkmap|show print # of 'B' on -v

similar to the way hammer checkmap prints # of errors,
and some refactoring around that part.

(otherwise one has to search for "^B" to see if there
is any error in some 100M bytes hammer show result for
large fs)

8 years agosbin/hammer: Add hammer stats command (= bstats + iostats)
Tomohiro Kusumi [Fri, 28 Aug 2015 18:35:30 +0000 (03:35 +0900)]
sbin/hammer: Add hammer stats command (= bstats + iostats)

It's simply good to have a command that combines these two.
One often runs these two concurrently and tries to see both
at the same time anyway.

8 years agohammer: Remove cluster topology related comments
Tomohiro Kusumi [Fri, 28 Aug 2015 10:33:07 +0000 (19:33 +0900)]
hammer: Remove cluster topology related comments

that were written in the early stage of hammer devel
but do not reflect the actual implementation today,
such as super-cluster, etc.

8 years agosbin/hammer: Remove obsolete variable UsingSuperClusters
Tomohiro Kusumi [Fri, 28 Aug 2015 15:01:28 +0000 (00:01 +0900)]
sbin/hammer: Remove obsolete variable UsingSuperClusters

This variable is no longer used and not necessary.

This was added in the early stage of hammer devel
when the real clustering code was being written, but
never removed when the clustering part was removed.

8 years agosys/vfs/hammer: Remove redundant elm type check [2/2]
Tomohiro Kusumi [Sat, 29 Aug 2015 08:08:50 +0000 (17:08 +0900)]
sys/vfs/hammer: Remove redundant elm type check [2/2]

The following code(A) in hammer_cursor_down() is redundant.
It works the same with or without if/else conditional.

hammer_is_internal_node_elm(elm) == 1
and
node->ondisk->type == HAMMER_BTREE_TYPE_INTERNAL
are essentially the same thing from the way hammer's ondisk
data structure is designed.

If above is not true, then it ends up calling panic().
Then (A) can be written like (B), and (B) can be written
like (C) since it's either panic or not panic anyway.

Also the way (C) looks is natural given that the purpose
of this function is to move the cursor downward to one of
its children. It must be an internal (non-leaf) to be able
to go down.

=====(A)
if (hammer_is_internal_node_elm(elm)) {
/* below never fails if above is true, and */
/* above would have never failed if below is true */
KKASSERT(node->ondisk->type == HAMMER_BTREE_TYPE_INTERNAL);
go_down();
} else {
panic();
}
=====

=====(B)
if (node->ondisk->type == HAMMER_BTREE_TYPE_INTERNAL) {
go_down();
} else {
panic();
}
=====

=====(C)
KKASSERT(node->ondisk->type == HAMMER_BTREE_TYPE_INTERNAL);
go_down();
=====

8 years agosys/vfs/hammer: Remove redundant elm type check [1/2]
Tomohiro Kusumi [Thu, 27 Aug 2015 21:04:55 +0000 (06:04 +0900)]
sys/vfs/hammer: Remove redundant elm type check [1/2]

hammer_btree_lock_children() assumes the node is internal,
but not leaf or anything else. Also given that all elms[]
within a node has the same elm type (i.e. all elms[] use
the same union member of hammer_btree_elm_t), this function
doesn't need to check if each elms[i] is a node element
of an internal node.

If elms[] are not elements of an internal node, then the
caller is not using this function right rather than this
function missing sanity checks.

In fact this is (only)used by hammer_split_internal() and
reblock/rebalance code where they deal with internal nodes.
They all do pass an internal node.

8 years agosys/vfs/hammer: Remove prototype of not existing fucntion
Tomohiro Kusumi [Mon, 31 Aug 2015 10:20:09 +0000 (19:20 +0900)]
sys/vfs/hammer: Remove prototype of not existing fucntion

This function no longer exists.
Also fix wrong name in kprintf().

8 years agosys/vfs/hammer: Cleanup debug kprintfs for cursor/elm
Tomohiro Kusumi [Tue, 25 Aug 2015 15:30:37 +0000 (00:30 +0900)]
sys/vfs/hammer: Cleanup debug kprintfs for cursor/elm

Most of the kprintfs in sys/vfs/hammer/hammer_btree.c
that are used only when vfs.hammer.debug_btree is set
do the same thing (with slightly different format),
so integrate them into two inline functions.

8 years agosys/vfs/hammer: Add and fix comments
Tomohiro Kusumi [Wed, 26 Aug 2015 15:21:27 +0000 (00:21 +0900)]
sys/vfs/hammer: Add and fix comments

on
* inode's node cache
* btree node split
* volume header