CVS log for src/sys/kern/kern_umtx.c
Up to [FreeBSD] / src / sys / kern
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
Revision 1.96.2.2: download - view: text, markup, annotated - select for diffs
Tue Jan 17 11:04:58 2012 UTC (3 weeks, 2 days ago) by pho
Branches: RELENG_9
Diff to: previous 1.96.2.1: preferred, colored; branchpoint 1.96: preferred, colored; next MAIN 1.97: preferred, colored
Changes since revision 1.96.2.1: +43 -95 lines
SVN rev 230263 on 2012-01-17 11:04:58Z by pho MFC: r228218, r228219, 228220, 228221 Rename copyin_timeout32 to umtx_copyin_timeout32 and move parameter check here. Include check for negative seconds value. Add umtx_copyin_timeout() and move parameter checks here. Add declaration of umtx_copyin_timeout() Use umtx_copyin_timeout() to copy and check timeout parameter.
Revision 1.100: download - view: text, markup, annotated - select for diffs
Mon Jan 16 04:39:10 2012 UTC (3 weeks, 3 days ago) by davidxu
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.99: preferred, colored
Changes since revision 1.99: +2 -3 lines
SVN rev 230194 on 2012-01-16 04:39:10Z by davidxu Eliminate branch and insert an explicit reader memory barrier to ensure that waiter bit is set before reading semaphore count.
Revision 1.73.2.7: download - view: text, markup, annotated - select for diffs
Mon Dec 12 17:33:38 2011 UTC (8 weeks, 2 days ago) by pho
Branches: RELENG_8
Diff to: previous 1.73.2.6: preferred, colored; branchpoint 1.73: preferred, colored; next MAIN 1.74: preferred, colored
Changes since revision 1.73.2.6: +41 -85 lines
SVN rev 228439 on 2011-12-12 17:33:38Z by pho MFC: r228218, r228219, 228220, 228221 Rename copyin_timeout32 to umtx_copyin_timeout32 and move parameter check here. Include check for negative seconds value. Add umtx_copyin_timeout() and move parameter checks here. Add declaration of umtx_copyin_timeout() Use umtx_copyin_timeout() to copy and check timeout parameteri in kern_thr_suspend().
Revision 1.99: download - view: text, markup, annotated - select for diffs
Sat Dec 3 12:30:58 2011 UTC (2 months, 1 week ago) by pho
Branches: MAIN
Diff to: previous 1.98: preferred, colored
Changes since revision 1.98: +25 -53 lines
SVN rev 228219 on 2011-12-03 12:30:58Z by pho Add umtx_copyin_timeout() and move parameter checks here. In collaboration with: kib MFC after: 1 week
Revision 1.98: download - view: text, markup, annotated - select for diffs
Sat Dec 3 12:28:33 2011 UTC (2 months, 1 week ago) by pho
Branches: MAIN
Diff to: previous 1.97: preferred, colored
Changes since revision 1.97: +18 -42 lines
SVN rev 228218 on 2011-12-03 12:28:33Z by pho Rename copyin_timeout32 to umtx_copyin_timeout32 and move parameter check here. Include check for negative seconds value. In collaboration with: kib MFC after: 1 week
Revision 1.96.2.1.2.1: download - view: text, markup, annotated - select for diffs
Fri Nov 11 04:20:22 2011 UTC (2 months, 4 weeks ago) by kensmith
Branches: RELENG_9_0
CVS tags: RELENG_9_0_0_RELEASE
Diff to: previous 1.96.2.1: preferred, colored; next MAIN 1.96.2.2: preferred, colored
Changes since revision 1.96.2.1: +0 -0 lines
SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release cycle. Approved by: re (implicit)
Revision 1.97: download - view: text, markup, annotated - select for diffs
Mon Nov 7 15:43:11 2011 UTC (3 months ago) by ed
Branches: MAIN
Diff to: previous 1.96: preferred, colored
Changes since revision 1.96: +1 -1 lines
SVN rev 227309 on 2011-11-07 15:43:11Z by ed Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static.
Revision 1.96.2.1: download - view: text, markup, annotated - select for diffs
Fri Sep 23 00:51:37 2011 UTC (4 months, 2 weeks ago) by kensmith
Branches: RELENG_9
CVS tags: RELENG_9_0_BP
Branch point for: RELENG_9_0
Diff to: previous 1.96: preferred, colored
Changes since revision 1.96: +0 -0 lines
SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith Copy head to stable/9 as part of 9.0-RELEASE release cycle. Approved by: re (implicit)
Revision 1.96: download - view: text, markup, annotated - select for diffs
Fri Sep 16 13:58:51 2011 UTC (4 months, 3 weeks ago) by kmacy
Branches: MAIN
CVS tags: RELENG_9_BP
Branch point for: RELENG_9
Diff to: previous 1.95: preferred, colored
Changes since revision 1.95: +3 -3 lines
SVN rev 225617 on 2011-09-16 13:58:51Z by kmacy In order to maximize the re-usability of kernel code in user space this patch modifies makesyscalls.sh to prefix all of the non-compatibility calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel entry points and all places in the code that use them. It also fixes an additional name space collision between the kernel function psignal and the libc function of the same name by renaming the kernel psignal kern_psignal(). By introducing this change now we will ease future MFCs that change syscalls. Reviewed by: rwatson Approved by: re (bz)
Revision 1.61.2.8: download - view: text, markup, annotated - select for diffs
Thu Mar 3 22:09:10 2011 UTC (11 months, 1 week ago) by jhb
Branches: RELENG_7
Diff to: previous 1.61.2.7: preferred, colored; branchpoint 1.61: preferred, colored; next MAIN 1.62: preferred, colored
Changes since revision 1.61.2.7: +2 -47 lines
SVN rev 219255 on 2011-03-03 22:09:10Z by jhb MFC 218969: Expose the umtx_key structure and API to the rest of the kernel.
Revision 1.73.2.6: download - view: text, markup, annotated - select for diffs
Thu Mar 3 22:08:51 2011 UTC (11 months, 1 week ago) by jhb
Branches: RELENG_8
Diff to: previous 1.73.2.5: preferred, colored; branchpoint 1.73: preferred, colored
Changes since revision 1.73.2.5: +2 -47 lines
SVN rev 219254 on 2011-03-03 22:08:51Z by jhb MFC 218969: Expose the umtx_key structure and API to the rest of the kernel.
Revision 1.95: download - view: text, markup, annotated - select for diffs
Wed Feb 23 13:19:14 2011 UTC (11 months, 2 weeks ago) by jhb
Branches: MAIN
Diff to: previous 1.94: preferred, colored
Changes since revision 1.94: +2 -50 lines
SVN rev 218969 on 2011-02-23 13:19:14Z by jhb Expose the umtx_key structure and API to the rest of the kernel. MFC after: 3 days
Revision 1.73.2.5: download - view: text, markup, annotated - select for diffs
Tue Jan 11 17:33:29 2011 UTC (12 months, 4 weeks ago) by mdf
Branches: RELENG_8
Diff to: previous 1.73.2.4: preferred, colored; branchpoint 1.73: preferred, colored
Changes since revision 1.73.2.4: +1 -2 lines
SVN rev 217272 on 2011-01-11 17:33:29Z by mdf MFC r216463: One of the compat32 functions was copying in a raw timespec, instead of a 32-bit one. This can cause weird timeout issues, as the copying reads garbage from the user.
Revision 1.94: download - view: text, markup, annotated - select for diffs
Wed Dec 29 09:26:46 2010 UTC (13 months, 1 week ago) by davidxu
Branches: MAIN
Diff to: previous 1.93: preferred, colored
Changes since revision 1.93: +18 -43 lines
SVN rev 216791 on 2010-12-29 09:26:46Z by davidxu - Follow r216313, the sched_unlend_user_prio is no longer needed, always use sched_lend_user_prio to set lent priority. - Improve pthread priority-inherit mutex, when a contender's priority is lowered, repropagete priorities, this may cause mutex owner's priority to be lowerd, in old code, mutex owner's priority is rise-only.
Revision 1.93: download - view: text, markup, annotated - select for diffs
Thu Dec 23 03:12:03 2010 UTC (13 months, 2 weeks ago) by davidxu
Branches: MAIN
Diff to: previous 1.92: preferred, colored
Changes since revision 1.92: +2 -2 lines
SVN rev 216678 on 2010-12-23 03:12:03Z by davidxu Enlarge hash table for new condition variable.
Revision 1.92: download - view: text, markup, annotated - select for diffs
Wed Dec 22 05:01:52 2010 UTC (13 months, 2 weeks ago) by davidxu
Branches: MAIN
Diff to: previous 1.91: preferred, colored
Changes since revision 1.91: +105 -15 lines
SVN rev 216641 on 2010-12-22 05:01:52Z by davidxu MFp4: - Add flags CVWAIT_ABSTIME and CVWAIT_CLOCKID for umtx kernel based condition variable, this should eliminate an extra system call to get current time. - Add sub-function UMTX_OP_NWAKE_PRIVATE to wake up N channels in single system call. Create userland sleep queue for condition variable, in most cases, thread will wait in the queue, the pthread_cond_signal will defer thread wakeup until the mutex is unlocked, it tries to avoid an extra system call and a extra context switch in time window of pthread_cond_signal and pthread_mutex_unlock. The changes are part of process-shared mutex project.
Revision 1.61.2.7.4.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:10:29 2010 UTC (13 months, 2 weeks ago) by kensmith
Branches: RELENG_7_4
CVS tags: RELENG_7_4_0_RELEASE
Diff to: previous 1.61.2.7: preferred, colored; next MAIN 1.61.2.8: preferred, colored
Changes since revision 1.61.2.7: +0 -0 lines
SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release. Approved by: re (implicit)
Revision 1.73.2.4.4.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:09:25 2010 UTC (13 months, 2 weeks ago) by kensmith
Branches: RELENG_8_2
CVS tags: RELENG_8_2_0_RELEASE
Diff to: previous 1.73.2.4: preferred, colored; next MAIN 1.73.2.5: preferred, colored
Changes since revision 1.73.2.4: +0 -0 lines
SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release. Approved by: re (implicit)
Revision 1.91: download - view: text, markup, annotated - select for diffs
Wed Dec 15 19:30:44 2010 UTC (13 months, 3 weeks ago) by mdf
Branches: MAIN
Diff to: previous 1.90: preferred, colored
Changes since revision 1.90: +1 -2 lines
SVN rev 216463 on 2010-12-15 19:30:44Z by mdf One of the compat32 functions was copying in a raw timespec, instead of a 32-bit one. This can cause weird timeout issues, as the copying reads garbage from the user. Code by: Deepak Veliath <deepak dot veliath at isilon dot com> MFC after: 1 week
Revision 1.90: download - view: text, markup, annotated - select for diffs
Thu Dec 9 02:42:02 2010 UTC (14 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.89: preferred, colored
Changes since revision 1.89: +9 -7 lines
SVN rev 216313 on 2010-12-09 02:42:02Z by davidxu MFp4: It is possible a lower priority thread lending priority to higher priority thread, in old code, it is ignored, however the lending should always be recorded, add field td_lend_user_pri to fix the problem, if a thread does not have borrowed priority, its value is PRI_MAX. MFC after: 1 week
Revision 1.89: download - view: text, markup, annotated - select for diffs
Mon Nov 22 02:42:02 2010 UTC (14 months, 2 weeks ago) by davidxu
Branches: MAIN
Diff to: previous 1.88: preferred, colored
Changes since revision 1.88: +2 -1 lines
SVN rev 215652 on 2010-11-22 02:42:02Z by davidxu Use atomic instruction to set _has_writer, otherwise there is a race causes userland to not wake up a thread sleeping in kernel. MFC after: 3 days
Revision 1.88: download - view: text, markup, annotated - select for diffs
Mon Nov 15 07:33:54 2010 UTC (14 months, 3 weeks ago) by davidxu
Branches: MAIN
Diff to: previous 1.87: preferred, colored
Changes since revision 1.87: +4 -4 lines
SVN rev 215336 on 2010-11-15 07:33:54Z by davidxu Only unlock process if a thread is found.
Revision 1.87: download - view: text, markup, annotated - select for diffs
Sat Oct 9 02:50:23 2010 UTC (16 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.86: preferred, colored
Changes since revision 1.86: +3 -8 lines
SVN rev 213642 on 2010-10-09 02:50:23Z by davidxu Create a global thread hash table to speed up thread lookup, use rwlock to protect the table. In old code, thread lookup is done with process lock held, to find a thread, kernel has to iterate through process and thread list, this is quite inefficient. With this change, test shows in extreme case performance is dramatically improved. Earlier patch was reviewed by: jhb, julian
Revision 1.86: download - view: text, markup, annotated - select for diffs
Wed Aug 25 03:14:32 2010 UTC (17 months, 2 weeks ago) by davidxu
Branches: MAIN
Diff to: previous 1.85: preferred, colored
Changes since revision 1.85: +12 -23 lines
SVN rev 211794 on 2010-08-25 03:14:32Z by davidxu If a thread is removed from umtxq while sleeping, reset error code to zero, this gives userland a better indication that a thread needn't to be cancelled.
Revision 1.85: download - view: text, markup, annotated - select for diffs
Mon Jun 21 09:55:56 2010 UTC (19 months, 2 weeks ago) by ed
Branches: MAIN
Diff to: previous 1.84: preferred, colored
Changes since revision 1.84: +2 -2 lines
SVN rev 209390 on 2010-06-21 09:55:56Z by ed Use ISO C99 integer types in sys/kern where possible. There are only about 100 occurences of the BSD-specific u_int*_t datatypes in sys/kern. The ISO C99 integer types are used here more often.
Revision 1.73.2.4.2.1: download - view: text, markup, annotated - select for diffs
Mon Jun 14 02:09:06 2010 UTC (19 months, 3 weeks ago) by kensmith
Branches: RELENG_8_1
CVS tags: RELENG_8_1_0_RELEASE
Diff to: previous 1.73.2.4: preferred, colored; next MAIN 1.73.2.5: preferred, colored
Changes since revision 1.73.2.4: +0 -0 lines
SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith Copy stable/8 to releng/8.1 in preparation for 8.1-RC1. Approved by: re (implicit)
Revision 1.73.2.4: download - view: text, markup, annotated - select for diffs
Wed Apr 7 02:24:41 2010 UTC (22 months ago) by nwhitehorn
Branches: RELENG_8
CVS tags: RELENG_8_2_BP, RELENG_8_1_BP
Branch point for: RELENG_8_2, RELENG_8_1
Diff to: previous 1.73.2.3: preferred, colored; branchpoint 1.73: preferred, colored
Changes since revision 1.73.2.3: +3 -3 lines
SVN rev 206336 on 2010-04-07 02:24:41Z by nwhitehorn MFC r205014,205015: Provide groundwork for 32-bit binary compatibility on non-x86 platforms, for upcoming 64-bit PowerPC and MIPS support. This renames the COMPAT_IA32 option to COMPAT_FREEBSD32, removes some IA32-specific code from MI parts of the kernel and enhances the freebsd32 compatibility code to support big-endian platforms. This MFC is required for MFCs of later changes to the freebsd32 compatibility from HEAD. Requested by: kib
Revision 1.84: download - view: text, markup, annotated - select for diffs
Thu Mar 11 14:49:06 2010 UTC (23 months ago) by nwhitehorn
Branches: MAIN
Diff to: previous 1.83: preferred, colored
Changes since revision 1.83: +3 -3 lines
SVN rev 205014 on 2010-03-11 14:49:06Z by nwhitehorn Provide groundwork for 32-bit binary compatibility on non-x86 platforms, for upcoming 64-bit PowerPC and MIPS support. This renames the COMPAT_IA32 option to COMPAT_FREEBSD32, removes some IA32-specific code from MI parts of the kernel and enhances the freebsd32 compatibility code to support big-endian platforms. Reviewed by: kib, jhb
Revision 1.83: download - view: text, markup, annotated - select for diffs
Wed Feb 10 05:47:34 2010 UTC (23 months, 4 weeks ago) by davidxu
Branches: MAIN
Diff to: previous 1.82: preferred, colored
Changes since revision 1.82: +1 -1 lines
SVN rev 203744 on 2010-02-10 05:47:34Z by davidxu In function umtxq_insert_queue, use parameter q (shared/exclusive queue) instead of hard coded constant. This does not affect RELENG_8 and previous, because the code only exists in the HEAD.
Revision 1.61.2.7.2.1: download - view: text, markup, annotated - select for diffs
Wed Feb 10 00:26:20 2010 UTC (23 months, 4 weeks ago) by kensmith
Branches: RELENG_7_3
CVS tags: RELENG_7_3_0_RELEASE
Diff to: previous 1.61.2.7: preferred, colored; next MAIN 1.61.2.8: preferred, colored
Changes since revision 1.61.2.7: +0 -0 lines
SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process. Approved by: re (implicit)
Revision 1.61.2.7: download - view: text, markup, annotated - select for diffs
Tue Feb 9 01:19:10 2010 UTC (2 years ago) by davidxu
Branches: RELENG_7
CVS tags: RELENG_7_4_BP, RELENG_7_3_BP
Branch point for: RELENG_7_4, RELENG_7_3
Diff to: previous 1.61.2.6: preferred, colored; branchpoint 1.61: preferred, colored
Changes since revision 1.61.2.6: +12 -0 lines
SVN rev 203694 on 2010-02-09 01:19:10Z by davidxu MFC r203414: After busied the lock, re-read state word before checking waiters flag, otherwise, the waiters bit may not be set and a wakeup is lost. Approved by: re (kib)
Revision 1.82: download - view: text, markup, annotated - select for diffs
Mon Feb 8 07:31:05 2010 UTC (2 years ago) by davidxu
Branches: MAIN
Diff to: previous 1.81: preferred, colored
Changes since revision 1.81: +2 -5 lines
SVN rev 203657 on 2010-02-08 07:31:05Z by davidxu Set waiters flag before checking semaphore's counter, otherwise we might lose a wakeup. Tested on postgresql database server.
Revision 1.73.2.3: download - view: text, markup, annotated - select for diffs
Mon Feb 8 03:11:55 2010 UTC (2 years ago) by davidxu
Branches: RELENG_8
Diff to: previous 1.73.2.2: preferred, colored; branchpoint 1.73: preferred, colored
Changes since revision 1.73.2.2: +12 -0 lines
SVN rev 203645 on 2010-02-08 03:11:55Z by davidxu MFC r203414: After busied the lock, re-read state word before checking waiters flag, otherwise, the waiters bit may not be set and a wakeup is lost.
Revision 1.81: download - view: text, markup, annotated - select for diffs
Wed Feb 3 07:21:20 2010 UTC (2 years ago) by davidxu
Branches: MAIN
Diff to: previous 1.80: preferred, colored
Changes since revision 1.80: +1 -2 lines
SVN rev 203419 on 2010-02-03 07:21:20Z by davidxu Fix comments in do_sem_wait().
Revision 1.80: download - view: text, markup, annotated - select for diffs
Wed Feb 3 03:56:32 2010 UTC (2 years ago) by davidxu
Branches: MAIN
Diff to: previous 1.79: preferred, colored
Changes since revision 1.79: +12 -0 lines
SVN rev 203414 on 2010-02-03 03:56:32Z by davidxu After busied the lock, re-read state word before checking waiters flag, otherwise, the waiters bit may not be set and a wakeup is lost. Submitted by: justin.teller at gmail dot com MFC after: 3 days
Revision 1.79: download - view: text, markup, annotated - select for diffs
Sun Jan 10 09:31:57 2010 UTC (2 years ago) by davidxu
Branches: MAIN
Diff to: previous 1.78: preferred, colored
Changes since revision 1.78: +93 -33 lines
SVN rev 201991 on 2010-01-10 09:31:57Z by davidxu Make a chain be a list of queues, and make threads waiting for same key coalesce to same queue, this makes searching path shorter and improves performance. Also fix comments about shared PI-mutex.
Revision 1.78: download - view: text, markup, annotated - select for diffs
Sat Jan 9 06:30:40 2010 UTC (2 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.77: preferred, colored
Changes since revision 1.77: +10 -8 lines
SVN rev 201887 on 2010-01-09 06:30:40Z by davidxu Use enum to define key types. Suggested by: jmallett
Revision 1.77: download - view: text, markup, annotated - select for diffs
Sat Jan 9 06:12:44 2010 UTC (2 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.76: preferred, colored
Changes since revision 1.76: +1 -1 lines
SVN rev 201886 on 2010-01-09 06:12:44Z by davidxu put semaphore waiter in long term list.
Revision 1.76: download - view: text, markup, annotated - select for diffs
Sat Jan 9 06:05:31 2010 UTC (2 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.75: preferred, colored
Changes since revision 1.75: +9 -8 lines
SVN rev 201885 on 2010-01-09 06:05:31Z by davidxu Add key type TYPE_SEM.
Revision 1.75: download - view: text, markup, annotated - select for diffs
Mon Jan 4 05:27:49 2010 UTC (2 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.74: preferred, colored
Changes since revision 1.74: +160 -2 lines
SVN rev 201472 on 2010-01-04 05:27:49Z by davidxu Add user-level semaphore synchronous type, this change allows multiple processes to share semaphore by using shared memory area, in simplest case, only one atomic operation is needed in userland, waiter flag is maintained by kernel and userland only checks the flag, if the flag is set, user code enters kernel and does a wakeup() call. Move type definitions into file _umtx.h to minimize compiling time. Also type names need to be prefixed with underline character, this would reduce name conflict (still in progress).
Revision 1.73.2.2.2.1: download - view: text, markup, annotated - select for diffs
Sun Oct 25 01:10:29 2009 UTC (2 years, 3 months ago) by kensmith
Branches: RELENG_8_0
CVS tags: RELENG_8_0_0_RELEASE
Diff to: previous 1.73.2.2: preferred, colored; next MAIN 1.73.2.3: preferred, colored
Changes since revision 1.73.2.2: +0 -0 lines
SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure. Approved by: re (implicit)
Revision 1.61.2.6: download - view: text, markup, annotated - select for diffs
Tue Oct 13 13:47:30 2009 UTC (2 years, 3 months ago) by attilio
Branches: RELENG_7
Diff to: previous 1.61.2.5: preferred, colored; branchpoint 1.61: preferred, colored
Changes since revision 1.61.2.5: +16 -2 lines
SVN rev 198032 on 2009-10-13 13:47:30Z by attilio MFC r197476: In function do_rw_wrlock, when a writer got an error and before returning, check if there are readers blocked by us via URWLOCK_WRITE_WAITERS flag, and resume the readers. The error must be EAGAIN, otherwise there must have memory problem, and nobody can rescue the buggy application. Approved by: davidxu
Revision 1.73.2.2: download - view: text, markup, annotated - select for diffs
Tue Oct 13 13:03:31 2009 UTC (2 years, 3 months ago) by attilio
Branches: RELENG_8
CVS tags: RELENG_8_0_BP
Branch point for: RELENG_8_0
Diff to: previous 1.73.2.1: preferred, colored; branchpoint 1.73: preferred, colored
Changes since revision 1.73.2.1: +16 -2 lines
SVN rev 198030 on 2009-10-13 13:03:31Z by attilio MFC r197476: In function do_rw_wrlock, when a writer got an error and before returning, check if there are readers blocked by us via URWLOCK_WRITE_WAITERS flag, and resume the readers. The error must be EAGAIN, otherwise there must have memory problem, and nobody can rescue the buggy application. Approved by: re (kib), davidxu
Revision 1.74: download - view: text, markup, annotated - select for diffs
Fri Sep 25 00:03:13 2009 UTC (2 years, 4 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +16 -2 lines
SVN rev 197476 on 2009-09-25 00:03:13Z by davidxu In function do_rw_wrlock, when a writer got an error and before returning, check if there are readers blocked by us via URWLOCK_WRITE_WAITERS flag, and resume the readers. The error must be EAGAIN, otherwise there must have memory problem, and nobody can rescue the buggy application. The revision 197445 might be reverted.
Revision 1.73.2.1: download - view: text, markup, annotated - select for diffs
Mon Aug 3 08:13:06 2009 UTC (2 years, 6 months ago) by kensmith
Branches: RELENG_8
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +0 -0 lines
SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith Copy head to stable/8 as part of 8.0 Release cycle. Approved by: re (Implicit)
Revision 1.61.2.5.2.1: download - view: text, markup, annotated - select for diffs
Wed Apr 15 03:14:26 2009 UTC (2 years, 9 months ago) by kensmith
Branches: RELENG_7_2
CVS tags: RELENG_7_2_0_RELEASE
Diff to: previous 1.61.2.5: preferred, colored; next MAIN 1.61.2.6: preferred, colored
Changes since revision 1.61.2.5: +0 -0 lines
SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE. Approved by: re (implicit)
Revision 1.61.2.5: download - view: text, markup, annotated - select for diffs
Mon Apr 13 14:25:36 2009 UTC (2 years, 9 months ago) by davidxu
Branches: RELENG_7
CVS tags: RELENG_7_2_BP
Branch point for: RELENG_7_2
Diff to: previous 1.61.2.4: preferred, colored; branchpoint 1.61: preferred, colored
Changes since revision 1.61.2.4: +1 -1 lines
SVN rev 191002 on 2009-04-13 14:25:36Z by davidxu
MFC r190987 from head to stable/7:
Make UMTX_OP_WAIT_UINT actually wait for an unsigned integer on 64-bits
machine.
Approved by: re (kib)
Revision 1.73: download - view: text, markup, annotated - select for diffs
Mon Apr 13 05:21:17 2009 UTC (2 years, 9 months ago) by davidxu
Branches: MAIN
CVS tags: RELENG_8_BP
Branch point for: RELENG_8
Diff to: previous 1.72: preferred, colored
Changes since revision 1.72: +1 -1 lines
SVN rev 190987 on 2009-04-13 05:21:17Z by davidxu Make UMTX_OP_WAIT_UINT actually wait for an unsigned integer on 64-bits machine. MFC after: 1 week
Revision 1.61.2.4: download - view: text, markup, annotated - select for diffs
Tue Mar 24 20:57:10 2009 UTC (2 years, 10 months ago) by kib
Branches: RELENG_7
Diff to: previous 1.61.2.3: preferred, colored; branchpoint 1.61: preferred, colored
Changes since revision 1.61.2.3: +262 -95 lines
SVN rev 190393 on 2009-03-24 20:57:10Z by kib Mostly synchronize lib/libthr and sys/kern/kern_umtx.c with the code from HEAD. Since libkse is still built on RELENG_7, pthread_cleanup_push/pop are left as the functions, but the support code in libthr is present for the macro versions. Malloc in RELENG_7 does not require thread exit hook, but I decided to add empty handler for it, instead of removing callback from thr_exit(). No mergeinfo since this change is prepared by patching libthr and then bringing in required missed bits. Requested by: bms Reviewed by: davidxu Tested by: bms, Mykola Dzham <i levsha org ua> Approved by: re (kensmith)
Revision 1.72: download - view: text, markup, annotated - select for diffs
Fri Mar 13 06:06:20 2009 UTC (2 years, 10 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.71: preferred, colored
Changes since revision 1.71: +26 -24 lines
SVN rev 189756 on 2009-03-13 06:06:20Z by davidxu 1) Check NULL pointer before calling umtx_pi_adjust_locked(), this avoids a PANIC. 2) Rework locking for POSIX priority-mutex, this fixes a race where a thread may wait there forever even if the mutex is unlocked.
Revision 1.61.2.3.2.1: download - view: text, markup, annotated - select for diffs
Tue Nov 25 02:59:29 2008 UTC (3 years, 2 months ago) by kensmith
Branches: RELENG_7_1
CVS tags: RELENG_7_1_0_RELEASE
Diff to: previous 1.61.2.3: preferred, colored; next MAIN 1.61.2.4: preferred, colored
Changes since revision 1.61.2.3: +0 -0 lines
SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith Create releng/7.1 in preparation for moving into RC phase of 7.1 release cycle. Approved by: re (implicit)
Revision 1.33.2.4.4.2: download - view: text, markup, annotated - select for diffs
Sat Oct 25 01:46:29 2008 UTC (3 years, 3 months ago) by alfred
Branches: RELENG_6_4
CVS tags: RELENG_6_4_0_RELEASE
Diff to: previous 1.33.2.4.4.1: preferred, colored; branchpoint 1.33.2.4: preferred, colored; next MAIN 1.33.2.5: preferred, colored
Changes since revision 1.33.2.4.4.1: +34 -115 lines
SVN rev 184239 on 2008-10-25 01:46:29Z by alfred Merge r184172 (pthread condvar race fix) into 6.4-release. Reviewed by: re, davidxu Approved by: re
Revision 1.33.2.5: download - view: text, markup, annotated - select for diffs
Wed Oct 22 18:07:37 2008 UTC (3 years, 3 months ago) by alfred
Branches: RELENG_6
Diff to: previous 1.33.2.4: preferred, colored; branchpoint 1.33: preferred, colored; next MAIN 1.34: preferred, colored
Changes since revision 1.33.2.4: +34 -115 lines
SVN rev 184172 on 2008-10-22 18:07:37Z by alfred Close races in the pthread_condvar implementation in 6.x, note that 7.x and beyond have very different implementations and these fixes do not apply. In the kernel: Move the flag UQF_UMTXQ from the thread's td_flags where it was unlocked to the umtx_q struct where it now has locking. Nuke the UMTX_DYNAMIC_SHARED define while here, it's unused and complex. Refactor do_wait so that if we get a signal or timeout AND woken up, we forward the wakeup to any other waiters pending to avoid a missed wakeup. In userland: Bring over some fixes from DragonFlyBSD for the userland part of pthread_condvars, basically relax the consistency on the number of waiters and signals pending because it was both too strict and incorrect causing lost wakeups. Reviewed by: davidxu Approved by: re
Revision 1.33.2.4.4.1: download - view: text, markup, annotated - select for diffs
Thu Oct 2 02:57:24 2008 UTC (3 years, 4 months ago) by kensmith
Branches: RELENG_6_4
Diff to: previous 1.33.2.4: preferred, colored
Changes since revision 1.33.2.4: +0 -0 lines
SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith Create releng/6.4 from stable/6 in preparation for 6.4-RC1. Approved by: re (implicit)
Revision 1.71: download - view: text, markup, annotated - select for diffs
Tue Jun 24 07:32:12 2008 UTC (3 years, 7 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.70: preferred, colored
Changes since revision 1.70: +142 -35 lines
SVN rev 179970 on 2008-06-24 07:32:12Z by davidxu Add two commands to _umtx_op system call to allow a simple mutex to be locked and unlocked completely in userland. by locking and unlocking mutex in userland, it reduces the total time a mutex is locked by a thread, in some application code, a mutex only protects a small piece of code, the code's execution time is less than a simple system call, if a lock contention happens, however in current implemenation, the lock holder has to extend its locking time and enter kernel to unlock it, the change avoids this disadvantage, it first sets mutex to free state and then enters kernel and wake one waiter up. This improves performance dramatically in some sysbench mutex tests. Tested by: kris Sounds great: jeff
Revision 1.70: download - view: text, markup, annotated - select for diffs
Fri May 30 02:18:54 2008 UTC (3 years, 8 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.69: preferred, colored
Changes since revision 1.69: +21 -17 lines
Use a seperated hash table for mutex and rwlock, avoid wasting some time on walking through idle threads sleeping on condition variables.
Revision 1.69: download - view: text, markup, annotated - select for diffs
Tue Apr 29 03:48:48 2008 UTC (3 years, 9 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.68: preferred, colored
Changes since revision 1.68: +62 -12 lines
Introduce command UMTX_OP_WAIT_UINT_PRIVATE and UMTX_OP_WAKE_PRIVATE to allow userland to specify that an address is not shared by multiple processes.
Revision 1.61.2.3: download - view: text, markup, annotated - select for diffs
Fri Apr 11 14:39:11 2008 UTC (3 years, 9 months ago) by davidxu
Branches: RELENG_7
CVS tags: RELENG_7_1_BP
Branch point for: RELENG_7_1
Diff to: previous 1.61.2.2: preferred, colored; branchpoint 1.61: preferred, colored
Changes since revision 1.61.2.2: +511 -49 lines
MFC: Add umtx operation UMTX_OP_WAIT_UINT and userland rwlock.
Revision 1.61.2.2: download - view: text, markup, annotated - select for diffs
Fri Apr 11 02:38:28 2008 UTC (3 years, 10 months ago) by davidxu
Branches: RELENG_7
Diff to: previous 1.61.2.1: preferred, colored; branchpoint 1.61: preferred, colored
Changes since revision 1.61.2.1: +2 -0 lines
MFC: Modifying td_flags with thread lock held.
Revision 1.68: download - view: text, markup, annotated - select for diffs
Thu Apr 3 11:49:20 2008 UTC (3 years, 10 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +13 -9 lines
let umtxq_busy() only spin on mp machine. make function name do_rwlock_unlock to be consistent with others.
Revision 1.67: download - view: text, markup, annotated - select for diffs
Wed Apr 2 05:54:41 2008 UTC (3 years, 10 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +2 -2 lines
Fix compiling problem for amd64.
Revision 1.66: download - view: text, markup, annotated - select for diffs
Wed Apr 2 04:26:59 2008 UTC (3 years, 10 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.65: preferred, colored
Changes since revision 1.65: +4 -2 lines
Er, don't restart a timeout version.
Revision 1.65: download - view: text, markup, annotated - select for diffs
Wed Apr 2 04:08:37 2008 UTC (3 years, 10 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.64: preferred, colored
Changes since revision 1.64: +487 -45 lines
Introduce kernel based userland rwlock. Each umtx chain now has two lists, one for readers and one for writers, other types of synchronization object just use first list. Asked by: jeff
Revision 1.61.2.1: download - view: text, markup, annotated - select for diffs
Thu Dec 20 07:15:40 2007 UTC (4 years, 1 month ago) by davidxu
Branches: RELENG_7
CVS tags: RELENG_7_0_BP, RELENG_7_0_0_RELEASE, RELENG_7_0
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +31 -7 lines
MFC:
Fix LOR of thread lock and umtx's priority propagation mutex due
to the reworking of scheduler lock.
Approved by: re (kensmith)
Revision 1.64: download - view: text, markup, annotated - select for diffs
Mon Dec 17 08:09:37 2007 UTC (4 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.63: preferred, colored
Changes since revision 1.63: +10 -1 lines
Check NULL pointer.
Revision 1.63: download - view: text, markup, annotated - select for diffs
Mon Dec 17 05:55:07 2007 UTC (4 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +24 -11 lines
Add missing changes for fixing LOR of umtx lock and thread lock, follow the committing of files: kern_resource.c revision 1.181 sched_4bsd.c revision 1.111 sched_ule.c revision 1.218
Revision 1.62: download - view: text, markup, annotated - select for diffs
Wed Nov 21 04:21:02 2007 UTC (4 years, 2 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +24 -2 lines
Add function UMTX_OP_WAIT_UINT, the function causes thread to wait for an integer to be changed.
Revision 1.33.2.4: download - view: text, markup, annotated - select for diffs
Sat Jun 23 19:18:50 2007 UTC (4 years, 7 months ago) by emaste
Branches: RELENG_6
CVS tags: RELENG_6_4_BP, RELENG_6_3_BP, RELENG_6_3_0_RELEASE, RELENG_6_3
Branch point for: RELENG_6_4
Diff to: previous 1.33.2.3: preferred, colored; branchpoint 1.33: preferred, colored
Changes since revision 1.33.2.3: +8 -4 lines
MFC compat32 argument to do_wait() to make it use fuword32() for readling longs from 32 bit processes. Submitted by: jhb
Revision 1.33.2.3: download - view: text, markup, annotated - select for diffs
Mon Jun 18 22:44:59 2007 UTC (4 years, 7 months ago) by jhb
Branches: RELENG_6
Diff to: previous 1.33.2.2: preferred, colored; branchpoint 1.33: preferred, colored
Changes since revision 1.33.2.2: +294 -3 lines
MFC: Support for running 32-bit multithreaded binaries using libthr on amd64 including: - Add 32-bit wrappers for thr_new(), thr_suspend(), and the umtx system calls. - Add support to amd64 for constructing thread upcalls for 32-bit processes. - Leave %fs and %gs alone in the signal trampoline for 32-bit processes on amd64. - Add 'casuword32()' to amd64 and ia64. Tested by: emaste
Revision 1.61: download - view: text, markup, annotated - select for diffs
Wed Jun 6 07:35:08 2007 UTC (4 years, 8 months ago) by davidxu
Branches: MAIN
CVS tags: RELENG_7_BP
Branch point for: RELENG_7
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +0 -67 lines
Backout experimental adaptive-spin umtx code.
Revision 1.60: download - view: text, markup, annotated - select for diffs
Mon Jun 4 23:54:50 2007 UTC (4 years, 8 months ago) by jeff
Branches: MAIN
Diff to: previous 1.59: preferred, colored
Changes since revision 1.59: +52 -33 lines
Commit 8/14 of sched_lock decomposition. - Use a global umtx spinlock to protect the sleep queues now that there is no global scheduler lock. - Use thread_lock() to protect thread state. Tested by: kris, current@ Tested on: i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc. Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
Revision 1.59: download - view: text, markup, annotated - select for diffs
Mon Mar 5 13:10:57 2007 UTC (4 years, 11 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +0 -1 lines
Further system call comment cleanup: - Remove also "MP SAFE" after prior "MPSAFE" pass. (suggested by bde) - Remove extra blank lines in some cases. - Add extra blank lines in some cases. - Remove no-op comments consisting solely of the function name, the word "syscall", or the system call name. - Add punctuation. - Re-wrap some comments.
Revision 1.58: download - view: text, markup, annotated - select for diffs
Wed Dec 20 04:40:39 2006 UTC (5 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +70 -0 lines
Add a lwpid field into per-cpu structure, the lwpid represents current
running thread's id on each cpu. This allow us to add in-kernel adaptive
spin for user level mutex. While spinning in user space is possible,
without correct thread running state exported from kernel, it hardly
can be implemented efficiently without wasting cpu cycles, however
exporting thread running state unlikely will be implemented soon as
it has to design and stablize interfaces. This implementation is
transparent to user space, it can be disabled dynamically. With this
change, mutex ping-pong program's performance is improved massively on
SMP machine. performance of mysql super-smack select benchmark is increased
about 7% on Intel dual dual-core2 Xeon machine, it indicates on systems
which have bunch of cpus and system-call overhead is low (athlon64, opteron,
and core-2 are known to be fast), the adaptive spin does help performance.
Added sysctls:
kern.threads.umtx_dflt_spins
if the sysctl value is non-zero, a zero umutex.m_spincount will
cause the sysctl value to be used a spin cycle count.
kern.threads.umtx_max_spins
the sysctl sets upper limit of spin cycle count.
Tested on: Athlon64 X2 3800+, Dual Xeon 5130
Revision 1.57: download - view: text, markup, annotated - select for diffs
Wed Dec 6 06:34:55 2006 UTC (5 years, 2 months ago) by julian
Branches: MAIN
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +0 -6 lines
Threading cleanup.. part 2 of several. Make part of John Birrell's KSE patch permanent.. Specifically, remove: Any reference of the ksegrp structure. This feature was never fully utilised and made things overly complicated. All code in the scheduler that tried to make threaded programs fair to unthreaded programs. Libpthread processes will already do this to some extent and libthr processes already disable it. Also: Since this makes such a big change to the scheduler(s), take the opportunity to rename some structures and elements that had to be moved anyhow. This makes the code a lot more readable. The ULE scheduler compiles again but I have no idea if it works. The 4bsd scheduler still reqires a little cleaning and some functions that now do ALMOST nothing will go away, but I thought I'd do that as a separate commit. Tested by David Xu, and Dan Eischen using libthr and libpthread.
Revision 1.56: download - view: text, markup, annotated - select for diffs
Mon Dec 4 14:15:12 2006 UTC (5 years, 2 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +10 -5 lines
if a thread blocked on userland condition variable is pthread_cancel()ed, it is expected that the thread will not consume a pthread_cond_signal(), therefor, we use thr_wake() to mark a flag, the flag tells a thread calling do_cv_wait() in umtx code to not block on a condition variable. Thread library is expected that once a thread detected itself is in pthread_cond_wait, it will call the thr_wake() for itself in its SIGCANCEL handler.
Revision 1.55: download - view: text, markup, annotated - select for diffs
Sun Dec 3 01:49:22 2006 UTC (5 years, 2 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.54: preferred, colored
Changes since revision 1.54: +200 -4 lines
Introduce userspace condition variable, since we have already POSIX priority mutex implemented, it is the time to introduce this stuff, now we can use umutex and ucond together to implement pthread's condition wait/signal.
Revision 1.54: download - view: text, markup, annotated - select for diffs
Mon Nov 6 13:42:01 2006 UTC (5 years, 3 months ago) by rwatson
Branches: MAIN
Diff to: previous 1.53: preferred, colored
Changes since revision 1.53: +3 -2 lines
Sweep kernel replacing suser(9) calls with priv(9) calls, assigning specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
Revision 1.53: download - view: text, markup, annotated - select for diffs
Thu Oct 26 21:42:20 2006 UTC (5 years, 3 months ago) by jb
Branches: MAIN
Diff to: previous 1.52: preferred, colored
Changes since revision 1.52: +6 -0 lines
Make KSE a kernel option, turned on by default in all GENERIC kernel configs except sun4v (which doesn't process signals properly with KSE). Reviewed by: davidxu@
Revision 1.52: download - view: text, markup, annotated - select for diffs
Thu Oct 26 09:33:34 2006 UTC (5 years, 3 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +27 -32 lines
Optimize umtx_lock_pi() a bit by moving some heavy code out of the loop, make a fast path when a umtx_pi can be allocated without being blocked.
Revision 1.51: download - view: text, markup, annotated - select for diffs
Wed Oct 25 06:38:46 2006 UTC (5 years, 3 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.50: preferred, colored
Changes since revision 1.50: +2 -2 lines
In order to eliminate a branch, convert opcode to unsigned integer.
Revision 1.50: download - view: text, markup, annotated - select for diffs
Wed Oct 25 06:28:23 2006 UTC (5 years, 3 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.49: preferred, colored
Changes since revision 1.49: +2 -1 lines
Eliminate an unnecessary `if' statement.
Revision 1.49: download - view: text, markup, annotated - select for diffs
Tue Oct 17 02:24:46 2006 UTC (5 years, 3 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.48: preferred, colored
Changes since revision 1.48: +23 -29 lines
o Add keyword volatile for user mutex owner field. o Fix type consistent problem by using type long for old umtx and wait channel. o Rename casuptr to casuword.
Revision 1.48: download - view: text, markup, annotated - select for diffs
Fri Oct 6 08:22:08 2006 UTC (5 years, 4 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +14 -0 lines
Implement 32bit umtx_lock and umtx_unlock system calls, these two system calls are not used by libthr in RELENG_6 and HEAD, it is only used by the libthr in RELENG-5, the _umtx_op system call can do more incremental dirty works than these two system calls without having to introduce new system calls or throw away old system calls when things are going on.
Revision 1.47: download - view: text, markup, annotated - select for diffs
Fri Sep 22 14:59:10 2006 UTC (5 years, 4 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +1 -1 lines
Fix umtx command order error for freebsd 32bit.
Revision 1.46: download - view: text, markup, annotated - select for diffs
Fri Sep 22 00:52:54 2006 UTC (5 years, 4 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +440 -82 lines
Add umtx support for 32bit process on AMD64 machine.
Revision 1.45: download - view: text, markup, annotated - select for diffs
Tue Sep 5 12:01:09 2006 UTC (5 years, 5 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +52 -120 lines
Merge all code of do_lock_normal, do_lock_pi and do_lock_pp into function do_lock_umutex.
Revision 1.44: download - view: text, markup, annotated - select for diffs
Sun Sep 3 00:07:37 2006 UTC (5 years, 5 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +4 -2 lines
Check if it is root user in do_unlock_pp.
Revision 1.43: download - view: text, markup, annotated - select for diffs
Sat Sep 2 02:41:33 2006 UTC (5 years, 5 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +12 -8 lines
Make sure we get new m_owner value if we can not unlock it in uncontested case. Reorder statements in do_unlock_umutex.
Revision 1.42: download - view: text, markup, annotated - select for diffs
Wed Aug 30 23:59:45 2006 UTC (5 years, 5 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +16 -20 lines
Reorder some statments. Fix typo and remove stale comments.
Revision 1.41: download - view: text, markup, annotated - select for diffs
Mon Aug 28 07:09:27 2006 UTC (5 years, 5 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +5 -12 lines
Update comments about interrupted mutex locking.
Revision 1.40: download - view: text, markup, annotated - select for diffs
Mon Aug 28 04:24:51 2006 UTC (5 years, 5 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +1743 -220 lines
This is initial version of POSIX priority mutex support, a new userland
mutex structure is added as following:
struct umutex {
__lwpid_t m_owner;
uint32_t m_flags;
uint32_t m_ceilings[2];
uint32_t m_spare[4];
};
The m_owner represents owner thread, it is a thread id, in non-contested
case, userland can simply use atomic_cmpset_int to lock the mutex, if the
mutex is contested, high order bit will be set, and userland should do locking
and unlocking via kernel syscall. Flag UMUTEX_PRIO_INHERIT represents
pthread's PTHREAD_PRIO_INHERIT mutex, which when contention happens, kernel
should do priority propagating. Flag UMUTEX_PRIO_PROTECT indicates it is
pthread's PTHREAD_PRIO_PROTECT mutex, userland should initialize m_owner
to contested state UMUTEX_CONTESTED, then atomic_cmpset_int will be failure
and kernel syscall should be invoked to do locking, this becauses
for such a mutex, kernel should always boost the thread's priority before
it can lock the mutex, m_ceilings is used by PTHREAD_PRIO_PROTECT mutex,
the first element is used to boost thread's priority when it locked the mutex,
second element is used when the mutex is unlocked, the PTHREAD_PRIO_PROTECT
mutex's link list is kept in userland, the m_ceiling[1] is managed by thread
library so kernel needn't allocate memory to keep the link list, when such
a mutex is unlocked, kernel reset m_owner to UMUTEX_CONTESTED.
Flag USYNC_PROCESS_SHARED indicate if the synchronization object is process
shared, if the flag is not set, it saves a vm_map_lookup() call.
The umtx chain is still used as a sleep queue, when a thread is blocked on
PTHREAD_PRIO_INHERIT mutex, a umtx_pi is allocated to support priority
propagating, it is dynamically allocated and reference count is used,
it is not optimized but works well in my tests, while the umtx chain has
its own locking protocol, the priority propagating protocol are all protected
by sched_lock because priority propagating function is called with sched_lock
held from scheduler.
No visible performance degradation is found which these changes. Some parameter
names in _umtx_op syscall are renamed.
Revision 1.39: download - view: text, markup, annotated - select for diffs
Fri Aug 25 06:12:53 2006 UTC (5 years, 5 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +5 -0 lines
Add user priority loaning code to support priority propagation for 1:1 threading's POSIX priority mutexes, the code is no-op unless priority-aware umtx code is committed.
Revision 1.33.2.2: download - view: text, markup, annotated - select for diffs
Fri Jun 16 22:11:55 2006 UTC (5 years, 7 months ago) by jhb
Branches: RELENG_6
CVS tags: RELENG_6_2_BP, RELENG_6_2_0_RELEASE, RELENG_6_2
Diff to: previous 1.33.2.1: preferred, colored; branchpoint 1.33: preferred, colored
Changes since revision 1.33.2.1: +4 -6 lines
MFC: Change msleep() and tsleep() to not alter the calling thread's priority if the specified priority is zero.
Revision 1.38: download - view: text, markup, annotated - select for diffs
Thu May 18 08:43:46 2006 UTC (5 years, 8 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +12 -15 lines
Move flag TDF_UMTXQ into structure umtxq, this eliminates the requirement of scheduler lock in some umtx code.
Revision 1.37: download - view: text, markup, annotated - select for diffs
Tue May 9 13:00:46 2006 UTC (5 years, 9 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +6 -6 lines
Use wakeup_one to avoid thundering herd. Tested by: kris
Revision 1.36: download - view: text, markup, annotated - select for diffs
Mon Apr 17 18:20:37 2006 UTC (5 years, 9 months ago) by jhb
Branches: MAIN
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +4 -6 lines
Change msleep() and tsleep() to not alter the calling thread's priority if the specified priority is zero. This avoids a race where the calling thread could read a snapshot of it's current priority, then a different thread could change the first thread's priority, then the original thread would call sched_prio() inside msleep() undoing the change made by the second thread. I used a priority of zero as no thread that calls msleep() or tsleep() should be specifying a priority of zero anyway. The various places that passed 'curthread->td_priority' or some variant as the priority now pass 0.
Revision 1.35: download - view: text, markup, annotated - select for diffs
Sat Feb 4 06:36:39 2006 UTC (6 years ago) by davidxu
Branches: MAIN
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +0 -96 lines
Axe unused code.
Revision 1.33.2.1: download - view: text, markup, annotated - select for diffs
Mon Jan 16 05:48:40 2006 UTC (6 years ago) by davidxu
Branches: RELENG_6
CVS tags: RELENG_6_1_BP, RELENG_6_1_0_RELEASE, RELENG_6_1
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +3 -3 lines
MFC following revisions: sys/umtx.h revision 1.17 kern/kern_umtx.c revision 1.34 kern/kern_thr.c revision 1.36 call kern_umtx_wake on thread exit.
Revision 1.34: download - view: text, markup, annotated - select for diffs
Wed Oct 26 06:55:46 2005 UTC (6 years, 3 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +3 -3 lines
do umtx_wake at userland thread exit address, so that others userland threads can wait for a thread to exit, and safely assume that the thread has left userland and is no longer using its userland stack, this is necessary for pthread_join when a thread is waiting for another thread to exit which has user customized stack, after pthread_join returns, the userland stack can be reused for other purposes, without this change, the joiner thread has to spin at the address to ensure the thread is really exited.
Revision 1.33: download - view: text, markup, annotated - select for diffs
Sat Mar 5 09:15:03 2005 UTC (6 years, 11 months ago) by davidxu
Branches: MAIN
CVS tags: RELENG_6_BP, RELENG_6_0_BP, RELENG_6_0_0_RELEASE, RELENG_6_0
Branch point for: RELENG_6
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +46 -34 lines
Allocate umtx_q from heap instead of stack, this avoids page fault panic in kernel under heavy swapping.
Revision 1.16.2.1: download - view: text, markup, annotated - select for diffs
Mon Jan 31 23:26:16 2005 UTC (7 years ago) by imp
Branches: RELENG_5
CVS tags: RELENG_5_5_BP, RELENG_5_5_0_RELEASE, RELENG_5_5, RELENG_5_4_BP, RELENG_5_4_0_RELEASE, RELENG_5_4
Diff to: previous 1.16: preferred, colored; next MAIN 1.17: preferred, colored
Changes since revision 1.16: +2 -1 lines
MFC: /*- and related license changes
Revision 1.32: download - view: text, markup, annotated - select for diffs
Tue Jan 18 13:53:10 2005 UTC (7 years ago) by davidxu
Branches: MAIN
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +1 -2 lines
Revert my previous errno hack, that is certainly an issue, and always has been, but the system call itself returns errno in a register so the problem is really a function of libc, not the system call. Discussed with : Matthew Dillion <dillon@apollo.backplane.com>
Revision 1.31: download - view: text, markup, annotated - select for diffs
Fri Jan 14 13:38:15 2005 UTC (7 years ago) by davidxu
Branches: MAIN
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +51 -46 lines
make umtx timeout relative so userland can select different clock type, e.g, CLOCK_REALTIME or CLOCK_MONOTONIC. merge umtx_wait and umtx_timedwait into single function.
Revision 1.30: download - view: text, markup, annotated - select for diffs
Wed Jan 12 10:11:31 2005 UTC (7 years ago) by phk
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +2 -0 lines
Comment out debugging printf which doesn't compile on amd64.
Revision 1.29: download - view: text, markup, annotated - select for diffs
Wed Jan 12 05:55:52 2005 UTC (7 years ago) by davidxu
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +23 -12 lines
Let _umtx_op directly return error code rather than from errno because errno can be tampered potentially by nested signal handle. Now all error codes are returned in negative value, positive value are reserved for future expansion.
Revision 1.28: download - view: text, markup, annotated - select for diffs
Sat Jan 8 06:57:46 2005 UTC (7 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +1 -1 lines
Break out of loop earlier if it is not timeout.
Revision 1.27: download - view: text, markup, annotated - select for diffs
Thu Jan 6 23:35:39 2005 UTC (7 years, 1 month ago) by imp
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +1 -1 lines
/* -> /*- for copyright notices, minor format tweaks as necessary
Revision 1.26: download - view: text, markup, annotated - select for diffs
Thu Jan 6 02:08:34 2005 UTC (7 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +7 -5 lines
Return ETIMEDOUT when thread is timeouted since POSIX thread APIs expect ETIMEDOUT not EAGAIN, this simplifies userland code a bit.
Revision 1.25: download - view: text, markup, annotated - select for diffs
Thu Dec 30 02:56:17 2004 UTC (7 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +9 -41 lines
Make umtx_wait and umtx_wake more like linux futex does, it is more general than previous. It also lets me implement cancelable point in thread library. Also in theory, umtx_lock and umtx_unlock can be implemented by using umtx_wait and umtx_wake, all atomic operations can be done in userland without kernel's casuptr() function.
Revision 1.24: download - view: text, markup, annotated - select for diffs
Sat Dec 25 13:02:50 2004 UTC (7 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +4 -4 lines
Make _umtx_op() as more general interface, the final parameter needn't be timespec pointer, every parameter will be interpreted by its opcode.
Revision 1.23: download - view: text, markup, annotated - select for diffs
Sat Dec 25 12:49:35 2004 UTC (7 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +1 -3 lines
1. introduce umtx_owner to get an owner of a umtx. 2. add const qualifier to umtx_timedlock and umtx_timedwait. 3. add missing blackets in umtx do_unlock_and_wait.
Revision 1.22: download - view: text, markup, annotated - select for diffs
Fri Dec 24 11:59:20 2004 UTC (7 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +9 -5 lines
Add umtxq_lock/unlock around umtx_signal, fix debug kernel compiling, let umtx_lock returns EINTR when it returns ERESTART, this lets userland have chance to back off mtx lock code when needed.
Revision 1.21: download - view: text, markup, annotated - select for diffs
Fri Dec 24 11:30:55 2004 UTC (7 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +104 -133 lines
1. Fix race condition between umtx lock and unlock, heavy testing on SMP can explore the bug. 2. Let umtx_wake returns number of threads have been woken.
Revision 1.20: download - view: text, markup, annotated - select for diffs
Sat Dec 18 13:43:16 2004 UTC (7 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +6 -8 lines
1. msleep returns EWOULDBLOCK not ETIMEDOUT, use EWOULDBLOCK instead. 2. Eliminate a possible lock leak in timed wait loop.
Revision 1.19: download - view: text, markup, annotated - select for diffs
Sat Dec 18 12:52:44 2004 UTC (7 years, 1 month ago) by davidxu
Branches: MAIN
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +544 -170 lines
1. make umtx sharable between processes, the way is two or more processes call mmap() to create a shared space, and then initialize umtx on it, after that, each thread in different processes can use the umtx same as threads in same process. 2. introduce a new syscall _umtx_op to support timed lock and condition variable semantics. also, orignal umtx_lock and umtx_unlock inline functions now are reimplemented by using _umtx_op, the _umtx_op can use arbitrary id not just a thread id.
Revision 1.18: download - view: text, markup, annotated - select for diffs
Tue Nov 30 12:18:53 2004 UTC (7 years, 2 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +1 -1 lines
Forgot to inline umtxq_unlock.
Revision 1.17: download - view: text, markup, annotated - select for diffs
Tue Nov 30 12:02:53 2004 UTC (7 years, 2 months ago) by davidxu
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +212 -115 lines
1. use per-chain mutex instead of global mutex to reduce lock collision. 2. Fix two race conditions. One is between _umtx_unlock and signal, also a thread was marked TDF_UMTXWAKEUP by _umtx_unlock, it is possible a signal delivered to the thread will cause msleep returns EINTR, and the thread breaks out of loop, this causes umtx ownership is not transfered to the thread. Another is in _umtx_unlock itself, when the function sets the umtx to UMTX_UNOWNED state, a new thread can come in and lock the umtx, also the function tries to set contested bit flag, but it will fail. Although the function will wake a blocked thread, if that thread breaks out of loop by signal, no contested bit will be set.
Revision 1.16: download - view: text, markup, annotated - select for diffs
Mon Jul 12 15:28:31 2004 UTC (7 years, 7 months ago) by mtm
Branches: MAIN
CVS tags: RELENG_5_BP, RELENG_5_3_BP, RELENG_5_3_0_RELEASE, RELENG_5_3
Branch point for: RELENG_5
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +3 -5 lines
writers must hold both sched_lock and the process lock; therefore, readers need only obtain the process lock.
Revision 1.15: download - view: text, markup, annotated - select for diffs
Fri Jul 2 00:40:07 2004 UTC (7 years, 7 months ago) by marcel
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +5 -3 lines
Change the thread ID (thr_id_t) used for 1:1 threading from being a pointer to the corresponding struct thread to the thread ID (lwpid_t) assigned to that thread. The primary reason for this change is that libthr now internally uses the same ID as the debugger and the kernel when referencing to a kernel thread. This allows us to implement the support for debugging without additional translations and/or mappings. To preserve the ABI, the 1:1 threading syscalls, including the umtx locking API have not been changed to work on a lwpid_t. Instead the 1:1 threading syscalls operate on long and the umtx locking API has not been changed except for the contested bit. Previously this was the least significant bit. Now it's the most significant bit. Since the contested bit should not be tested by userland, this change is not expected to be visible. Just to be sure, UMTX_CONTESTED has been removed from <sys/umtx.h>. Reviewed by: mtm@ ABI preservation tested on: i386, ia64
Revision 1.14: download - view: text, markup, annotated - select for diffs
Sat Mar 27 14:32:03 2004 UTC (7 years, 10 months ago) by mtm
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +6 -2 lines
Use the proc lock to sleep on a libthr umtx.
Revision 1.13: download - view: text, markup, annotated - select for diffs
Sun Sep 7 11:14:52 2003 UTC (8 years, 5 months ago) by tjr
Branches: MAIN
CVS tags: RELENG_5_2_BP, RELENG_5_2_1_RELEASE, RELENG_5_2_0_RELEASE, RELENG_5_2
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +2 -1 lines
Return EINVAL if the contested bit is not set on the umtx passed to _umtx_unlock() instead of firing a KASSERT.
Revision 1.12: download - view: text, markup, annotated - select for diffs
Wed Jul 23 20:29:13 2003 UTC (8 years, 6 months ago) by peter
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +1 -0 lines
Initialize 'blocked' to NULL. I think this was a real problem, but I am not sure about that. The lack of -Werror and the inline noise hid this for a while.
Revision 1.11: download - view: text, markup, annotated - select for diffs
Sat Jul 19 11:32:48 2003 UTC (8 years, 6 months ago) by mtm
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +4 -2 lines
Turn a KASSERT back into an EINVAL return value. So, next time someone comes across it, it will turn into a core dump in userland instead of a kernel panic. I had also inverted the sense of the test, so Double pointy hat to: mtm
Revision 1.10: download - view: text, markup, annotated - select for diffs
Fri Jul 18 21:26:45 2003 UTC (8 years, 6 months ago) by mtm
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +5 -2 lines
Remove a lock held across casuptr() that snuck in last commit.
Revision 1.9: download - view: text, markup, annotated - select for diffs
Fri Jul 18 17:58:37 2003 UTC (8 years, 6 months ago) by mtm
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +40 -48 lines
Move the decision on whether to unset the contested bit or not from lock to unlock time. Suggested by: jhb
Revision 1.8: download - view: text, markup, annotated - select for diffs
Thu Jul 17 11:06:40 2003 UTC (8 years, 6 months ago) by mtm
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +47 -24 lines
Fix umtx locking, for libthr, in the kernel. 1. There was a race condition between a thread unlocking a umtx and the thread contesting it. If the unlocking thread won the race it may try to wakeup a thread that was not yet in msleep(). The contesting thread would then go to sleep to await a wakeup that would never come. It's not possible to close the race by using a lock because calls to casuptr() may have to fault a page in from swap. Instead, the race was closed by introducing a flag that the unlocking thread will set when waking up a thread. The contesting thread will check for this flag before going to sleep. For now the flag is kept in td_flags, but it may be better to use some other member or create a new one because of the possible performance/contention issues of having to own sched_lock. Thanks to jhb for pointing me in the right direction on this one. 2. Once a umtx was contested all future locks and unlocks were happening in the kernel, regardless of whether it was contested or not. To prevent this from happening, when a thread locks a umtx it checks the queue for that umtx and unsets the contested bit if there are no other threads waiting on it. Again, this is slightly more complicated than it needs to be because we can't hold a lock across casuptr(). So, the thread has to check the queue again after unseting the bit, and reset the contested bit if it finds that another thread has put itself on the queue in the mean time. 3. Remove the if... block for unlocking an uncontested umtx, and replace it with a KASSERT. The _only_ time a thread should be unlocking a umtx in the kernel is if it is contested.
Revision 1.7: download - view: text, markup, annotated - select for diffs
Fri Jul 4 23:28:42 2003 UTC (8 years, 7 months ago) by mtm
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +1 -1 lines
I was so happy I found the semi-colon from hell that I didn't notice another typo in the same line. This typo makes libthr unuseable, but it's effects where counter-balanced by the extra semicolon, which made libthr remarkably useable for the past several months.
Revision 1.6: download - view: text, markup, annotated - select for diffs
Fri Jul 4 11:18:07 2003 UTC (8 years, 7 months ago) by mtm
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +1 -1 lines
It's unfair how one extraneous semi-colon can cause so much grief.
Revision 1.5: download - view: text, markup, annotated - select for diffs
Wed Jun 11 00:56:57 2003 UTC (8 years, 8 months ago) by obrien
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +3 -3 lines
Use __FBSDID().
Revision 1.3.2.1: download - view: text, markup, annotated - select for diffs
Tue Jun 3 20:43:18 2003 UTC (8 years, 8 months ago) by jeff
Branches: RELENG_5_1
CVS tags: RELENG_5_1_0_RELEASE
Diff to: previous 1.3: preferred, colored; next MAIN 1.4: preferred, colored
Changes since revision 1.3: +163 -171 lines
- Merge in fixes to umtx from -CURRENT. Approved by: re (scottl)
Revision 1.4: download - view: text, markup, annotated - select for diffs
Tue Jun 3 05:24:46 2003 UTC (8 years, 8 months ago) by jeff
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +163 -171 lines
- Remove the blocked pointer from the umtx structure. - Use a hash of umtx queues to queue blocked threads. We hash on pid and the virtual address of the umtx structure. This eliminates cases where we previously held a lock across a casuptr call. Reviwed by: jhb (quickly)
Revision 1.3: download - view: text, markup, annotated - select for diffs
Sun May 25 18:18:32 2003 UTC (8 years, 8 months ago) by jeff
Branches: MAIN
CVS tags: RELENG_5_1_BP
Branch point for: RELENG_5_1
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +13 -6 lines
- Create a new lock, umtx_lock, for use instead of the proc lock for protecting the umtx queues. We can't use the proc lock because we need to hold the lock across calls to casuptr, which can fault. Approved by: re
Revision 1.2: download - view: text, markup, annotated - select for diffs
Wed Apr 2 08:02:27 2003 UTC (8 years, 10 months ago) by jake
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +13 -10 lines
- Make casuptr return the old value of the location we're trying to update, and change the umtx code to expect this. Reviewed by: jeff
Revision 1.1: download - view: text, markup, annotated - select for diffs
Tue Apr 1 01:10:42 2003 UTC (8 years, 10 months ago) by jeff
Branches: MAIN
- Add an api for doing smp safe locks in userland. - umtx_lock() is defined as an inline in umtx.h. It tries to do an uncontested acquire of a lock which falls back to the _umtx_lock() system-call if that fails. - umtx_unlock() is also an inline which falls back to _umtx_unlock() if the uncontested unlock fails. - Locks are keyed off of the thr_id_t of the currently running thread which is currently just the pointer to the 'struct thread' in kernel. - _umtx_lock() uses the proc pointer to synchronize access to blocked thread queues which are stored in the first blocked thread.
