seL4 / seL4

The seL4 microkernel

Home Page:https://sel4.systems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SMP with clang hangs on hifive in release config

lsf37 opened this issue · comments

The combination of clang, release, and SMP hangs on boot on the hifive board, see e.g. https://github.com/seL4/seL4/actions/runs/7508485461/job/20463803054

 U-Boot 2018.09-g6f6e014-dirty (Jul 04 2019 - 12:40:44 +1000)
  
  DRAM:  2 GiB
  MMC:
  In:    serial
  Out:   serial
  Err:   serial
  Net:   gmac0
  RISC-V # setenv autoload no
  dhcp
  setenv autoload no
  RISC-V # dhcp
  gmac0: PHY present at 0
  gmac0: Starting autonegotiation...
  gmac0: Autonegotiation complete
  gmac0: link up, 1000Mbps full-duplex (lpa: 0x3800)
  BOOTP broadcast 1
  BOOTP broadcast 2
  BOOTP broadcast 3
  BOOTP broadcast 4
  BOOTP broadcast 5
  DHCP client bound to address 172.16.1.52 (3766 ms)
  RISC-V # tftp 0x80000000 /hifive/sel4-image
  tftp 0x80000000 /hifive/sel4-image
  gmac0: PHY present at 0
  gmac0: Starting autonegotiation...
  gmac0: Autonegotiation complete
  gmac0: link up, 1000Mbps full-duplex (lpa: 0x3800)
  Using gmac0 device
  TFTP from server 172.16.0.2; our IP address is 172.16.1.52
  Filename '/hifive/sel4-image'.
  Load address: 0x80000000
  Loading: *�#################################################################
  	 #################################################################
  	 #################################################################
  	 ############################################
  	 608.4 KiB/s
  done
  Bytes transferred = 3498264 (356118 hex)
  RISC-V # go 0x80000000
  go 0x80000000
  ## Starting application at 0x80000000 ...
  
  OpenSBI v0.9
     ____                    _____ ____ _____
    / __ \                  / ____|  _ \_   _|
   | |  | |_ __   ___ _ __ | (___ | |_) || |
   | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
   | |__| | |_) |  __/ | | |____) | |_) || |_
    \____/| .__/ \___|_| |_|_____/|____/_____|
          | |
          |_|
  
  Platform Name             : sifive,hifive-unleashed-a00
  Platform Features         : timer,mfdeleg
  Platform HART Count       : 5
  Firmware Base             : 0x80000000
  Firmware Size             : 132 KB
  Runtime SBI Version       : 0.2
  
  Domain0 Name              : root
  Domain0 Boot HART         : 2
  Domain0 HARTs             : 0*,1*,2*,3*,4*
  Domain0 Region00          : 0x0000000080000000-0x000000008003ffff ()
  Domain0 Region01          : 0x0000000000000000-0xffffffffffffffff (R,W,X)
  Domain0 Next Address      : 0x0000000080200000
  Domain0 Next Arg1         : 0x0000000082200000
  Domain0 Next Mode         : S-mode
  Domain0 SysReset          : yes
  
  Boot HART ID              : 2
  Boot HART Domain          : root
  Boot HART ISA             : rv64imafdcsu
  Boot HART Features        : scounteren,mcounteren
  Boot HART PMP Count       : 16
  Boot HART PMP Granularity : 4
  Boot HART PMP Address Bits: 36
  Boot HART MHPM Count      : 0
  Boot HART MHPM Count      : 0
  Boot HART MIDELEG         : 0x0000000000000222
  Boot HART MEDELEG         : 0x000000000000b109
  ELF-loader started on (HART 1) (NODES 4)
    paddr=[80200000..8035d027]
  Looking for DTB in CPIO archive...found at 8021b908.
  Loaded DTB from 8021b908.
     paddr=[84023000..84025fff]
  ELF-loading image 'kernel' to 84000000
    paddr=[84000000..84022fff]
    vaddr=[ffffffff84000000..ffffffff84022fff]
    virt_entry=ffffffff84000000
  ELF-loading image 'sel4test-driver' to 84026000
    paddr=[84026000..8420bfff]
    vaddr=[10000..1f5fff]
    virt_entry=14474
  Main entry hart_id:1
  Secondary entry hart_id:2 core_id:1
  Hart ID 2 core ID 1
  Hart ID 1 core ID 0
  
  [[Timeout]]

It works fine on verification and debug builds (they succeeded in the same job above). Looks like this is actually before we enter the kernel. A successful run in debug mode shows this:

  ELF-loader started on (HART 1) (NODES 4)
    paddr=[80200000..80bc8027]
  Looking for DTB in CPIO archive...found at 8039ea88.
  Loaded DTB from 8039ea88.
     paddr=[84032000..84034fff]
  ELF-loading image 'kernel' to 84000000
    paddr=[84000000..84031fff]
    vaddr=[ffffffff84000000..ffffffff84031fff]
    virt_entry=ffffffff84000000
  ELF-loading image 'sel4test-driver' to 84035000
    paddr=[84035000..846cafff]
    vaddr=[10000..6a5fff]
    virt_entry=1ef2c
  Main entry hart_id:1
  Secondary entry hart_id:2 core_id:1
  Secondary entry hart_id:4 core_id:3
  Secondary entry hart_id:3 core_id:2
  Hart ID 2 core ID 1
  Hart ID 3 core ID 2
  Hart ID 4 core ID 3
  Hart ID 1 core ID 0
  Enabling MMU and paging
  Jumping to kernel-image entry point...

@axel-h any idea what might be going on here?

Maybe. Sometime ago I have been experimenting with RISC-V SMP a bit and noticed some issues. I will have a look at my old patches, and try running them in CI to see if this changes something.