From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87B22C388F7 for ; Thu, 22 Oct 2020 12:05:00 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 03558221FE for ; Thu, 22 Oct 2020 12:04:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hu5gLJAw"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="YRpZPXny" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 03558221FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MPl84KCoe2B+lXVMTJ4E8kppQsuMag8aUv3A21K6XNU=; b=hu5gLJAwC7nK6aS21hdiqSvP+ IefwFzNtTWbEbJrlfh7vmCWRvJBrnHRGkv5i5l8+hyzi8YEwfnysTRcA2x+75FW2/zujOMSxcDR8L 0ecxkfAQtKAeVarlypT9VPu9gLMw1nMC5cF9g0v7QREYF6+ZNHsZ3QZ6gbGj03/oPhUrTVy4QKklU mqCv50t1pBefJgXsR4KQP7PSc2wzk1D0sLuv2lsjvgGk+6ZhJpJIaMkcofYNJnsXmeRSeDUC/iyCD lNm2XYtuQLh9R0i5WS5oPPQG2sdElOREVfQciWA1oEvaTZURyj0HlVk6IGM7AqsOBD7Wvrvhh3tjG hGbqIHdCQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVZJN-0001Az-Ui; Thu, 22 Oct 2020 12:03:18 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kVZJK-0001AV-HK for linux-arm-kernel@lists.infradead.org; Thu, 22 Oct 2020 12:03:15 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 174A9221FE; Thu, 22 Oct 2020 12:03:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603368193; bh=QoNlR6rIRYPKupL4AS+eEnrxGc2IW3lD5dGdm24WsAc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=YRpZPXnyyuQqVeCuey02XRVYLQwVvODglK08tP2UEGvxxpkV11lo/bsqQocZZiQBF IORypbWtJatWmO7ydVc1b+3GWAxzeqJ7ho5jNwJic0m8c791iIaxHjQ+Z1WH+S0yvT uI5ELeVmCraFXhb7NYAwdiZqgYO8KhRG4GLwCwqE= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kVZJG-003Iwo-Vu; Thu, 22 Oct 2020 13:03:11 +0100 MIME-Version: 1.0 Date: Thu, 22 Oct 2020 13:03:10 +0100 From: Marc Zyngier To: Shaokun Zhang Subject: Re: [RFC] KVM: arm64: Don't force broadcast tlbi when guest is running In-Reply-To: <1603331829-33879-1-git-send-email-zhangshaokun@hisilicon.com> References: <1603331829-33879-1-git-send-email-zhangshaokun@hisilicon.com> User-Agent: Roundcube Webmail/1.4.9 Message-ID: X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: zhangshaokun@hisilicon.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, tangnianyao@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201022_080314_773265_72D275DB X-CRM114-Status: GOOD ( 19.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Nianyao Tang Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020-10-22 02:57, Shaokun Zhang wrote: > From: Nianyao Tang > > Now HCR_EL2.FB is set to force broadcast tlbi to all online pcpus, > even those vcpu do not resident on. It would get worse as system > gets larger and more pcpus get online. > Let's disable force-broadcast. We flush tlbi when move vcpu to a > new pcpu, in case old page mapping still exists on new pcpu. > > Cc: Marc Zyngier > Signed-off-by: Nianyao Tang > Signed-off-by: Shaokun Zhang > --- > arch/arm64/include/asm/kvm_arm.h | 2 +- > arch/arm64/kvm/arm.c | 4 +++- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/include/asm/kvm_arm.h > b/arch/arm64/include/asm/kvm_arm.h > index 64ce29378467..f85ea9c649cb 100644 > --- a/arch/arm64/include/asm/kvm_arm.h > +++ b/arch/arm64/include/asm/kvm_arm.h > @@ -75,7 +75,7 @@ > * PTW: Take a stage2 fault if a stage1 walk steps in device memory > */ > #define HCR_GUEST_FLAGS (HCR_TSC | HCR_TSW | HCR_TWE | HCR_TWI | > HCR_VM | \ > - HCR_BSU_IS | HCR_FB | HCR_TAC | \ > + HCR_BSU_IS | HCR_TAC | \ > HCR_AMO | HCR_SWIO | HCR_TIDCP | HCR_RW | HCR_TLOR | \ > HCR_FMO | HCR_IMO | HCR_PTW ) > #define HCR_VIRT_EXCP_MASK (HCR_VSE | HCR_VI | HCR_VF) > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c > index acf9a993dfb6..845be911f885 100644 > --- a/arch/arm64/kvm/arm.c > +++ b/arch/arm64/kvm/arm.c > @@ -334,8 +334,10 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int > cpu) > /* > * We might get preempted before the vCPU actually runs, but > * over-invalidation doesn't affect correctness. > + * Dirty tlb might still exist when vcpu ran on other pcpu > + * and modified page mapping. > */ > - if (*last_ran != vcpu->vcpu_id) { > + if (*last_ran != vcpu->vcpu_id || vcpu->cpu != cpu) { > kvm_call_hyp(__kvm_tlb_flush_local_vmid, mmu); > *last_ran = vcpu->vcpu_id; > } This breaks uniprocessor semantics for I-cache invalidation. What could possibly go wrong? You also fail to provide any data that would back up your claim, as usual. M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel