Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp2913607rwo; Mon, 24 Jul 2023 03:26:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlE99ijoAIfg0nOoQ0ScD5DK7pJchSKQKpPlkkRi/F04FFtLx864RzZ/bc85rt5CSDo20cAz X-Received: by 2002:a05:6a20:1d0:b0:135:940:97e6 with SMTP id 16-20020a056a2001d000b00135094097e6mr11509130pzz.8.1690194399591; Mon, 24 Jul 2023 03:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690194399; cv=none; d=google.com; s=arc-20160816; b=kQduw5/5KaL4jAIAknxHwYfAdD9eQRKpxi5FJAxGdbjN5xerHl/+JS6mMDRQuyUfPX phDcMKFSBRgQ8qcxnyABHGbKvR+PQyykPSOvmLmji5qJn1yJ1paXRIeDkAzl/8/FkT0s j1AJ+MoSTN4EWwTDB+sI/PXKOEtuosgvjJvcc2HglP/rFdeg6pLBuAekfAei0jQCICMg kjs2wFv0YNXb+7tbxCP/jLRCn0ceMkCftCUxDWGWFk0xZK4QmyoxLQPldbLM5zu0ldft RXCDjojOu354VS4WIOj92+kwv0CRYJ7I5Rb/1Z2ikyphWp6zwElg6zxcZRpkhGDtd5RX kEKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=//aPJH4zrPdTDxzMzJs7UJ4GFjBaI2aqgPX71P6a5dg=; fh=MfOLBeyoCsBIqveUcrLt6LkPSwgg+DtgEOwxJoBaBOs=; b=W7LwPavmM5Em5OPoZh0IhdSaRcyDBSzEk+l+MfsIEppG8YaxkC7vEg0cpNU6hvQoiC ZjBLK5zY85dncjEvJ3rjC9gRIImmpgbg2kKE2/iIuA0wpHLQS2fNYL2hc5Fr2npGkPNU 187DhNqCu7SIEgonhL8yeEYy6NM6B18ylZek4AeLm5xJMmyHtsdv+++V/FRIcnopdIoO vaBnXswQ+SKG+bSJnSI5NL3uqLhSQEkr9803gQkXX1bldenPtbEAryQXbGR15PhjOvLb Sj6mVP55hYlkc6Pd2bK6+MHL82SkJ0tSb4jwfy5nzw5O9vm/gzOsaCXNnXMPcRmLJHz5 DnwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hXiDVIM2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o6-20020a056a0015c600b0066886c86747si9246268pfu.310.2023.07.24.03.26.27; Mon, 24 Jul 2023 03:26:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hXiDVIM2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232193AbjGXJON (ORCPT + 99 others); Mon, 24 Jul 2023 05:14:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbjGXJOJ (ORCPT ); Mon, 24 Jul 2023 05:14:09 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B081D12A for ; Mon, 24 Jul 2023 02:13:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690190000; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=//aPJH4zrPdTDxzMzJs7UJ4GFjBaI2aqgPX71P6a5dg=; b=hXiDVIM2mC3M6DJsNh6TsEmcyuphhWW5Y30rCsHVrxAdwAA2WSAZNiGoCgRDi9g8hVRQMZ walFasxW6u2nnMi5jmtvK/FCD5xDt+x/0HTBTtYdfiFv0KCZgaOyu3eGHarGETccSPkor+ jDG2F7fOrsKg6HOzd0Xt97+t4S4wV4c= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-369-_cHJUeYQOq2996_vFUj-BQ-1; Mon, 24 Jul 2023 05:13:13 -0400 X-MC-Unique: _cHJUeYQOq2996_vFUj-BQ-1 Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-26801e9bcdaso439039a91.1 for ; Mon, 24 Jul 2023 02:13:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690189992; x=1690794792; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=//aPJH4zrPdTDxzMzJs7UJ4GFjBaI2aqgPX71P6a5dg=; b=R3esfAwQN5vFxRsmCwm2xtk5midy9KvLVakLpQuxFtGeay70L3xh2/5C5pfaa6aJxX w1+xv3sG3x0EvcUrVYI7QoJwG71ksF73fXzkpup++SMbCjJaDL2XE6IUVKX4gaGFp/5w M7Wo3m8Ahd8E7a2cdnm0e6LqVe4AY8HWNewoM3KYW1PiXn1f3/8N2ftlgRjySlR3+H21 YK0ai67fic/ff4XuR8MTbJalHVudrzVKJKfCof7AFKgjWDxI6laE7lcE4S188ZDghLy+ VBkv3Y0BDtqLZ7yg99lhD7SWCqUrWLurr+iFgbY1/a1Pjjc8xbJjg4Ca/jvzvi4OsXUN iExQ== X-Gm-Message-State: ABy/qLau0enwSoehsLUUoEHNppmq6WyGZtWFrJVNBbAQiD7auoEcHwk+ 0vxhCqiRvYTWBfN/0YXrCEyvzHNV5FpDK/Yi7QQBvBetr9WZWdhuDKvG/d+0wHmKenCCUc2VqA0 yfDNvjDx1VsytM6Rt7jZF3e1y X-Received: by 2002:a17:902:ce92:b0:1b8:1591:9f81 with SMTP id f18-20020a170902ce9200b001b815919f81mr12102519plg.4.1690189992429; Mon, 24 Jul 2023 02:13:12 -0700 (PDT) X-Received: by 2002:a17:902:ce92:b0:1b8:1591:9f81 with SMTP id f18-20020a170902ce9200b001b815919f81mr12102507plg.4.1690189992175; Mon, 24 Jul 2023 02:13:12 -0700 (PDT) Received: from [10.66.61.39] ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id w7-20020a170902e88700b001b06c106844sm8389140plg.151.2023.07.24.02.13.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Jul 2023 02:13:11 -0700 (PDT) Message-ID: Date: Mon, 24 Jul 2023 17:13:06 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v7 02/12] KVM: arm64: Use kvm_arch_flush_remote_tlbs() Content-Language: en-US To: Raghavendra Rao Ananta , Oliver Upton , Marc Zyngier , James Morse , Suzuki K Poulose Cc: Paolo Bonzini , Sean Christopherson , Huacai Chen , Zenghui Yu , Anup Patel , Atish Patra , Jing Zhang , Reiji Watanabe , Colton Lewis , David Matlack , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <20230722022251.3446223-1-rananta@google.com> <20230722022251.3446223-3-rananta@google.com> From: Shaoqin Huang In-Reply-To: <20230722022251.3446223-3-rananta@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/22/23 10:22, Raghavendra Rao Ananta wrote: > Stop depending on CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL and opt to > standardize on kvm_arch_flush_remote_tlbs() since it avoids > duplicating the generic TLB stats across architectures that implement > their own remote TLB flush. > > This adds an extra function call to the ARM64 kvm_flush_remote_tlbs() > path, but that is a small cost in comparison to flushing remote TLBs. > > In addition, instead of just incrementing remote_tlb_flush_requests > stat, the generic interface would also increment the > remote_tlb_flush stat. > > Signed-off-by: Raghavendra Rao Ananta Reviewed-by: Shaoqin Huang > --- > arch/arm64/include/asm/kvm_host.h | 3 +++ > arch/arm64/kvm/Kconfig | 1 - > arch/arm64/kvm/mmu.c | 6 +++--- > 3 files changed, 6 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > index 8b6096753740..7281222f24ef 100644 > --- a/arch/arm64/include/asm/kvm_host.h > +++ b/arch/arm64/include/asm/kvm_host.h > @@ -1111,6 +1111,9 @@ int __init kvm_set_ipa_limit(void); > #define __KVM_HAVE_ARCH_VM_ALLOC > struct kvm *kvm_arch_alloc_vm(void); > > +#define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS > +int kvm_arch_flush_remote_tlbs(struct kvm *kvm); > + > static inline bool kvm_vm_is_protected(struct kvm *kvm) > { > return false; > diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig > index f531da6b362e..6b730fcfee37 100644 > --- a/arch/arm64/kvm/Kconfig > +++ b/arch/arm64/kvm/Kconfig > @@ -25,7 +25,6 @@ menuconfig KVM > select MMU_NOTIFIER > select PREEMPT_NOTIFIERS > select HAVE_KVM_CPU_RELAX_INTERCEPT > - select HAVE_KVM_ARCH_TLB_FLUSH_ALL > select KVM_MMIO > select KVM_GENERIC_DIRTYLOG_READ_PROTECT > select KVM_XFER_TO_GUEST_WORK > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > index 6db9ef288ec3..0ac721fa27f1 100644 > --- a/arch/arm64/kvm/mmu.c > +++ b/arch/arm64/kvm/mmu.c > @@ -161,15 +161,15 @@ static bool memslot_is_logging(struct kvm_memory_slot *memslot) > } > > /** > - * kvm_flush_remote_tlbs() - flush all VM TLB entries for v7/8 > + * kvm_arch_flush_remote_tlbs() - flush all VM TLB entries for v7/8 > * @kvm: pointer to kvm structure. > * > * Interface to HYP function to flush all VM TLB entries > */ > -void kvm_flush_remote_tlbs(struct kvm *kvm) > +int kvm_arch_flush_remote_tlbs(struct kvm *kvm) > { > - ++kvm->stat.generic.remote_tlb_flush_requests; > kvm_call_hyp(__kvm_tlb_flush_vmid, &kvm->arch.mmu); > + return 0; > } > > static bool kvm_is_device_pfn(unsigned long pfn) -- Shaoqin