Commit Graph

11 Commits

Author SHA1 Message Date
Joseph Myers 04277e02d7 Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2019-01-01 00:11:28 +00:00
Joseph Myers 688903eb3e Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2018-01-01 00:32:25 +00:00
Adhemerval Zanella 72b3c6eecd nptl: Change tst-typesizes to _Static_assert
Instead of rely on runtime check to assure correct pthread types
size a better strategy would use _Static_assert to trigger an error
on build time (and thus allowing to check to potentially ABI breakage
on cross-compiling make check).

This patch moves nptl/tst-typesizes.c to libpthread build time on
each specific initialization routine and also remove some runtime
redundant asserts for the same type sizes.

Checked on x86_64-linux-gnu and with a build check for all affected
ABIs (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabihf,
hppa-linux-gnu, i686-linux-gnu, ia64-linux-gnu, m68k-linux-gnu,
microblaze-linux-gnu, mips64-linux-gnu, mips64-n32-linux-gnu,
mips-linux-gnu, powerpc64le-linux-gnu, powerpc-linux-gnu,
s390-linux-gnu, s390x-linux-gnu, sh4-linux-gnu, sparc64-linux-gnu,
sparcv9-linux-gnu, tilegx-linux-gnu, tilegx-linux-gnu-x32,
tilepro-linux-gnu, x86_64-linux-gnu, and x86_64-linux-x32).

	* nptl/pthreadP.h (ASSERT_TYPE_SIZE, ASSERT_PTHREAD_INTERNAL_SIZE):
	New macros.
	* nptl/pthread_attr_init.c (__pthread_mutex_init): Add build time
	checks for expected input type size.
	* nptl/pthread_barrier_init.c (__pthread_barrier_init): Likewise.
	* nptl/pthread_barrierattr_init.c (pthread_barrierattr_init):
	Likewise.
	* nptl/pthread_cond_init.c (__pthread_cond_init): Likewise.
	* nptl/pthread_condattr_init.c (__pthread_condattr_init): Likewise.
	* nptl/pthread_mutex_init.c (__pthread_mutex_init): Likewise.
	* nptl/pthread_mutexattr_init.c (__pthread_mutexattr_init): Likewise.
	* nptl/pthread_rwlock_init.c (__pthread_rwlock_init): Likewise.
	* nptl/pthread_rwlockattr_init.c (pthread_rwlockattr_init): Likewise.
	* nptl/sem_init.c (__new_sem_init, __old_sem_init): Likewise
	* nptl/pthread_attr_destroy.c (__pthread_attr_destroy): Remove
	superflous runtime assert check.
	* nptl/pthread_attr_getaffinity.c (__pthread_attr_getaffinity_new):
	Likewise.
	* nptl/pthread_attr_getdetachstate.c (__pthread_attr_getdetachstate):
	Likewise.
	* nptl/pthread_attr_getguardsize.c (pthread_attr_getguardsize):
	Likewise.
	* nptl/pthread_attr_getinheritsched.c (__pthread_attr_getinheritsched):
	Likewise.
	* nptl/pthread_attr_getschedparam.c (__pthread_attr_getschedparam):
	Likewise.
	* nptl/pthread_attr_getschedpolicy.c (__pthread_attr_getschedpolicy):
	Likewise.
	* nptl/pthread_attr_getscope.c (__pthread_attr_getscope): Likewise.
	* nptl/pthread_attr_getstack.c (__pthread_attr_getstack): Likewise.
	* nptl/pthread_attr_getstackaddr.c (__pthread_attr_getstackaddr):
	Likewise.
	* nptl/pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
	Likewise.
	* nptl/pthread_attr_setaffinity.c (__pthread_attr_setaffinity_new):
	Likewise.
	* nptl/pthread_attr_setdetachstate.c (__pthread_attr_setdetachstate):
	Likewise.
	* nptl/pthread_attr_setguardsize.c (pthread_attr_setguardsize):
	Likewise.
	* nptl/pthread_attr_setinheritsched.c
	(__pthread_attr_setinheritsched): Likewise.
	* nptl/pthread_attr_setschedparam.c (__pthread_attr_setschedparam):
	Likewise.
	* nptl/pthread_attr_setschedpolicy.c (__pthread_attr_setschedpolicy):
	Likewise.
	* nptl/pthread_attr_setscope.c (__pthread_attr_setscope): Likewise.
	* nptl/pthread_attr_setstack.c (__pthread_attr_setstack,
	__old_pthread_attr_setstack): Likewise.
	* nptl/pthread_attr_setstackaddr.c (__pthread_attr_setstackaddr):
	Likewise.
	* nptl/pthread_attr_setstacksize.c (__pthread_attr_setstacksize):
	Likewise.
	* nptl/pthread_getattr_default_np.c (pthread_getattr_default_np):
	Likewise.
	* nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Likewise.
	* nptl/pthread_setattr_default_np.c (pthread_setattr_default_np):
	Likewise.
	* nptl/tst-typesizes.c: Remove file.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-11-07 09:48:37 -02:00
Joseph Myers bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Florian Weimer 2359035ac5 Remove CPU set size checking from affinity functions [BZ #19143]
With current kernel versions, the check does not reliably detect that
unavailable CPUs are requested, for these reasons:

(1) The kernel will silently ignore non-allowed CPUs, that is, CPUs
    which are physically present but disallowed for the thread
    based on system configuration.

(2) Similarly, CPU bits which lack an online CPU (possible CPUs)
    are ignored.

(3) The existing probing code assumes that the CPU mask size is a
    power of two and at least 1024.  Neither has it to be a power
    of two, nor is the minimum possible value 1024, so the value
    determined is often too large.  This means that the CPU set
    size check in glibc accepts CPU bits beyond the actual hard
    system limit.

(4) Future kernel versions may not even have a fixed CPU set size.

After the removal of the probing code, the kernel still returns
EINVAL if no CPU in the requested set remains which can run the
thread after the affinity change.

Applications which care about the exact affinity mask will have
to query it using sched_getaffinity after setting it.  Due to the
effects described above, this commit does not change this.

The new tests supersede tst-getcpu, which is removed.  This
addresses bug 19164 because the new tests allocate CPU sets
dynamically.

	* nptl/check-cpuset.h: Remove.
	* nptl/pthread_attr_setaffinity.c (__pthread_attr_setaffinity_new):
	Remove CPU set size check.
	* nptl/pthread_setattr_default_np.c (pthread_setattr_default_np):
	Likewise.
	* sysdeps/unix/sysv/linux/check-cpuset.h: Remove.
	* sysdeps/unix/sysv/linux/pthread_setaffinity.c
	(__kernel_cpumask_size, __determine_cpumask_size): Remove.
	(__pthread_setaffinity_new): Remove CPU set size check.
	* sysdeps/unix/sysv/linux/sched_setaffinity.c
	(__kernel_cpumask_size): Remove.
	(__sched_setaffinity_new): Remove CPU set size check.
	* manual/threads.texi (Default Thread Attributes): Remove stale
	reference to check_cpuset_attr, determine_cpumask_size in comment.
	* sysdeps/unix/sysv/linux/Makefile [$(subdir) == posix] (tests):
	Remove tst-getcpu.  Add tst-affinity, tst-affinity-pid.
	[$(subdir) == nptl] (tests): Add tst-thread-affinity-pthread,
	tst-thread-affinity-pthread2, tst-thread-affinity-sched.
	* sysdeps/unix/sysv/linux/tst-affinity.c: New file.
	* sysdeps/unix/sysv/linux/tst-affinity-pid.c: New file.
	* sysdeps/unix/sysv/linux/tst-skeleton-affinity.c: New skeleton test file.
	* sysdeps/unix/sysv/linux/tst-thread-affinity-sched.c: New file.
	* sysdeps/unix/sysv/linux/tst-thread-affinity-pthread.c: New file.
	* sysdeps/unix/sysv/linux/tst-thread-affinity-pthread2.c: New file.
	* sysdeps/unix/sysv/linux/tst-thread-skeleton-affinity.c: New
	skeleton test file.
	* sysdeps/unix/sysv/linux/tst-getcpu.c: Remove.  Superseded by
	tst-affinity-pid.
2015-11-24 17:21:01 +01:00
Roland McGrath 59ff172f80 NPTL: Refactor cpu_set_t validation to be sysdeps-controlled
This removes Linuxisms related to cpu_set_t validation from the
generic NPTL code and puts them into a new sysdeps header file.
2015-01-08 10:49:40 -08:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Allan McRae d4697bc93d Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Joseph Myers e781d7c58f Include <string.h> in nptl/pthread_setattr_default_np.c. 2013-06-22 19:32:50 +00:00
Siddhesh Poyarekar 61dd6208fb New API to set default thread attributes
This patch introduces two new convenience functions to set the default
thread attributes used for creating threads.  This allows a programmer
to set the default thread attributes just once in a process and then
run pthread_create without additional attributes.
2013-06-15 12:24:15 +05:30