Hi Wei,
On 03/03/2022 01:35, Wei Chen wrote:
1. Assembly code for EL1 MPU context_switch
This discussion reminds me when KVM decided to rewrite their context
switch from assembly to C. The outcome was the compiler is able to do a
better job than us when it comes to optimizing.
With a C version, we could also share the save/restore code with 32-bit
and it is easier to read/maintain.
So I would suggest to run some numbers to check if it really worth
implementing the MPU save/restore in assembly.
It's interesting to hear KVM guys have similar discussion. Yes, if the
gains of assembly code is not very obvious, then reusing the code for 32-bit
would be more important. As our current platform (FVP) could not do very
precise performance measurement. I want to keep current assembly code there,
when we have a platform that can do such measurement we can have a thread
to discuss it.
I briefly looked at the code, the assembly version is not going to be
trivial to review and we don't know yet whether it has an advantage. So
I would say this should be the inverse here.
We want the C version first until we can prove the assembly version is
better.
My gut feeling is we will not need the assembly version.
Cheers,
--
Julien Grall