Commit Graph

301 Commits

Author SHA1 Message Date
lha 8b387b156a Fix a problem where pthread_kill can set a signal while the process
have the signal blocked, this ends up making target thread getting
later stuck in a loop if it uses pthread_sigmask.

ok, cl and christos
2004-03-24 20:01:37 +00:00
he 99f69b6c5f It appears that <sys/lock.h> requires <sys/types.h>, so include that as well. 2004-03-14 12:49:31 +00:00
cl f3f745b9af fix comment for recent pthread_stack* var rename 2004-03-14 01:20:01 +00:00
cl f2f106648c add libpthread part of concurrency support for SA on MP systems
- enable concurrency according to environment variable PTHREAD_CONCURRENCY
- add idle VP wakeup if there are additional jobs and idle VPs
- make reidlequeue per VP
- enable spinning for locks
- fix race condition in alarm processing
- fix race condition in mutex locking
- make debugging output line buffered and add VP prefix to debug lines
2004-03-14 01:19:41 +00:00
thorpej 1cda93b426 Use the new RAS_*() macros. 2004-03-03 21:06:07 +00:00
wiz 85746c6759 Spell interrupt with two rs. From Peter Postma. 2004-02-24 15:16:04 +00:00
wiz f05e6f1a3a occured -> occurred. From Peter Postma. 2004-02-24 15:12:51 +00:00
wiz d20841bb64 Uppercase CPU, plural is CPUs. 2004-02-13 11:36:08 +00:00
nathanw 94fc83a6be Add ucontext conversion macros for an "extra" register set. 2004-02-11 21:04:10 +00:00
nathanw 0a6afcc70d Rename pt_stacksize, pt_stacksize_lg, and pt_stackmask to pthread_*. External
symbols can't start with pt_, as that is in the application namespace.
2004-02-02 20:36:18 +00:00
kleink 9f0429b6cc ; may be a comment character in assembly, use \n as a separator instead.
This instance spotted by Martin Husemann.
2004-01-19 16:18:33 +00:00
cl 359b937c80 - delay making a thread unblocked until it's put on the runqueue.
- simplify handling of blocked idle threads.

This should fix the ``assertion "target->pt_state != PT_STATE_RUNNING
|| target->pt_blockgen != target->pt_unblockgen" failed'' problem
reported by Marc Recht and Steve Bellovin on current-users.

Also g/c unused pthread__sched_bulk call left over from pthread_sa.c
rev. 1.22 change.
2004-01-16 15:23:31 +00:00
cl c8017c0dc6 - add deadlock check to pthread_rwlock_wrlock and pthread_rwlock_timedwrlock
- return EPERM when unlocking a lock which isn't held
=> prevent the failure in PR 24023, where the citrus code had a deadlocking
   code path

- remove deadlock check in pthread_rwlock_tryrdlock, return EBUSY instead
=> makes pthread_rwlock_tryrdlock standards compliant
2004-01-09 18:08:28 +00:00
cl f35871411a make siglongjmp out of a signal handler work:
- strong alias __sigprocmask14 to pthread_sigmask
- call _sys___sigprocmask14 where appropriate
- make pthread_sigmask not set the signal mask lazily when pthreads
  aren't started yet
2004-01-02 19:24:44 +00:00
cl 33622a5943 userland part of no-syscall upcall stack return
- add pt_stackinfo to struct __pthread_st
- add pthread__stackinfo_offset returning the offset from ss_sp to
  pt_stackinfo
- pass stackinfo_offset to sa_register and set SA_FLAG_STACKINFO to
  make the kernel use it
- call pthread__sa_recycle in pthread__resolve_locks; g/c recycleq and
  pthread__recycle_bulk
- return stack in pthread__sa_recycle by incrementing sasi_stackgen
- make pthread__sa_recycle debugging output formatting conditional on
  pthread__debug_newline
2004-01-02 19:14:00 +00:00
cl 90e89977d4 - libc.so.12.109 and libpthread.so.0.4
- add ssize_t stackinfo_offset argument to sa_register syscall
- remove sa_unblockyield syscall
- make __sigprocmask14 syscall weak
- in pthread__sa_start: catch up with 4-argument sa_register syscall
2004-01-02 18:56:39 +00:00
cl 91d9c8c22f pthread__upcall: output LWPid in SA_UPCALL_BLOCKED case 2004-01-02 14:29:22 +00:00
cl 677748c645 logging/debugging changes:
- add PTHREAD_PID_DEBUG which prints the pid before each debuglog line
- output thread returned in pthread__next
- add asserts in pthread__sched akin to asserts in pthread__sched_bulk:
  check if scheduled thread is at front/end of queue
- pthread__upcall: output event/interrupted LWP count instead of LWPid
  of the first event/interrupted LWP (since unblock upcalls can have
  multiple event LWPs).
- pthread__find_interrupted: output LWPid here
2004-01-02 14:13:16 +00:00
lukem d597f546a1 Add dependencies to assym.h on:
pthread.h pthread_int.h pthread_md.h
Should help prevent the problem I raised in [kern/23946], based on
a hint from Christian Limpach.

Add MAKEVERBOSE support.
2004-01-02 01:37:53 +00:00
cl 82b6b2dbda Handle block/unblock for threads in critical section without
sa_unblockyield.

XXX g/c sa_unblockyield in kernel later
2003-12-31 16:45:48 +00:00
christos b7559f8576 PR/23791: Patrick Latify: Fix memory leak on thread creation failure. 2003-12-18 15:39:56 +00:00
jmc d9948df6dd Clean up tmp files on exit. Fixes PR#23723 2003-12-15 20:07:39 +00:00
christos 1edf98ec41 Add pthread_{g,s}etschedparam, that do nothing. 2003-12-07 20:29:07 +00:00
cl 2c9b7b1eb7 Set default stack size to the current limit on the stack size as set
with the shell's command to change limits.  Make the PTHREAD_STACKSIZE
environment variable override the default stack size.  The old fixed
stack size behaviour can be enable with PT_FIXEDSTACKSIZE_LG when building
libpthread.
2003-11-27 16:30:54 +00:00
he ea56bcee84 Hide the register number constants behind an _R_ prefix, and also
rename FPBASE to _FPBASE, so that we avoid polluting the user's
name space when e.g. <sys/ptrace.h> is included.  Previously, the
PC symbol in mips/regnum.h would conflict with the declaration of
the external variable by the same name in termcap.h, as discovered
by the ``okheaders'' regression test.
2003-11-26 08:36:49 +00:00
cl 11127744bf Save the old mask in the old context, not in the new one. 2003-11-25 23:55:27 +00:00
cl d109665f1d Honor SA_NODEFER in pthread__deliver_signal(). This should help code which
makes a longjmp out of a signal handler.

Also add missing si_code argument to debugging printf in pthread__kill().
2003-11-25 22:45:33 +00:00
christos 0446e60323 Update list of items. 2003-11-25 22:44:16 +00:00
christos adfca9e3e4 This is not needed anymore. 2003-11-25 22:41:12 +00:00
christos 5077d05f7b GC sigcontext<->mcontext code and __HAVE_SIGINFO. All supported archs have
siginfo implemented.
2003-11-25 22:36:32 +00:00
christos 69658517e0 - don't store sigmask on the stack, we could store it in the right place
[in the context]
- this has the side effect of fixing the problem of the signal mask not
  being preserved properly upon signal return, found and fixed by cl.
- add si_code to the tramp debugging output (requested by cl).
2003-11-25 22:26:44 +00:00
christos 6477735848 m68k does not sigcontext<->mcontext anymore. 2003-11-25 21:27:30 +00:00
cl 774b4b225b Update mutex/rwlock/sem code to match recent change in cond code. 2003-11-24 23:54:13 +00:00
cl 4f8ea51319 add CONSTCOND in constant condition. 2003-11-24 23:23:17 +00:00
nathanw 250e7bbf8e Fix a race between timed wait callbacks and manual signal/broadcasting
accidentally introduced in rev. 1.5.

Noted by Christian Limpach.
2003-11-24 22:54:31 +00:00
nathanw cdf7f99ee6 Manually inline pthread__testcancel in these routines; two function
calls' worth of overhead per cancellable syscall is overkill.
2003-11-21 23:03:13 +00:00
nathanw 4e755ddba8 Prevent ptc_mutex from remaining set if a CV sleep is woken by
cancellation:

 * Arrange to not set ptc_mutex until after the pre-sleep cancellation
   test.

 * In the post-sleep cancellation test, check if there are no more
   sleepers and clear ptc_mutex if so.

While here, sprinkle some __predict_false() around the cancellation
tests.
2003-11-21 22:08:00 +00:00
uwe 6d08061385 Do not move incoming paramters to callee-save registers when not
necessary.  Saves about a dozen of instructions.
2003-11-20 17:55:11 +00:00
uwe 4b13bb93a0 Follow-up to previous. In pthread__signal_tramp() maskp is below
siginfo on the stack, so get it from there.  ss_sp no longer points to
the the mask.  Pointed out by cl@.
2003-11-20 17:45:00 +00:00
uwe b3c165e505 Add _INITCONTEXT_U_MD, we need to clean _REG_SR. 2003-11-20 17:38:08 +00:00
uwe f5cd7f26ed Undo previous. In pthread__deliver_signal set uc->uc_stack.ss_sp = uc;
(as it used to be before 1.1.2.12) so that makecontext doesn't stomp
on the data we allocated on the stack.  Correct the debugging printf
to print olduc instead of target->pt_uc (we have pt_trapuc now, and
olduc can be pt_trapuc).
2003-11-20 17:16:41 +00:00
yamt d7b65981fb pthread__deliver_signal: swap oldmask and siginfo so that signal
handler's stack doesn't stomp siginfo.
this also fixes !__HAVE_SIGINFO, in that case
pthread__signal_tramp assumes uc->uc_stack.ss_sp points the old
signal mask.

pointed by uwe@.
2003-11-20 15:46:42 +00:00
uwe 1e78682585 In pthread__locked_switch set self->pt_uc only when the context is inited.
In STACK_SWITCH subtract STACKSPACE, not add it (it's zero for now anyway).
2003-11-20 03:31:02 +00:00
uwe 024d461f8f First cut at pthreads MD code for sh3. Based on m68k version.
Regression tests still failing: sem, sigalarm.
2003-11-18 03:11:41 +00:00
uwe f9cb911365 Add necessary symbols. 2003-11-18 03:07:29 +00:00
thorpej 88ed237274 Bump libc to 12.107 and libpthread to 0.3 for fsync_range(2). 2003-11-18 01:00:19 +00:00
thorpej 137c808bb8 Userland portion of fsync_range(2), written by Bill Studenmund, and
contributed by Wasabi Systems, Inc.
2003-11-18 00:56:56 +00:00
cl 196dbdcd2b - delay processing unblocked threads until after locks are resolved:
without the blocked/unblocked upcall ordering, an interrupted blocked
  upcall might put the blocked thread on the intqueue because it needs
  to be continued.  With the delayed processing, we avoid putting such a
  thread twice on the runqueue.
- fix putting a thread on the intqueue when it needs to be continued
  after it blocked.

Also check return value when returning a single stack.
2003-11-17 22:59:00 +00:00
uwe 764c596c3f Cause SIGTRAP if NOTREACHED code is reached. 2003-11-17 22:38:11 +00:00
cl 803f13c062 check deferred signals for all unblocked threads 2003-11-12 22:21:21 +00:00