Commit Graph

7641 Commits

Author SHA1 Message Date
Sergey Kandaurov
71b282bb92 Add missing priority argument in example code in BUGS section.
PR:		201725
Submitted by:	Thomas Cort
MFC after:	1 week
2015-07-21 09:44:45 +00:00
Konstantin Belousov
b4490c6e93 The si_status field of the siginfo_t, provided by the waitid(2) and
SIGCHLD signal, should keep full 32 bits of the status passed to the
_exit(2).

Split the combined p_xstat of the struct proc into the separate exit
status p_xexit for normal process exit, and signalled termination
information p_xsig.  Kernel-visible macro KW_EXITCODE() reconstructs
old p_xstat from p_xexit and p_xsig.  p_xexit contains complete status
and copied out into si_status.

Requested by:	Joerg Schilling
Reviewed by:	jilles (previous version), pho
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
2015-07-18 09:02:50 +00:00
Alan Cox
131041fa2a Correct the description of MADV_DONTNEED. Specifically, after using
MADV_DONTNEED, while pages faults on the affected address range are more
likely to occur, they are not guaranteed to occur.

MFC after:	3 days
2015-07-12 19:18:19 +00:00
Adrian Chadd
6520495abc Add an initial NUMA affinity/policy configuration for threads and processes.
This is based on work done by jeff@ and jhb@, as well as the numa.diff
patch that has been circulating when someone asks for first-touch NUMA
on -10 or -11.

* Introduce a simple set of VM policy and iterator types.
* tie the policy types into the vm_phys path for now, mirroring how
  the initial first-touch allocation work was enabled.
* add syscalls to control changing thread and process defaults.
* add a global NUMA VM domain policy.
* implement a simple cascade policy order - if a thread policy exists, use it;
  if a process policy exists, use it; use the default policy.
* processes inherit policies from their parent processes, threads inherit
  policies from their parent threads.
* add a simple tool (numactl) to query and modify default thread/process
  policities.
* add documentation for the new syscalls, for numa and for numactl.
* re-enable first touch NUMA again by default, as now policies can be
  set in a variety of methods.

This is only relevant for very specific workloads.

This doesn't pretend to be a final NUMA solution.

The previous defaults in -HEAD (with MAXMEMDOM set) can be achieved by
'sysctl vm.default_policy=rr'.

This is only relevant if MAXMEMDOM is set to something other than 1.
Ie, if you're using GENERIC or a modified kernel with non-NUMA, then
this is a glorified no-op for you.

Thank you to Norse Corp for giving me access to rather large
(for FreeBSD!) NUMA machines in order to develop and verify this.

Thank you to Dell for providing me with dual socket sandybridge
and westmere v3 hardware to do NUMA development with.

Thank you to Scott Long at Netflix for providing me with access
to the two-socket, four-domain haswell v3 hardware.

Thank you to Peter Holm for running the stress testing suite
against the NUMA branch during various stages of development!

Tested:

* MIPS (regression testing; non-NUMA)
* i386 (regression testing; non-NUMA GENERIC)
* amd64 (regression testing; non-NUMA GENERIC)
* westmere, 2 socket (thankyou norse!)
* sandy bridge, 2 socket (thankyou dell!)
* ivy bridge, 2 socket (thankyou norse!)
* westmere-EX, 4 socket / 1TB RAM (thankyou norse!)
* haswell, 2 socket (thankyou norse!)
* haswell v3, 2 socket (thankyou dell)
* haswell v3, 2x18 core (thankyou scott long / netflix!)

* Peter Holm ran a stress test suite on this work and found one
  issue, but has not been able to verify it (it doesn't look NUMA
  related, and he only saw it once over many testing runs.)

* I've tested bhyve instances running in fixed NUMA domains and cpusets;
  all seems to work correctly.

Verified:

* intel-pcm - pcm-numa.x and pcm-memory.x, whilst selecting different
  NUMA policies for processes under test.

Review:

This was reviewed through phabricator (https://reviews.freebsd.org/D2559)
as well as privately and via emails to freebsd-arch@.  The git history
with specific attributes is available at https://github.com/erikarn/freebsd/
in the NUMA branch (https://github.com/erikarn/freebsd/compare/local/adrian_numa_policy).

This has been reviewed by a number of people (stas, rpaulo, kib, ngie,
wblock) but not achieved a clear consensus.  My hope is that with further
exposure and testing more functionality can be implemented and evaluated.

Notes:

* The VM doesn't handle unbalanced domains very well, and if you have an overly
  unbalanced memory setup whilst under high memory pressure, VM page allocation
  may fail leading to a kernel panic.  This was a problem in the past, but it's
  much more easily triggered now with these tools.

* This work only controls the path through vm_phys; it doesn't yet strongly/predictably
  affect contigmalloc, KVA placement, UMA, etc.  So, driver placement of memory
  isn't really guaranteed in any way.  That's next on my plate.

Sponsored by:	Norse Corp, Inc.; Dell
2015-07-11 15:21:37 +00:00
Baptiste Daroussin
d7852cbcf2 Since sh(1) now supports mulitbyte (only UTF-8) clarify the related BUGS
section in wordexp(3) manual page

Discussed with:	jilles
2015-07-11 13:07:50 +00:00
Andrew Turner
249d5c7acc Add support for makecontext. This supports up to 8 arguments as this
simplifies the code, these can be passed in registers.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2015-07-10 08:36:22 +00:00
Edward Tomasz Napierala
a238a79872 Fix markup.
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2015-07-07 19:23:59 +00:00
Edward Tomasz Napierala
c886a05c13 Remove reboot.S (part of libc). It's not needed and was actually
broken - returning 0 from reboot(2) resulted in SIGBUS.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-07-07 09:25:51 +00:00
Andrew Turner
1af1dde836 Add hton and ntoh to the arm64 Symbols.map file, they exist but were not
exported.
2015-07-06 09:57:40 +00:00
Patrick Kelsey
4959a176f8 Fix sysctl(3) so it returns the intended values for all mib names in
the 'user' sysctl tree, which have all been coming back 0 or empty
since r240176.

Differential Revision: https://reviews.freebsd.org/D2945
Reviewed by: sbruno
Approved by: jmallett (mentor)
MFC after: 3 days
2015-07-06 01:42:12 +00:00
Mariusz Zaborski
fd10995478 Add fdclose(3) function.
This function is equivalent to fclose(3) function except that it
does not close the underlying file descriptor.
fdclose(3) is step forward to make FILE structure private.

Reviewed by:	wblock, jilles, jhb, pjd
Approved by:	pjd (mentor)
Differential Revision:	https://reviews.freebsd.org/D2697
2015-07-04 16:42:14 +00:00
Konstantin Belousov
eb89622653 Grammar and language fixes.
Submitted by:	wblock
Review:	https://reviews.freebsd.org/D2969
MFC after:	12 days
2015-07-03 17:30:31 +00:00
Andrew Turner
74735cf188 Cleanup brk and sbrk to use the same code to find curbrk and minbrk when
both compiling for PIC and non-PIC.

Sponsored by:	ABT Systems Ltd
2015-07-02 14:54:21 +00:00
Konstantin Belousov
23e1c1251c Document x86 machine-specific ptrace(2) requests. Provide list of the
ppc requests.

Reviewed by:	brueffer, emaste, gjb (previous version)
Sponsored by:	The FreeBSD Foundation
Review:	https://reviews.freebsd.org/D2962
MFC after:	2 weeks
2015-06-30 18:53:42 +00:00
Andrew Turner
93b86b2fb0 Implement fpgetmask, it's needed by Python.
Approved by:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2015-06-25 08:22:25 +00:00
Andrew Turner
bbe1d59571 Export __flt_rounds from the arm64 libc.so 2015-06-25 08:15:47 +00:00
Andrew Turner
f36c0f6257 Implement fpsetmask. Some third-party software makes use of it, for example
perl.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2015-06-24 16:18:58 +00:00
Andrew Turner
a998adbb90 Set the alignment of the setjmp magic values correctly. The alignment needs
to be before the lavel, otherwise an extra word may be added between the
label and the data.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FReeBSD Foundation
2015-06-24 16:15:32 +00:00
Jilles Tjoelker
764a9bbee1 fts_children: preserve errno after running close/fchdir
PR:		200942
Submitted by:	Conrad Meyer
Differential Revision: https://reviews.freebsd.org/D2852
MFC after:	1 week
2015-06-20 20:54:05 +00:00
Simon J. Gerraty
2ef6d5a7b9 new depends 2015-06-16 23:37:19 +00:00
Andrew Turner
9975c7a7ef Export the ARM __aeabi_mem* functions from libc, they are needed by the gcc
from ports as it doesn't include these in the copy of libgcc it installs
uses.

Obtained from:	ABT Systems Ltd
2015-06-16 16:40:25 +00:00
Baptiste Daroussin
18b2ee82db Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
Baptiste Daroussin
4232f82668 Enforce overwritting SHLIBDIR
Since METAMODE has been added, sys.mk loads bsd.mkopt.mk which ends load loading
bsd.own.mk which then defines SHLIBDIR before all the Makefile.inc everywhere.

This makes /lib being populated again.

Reported by:	many
2015-06-15 15:34:20 +00:00
Michael Tuexen
b96e9390db Fix name of a constant.
MFC after: 3 days
2015-06-14 20:16:36 +00:00
Jeremie Le Hen
b7c4ed65cc NetBSD commit log:
Use a constant array for the MIB. Newer LLVM decided that mib[] warranted
  stack protections, with the obvious crash after the setup was done.
  As a positive side effect, code size shrinks a bit.

I'm not sure why this hasn't bitten us yes, but it is certainly possible and
there are no real drawbacks to this change anyway.

Submitted by:	pfg
Obtained from:	NetBSD
MFC after:	1 week
2015-06-14 07:47:18 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Hajimu UMEMOTO
0df21fef2d Add support for '_' occurring at the beginning or end of a name
component.

PR:		176093
Submitted by:	landonf__at__bikemonkey.org
MFC after:	1 week
2015-06-10 16:15:22 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Andrew Turner
cfca10c23e Set the correct register when calling sigprocmask in longjmp.
Submitted by:	Patrick Wildt <patrick@bitrig.org>
Obtained from:	drahn@bitrig.org
2015-06-06 10:28:38 +00:00
Jilles Tjoelker
c0806cdc21 strchr(3): Mdoc fixes. 2015-06-04 21:54:46 +00:00
Craig Rodrigues
73fe130441 Use proper prototype for harmless(). 2015-05-31 19:09:24 +00:00
Craig Rodrigues
9c75ed7f39 Make x_putlong() and x_putbytes() prototypes match the
prototypes in <rpc/xdr.h>
2015-05-31 18:11:20 +00:00
Craig Rodrigues
d660d38da5 Use ANSI C prototypes. 2015-05-31 18:08:58 +00:00
Andrew Turner
6c5bc49c5a Add the needed if-then instructions to build as Thumb-2. 2015-05-31 14:04:11 +00:00
Andrew Turner
ab70803433 Remove __ARM_EABI__ from more places in libc as this is the only ARM ABI
we support.
2015-05-31 12:53:10 +00:00
Andrew Turner
24e8388b29 Use a register to set the cpsr bits. The ip register is safe to be changed
within all of these functions, and is only stored in some to correctly pad
the stack.

This will be needed to build as Thumb-2 as, unlike with ARM instructions,
the msr instruction only takes a register as the input.
2015-05-31 09:07:26 +00:00
Brooks Davis
0aa6527ff0 Removed unused special fork() implementations.
The arm version hasn't been used in ages.

The mips version uses a valid, but pointless check of v1 and has been
unhooked from the build since r276630.

Differential Revision:	https://reviews.freebsd.org/D2592
Reviewed by:	emaste
Sponsored by:	DARPA, AFRL
2015-05-29 19:42:55 +00:00
Andrew Turner
5d8564aec8 Fix __fpclassifyl when double == long double. As with r283693 this is
needed on ARM and PowerPC.

MFC after:	1 Week
2015-05-29 09:26:10 +00:00
Andrew Turner
275ac7729e Fix __isinfl on architectures where double == long double. This is the
case on at least ARM and PowerPC.

MFC after:	1 week
2015-05-29 09:23:20 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Ed Maste
16150352f5 memmem(3): empty little string matches the beginning of the big string
This function originated in glibc, and this matches their behaviour
(and NetBSD, OpenBSD, and musl).

An empty big string (arg "l") is handled by the existing
l_len < s_len test.

Reviewed by:	bapt, ngie
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2657
2015-05-26 21:16:07 +00:00
Baptiste Daroussin
a822b64165 Remove clause 3 and 4 from the license
Obtained from:	NetBSD
2015-05-21 08:38:25 +00:00
Konstantin Belousov
60a8e659bb Remove the write-only variable phent. We currently do not check the
size of the program header's entries.

Reported by:	adrian (by using gcc 4.9)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-05-20 15:37:15 +00:00
Pedro F. Giffuni
1b81d86525 Drop some unnecessary casts.
Reported by:	Clang static analyzer
Obtained from:	NetBSD
2015-05-18 16:28:13 +00:00
Ed Maste
e09e55dc82 Add fabs() to arm64 libc
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2532
2015-05-14 17:12:45 +00:00
Andrew Turner
2b6a6357f2 Teach bits of libc about Thumb. This adds the if-then instructions needed
to handle the ARM conditional execution.

While here fix a bug found by this in the hard-float code, cc is the
opposite of cs. The former is used for 'less than' in floating-point code
and is executed when the C (carry) bit is clear, the latter is used when
greater than, equal, or unordered, and is executed when the C bit is set.
2015-05-12 10:03:14 +00:00
Andrew Turner
74de7730b7 Use the GOT_* macros to help simplify the code, these work with both pic
and non-pic code, and to build for Thumb.
2015-05-11 20:33:46 +00:00
Jilles Tjoelker
53d1c63711 recv(),send(): Directly call interposing entry instead of going through PLT.
recv() and send()'s calls to recvfrom() and sendto() are much like
waitpid()'s call to wait4(), and likewise need not allow PLT interposing on
the called function.
2015-05-10 14:50:50 +00:00
John Baldwin
8b2e525f52 Tweak the comment here some more. In particular, the previous opening
sentence was a bit confusing.

Noted by:	kib
2015-05-06 17:23:42 +00:00
John Baldwin
5deee724da Remove the note about seekdir() removing telldir() cookies. That was
removed back in r269204.

MFC after:	3 days
2015-05-06 15:30:05 +00:00