diff mbox

[v1,3/3] KVM: arm64: add ESB in exception handler entry and exit.

Message ID 1509563697-6359-4-git-send-email-gengdongjiu@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dongjiu Geng Nov. 1, 2017, 7:14 p.m. UTC
Some hardware platform can support RAS Extension instead
of support IESB, so software need to insert Synchronization
Barrier operations at exception handler entry and exit.

In the __guest_exit(), it added a ESB instruction, but can
not cover the path which is not guest exit. For example, if
EL1 host call HVC instruction enter to hypervisor, it will
not call __guest_exit().

In the kvm_arm_vhe_guest_enter(), it synchronised any host
RAS errors for VHE mode, but it can not handle the non-VHE
mode. For example, if EL1 host is pending a SError, the error
can be propagated to guest without error synchronization
operation.

Only add the ESB in the important exception handler path to
reduce the impact on performance.

Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
---
 arch/arm64/kvm/hyp/entry.S     | 2 ++
 arch/arm64/kvm/hyp/hyp-entry.S | 1 +
 2 files changed, 3 insertions(+)

Comments

kernel test robot Nov. 4, 2017, 6:49 p.m. UTC | #1
Hi Dongjiu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on v4.14-rc7 next-20171103]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Dongjiu-Geng/arm64-add-a-macro-for-SError-synchronization/20171104-224216
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: arm64-allmodconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

   arch/arm64/kvm/hyp/entry.S: Assembler messages:
>> arch/arm64/kvm/hyp/entry.S:88: Error: selected processor does not support `esb'
--
   arch/arm64/kvm/hyp/hyp-entry.S: Assembler messages:
>> arch/arm64/kvm/hyp/hyp-entry.S:57: Error: selected processor does not support `esb'

vim +88 arch/arm64/kvm/hyp/entry.S

    51	
    52	/*
    53	 * u64 __guest_enter(struct kvm_vcpu *vcpu,
    54	 *		     struct kvm_cpu_context *host_ctxt);
    55	 */
    56	ENTRY(__guest_enter)
    57		// x0: vcpu
    58		// x1: host context
    59		// x2-x17: clobbered by macros
    60		// x18: guest context
    61	
    62		// Store the host regs
    63		save_callee_saved_regs x1
    64	
    65		// Store the host_ctxt for use at exit time
    66		str	x1, [sp, #-16]!
    67	
    68		add	x18, x0, #VCPU_CONTEXT
    69	
    70		// Restore guest regs x0-x17
    71		ldp	x0, x1,   [x18, #CPU_XREG_OFFSET(0)]
    72		ldp	x2, x3,   [x18, #CPU_XREG_OFFSET(2)]
    73		ldp	x4, x5,   [x18, #CPU_XREG_OFFSET(4)]
    74		ldp	x6, x7,   [x18, #CPU_XREG_OFFSET(6)]
    75		ldp	x8, x9,   [x18, #CPU_XREG_OFFSET(8)]
    76		ldp	x10, x11, [x18, #CPU_XREG_OFFSET(10)]
    77		ldp	x12, x13, [x18, #CPU_XREG_OFFSET(12)]
    78		ldp	x14, x15, [x18, #CPU_XREG_OFFSET(14)]
    79		ldp	x16, x17, [x18, #CPU_XREG_OFFSET(16)]
    80	
    81		// Restore guest regs x19-x29, lr
    82		restore_callee_saved_regs x18
    83	
    84		// Restore guest reg x18
    85		ldr	x18,      [x18, #CPU_XREG_OFFSET(18)]
    86	
    87		// synchronize host pending asynchronous error
  > 88		error_synchronize
    89		// Do not touch any register after this!
    90		eret
    91	ENDPROC(__guest_enter)
    92	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S
index 96caa53..fce6806 100644
--- a/arch/arm64/kvm/hyp/entry.S
+++ b/arch/arm64/kvm/hyp/entry.S
@@ -84,6 +84,8 @@  ENTRY(__guest_enter)
 	// Restore guest reg x18
 	ldr	x18,      [x18, #CPU_XREG_OFFSET(18)]
 
+	// synchronize host pending asynchronous error
+	error_synchronize
 	// Do not touch any register after this!
 	eret
 ENDPROC(__guest_enter)
diff --git a/arch/arm64/kvm/hyp/hyp-entry.S b/arch/arm64/kvm/hyp/hyp-entry.S
index 5170ce1..ac85029 100644
--- a/arch/arm64/kvm/hyp/hyp-entry.S
+++ b/arch/arm64/kvm/hyp/hyp-entry.S
@@ -54,6 +54,7 @@  ENTRY(__vhe_hyp_call)
 ENDPROC(__vhe_hyp_call)
 
 el1_sync:				// Guest trapped into EL2
+	error_synchronize
 	stp	x0, x1, [sp, #-16]!
 
 alternative_if_not ARM64_HAS_VIRT_HOST_EXTN