From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751472AbdIKLto (ORCPT ); Mon, 11 Sep 2017 07:49:44 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6023 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750989AbdIKLtn (ORCPT ); Mon, 11 Sep 2017 07:49:43 -0400 Subject: Re: [PATCH] arm64: KVM: Skip PSTATE.PAN reest at EL2 in non-VHE To: Vladimir Murzin , , , References: <1505128612-13819-1-git-send-email-gengdongjiu@huawei.com> <652c020f-172f-f022-d23e-3b53375c6aae@arm.com> CC: , From: gengdongjiu Message-ID: Date: Mon, 11 Sep 2017 19:48:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <652c020f-172f-f022-d23e-3b53375c6aae@arm.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.142.68.147] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.59B67836.00A3,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: e5a4f38702f1decb54f723c8e235afb6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vladimir, On 2017/9/11 19:20, Vladimir Murzin wrote: > On 11/09/17 12:16, Dongjiu Geng wrote: >> PSTATE.PAN disables reading and/or writing to a userspace virtual >> address from EL1 in non-VHE or from EL2 in VHE. In non-VHE, there is >> no any userspace mapping at EL2, so no need to reest the PSTATE.PAN. > ^^^^^ > reset >> >> Signed-off-by: Dongjiu Geng >> Signed-off-by: Haibin Zhang >> --- >> arch/arm64/kvm/hyp/entry.S | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S >> index 12ee62d6d410..86a7549b1b4c 100644 >> --- a/arch/arm64/kvm/hyp/entry.S >> +++ b/arch/arm64/kvm/hyp/entry.S >> @@ -96,8 +96,12 @@ ENTRY(__guest_exit) >> >> add x1, x1, #VCPU_CONTEXT >> >> - ALTERNATIVE(nop, SET_PSTATE_PAN(1), ARM64_HAS_PAN, CONFIG_ARM64_PAN) >> +alternative_if_not ARM64_HAS_VIRT_HOST_EXTN >> + b 2f // skip PAN at EL2 in non-VHE >> +alternative_else_nop_endif >> >> + ALTERNATIVE(nop, SET_PSTATE_PAN(1), ARM64_HAS_PAN, CONFIG_ARM64_PAN) >> +2: >> // Store the guest regs x2 and x3 >> stp x2, x3, [x1, #CPU_XREG_OFFSET(2)] >> >> > > Ok. Probably I need to say why original patch did not consider non-VHE case: > - VHE and PAN features come within the same v8.1 extension bundle, so it is > unlucky to see IRL implementation with PAN but no VHE. > - Given above the only case where extra PAN instruction could count is > VHE-enabled system with CONFIG_ARM64_VHE is not set; However, IMO, usecase for > such setup is kind of debugging; it is quite obvious that those who care of > performance should not disable VHE in the first place... thanks for the explanation. > > Nit: > In general it is not polite to keep posting patches in a middle of the merge > window - people are busy with more important stuff... I do not know when you are busy and in merge window > > Cheers > Vladimir > > . >