[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 7/7] xen/arm64: Implement a fast path for handling SMCCC_ARCH_WORKAROUND_1
Hi Julien, On 6 February 2018 at 20:33, Julien Grall <julien.grall@xxxxxxx> wrote: > Hi, > > On 02/06/2018 04:36 PM, Volodymyr Babchuk wrote: >> >> On 5 February 2018 at 15:20, Julien Grall <julien.grall@xxxxxxx> wrote: >>> >>> The function SMCCC_ARCH_WORKAROUND_1 will be called by the guest for >>> hardening the branch predictor. So we want the handling to be as fast as >>> possible. >>> >>> As the mitigation is applied on every guest exit, we can check for the >>> call before saving all the context and return very early. >> >> Have you tried any benchmarks? How big is the benefit? > > > I have benchmarked but I can't share the result. I can give you an idea on > how this could benefits Xen. > > Linux will call the workaround on every context switch between process. So > imagine for each context switch, you have will enter in Xen and in the > following order: > 1) enter Xen > 2) apply the workaround which means calling EL3. > 3) save part of the guest context > 4) call enter_hypervisor_head that will sync the vGIC state > 5) detect you actually call SMCCC_ARCH_WORKAROUND_1 that will do > nothing > 6) call leave_hypervisor_tail that will sync back the vGIC state and > execute softirq (that could reschedule the vCPU) > 7) restore the guest context > 8) return to the guest > > So effectively, instead of executing hundreds (if not thousands) > instructions each time, you will end up only executing less than 50 > instructions. Sounds fine. > >>> >>> For now, only provide a fast path for HVC64 call. Because the code rely >>> on 2 registers, x0 and x1 are saved in advanced. >> >> Is there a typo? Should it be "advance"? >> >>> >>> Signed-off-by: Julien Grall <julien.grall@xxxxxxx> Provided that above typo is fixed: Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx> >>> >>> --- >>> guest_sync only handle 64-bit guest, so I have only implemented the >>> 64-bit side for now. We can discuss whether it is useful to >>> implement it for 32-bit guests. >>> >>> We could also consider to implement the fast path for SMC64, >>> althought a guest should always use HVC. >> >> I can imagine a guest that know nothing about virtualization and use >> SMC as a conduit. But I can't provide real world example, thou. I'm okay with this. -- WBR Volodymyr Babchuk aka lorc [+380976646013] mailto: vlad.babchuk@xxxxxxxxx _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |