markj [Thu, 19 Nov 2015 05:33:15 +0000 (05:33 +0000)]
Fix a bug in the amd64 dtrace_getarg() implementation: when unwinding the
stack, take into account the copy of rsi pushed between the breakpoint
trapframe and the dtrace_invop frame. Prior to r287644, this was covered
by the fact that sizeof(struct amd64_frame) was 24 rather than 16.
bdrewery [Thu, 19 Nov 2015 00:45:36 +0000 (00:45 +0000)]
FAST_DEPEND: Similar to r290629, do always depend on headers if 'make depend'
has not ran yet.
This fixes building objects directly, or skipping 'make depend', not generating
required headers first. This case did work without FAST_DEPEND so there's no
reason it should not work here as well.
An example of this can be seen building in gnu/usr.bin/binutils/libbfd
without running 'make depend' first to generate config.h.
rodrigc [Thu, 19 Nov 2015 00:01:52 +0000 (00:01 +0000)]
Use print as a function for Python 3 [PEP 3105]
Import print_function from the __future__ module
to activate this for Python 2. This works as far back as Python 2.6.0a2:
https://docs.python.org/2/library/__future__.html
cem [Wed, 18 Nov 2015 23:53:13 +0000 (23:53 +0000)]
in_getmulti: Fix recursion on if_addr_lock on malloc failure
When the M_NOWAIT allocation fails, we recurse the if_addr_lock trying
to clean up. Reorder the cleanup after dropping the if_addr_lock. The
obvious race is already possible between if_addmulti and IF_ADDR_WLOCK
above, so it must be ok.
rodrigc [Wed, 18 Nov 2015 23:32:29 +0000 (23:32 +0000)]
Use 'in' instead of 'has_key()' for testing dictionary membership.
In PEP 0290, has_key() was deprecated in Python 2.2 and higher:
https://www.python.org/dev/peps/pep-0290/#testing-dictionary-membership
https://docs.python.org/2.2/whatsnew/node4.html
In Python 3, dict.has_key() was removed:
https://docs.python.org/3.0/whatsnew/3.0.html#builtins
rmacklem [Wed, 18 Nov 2015 23:04:01 +0000 (23:04 +0000)]
The problem report was for a crash that happened when smbfs was
trying to do a mount. Given the backtrace,
it appears that the crash occurred when smb_vc_create() failed and then
called smb_vc_put() with vcp->vc_iod == NULL. smb_vc_put() subsequently
called smb_vc_disconnect() with vcp->vc_iod == NULL, causing the crash.
This patch adds a check for vcp->vc_iod != NULL in smb_vc_disconnect() to
avoid the crash. It also fixes the case in smb_vc_create() where
kproc_create() fails so that it destroys the mutexes and sets
vcp->vc_iod == NULL before free()'ing the iod structure.
The person who reported the PR tested the patch, but was not able
to reproduce the crash with or without the patch.
bdrewery [Wed, 18 Nov 2015 21:39:58 +0000 (21:39 +0000)]
META MODE: Fix changing what "MACHINE=host" means when computing dirdeps for include/.
The _SKIP_BUILD is used while computing DIRDEPS. If MACHINE=host is passed in
then this logic was replacing 'MACHINE' with a literal value of the host arch,
which then caused the dirdeps graph to be wrong since it no longer had the
literal 'host' for any of include's dependencies.
This is a NOP currently since include/ is not usually built with MACHINE=host.
bdrewery [Wed, 18 Nov 2015 21:37:46 +0000 (21:37 +0000)]
Remove unneeded libmd from bootstrap-tools (reverting r246784).
The bootstrap-tools are supposed to be host tools, which in most cases, use
host headers and libraries. As such, directly including the src tree's headers
for libmd here causes the need to link libmd in since it will be built with
the new symbols (which /usr/lib/libmd.so) won't have unless it is new enough.
During the target build in buildworld the target headers are staged into
WORLDTMP and used via --sysroot, allowing the target xinstall to be built with
the new/target libmd.
The .PATH here was also not doing anything since xinstall does not use libmd
source files.
royger [Wed, 18 Nov 2015 18:11:19 +0000 (18:11 +0000)]
xen: fix dropping bitmap IPIs during resume
Current Xen resume code clears all pending bitmap IPIs on resume, which is
not correct. Instead re-inject bitmap IPI vectors on resume to all CPUs in
order to acknowledge any pending bitmap IPIs.
Sponsored by: Citrix Systems R&D
MFC after: 2 weeks
royger [Wed, 18 Nov 2015 18:10:28 +0000 (18:10 +0000)]
xen/intr: properly dispose event channels on resume
All event channels are torn down when performing a migration on Xen, make
sure all handlers are also removed and the event channel structure is
properly disposed so it can be reused.
Sponsored by: Citrix Systems R&D
MFC after: 2 weeks
royger [Wed, 18 Nov 2015 18:09:49 +0000 (18:09 +0000)]
x86/intr: allow mutex recursion in intr_remove_handler
This is needed so interrupt handlers can be removed while the PIC is
resuming, it was previously not possible due to intr_resume holding the
intr_table_lock and intr_remove_handler recursing on it.
nwhitehorn [Wed, 18 Nov 2015 17:03:22 +0000 (17:03 +0000)]
Extend r270123 to run the brand info's header_supported() routine for
branded as well as unbranded binaries. This will be required to add
support for the new ELFv2 ABI on powerpc64, which is distinguished from
ELFv1 by the contents of the ELF header's flags field.
mmel [Wed, 18 Nov 2015 16:07:01 +0000 (16:07 +0000)]
ARM: Fix dma_dcache_sync() for early allocated memory.
Drivers can request DMA to buffers that are not in memory represented
in the vm page arrays. Because of this, store KVA of already mapped
buffer to synclist and use it in dma_dcache_sync().
jtl [Wed, 18 Nov 2015 14:52:01 +0000 (14:52 +0000)]
Support a wider history counter in pmcstat(8) gmon output
pmcstat(8) contains an option to output sampling data in a gmon format
compatible with gprof(1). Currently, it uses the default histcounter,
which is an (unsigned short). With large sets of sampling data, it
is possible to overflow the maximum value provided by an (unsigned
short).
This change adds the -e argument to pmcstat. If -e and -g are both
specified, pmcstat will use a histcounter type of uint64_t.
rodrigc [Wed, 18 Nov 2015 13:19:34 +0000 (13:19 +0000)]
Temporarily comment out the libcrypt tests.
They are emitting characters which are triggering
a kyua bug which causes kyua to emit invalid XML.
This invalid XML is causing false failures in Jenkins.
On a separate note, kyua needs to be fixed with this:
https://github.com/jmmv/kyua/pull/148
or something similar.
mav [Wed, 18 Nov 2015 11:14:59 +0000 (11:14 +0000)]
Remove some confusions between loopid and nphdl.
Modern cards in most cases operate abstract port handles, that have no
any relation to real loop IDs. Leave loopid used only where it really
goes about local loop IDs.
While there, fix few more cases where LUNs were still printed in decimal.
smh [Tue, 17 Nov 2015 20:55:50 +0000 (20:55 +0000)]
Fix early kernel dump via dumpdev env
Setting the dumpdev via env e.g. loader.conf provides the ability to
configure the kernel dump device during early boot. When using this
g_io_getattr was returning EPERM due to cp->acr == 0.
Fix this by calling g_access to ensure we're a read consumer prior
to calling g_dev_setdumpdev.
nwhitehorn [Tue, 17 Nov 2015 16:09:26 +0000 (16:09 +0000)]
Make native page table access endian-safe. Even on CPUs running in
little-endian mode, the hardware page table is big-endian. This is a
no-op on all currently supported systems.
nwhitehorn [Tue, 17 Nov 2015 16:07:43 +0000 (16:07 +0000)]
Where appropriate, use the endian-flipping OF_getencprop() instead of
OF_getprop() to get encode-int encoded values from the OF tree. This is
a no-op at present, since all existing PowerPC ports are big-endian, but
it is a correctness improvement and will be required if we have a
little-endian kernel at some future point.
Where it is totally impossible for the code ever to be used on a
little-endian system (much of powerpc/powermac, for instance), I have not
necessarily made the appropriate changes.
zbb [Tue, 17 Nov 2015 13:09:51 +0000 (13:09 +0000)]
Make PCB structure binary compatible for old and new PMAP on ARM
This structure must be binary compatible regardless of PMAP
version being used. Create reserved section for NEW_PMAP to
make other variables be placed exactly in the same memory
addresses. This fixes kgdb/gdb behavoiur, which uses pcb.h stuctures.
The NEW_PMAP is kernel flag, so it does not propagate to the buildworld,
what makes the tools using pcb.h unable to parse PCB data.
Reviewed by: mmel, kib
Submitted by: Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by: Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4011
bapt [Tue, 17 Nov 2015 12:18:57 +0000 (12:18 +0000)]
install(1) is following symlinks when installing a files, which result in
inconsistency when installing new locales and may also result in failures
when reinstalling after having run make delete-old (due to previous
inconsistencies) for now recommand removing all locales until install(1) is
fixed
rmacklem [Tue, 17 Nov 2015 01:44:26 +0000 (01:44 +0000)]
mnt_stat.f_iosize (which is used to set bo_bsize) must be set to
the largest size of buffer cache block or the mapping of the buffer
is bogus. When a mount with rsize=4096,wsize=4096 was done, f_iosize
would be set to 4096. This resulted in corrupted directory data, since
the buffer cache block size for directories is NFS_DIRBLKSIZ (8192).
This patch fixes the code so that it always sets f_iosize to at least
NFS_DIRBLKSIZ.
rmacklem [Mon, 16 Nov 2015 23:19:53 +0000 (23:19 +0000)]
When the smbfs iod thread (smb_iod_thread()) is shutting down, smb_iod_destroy()
would call smb_iod_request(). This call could return as soon as the
wakeup(evp) in smb_iod_main() call is done and then could destroy
the mutexes. This caused a race with the rest of smb_iod_main()s
use of these mutexes.
A crash reported on freebsd-stable@ by Christian Kratzer was
diagnosed as a use of one of these mutexes after it was destroyed.
This patch moves destruction of the mutexes from smb_iod_destroy()
to the end of smb_iod_thread(), so that they aren't destroyed before
the thread is done with them. Christian comfirmed that the patch
stopped the crashes from happening.
marius [Mon, 16 Nov 2015 23:02:33 +0000 (23:02 +0000)]
- Unbreak dumpsys(9) on sparc64 after r276772
- While at it, arrange #ifndefs in kern_dump.c more intelligently; it's
rather confusing to have multiple competing and/or unused functions in
the kernel.
jhb [Mon, 16 Nov 2015 21:36:50 +0000 (21:36 +0000)]
Only use a power of 2 for the number of receive and transmit queues.
Using other values causes VMXNET3_CMD_ENABLE to fail. The Linux
driver also enforces this restriction.
marius [Mon, 16 Nov 2015 21:13:57 +0000 (21:13 +0000)]
With r290566 in place it turned out that WOL previously only worked by
accident with RTL8168G and later chips when the interface actually was
brought up. This is due to the fact that with these MAC variants, RXDV
gate needs be disabled for WOL to work. So do just that in re_setwol()
when IFCAP_WOL is requested.
Reported and tested by: dhw
rodrigc [Mon, 16 Nov 2015 16:48:43 +0000 (16:48 +0000)]
Import ypldap from OpenBSD.
ypldap -- Intended to be a drop-in replacement for ypserv, gluing in a
LDAP directory and thus providing support for users and groups stored in
LDAP for the get{pw,gr}ent family of functions.
jtl [Mon, 16 Nov 2015 15:22:15 +0000 (15:22 +0000)]
Improve accuracy of PMC sampling frequency
The code tracks a counter which is the number of events until the next
sample. On context switch in, it loads the saved counter. On context
switch out, it tries to calculate a new saved counter.
Problems:
1. The saved counter was shared by all threads in a process. However, this
means that all threads would be initially loaded with the same saved
counter. However, that could result in sampling more often than once every
X number of events.
2. The calculation to determine a new saved counter was backwards. It
added when it should have subtracted, and subtracted when it should have
added. Assume a single-threaded process with a reload count of 1000 events.
Assuming the counter on context switch in was 100 and the counter on context
switch out was 50 (meaning the thread has "consumed" 50 more events), the
code would calculate a new saved counter of 150 (instead of the proper 50).
Fix:
1. As soon as the saved counter is used to initialize a monitor for a
thread on context switch in, set the saved counter to the reload count.
That way, subsequent threads to use the saved counter will get the full
reload count, assuring we sample at least once every X number of events
(across all threads).
2. Change the calculation of the saved counter. Due to the change to the
saved counter in #1, we simply need to add (modulo the reload count) the
remaining counter time we retrieve from the CPU when a thread is context
switched out.
jtl [Mon, 16 Nov 2015 15:16:09 +0000 (15:16 +0000)]
Change the driver stats to what they really are: unsigned values.
When pmcstat exits after some samples were dropped, give the user an
idea of how many were lost. (Granted, these are global numbers, but
they may still help quantify the scope of the loss.)
ae [Mon, 16 Nov 2015 07:10:42 +0000 (07:10 +0000)]
Use explicitly specified ivsize instead of blocksize when we mean IV size.
Set zero ivsize for enc_xform_null and remove special handling from
xform_esp.c.