When sleeping waiting for the profiling stop, always set P_STOPPROF
before dropping process lock. Clear P_STOPPROF when doing wakeup. Both issues caused thread to hang in stopprofclock() "stopprof" sleep. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
45d1880a36
commit
0436fcb809
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=274343
@ -668,11 +668,11 @@ stopprofclock(p)
|
|||||||
PROC_LOCK_ASSERT(p, MA_OWNED);
|
PROC_LOCK_ASSERT(p, MA_OWNED);
|
||||||
if (p->p_flag & P_PROFIL) {
|
if (p->p_flag & P_PROFIL) {
|
||||||
if (p->p_profthreads != 0) {
|
if (p->p_profthreads != 0) {
|
||||||
p->p_flag |= P_STOPPROF;
|
while (p->p_profthreads != 0) {
|
||||||
while (p->p_profthreads != 0)
|
p->p_flag |= P_STOPPROF;
|
||||||
msleep(&p->p_profthreads, &p->p_mtx, PPAUSE,
|
msleep(&p->p_profthreads, &p->p_mtx, PPAUSE,
|
||||||
"stopprof", 0);
|
"stopprof", 0);
|
||||||
p->p_flag &= ~P_STOPPROF;
|
}
|
||||||
}
|
}
|
||||||
if ((p->p_flag & P_PROFIL) == 0)
|
if ((p->p_flag & P_PROFIL) == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -533,6 +533,7 @@ addupc_task(struct thread *td, uintfptr_t pc, u_int ticks)
|
|||||||
if (--p->p_profthreads == 0) {
|
if (--p->p_profthreads == 0) {
|
||||||
if (p->p_flag & P_STOPPROF) {
|
if (p->p_flag & P_STOPPROF) {
|
||||||
wakeup(&p->p_profthreads);
|
wakeup(&p->p_profthreads);
|
||||||
|
p->p_flag &= ~P_STOPPROF;
|
||||||
stop = 0;
|
stop = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user