[GHC] #16143: Some cost centre stacks are not registered via registerCcsList()

#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

#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 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonmar): CCS_LIST is not used when reporting. It's only used during initialization to chain all the static CCSs together so that they can be assigned unique IDs. See `initProfiling` and `initProfiling2`. So I think you're not finding `base_GHCziIOziHandleziFD_CAFs_cc_ccs` because it was only on the CCS_LIST temporarily during initialization, and you're not finding the dynamic CCSs becuase they never get put on the CCS_LIST. Summary: I think you're barking up the wrong tree here :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16143#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by osa1): Thanks Simon. Would it make sense to register _all_ CCSs, to be able to use `CCS_LIST` when debugging profiling issues? More specifically I want to use `CCS_LIST` to implement the sanity check I showed in the description, we should help me debug #15508. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16143#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by osa1): Ah, I see the problem with this now. That wouldn't work, unless I implement another, module-local list for `initProfiling2`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16143#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16143: Some cost centre stacks are not registered via registerCcsList() -------------------------------------+------------------------------------- Reporter: osa1 | Owner: osa1 Type: bug | Status: new Priority: normal | Milestone: Component: Profiling | Version: 8.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by osa1): * owner: (none) => osa1 Comment: I'll document this stuff before closing the ticket. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16143#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC