Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp146687ybg; Wed, 18 Mar 2020 19:22:18 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuyK+dEb4whH/FvoBdiX3pbOcXB2FLBEsGCm+xRG/QQi1gPKD9Adc23JA1TnXNoCdfETgqh X-Received: by 2002:a9d:67c7:: with SMTP id c7mr526847otn.85.1584584537969; Wed, 18 Mar 2020 19:22:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584584537; cv=none; d=google.com; s=arc-20160816; b=acwrTg81J80AIoQq77Iu3KTmLHlnm7vgE/oyjL6TcSuYai/vWNwRthgwewJUGen8DC 0qxij8x/PgS/pf8Rf2/Czqbk/YLuHGDgGYK7cvi0+jbSvfExQeRtYLYtY61XEfNdf8Go Nfw4MSaeeNPWj0uhZB66T//+2JPIjeU7DPBBmcUDMq3xQYNwWWjGzGXJm/rB1xacM6jk g+D77yLGnBUGaaYyfTnzNDLE2+O7AHDlRp6+Pqyvy1E0rIWDpjCUfLZdw+yBP34Swv+r 2KuH2QouXFXju2XR5UDX9McpLucaebk4PY2+7wjzEA/KsRFPHjZx+GNx1Vvvt+o9jI5a G70g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=upyqTe02M/tYR7QK458TbIuhinCElOOphWaA/cyCZGc=; b=nHYF2mHPE+ixU0lAEz8Jy48iaknoD+NaEknvdySmotDIGIDHhNtYbJDgEoDCdsgCX1 IOC1Ph+Aght33CC+4PjGqIdk5sLnvy8d/2Fo2nqn1qb000ecx7NoL5pdmjmULkao1aOG yTnsMXQZumQp1IU00nLbskeGN+q9vo9Ons8WzbbDYUBsQUJdpb20IJVDFpX8cMcth9kY UCMxta0bsgAnrylmt29P9vUud4Aph9wsgNNofYZsljncl4kzGcMwaPiGIUK+cbbAYceU 0GM2130emCp/jCvSzUsaAXv3C6QLYCfIQZDU68ha4EJVw4CWDtxzlgEe9zi+aoeM+ive 5l1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n190si299590oig.207.2020.03.18.19.22.05; Wed, 18 Mar 2020 19:22:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727108AbgCSCVQ (ORCPT + 99 others); Wed, 18 Mar 2020 22:21:16 -0400 Received: from mail.loongson.cn ([114.242.206.163]:45810 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726596AbgCSCVP (ORCPT ); Wed, 18 Mar 2020 22:21:15 -0400 Received: from [10.20.42.25] (unknown [10.20.42.25]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxH2kV13Je8mMcAA--.28S3; Thu, 19 Mar 2020 10:21:09 +0800 (CST) Subject: Re: [PATCH RFC 4/4] KVM: MIPS: Define arch-specific kvm_flush_remote_tlbs() To: Peter Xu References: <20200207223520.735523-1-peterx@redhat.com> <20200207223520.735523-5-peterx@redhat.com> <20200318152837.GB26585@xz-x1> Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Sean Christopherson , Paolo Bonzini , linux-mips@vger.kernel.org, Vitaly Kuznetsov From: maobibo Message-ID: Date: Thu, 19 Mar 2020 10:21:09 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20200318152837.GB26585@xz-x1> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID: AQAAf9DxH2kV13Je8mMcAA--.28S3 X-Coremail-Antispam: 1UD129KBjvJXoW7Kw4UAFykAw1kXF15Gw43Awb_yoW8uFy8pF W7C3ZrCF4UWrWkWa4SvwnxWr1aqws3JFWUW3WUK345Xr90qr1kJFWfGr4F9ryUWrySqw1S 9F1rX3W3W3y7Aa7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvFb7Iv0xC_KF4lb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVWxJVW8Jr1l84ACjcxK6I 8E87Iv6xkF7I0E14v26r4UJVWxJr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xv F2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r 4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvEwIxGrwCYjI0SjxkI62AI1cAE67vIY487 MxkIecxEwVCm-wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c 02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_ Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7 CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAF wI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvj xU2xR6UUUUU X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/18/2020 11:28 PM, Peter Xu wrote: > On Wed, Mar 18, 2020 at 11:03:13AM +0800, maobibo wrote: >> >> >> On 02/08/2020 06:35 AM, Peter Xu wrote: >>> Select HAVE_KVM_ARCH_TLB_FLUSH_ALL for MIPS to define its own >>> kvm_flush_remote_tlbs(). It's as simple as calling the >>> flush_shadow_all(kvm) hook. Then replace all the flush_shadow_all() >>> calls to use this KVM generic API to do TLB flush. >>> >>> Signed-off-by: Peter Xu >>> --- >>> arch/mips/kvm/Kconfig | 1 + >>> arch/mips/kvm/mips.c | 22 ++++++++++------------ >>> 2 files changed, 11 insertions(+), 12 deletions(-) >>> >>> diff --git a/arch/mips/kvm/Kconfig b/arch/mips/kvm/Kconfig >>> index eac25aef21e0..8a06f660d39e 100644 >>> --- a/arch/mips/kvm/Kconfig >>> +++ b/arch/mips/kvm/Kconfig >>> @@ -26,6 +26,7 @@ config KVM >>> select KVM_MMIO >>> select MMU_NOTIFIER >>> select SRCU >>> + select HAVE_KVM_ARCH_TLB_FLUSH_ALL >>> ---help--- >>> Support for hosting Guest kernels. >>> >>> diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c >>> index 1d5e7ffda746..518020b466bf 100644 >>> --- a/arch/mips/kvm/mips.c >>> +++ b/arch/mips/kvm/mips.c >>> @@ -194,13 +194,16 @@ int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot, >>> return 0; >>> } >>> >>> +void kvm_flush_remote_tlbs(struct kvm *kvm) >>> +{ >>> + kvm_mips_callbacks->flush_shadow_all(kvm); >>> +} >>> + >> Hi Peter, > > Hi, Bibo, > >> >> Although I do not understand mip VZ fully, however it changes behavior of >> MIPS VZ, since kvm_flush_remote_tlbs is also called in function >> kvm_mmu_notifier_change_pte/kvm_mmu_notifier_invalidate_range_start > > I'm not familiar with MIPS either, however... I would start to suspect > MIPS could be problematic with MMU notifiers when cpu_has_guestid is > not set. If that's the case, then this series might instead fix it. yeap, from my viewpoint this series actually fix it when cpu_has_guestid is not set, previous kvm_flush_remote_tlbs function do nothing actually for MIPS VZ machine without cpu_has_guestid flag. > > Thanks, >