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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17CF8C433FE for ; Wed, 19 Oct 2022 19:52:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230261AbiJSTw3 (ORCPT ); Wed, 19 Oct 2022 15:52:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiJSTw0 (ORCPT ); Wed, 19 Oct 2022 15:52:26 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F53A1D638F for ; Wed, 19 Oct 2022 12:52:20 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id d24so18275713pls.4 for ; Wed, 19 Oct 2022 12:52:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=hnwB06qHFVpiyjYkVj8hLBRnRlHSm7STOnmVqd/nWMs=; b=NfGmDTqXy5LHjgivlWFDkeKrrRP0nhqXyYq+zER68SfYiZ/KZZx55AuFU2tETRwgAG CvvYny8VR6n3ncCR/48eWF3EybY8bqIo35OsVMApVLgRUjVki1Mm6DmQ7Tq5flL0mMYO mNF17c2CPXu6ixK/flyZnAE0D0cCSy9ooydINwO0X8LCNdRUR+h0UmMAazER/6XahBsA 5YmNMtMm/j+kwF3tLuwcG76h9h6PH++x/Vu/SIXEFiffvTOz5HSUq7QAnuy27sy9AfV7 lGNOZomSPfGgb0TR3KyQ425c8DWQ1f52ku7t8Xbl8Q5QdcZn6g9mForUsgYFK+tdNVDJ 497w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hnwB06qHFVpiyjYkVj8hLBRnRlHSm7STOnmVqd/nWMs=; b=GrDQuvHh+PzePi1MFe6ULbvHbIn54Jlw19wz7LtgoMZBhHCYPIb4NZmYnmX1wxo840 yTNH+SUVIm7WHCZyd9qtaky1D2N/c3Amu6d0qPY6JjK5PG8lxyWQ7IYS4zmMZ282HxUL iub0npyuN/b8R3kZ2tIWF2DcLB39JeZ5BGoc6+Q8YNf9OsGKFLDH98jbDlyj91fboJhP rNqb0C4AgzCYpiUFSJeQyhTtCp7xKNncP+BXV3BiDWzo52yqqB7R/6V4o3PXZwuT2YVr 9+l9sZpBWJAXRVeC37PBAdr179N6dglCoXb78Divkw1XqmQgOG6DRjGx8wdVE8c+gmS6 gjgQ== X-Gm-Message-State: ACrzQf2HbtW+3alzV9tfXL9F88ZFvGCr+je4/AdwA9G3ch/iF9jzZFbt Ovtfn6U9h6MzlKPF8sI63ht6YRyom6QfHA== X-Google-Smtp-Source: AMsMyM75YJZ2jZ3WYMp87mMgAHA1mh0zI14iepyX5OdZ2yLFzi/fYu9BTOwEEIdtpyMqh4eAabTBDQ== X-Received: by 2002:a17:902:8c81:b0:178:a33f:8b8f with SMTP id t1-20020a1709028c8100b00178a33f8b8fmr10299902plo.50.1666209139843; Wed, 19 Oct 2022 12:52:19 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id u14-20020a63d34e000000b0046b1dabf9a8sm10365023pgi.70.2022.10.19.12.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 12:52:19 -0700 (PDT) Date: Wed, 19 Oct 2022 19:52:16 +0000 From: Sean Christopherson To: Vitaly Kuznetsov Cc: kvm@vger.kernel.org, Paolo Bonzini , Wanpeng Li , Jim Mattson , Michael Kelley , Siddharth Chandrasekaran , Yuan Yao , Maxim Levitsky , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v11 09/46] KVM: x86: hyper-v: Introduce TLB flush fifo Message-ID: References: <20221004123956.188909-1-vkuznets@redhat.com> <20221004123956.188909-10-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221004123956.188909-10-vkuznets@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-hyperv@vger.kernel.org On Tue, Oct 04, 2022, Vitaly Kuznetsov wrote: > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 0539d216f760..7fb8bd42b13e 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -3388,7 +3388,7 @@ static void kvm_vcpu_flush_tlb_all(struct kvm_vcpu *vcpu) > kvm_clear_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu); > } > > -static void kvm_vcpu_flush_tlb_guest(struct kvm_vcpu *vcpu) > +void kvm_vcpu_flush_tlb_guest(struct kvm_vcpu *vcpu) kvm_vcpu_flush_tlb_guest() doesn't need to be exposed in this patch, i.e. can remain static. I think it can be restricted to x86.c even in the final form (will follow-up in later patch). > { > ++vcpu->stat.tlb_flush; > > @@ -3409,7 +3409,7 @@ static void kvm_vcpu_flush_tlb_guest(struct kvm_vcpu *vcpu) > * Flushing all "guest" TLB is always a superset of Hyper-V's fine > * grained flushing. > */ > - kvm_clear_request(KVM_REQ_HV_TLB_FLUSH, vcpu); > + kvm_hv_vcpu_purge_flush_tlb(vcpu); > } > > > @@ -10484,7 +10484,14 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) > > kvm_service_local_tlb_flush_requests(vcpu); > > - if (kvm_check_request(KVM_REQ_HV_TLB_FLUSH, vcpu)) > + /* > + * Fall back to a "full" guest flush if Hyper-V's precise > + * flushing fails. Note, Hyper-V's flushing is per-vCPU, but > + * the flushes are considered "remote" and not "local" because > + * the requests can be initiated from other vCPUs. > + */ > + if (kvm_check_request(KVM_REQ_HV_TLB_FLUSH, vcpu) && > + kvm_hv_vcpu_flush_tlb(vcpu)) > kvm_vcpu_flush_tlb_guest(vcpu); > > if (kvm_check_request(KVM_REQ_REPORT_TPR_ACCESS, vcpu)) { > diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h > index a784ff90740b..1ea28a7bdf2f 100644 > --- a/arch/x86/kvm/x86.h > +++ b/arch/x86/kvm/x86.h > @@ -79,6 +79,7 @@ static inline unsigned int __shrink_ple_window(unsigned int val, > > #define MSR_IA32_CR_PAT_DEFAULT 0x0007040600070406ULL > > +void kvm_vcpu_flush_tlb_guest(struct kvm_vcpu *vcpu); As above, this is unnecessary. > void kvm_service_local_tlb_flush_requests(struct kvm_vcpu *vcpu); > int kvm_check_nested_events(struct kvm_vcpu *vcpu); > > -- > 2.37.3 >