
#16143: Some cost centre stacks are not registered via registerCcsList() -------------------------------------+------------------------------------- Reporter: osa1 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Profiling | Version: 8.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- In #15508 I observe that some closures have incorrect CCS field. To be able to catch this problem as early as possible I implemented a simple check: {{{ static void checkClosureProfSanity(const StgClosure *p) { StgProfHeader prof_hdr = p->header.prof; CostCentreStack *ccs = prof_hdr.ccs; // For now just make sure the CCS is a registered CCS and not a pointer to // some random heap closure (happened before, see #15508). for (CostCentreStack *ccs_ = CCS_LIST; ccs_; ccs_ = ccs_->prevStack) { if (ccs == ccs_) { return; } } barf("CCS for closure %p is not registered: %p", (void*)p, (void*)ccs); } }}} I call this on all closures before and after a GC. This assumes that all cost centre stacks are registered via `registerCcsList()`, however this currently does not hold. I was able to find two cases: - `base_GHCziIOziHandleziFD_CAFs_cc_ccs` is never registered (there are probably a few CCSs per module like this which are never registered) - None of the dynamically allocated CCSs are registered. My question is: am I misunderstanding how the CCS registry (`CCS_LIST`) is supposed to be used? I thought all CCSs should really be in that list, because the list is used when reporting. Not registering a CCS means not reporting it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16143 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler