Re: svn commit: r350005 - head/sys/kern
On 7/31/19 12:42 PM, Konstantin Belousov wrote: > On Wed, Jul 31, 2019 at 10:08:39AM -0700, Bryan Drewery wrote: >> On 7/30/19 10:14 PM, Konstantin Belousov wrote: >>> No, you should create a situation where the python process ends the endless >>> loop, as reported. Then, it should become killable by 9 with the first >>> chunk only applied. >>> >> >> I don't have an easy way to test that. kill -9 inside the loop didn't >> work. Once the loop ended the process was done; it is very short lived >> and the calling code is buried in Python I think. > With only the umtxq_check_susp() chunk applied, you would wait for > python to start looping, then verify that kill -9 works. > > Anyway, I believe that the change is correct, and put the review at > https://reviews.freebsd.org/D21124. I will commit after it get some > sanity checking by mentioned people. > Right. I did that earlier and it did not work. I can try again shortly. -- Regards, Bryan Drewery signature.asc Description: OpenPGP digital signature
Re: svn commit: r350005 - head/sys/kern
On Wed, Jul 31, 2019 at 10:08:39AM -0700, Bryan Drewery wrote: > On 7/30/19 10:14 PM, Konstantin Belousov wrote: > > No, you should create a situation where the python process ends the endless > > loop, as reported. Then, it should become killable by 9 with the first > > chunk only applied. > > > > I don't have an easy way to test that. kill -9 inside the loop didn't > work. Once the loop ended the process was done; it is very short lived > and the calling code is buried in Python I think. With only the umtxq_check_susp() chunk applied, you would wait for python to start looping, then verify that kill -9 works. Anyway, I believe that the change is correct, and put the review at https://reviews.freebsd.org/D21124. I will commit after it get some sanity checking by mentioned people. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r350005 - head/sys/kern
On 7/30/19 10:14 PM, Konstantin Belousov wrote: > On Tue, Jul 30, 2019 at 08:40:28PM -0700, Bryan Drewery wrote: >> This 2nd change alone (&& count1 == 0) was sufficient to fix the endless >> loop problem. > Good, thank you. > >> >> I am not sure how to test the umtxq_check_susp() change. Do I just need >> to ptrace the process? > > No, you should create a situation where the python process ends the endless > loop, as reported. Then, it should become killable by 9 with the first > chunk only applied. > I don't have an easy way to test that. kill -9 inside the loop didn't work. Once the loop ended the process was done; it is very short lived and the calling code is buried in Python I think. -- Regards, Bryan Drewery signature.asc Description: OpenPGP digital signature
Re: svn commit: r350005 - head/sys/kern
On Tue, Jul 30, 2019 at 08:40:28PM -0700, Bryan Drewery wrote: > This 2nd change alone (&& count1 == 0) was sufficient to fix the endless > loop problem. Good, thank you. > > I am not sure how to test the umtxq_check_susp() change. Do I just need > to ptrace the process? No, you should create a situation where the python process ends the endless loop, as reported. Then, it should become killable by 9 with the first chunk only applied. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r350005 - head/sys/kern
On 7/30/19 4:27 PM, Konstantin Belousov wrote: > On Wed, Jul 31, 2019 at 02:13:02AM +0300, Konstantin Belousov wrote: >> On Tue, Jul 30, 2019 at 03:04:57PM -0700, Bryan Drewery wrote: >>> On 7/15/2019 12:18 PM, Konstantin Belousov wrote: Author: kib Date: Mon Jul 15 19:18:25 2019 New Revision: 350005 URL: https://svnweb.freebsd.org/changeset/base/350005 Log: In do_sem2_wait(), balance umtx_key_get() with umtx_key_release() on retry. >>> >>> Is this also needed in do_sem_wait()? A similar pattern seems to be there. >> No, I do not think do_sem_wait() has similar issue, because the again label >> does not re-get the key. >> >>> >>> I ask because of what I referenced on IRC. I have some processes stuck >>> in here from a 10.4 jail. >>> ~/git/poudriere # procstat -kk 1498 PIDTID COMMTDNAME KSTACK 1498 100710 python2.7 - mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 1498 101575 python2.7 - mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 1498 101657 python2.7 - >>> ... ~/git/poudriere # procstat -kk 1498 PIDTID COMMTDNAME KSTACK 1498 100710 python2.7 - mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 1498 101575 python2.7 - mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 1498 101657 python2.7 - do_sem_wait+0x1b6 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 >>> ... ~/git/poudriere # procstat -kk 94392 PIDTID COMMTDNAME KSTACK 94392 101815 python2.7 - mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 94392 101816 python2.7 - __mtx_lock_sleep+0x118 __mtx_lock_flags+0x102 _sleep+0x334 umtxq_busy+0xb7 do_sem_wait+0x161 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 94392 102076 python2.7 - __mtx_lock_flags+0x94 do_sem_wait+0x228 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 >> >> Try this. We should only retry casueword if it failed spuriously. >> >> diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c >> index bb998457975..6c914ab6f3e 100644 >> --- a/sys/kern/kern_umtx.c >> +++ b/sys/kern/kern_umtx.c >> @@ -3229,7 +3229,8 @@ do_sem_wait(struct thread *td, struct _usem *sem, >> struct _umtx_time *timeout) >> rv = casueword32(>_has_waiters, 0, , 1); >> if (rv == 0) >> rv1 = fueword32(>_count, ); >> -if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || rv == 1) { >> +if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || >> +(rv == 1 && count1 == 0)) { >> umtxq_lock(>uq_key); >> umtxq_unbusy(>uq_key); >> umtxq_remove(uq); > > I think there is another problem, since even despite our intent of looping > just because of casueword returned 1, the umtxq_check_susp() should have > terminated the loop. I believe the following update would fix that. > > If you have time, can you please apply only the umtxq_check_susp() chunk > and see if it helps as well ? [Both chunks are needed for correctness, but > the umtxq_check_susp() is almost impossible to test in combination] > > diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c > index bb998457975..08bdd1a1a9a 100644 > --- a/sys/kern/kern_umtx.c > +++ b/sys/kern/kern_umtx.c > @@ -723,13 +723,11 @@ umtxq_check_susp(struct thread *td, bool sleep) > error = 0; > p = td->td_proc; > PROC_LOCK(p); > - if (P_SHOULDSTOP(p) || > - ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND))) { > - if (p->p_flag & P_SINGLE_EXIT) > - error = EINTR; > - else > - error = sleep ? thread_suspend_check(0) : ERESTART; > - } > + if (p->p_flag & P_SINGLE_EXIT) > +
Re: svn commit: r350005 - head/sys/kern
On 7/30/2019 4:27 PM, Konstantin Belousov wrote: > On Wed, Jul 31, 2019 at 02:13:02AM +0300, Konstantin Belousov wrote: >> On Tue, Jul 30, 2019 at 03:04:57PM -0700, Bryan Drewery wrote: >>> On 7/15/2019 12:18 PM, Konstantin Belousov wrote: Author: kib Date: Mon Jul 15 19:18:25 2019 New Revision: 350005 URL: https://svnweb.freebsd.org/changeset/base/350005 Log: In do_sem2_wait(), balance umtx_key_get() with umtx_key_release() on retry. >>> >>> Is this also needed in do_sem_wait()? A similar pattern seems to be there. >> No, I do not think do_sem_wait() has similar issue, because the again label >> does not re-get the key. >> >>> >>> I ask because of what I referenced on IRC. I have some processes stuck >>> in here from a 10.4 jail. >>> ~/git/poudriere # procstat -kk 1498 PIDTID COMMTDNAME KSTACK 1498 100710 python2.7 - mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 1498 101575 python2.7 - mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 1498 101657 python2.7 - >>> ... ~/git/poudriere # procstat -kk 1498 PIDTID COMMTDNAME KSTACK 1498 100710 python2.7 - mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 1498 101575 python2.7 - mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 1498 101657 python2.7 - do_sem_wait+0x1b6 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 >>> ... ~/git/poudriere # procstat -kk 94392 PIDTID COMMTDNAME KSTACK 94392 101815 python2.7 - mi_switch+0x174 sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 94392 101816 python2.7 - __mtx_lock_sleep+0x118 __mtx_lock_flags+0x102 _sleep+0x334 umtxq_busy+0xb7 do_sem_wait+0x161 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 94392 102076 python2.7 - __mtx_lock_flags+0x94 do_sem_wait+0x228 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 >> >> Try this. We should only retry casueword if it failed spuriously. >> >> diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c >> index bb998457975..6c914ab6f3e 100644 >> --- a/sys/kern/kern_umtx.c >> +++ b/sys/kern/kern_umtx.c >> @@ -3229,7 +3229,8 @@ do_sem_wait(struct thread *td, struct _usem *sem, >> struct _umtx_time *timeout) >> rv = casueword32(>_has_waiters, 0, , 1); >> if (rv == 0) >> rv1 = fueword32(>_count, ); >> -if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || rv == 1) { >> +if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || >> +(rv == 1 && count1 == 0)) { >> umtxq_lock(>uq_key); >> umtxq_unbusy(>uq_key); >> umtxq_remove(uq); > > I think there is another problem, since even despite our intent of looping > just because of casueword returned 1, the umtxq_check_susp() should have > terminated the loop. I believe the following update would fix that. > > If you have time, can you please apply only the umtxq_check_susp() chunk > and see if it helps as well ? [Both chunks are needed for correctness, but > the umtxq_check_susp() is almost impossible to test in combination] What is the expected "working" test for the umtxq_check_susp() change? I get the 100% CPU and kill -9 does not kill it. > ~ # procstat -kk 19150 > PIDTID COMMTDNAME KSTACK > 19150 101524 python2.7 - do_sem_wait+0x150 > __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 > 19150 101553 python2.7 - mi_switch+0x174 > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x41c __umtx_op_sem_wait+0x6e > amd64_syscall+0x2bb fast_syscall_common+0x101 > 19150 101554 python2.7
Re: svn commit: r350005 - head/sys/kern
On Wed, Jul 31, 2019 at 02:13:02AM +0300, Konstantin Belousov wrote: > On Tue, Jul 30, 2019 at 03:04:57PM -0700, Bryan Drewery wrote: > > On 7/15/2019 12:18 PM, Konstantin Belousov wrote: > > > Author: kib > > > Date: Mon Jul 15 19:18:25 2019 > > > New Revision: 350005 > > > URL: https://svnweb.freebsd.org/changeset/base/350005 > > > > > > Log: > > > In do_sem2_wait(), balance umtx_key_get() with umtx_key_release() on > > > retry. > > > > > > > Is this also needed in do_sem_wait()? A similar pattern seems to be there. > No, I do not think do_sem_wait() has similar issue, because the again label > does not re-get the key. > > > > > I ask because of what I referenced on IRC. I have some processes stuck > > in here from a 10.4 jail. > > > > > ~/git/poudriere # procstat -kk 1498 > > > PIDTID COMMTDNAME KSTACK > > > 1498 100710 python2.7 - mi_switch+0x174 > > > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > > > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e > > > amd64_syscall+0x2bb fast_syscall_common+0x101 > > > 1498 101575 python2.7 - mi_switch+0x174 > > > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > > > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e > > > amd64_syscall+0x2bb fast_syscall_common+0x101 > > > 1498 101657 python2.7 - > > ... > > > ~/git/poudriere # procstat -kk 1498 > > > PIDTID COMMTDNAME KSTACK > > > 1498 100710 python2.7 - mi_switch+0x174 > > > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > > > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e > > > amd64_syscall+0x2bb fast_syscall_common+0x101 > > > 1498 101575 python2.7 - mi_switch+0x174 > > > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > > > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e > > > amd64_syscall+0x2bb fast_syscall_common+0x101 > > > 1498 101657 python2.7 - do_sem_wait+0x1b6 > > > __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 > > ... > > > ~/git/poudriere # procstat -kk 94392 > > > PIDTID COMMTDNAME KSTACK > > > 94392 101815 python2.7 - mi_switch+0x174 > > > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > > > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e > > > amd64_syscall+0x2bb fast_syscall_common+0x101 > > > 94392 101816 python2.7 - > > > __mtx_lock_sleep+0x118 __mtx_lock_flags+0x102 _sleep+0x334 > > > umtxq_busy+0xb7 do_sem_wait+0x161 __umtx_op_sem_wait+0x6e > > > amd64_syscall+0x2bb fast_syscall_common+0x101 > > > 94392 102076 python2.7 - > > > __mtx_lock_flags+0x94 do_sem_wait+0x228 __umtx_op_sem_wait+0x6e > > > amd64_syscall+0x2bb fast_syscall_common+0x101 > > Try this. We should only retry casueword if it failed spuriously. > > diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c > index bb998457975..6c914ab6f3e 100644 > --- a/sys/kern/kern_umtx.c > +++ b/sys/kern/kern_umtx.c > @@ -3229,7 +3229,8 @@ do_sem_wait(struct thread *td, struct _usem *sem, > struct _umtx_time *timeout) > rv = casueword32(>_has_waiters, 0, , 1); > if (rv == 0) > rv1 = fueword32(>_count, ); > - if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || rv == 1) { > + if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || > + (rv == 1 && count1 == 0)) { > umtxq_lock(>uq_key); > umtxq_unbusy(>uq_key); > umtxq_remove(uq); I think there is another problem, since even despite our intent of looping just because of casueword returned 1, the umtxq_check_susp() should have terminated the loop. I believe the following update would fix that. If you have time, can you please apply only the umtxq_check_susp() chunk and see if it helps as well ? [Both chunks are needed for correctness, but the umtxq_check_susp() is almost impossible to test in combination] diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index bb998457975..08bdd1a1a9a 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -723,13 +723,11 @@ umtxq_check_susp(struct thread *td, bool sleep) error = 0; p = td->td_proc; PROC_LOCK(p); - if (P_SHOULDSTOP(p) || - ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND))) { - if (p->p_flag & P_SINGLE_EXIT) - error = EINTR; - else - error = sleep ? thread_suspend_check(0) : ERESTART; - } + if (p->p_flag & P_SINGLE_EXIT) + error = EINTR; + else if
Re: svn commit: r350005 - head/sys/kern
On Tue, Jul 30, 2019 at 03:04:57PM -0700, Bryan Drewery wrote: > On 7/15/2019 12:18 PM, Konstantin Belousov wrote: > > Author: kib > > Date: Mon Jul 15 19:18:25 2019 > > New Revision: 350005 > > URL: https://svnweb.freebsd.org/changeset/base/350005 > > > > Log: > > In do_sem2_wait(), balance umtx_key_get() with umtx_key_release() on > > retry. > > > > Is this also needed in do_sem_wait()? A similar pattern seems to be there. No, I do not think do_sem_wait() has similar issue, because the again label does not re-get the key. > > I ask because of what I referenced on IRC. I have some processes stuck > in here from a 10.4 jail. > > > ~/git/poudriere # procstat -kk 1498 > > PIDTID COMMTDNAME KSTACK > > 1498 100710 python2.7 - mi_switch+0x174 > > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e > > amd64_syscall+0x2bb fast_syscall_common+0x101 > > 1498 101575 python2.7 - mi_switch+0x174 > > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e > > amd64_syscall+0x2bb fast_syscall_common+0x101 > > 1498 101657 python2.7 - > ... > > ~/git/poudriere # procstat -kk 1498 > > PIDTID COMMTDNAME KSTACK > > 1498 100710 python2.7 - mi_switch+0x174 > > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e > > amd64_syscall+0x2bb fast_syscall_common+0x101 > > 1498 101575 python2.7 - mi_switch+0x174 > > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e > > amd64_syscall+0x2bb fast_syscall_common+0x101 > > 1498 101657 python2.7 - do_sem_wait+0x1b6 > > __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 > ... > > ~/git/poudriere # procstat -kk 94392 > > PIDTID COMMTDNAME KSTACK > > 94392 101815 python2.7 - mi_switch+0x174 > > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e > > amd64_syscall+0x2bb fast_syscall_common+0x101 > > 94392 101816 python2.7 - __mtx_lock_sleep+0x118 > > __mtx_lock_flags+0x102 _sleep+0x334 umtxq_busy+0xb7 do_sem_wait+0x161 > > __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 > > 94392 102076 python2.7 - __mtx_lock_flags+0x94 > > do_sem_wait+0x228 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb > > fast_syscall_common+0x101 Try this. We should only retry casueword if it failed spuriously. diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index bb998457975..6c914ab6f3e 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -3229,7 +3229,8 @@ do_sem_wait(struct thread *td, struct _usem *sem, struct _umtx_time *timeout) rv = casueword32(>_has_waiters, 0, , 1); if (rv == 0) rv1 = fueword32(>_count, ); - if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || rv == 1) { + if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || + (rv == 1 && count1 == 0)) { umtxq_lock(>uq_key); umtxq_unbusy(>uq_key); umtxq_remove(uq); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r350005 - head/sys/kern
On 7/15/2019 12:18 PM, Konstantin Belousov wrote: > Author: kib > Date: Mon Jul 15 19:18:25 2019 > New Revision: 350005 > URL: https://svnweb.freebsd.org/changeset/base/350005 > > Log: > In do_sem2_wait(), balance umtx_key_get() with umtx_key_release() on retry. > Is this also needed in do_sem_wait()? A similar pattern seems to be there. I ask because of what I referenced on IRC. I have some processes stuck in here from a 10.4 jail. > ~/git/poudriere # procstat -kk 1498 > PIDTID COMMTDNAME KSTACK > 1498 100710 python2.7 - mi_switch+0x174 > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e > amd64_syscall+0x2bb fast_syscall_common+0x101 > 1498 101575 python2.7 - mi_switch+0x174 > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e > amd64_syscall+0x2bb fast_syscall_common+0x101 > 1498 101657 python2.7 - ... > ~/git/poudriere # procstat -kk 1498 > PIDTID COMMTDNAME KSTACK > 1498 100710 python2.7 - mi_switch+0x174 > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e > amd64_syscall+0x2bb fast_syscall_common+0x101 > 1498 101575 python2.7 - mi_switch+0x174 > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e > amd64_syscall+0x2bb fast_syscall_common+0x101 > 1498 101657 python2.7 - do_sem_wait+0x1b6 > __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 ... > ~/git/poudriere # procstat -kk 94392 > PIDTID COMMTDNAME KSTACK > 94392 101815 python2.7 - mi_switch+0x174 > sleepq_switch+0x110 sleepq_catch_signals+0x417 sleepq_wait_sig+0xf > _sleep+0x2d0 umtxq_sleep+0x153 do_sem_wait+0x42c __umtx_op_sem_wait+0x6e > amd64_syscall+0x2bb fast_syscall_common+0x101 > 94392 101816 python2.7 - __mtx_lock_sleep+0x118 > __mtx_lock_flags+0x102 _sleep+0x334 umtxq_busy+0xb7 do_sem_wait+0x161 > __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb fast_syscall_common+0x101 > 94392 102076 python2.7 - __mtx_lock_flags+0x94 > do_sem_wait+0x228 __umtx_op_sem_wait+0x6e amd64_syscall+0x2bb > fast_syscall_common+0x101 > Reported by:ler > Bisected and reviewed by: markj > Sponsored by: The FreeBSD Foundation > MFC after: 12 days > > Modified: > head/sys/kern/kern_umtx.c > > Modified: head/sys/kern/kern_umtx.c > == > --- head/sys/kern/kern_umtx.c Mon Jul 15 17:13:32 2019(r350004) > +++ head/sys/kern/kern_umtx.c Mon Jul 15 19:18:25 2019(r350005) > @@ -3316,14 +3316,13 @@ do_sem2_wait(struct thread *td, struct _usem2 *sem, st > > uq = td->td_umtxq; > flags = fuword32(>_flags); > - error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), >uq_key); > - if (error != 0) > - return (error); > - > if (timeout != NULL) > abs_timeout_init2(, timeout); > > again: > + error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), >uq_key); > + if (error != 0) > + return (error); > umtxq_lock(>uq_key); > umtxq_busy(>uq_key); > umtxq_insert(uq); > -- Regards, Bryan Drewery signature.asc Description: OpenPGP digital signature