hex-five / multizone-sdk

MultiZone® Security TEE is the quick and safe way to add security and separation to any RISC-V processors. The RISC-V standard ISA doesn't define TrustZone-like primitives to provide hardware separation. To shield critical functionality from untrusted third-party components, MultiZone provides hardware-enforced, software-defined separation of multi
https://hex-five.com/multizone-security-tee-riscv/
Other
79 stars 24 forks source link

Yield doesn't match stats #42

Closed borancar closed 4 years ago

borancar commented 5 years ago

Reported on: 0e5d4a83e0ecf851d920b6c4069bb02f6c19073d Reproduced on boards: E31, S51 (somewhat)

Description

Running yield repeatedly on E31 will give the time 300-400us. Running the stats command will give the time aroud 19us. On the S51 the yield variance is bigger, sometimes matching the stats output in a couple of numbers.

Steps to reproduce

Z1 > yield
yield : elapsed time 297us

Z1 > yield
yield : elapsed time 297us

Z1 > yield
yield : elapsed time 297us

Z1 > yield
yield : elapsed time 297us

Z1 > yield
yield : elapsed time 436us

Z1 > yield
yield : elapsed time 303us

Z1 > yield
yield : elapsed time 436us

Z1 > yield
yield : elapsed time 436us

Z1 > stats
1252 cycles in 19 us
1581 cycles in 24 us
1242 cycles in 19 us
1576 cycles in 24 us
1242 cycles in 19 us
1579 cycles in 24 us
1243 cycles in 19 us
1577 cycles in 24 us
1242 cycles in 19 us
1578 cycles in 24 us
1242 cycles in 19 us
------------------------------------------------
cycles  min/med/max = 1242/1252/1581
time    min/med/max = 19/19/24 us

ctx sw instr  min/med/max = 120/120/120
ctx sw cycles min/med/max = 205/208/209
ctx sw time   min/med/max = 3/3/3 us
borancar commented 5 years ago

This is a candidate for known issues. I assume the cache gets blown because I haven't observed this on the X300 on the hexfive-boran-wip2 branch.