aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_trap.c
diff options
context:
space:
mode:
authorAttilio Rao <attilio@FreeBSD.org>2012-10-30 15:10:50 +0000
committerAttilio Rao <attilio@FreeBSD.org>2012-10-30 15:10:50 +0000
commit5584e91718acd2e63285d159949778fff6bb224f (patch)
treee789d39c82bfc0a96712580c4b803232b496457d /sys/kern/subr_trap.c
parentdf0adc13c79cc759e23b3f3c35da46e75f66c464 (diff)
downloadsrc-5584e91718acd2e63285d159949778fff6bb224f.tar.gz
src-5584e91718acd2e63285d159949778fff6bb224f.zip
Fixup r240246: hwpmc needs to retain the pinning until ASTs are not
executed. This means past the point where userret() is generally executed. Skip the td_pinned check if a callchain tracing is currently happening and add a more robust check to pmc_capture_user_callchain() in order to catch td_pinned leak past ast() in hwpmc case. Reported and tested by: fabient MFC after: 1 week X-MFC: r240246
Notes
Notes: svn path=/head/; revision=242361
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r--sys/kern/subr_trap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index 70df8a10895c..22cabcb3b444 100644
--- a/sys/kern/subr_trap.c
+++ b/sys/kern/subr_trap.c
@@ -145,6 +145,11 @@ userret(struct thread *td, struct trapframe *frame)
/*
* Check for misbehavior.
+ *
+ * In case there is a callchain tracing ongoing because of
+ * hwpmc(4), skip the scheduler pinning check.
+ * hwpmc(4) subsystem, infact, will collect callchain informations
+ * at ast() checkpoint, which is past userret().
*/
WITNESS_WARN(WARN_PANIC, NULL, "userret: returning");
KASSERT(td->td_critnest == 0,
@@ -155,7 +160,7 @@ userret(struct thread *td, struct trapframe *frame)
("userret: Returning with pagefaults disabled"));
KASSERT((td->td_pflags & TDP_NOSLEEPING) == 0,
("userret: Returning with sleep disabled"));
- KASSERT(td->td_pinned == 0,
+ KASSERT(td->td_pinned == 0 || (td->td_pflags & TDP_CALLCHAIN) != 0,
("userret: Returning with with pinned thread"));
KASSERT(td->td_vp_reserv == 0,
("userret: Returning while holding vnode reservation"));