Skip to content

Commit

Permalink
Fix bug corrupting token storage in mDxgKrnlPresentHistoryTokens
Browse files Browse the repository at this point in the history
There was an issue where a present gets handed off to a DWM (becoming a
mDependentPresent) and is eventually completed when the DWM present
completes.

The token used by that dependent present can be reused for a new
present.  If this happens, and the new present is live in
mDxgKrnlPresentHistoryTokens when the dependent present is completed,
then CompletePresent() did erase the mDxgKrnlPresentHistoryTokens entry
causing the present to be lost and eventually labeled as dropped.
  • Loading branch information
JeffersonMontgomery-Intel committed Mar 14, 2018
1 parent 3f767a6 commit 5087793
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion PresentData/PresentMonTraceConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,10 @@ void PMTraceConsumer::CompletePresent(std::shared_ptr<PresentEvent> p)
}
}
if (p->TokenPtr != 0) {
mDxgKrnlPresentHistoryTokens.erase(p->TokenPtr);
auto iter = mDxgKrnlPresentHistoryTokens.find(p->TokenPtr);
if (iter != mDxgKrnlPresentHistoryTokens.end() && iter->second == p) {
mDxgKrnlPresentHistoryTokens.erase(iter);
}
}
auto& processMap = mPresentsByProcess[p->ProcessId];
processMap.erase(p->QpcTime);
Expand Down

1 comment on commit 5087793

@jenatali
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a subtle bug... good find!

Please sign in to comment.