Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp5180606rwb; Tue, 8 Aug 2023 23:09:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCFUtPsTXBfRIkE7798fWgausezRDE+yDf2YVf1evYkN6qCrpLtYmkTHcT5sxRqcOQuHFy X-Received: by 2002:a17:906:1017:b0:99c:3b4:940c with SMTP id 23-20020a170906101700b0099c03b4940cmr1473358ejm.7.1691561368178; Tue, 08 Aug 2023 23:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691561368; cv=none; d=google.com; s=arc-20160816; b=LSW9wk8j3j/jzLDjmoWLaXRCU6pfbrpvY68FWbFOZNAl5/enrFy4j5+BhtGTWWxcEV YJrVb2TZKd8CzYiPqD3o6A6p1pVXhg8pXxYPie8hDY+qgqaHeHPIgFsE2bluckG8b+4s QmcLMFudTeG7LX84HK+k5sveBUFGwHeUp25R2YmYLFJOQm2wR3Pk5pAOsh4Bm7eXE4UJ Ho4ewXewdGYw320SdWhFJhJZ5Hyi02eLcT9fi2nK9OrWmK4n3owBjjKgXHkW9SbqaiEy Zk0v1eR5UMGk3UT2fgbWFauW5gtzRGay8IbAEc/VdocjJ6znOJHy7YmXokj478KndoIR vpbA== 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=tiZt5qkV373iiZscCJbcFROPFCou/fOb43yGS5e3+0c=; fh=Bs4IlUUrR08+5RcvALEk5OwqZCdlb6dszx82ZRjpnrU=; b=S70JTWZFKjwCkuHFCyqXIbHDiiwVIN3giSMF+6Jihp06kSctu5mzmhsMnt9I1zT5ew HLdcmO/7jyC9gQbrY7HLZ3MaTsVRqE/NqlSO3okPD8D3d5/9lH5OnwyiNwMxoYZZlJSX frzmN4KuojFiDZQiG9s0/N71ldTH0KhE+qaSratxC43wSuOdutslXM99BU+EeTGbWSFx WEOrZJ1dRXxe5SRCb5VoSbhDLJCwxllKSNmVGVricxojmCxk7paGlD4lxkiVzWjcm7dm DI/MwmzQRFqH+TXJCWf70P32xWgPvEQ5XKNjlaEZyQY6NJgVpGcd9UzI/ly4MZJzKi4E snUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OkBpJ4hj; 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 n22-20020a170906701600b00977ab47b334si4727515ejj.435.2023.08.08.23.09.03; Tue, 08 Aug 2023 23:09:28 -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=OkBpJ4hj; 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 S229851AbjHIELQ (ORCPT + 99 others); Wed, 9 Aug 2023 00:11:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229783AbjHIELP (ORCPT ); Wed, 9 Aug 2023 00:11:15 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DED95198A for ; Tue, 8 Aug 2023 21:10:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691554228; 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=tiZt5qkV373iiZscCJbcFROPFCou/fOb43yGS5e3+0c=; b=OkBpJ4hjb4XeaPhRFCc9NGg1ldWTUzHvjxvWCDdKLNaRinp2X73RgxzCBcGpAtUOl5HLh7 cEsQDo9nZ271hbPwuSkPUgAqEHTVHgn5UjZepE4mTHaZcrYVG/jTINy9RKu8pI8Evb2j+v xQw+/fnr7bIOCatNhho+6EGg7/nMNvY= Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-274-d8u96XdpM2W7GcwgocmQUQ-1; Wed, 09 Aug 2023 00:10:26 -0400 X-MC-Unique: d8u96XdpM2W7GcwgocmQUQ-1 Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-686bc3f11feso479310b3a.0 for ; Tue, 08 Aug 2023 21:10:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691554223; x=1692159023; 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=tiZt5qkV373iiZscCJbcFROPFCou/fOb43yGS5e3+0c=; b=fQYmWpE+P+k5cC+cV7Qu8FLUOXD+0DfUD6yzN9j3aVex+FIw1rmRt8XRLxLkNh3EIY 0yfnEUsR5slDE4+rAqdg9PR+n92pZUvo1iewC+C0jTGbs5R/gOP4vyh9teiBZSSeNZ0x Vydagps+AawQotzH5vdMy5nmqlmQNg23EF6xtP3Q7GoCOs4EVdq+jzlI0nREHc5GhqxE AA/D1URtIVata1Jtp3eOOzkli0vHFq0n5DurWJN6YYklwbCCgffbC/XTlGwuPhgMqbuv k/YoRCy155RHblupDltfdlDxa9IJvVPjvLHhyMYB7G28eB5vUyIpyVnox1f4QvditjM9 cuXg== X-Gm-Message-State: AOJu0Yz5Zr3bR1lmXWwZvEnrlRsg2GL75hrw2gVvMf685P7TMlf+uJMD V8k6JGcRsbAzjFIqQSOOdjf6JjD0cV15JDO8cNkQiih0Mm2Imn9+jTqI/SXJKrNsLCrdojZLxRV c8PdV6C/1qu6y9hZPhUkXRbeL X-Received: by 2002:a05:6a00:1487:b0:666:eaaf:a2af with SMTP id v7-20020a056a00148700b00666eaafa2afmr2263680pfu.14.1691554222963; Tue, 08 Aug 2023 21:10:22 -0700 (PDT) X-Received: by 2002:a05:6a00:1487:b0:666:eaaf:a2af with SMTP id v7-20020a056a00148700b00666eaafa2afmr2263648pfu.14.1691554222702; Tue, 08 Aug 2023 21:10:22 -0700 (PDT) Received: from ?IPV6:2001:8003:e5b0:9f00:dbbc:1945:6e65:ec5? ([2001:8003:e5b0:9f00:dbbc:1945:6e65:ec5]) by smtp.gmail.com with ESMTPSA id p26-20020a62ab1a000000b006871fdde2c7sm8840727pff.110.2023.08.08.21.10.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Aug 2023 21:10:22 -0700 (PDT) Message-ID: Date: Wed, 9 Aug 2023 14:10:12 +1000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v8 03/14] 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 , Fuad Tabba , 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, Shaoqin Huang References: <20230808231330.3855936-1-rananta@google.com> <20230808231330.3855936-4-rananta@google.com> From: Gavin Shan In-Reply-To: <20230808231330.3855936-4-rananta@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.9 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_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=ham 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 8/9/23 09:13, 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 | 2 ++ > arch/arm64/kvm/Kconfig | 1 - > arch/arm64/kvm/mmu.c | 6 +++--- > 3 files changed, 5 insertions(+), 4 deletions(-) > Reviewed-by: Gavin Shan > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > index 8b6096753740c..20f2ba149c70c 100644 > --- a/arch/arm64/include/asm/kvm_host.h > +++ b/arch/arm64/include/asm/kvm_host.h > @@ -1111,6 +1111,8 @@ 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 > + > 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 f531da6b362e9..6b730fcfee379 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 6db9ef288ec38..0ac721fa27f18 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)