[GHC] #8380: Numerous testsuite failures on ARM due to missing mkJumpToAddr
#8380: Numerous testsuite failures on ARM due to missing mkJumpToAddr ----------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Keywords: patch | Operating System: Unknown/Multiple Architecture: arm | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ----------------------------+------------------------------------- Numerous ghci tests in the testsuite currently fail on ARM due to the lack of a `mkJumpToAddr` definition. These failures look like, {{{ ghc-stage2: panic! (the 'impossible' happened) (GHC version 7.7.20130927 for arm-unknown-linux): mkJumpToAddr not defined for ArchARM {armISA = ARMv7, armISAExt = FPv3,NEON], armABI = HARD} Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} As it turns out `mkJumpToAddr` is fairly straightforward to implement. I've done this in https://github.com/bgamari/ghc/tree/arm. This brings the number of unexpected failures in `tests/ghci` from 44 to 4. These four failures are segmentation faults that I need to look more closely at. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8380> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8380: Numerous testsuite failures on ARM due to missing mkJumpToAddr -------------------------------------+--------------------------- Reporter: bgamari | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: | Keywords: patch Operating System: Unknown/Multiple | Architecture: arm Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+--------------------------- Comment (by bgamari): thoughtpolice correctly pointed out that in addition to implementing `mkJumpToAddr` we also need to ensure that the icache gets flushed after modifying the loaded code. I've added another patch to ensure this happens although this hasn't cleared up any further testsuite failures. These two patches brought down the number of total testsuite failures from 204 to 104 in my test environment. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8380#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8380: Numerous testsuite failures on ARM due to missing mkJumpToAddr -------------------------------------+--------------------------- Reporter: bgamari | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: | Keywords: patch Operating System: Unknown/Multiple | Architecture: arm Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+--------------------------- Comment (by thoughtpolice): It turns out we don't need `__clear_cache` because libffi (correctly) calls it for us when emitting trampolines/executable code. I'm validating this patch on my ODROID. It will also close #7794. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8380#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8380: Numerous testsuite failures on ARM due to missing mkJumpToAddr -------------------------------------+--------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: | Keywords: patch Operating System: Unknown/Multiple | Architecture: arm Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+--------------------------- Changes (by bgamari): * owner: => bgamari -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8380#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8380: Numerous testsuite failures on ARM due to missing mkJumpToAddr -------------------------------------+--------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: | Keywords: patch Operating System: Unknown/Multiple | Architecture: arm Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+--------------------------- Comment (by bgamari): As thoughtpolice pointed out in #ghc, it appears the libffi actually already takes care of icache flushing. I've updated the patch set to reflect this. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8380#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8380: Numerous testsuite failures on ARM due to missing mkJumpToAddr -------------------------------------+--------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: | Keywords: patch Operating System: Unknown/Multiple | Architecture: arm Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+--------------------------- Comment (by bgamari): What is the plan for merging this? I know the feature window for 7.8 has officially closed by I think this could be considered a bug-fix. Regardless, it should be a pretty harmless patch as it only touches the ARM path, implementing what was previous unimplemented. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8380#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8380: Numerous testsuite failures on ARM due to missing mkJumpToAddr -------------------------------------+--------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: patch Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: patch Operating System: Unknown/Multiple | Architecture: arm Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+--------------------------- Changes (by simonpj): * status: new => patch * milestone: => 7.8.1 Comment: I don't know but I'll make it 'patch' status and milestone for 7.8, so that Austin should get to it before we release. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8380#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8380: Numerous testsuite failures on ARM due to missing mkJumpToAddr -------------------------------------+--------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: patch Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: patch Operating System: Unknown/Multiple | Architecture: arm Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+--------------------------- Comment (by cjwatson): The GHCi byte code generator doesn't actually appear to use libffi to generate trampolines, so I'm not sure how its cache-clearing code would take effect. Am I missing something? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8380#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8380: Numerous testsuite failures on ARM due to missing mkJumpToAddr -------------------------------------+--------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: patch Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: patch Operating System: Unknown/Multiple | Architecture: arm Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+--------------------------- Changes (by cjwatson): * cc: cjwatson@… (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8380#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8380: Numerous testsuite failures on ARM due to missing mkJumpToAddr -------------------------------------+--------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: patch Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: patch Operating System: Unknown/Multiple | Architecture: arm Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+--------------------------- Comment (by thoughtpolice): Actually, I was missing something when I dove into the code. :) We actually need `ffi_prep_closure_loc` in order to clear the cache for us on ARM, which we don't do in the `allocateExec` path. In which case, we need to flush the cache explicitly. I'm bumping the priority on this since it's perhaps the biggest bug left for ARM. I'll integrate Ben's mkJumpToAddr patch and double check we clear things appropriately. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8380#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8380: Numerous testsuite failures on ARM due to missing mkJumpToAddr -------------------------------------+--------------------------------- Reporter: bgamari | Owner: thoughtpolice Type: bug | Status: patch Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: patch Operating System: Unknown/Multiple | Architecture: arm Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+--------------------------------- Changes (by thoughtpolice): * owner: bgamari => thoughtpolice * priority: normal => highest -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8380#comment:10> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8380: Numerous testsuite failures on ARM due to missing mkJumpToAddr -------------------------------------+--------------------------------- Reporter: bgamari | Owner: thoughtpolice Type: bug | Status: patch Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: patch Operating System: Unknown/Multiple | Architecture: arm Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+--------------------------------- Comment (by Austin Seipp <austin@…>): In [changeset:"5bab1a57f572e29dfdffd6d1ce8e53a2772b18fd/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="5bab1a57f572e29dfdffd6d1ce8e53a2772b18fd" GHCi: Properly generate jump code for ARM (#8380) This adds code for jumping to given addresses for ARM, written by Ben Gamari. However, when allocating new infotables for bytecode (which is where this jump code occurs), we need to be sure to flush the cache on the execute pointer returned from allocateExec() - on systems like ARM, the processor won't reliably read back code or automatically cache flush, where x86 will. So we add a new flushExec primitive to call out to GCC's __builtin___clear_cache primitive, which will properly generate the correct code (nothing on x86, and a call to libgcc's __clear_cache on ARM) and make sure we use it after writing the code out. Authored-by: Ben Gamari <bgamari.foss@gmail.com> Authored-by: Austin Seipp <austin@well-typed.com> Signed-off-by: Austin Seipp <austin@well-typed.com> }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8380#comment:11> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8380: Numerous testsuite failures on ARM due to missing mkJumpToAddr -------------------------------------+--------------------------------- Reporter: bgamari | Owner: thoughtpolice Type: bug | Status: closed Priority: highest | Milestone: 7.8.1 Component: Compiler | Version: 7.7 Resolution: fixed | Keywords: patch Operating System: Unknown/Multiple | Architecture: arm Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+--------------------------------- Changes (by thoughtpolice): * status: patch => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8380#comment:12> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC