svn commit: r350005 - head/sys/kern

Bryan Drewery bdrewery at FreeBSD.org
Tue Jul 30 22:05:09 UTC 2019


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
>   PID    TID COMM                TDNAME              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           -                   <running>
...
> ~/git/poudriere # procstat -kk 1498
>   PID    TID COMM                TDNAME              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
>   PID    TID COMM                TDNAME              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(&sem->_flags);
> -	error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &uq->uq_key);
> -	if (error != 0)
> -		return (error);
> -
>  	if (timeout != NULL)
>  		abs_timeout_init2(&timo, timeout);
>  
>  again:
> +	error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &uq->uq_key);
> +	if (error != 0)
> +		return (error);
>  	umtxq_lock(&uq->uq_key);
>  	umtxq_busy(&uq->uq_key);
>  	umtxq_insert(uq);
> 


-- 
Regards,
Bryan Drewery

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 618 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20190730/5e8bacf6/attachment.sig>


More information about the svn-src-all mailing list