Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1635872rwi; Wed, 19 Oct 2022 13:16:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7kr5UWzmA3zgidA+u8zRGDjgji7JRmEvzUtQl3l7HRlCrdop816/jUH4CzIbgaDVxPGRxu X-Received: by 2002:a17:906:730e:b0:78d:94ab:77c2 with SMTP id di14-20020a170906730e00b0078d94ab77c2mr8261253ejc.639.1666210580692; Wed, 19 Oct 2022 13:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666210580; cv=none; d=google.com; s=arc-20160816; b=mq+GDyyZD/a2ZefwdmfrkGMPORkDlB1En4xwlaC8s76ovlWIg/I6AxBrppaPPRyPvb Gac8G3UwqJcsol+7TJAPLxAFMFizMdsSupwwFSChVQ/+MRw3efMVYNQquSL76ag2jK0J hLZa5JVRjdGx1xA3GqUbqVWA84ntg2ZtGUuztgf9eqqK2OdjofBZlzCOQEhrlXMZ/Kry PDZkOO0fLM+diCuEWxl0DadCAROFTf3utHZDScbN8Uu5KunqihiPepm1mxkIJIuuRkV7 XsI4fSPXv48ik+aKv1/lp1snc2BLUViGSDi2XviAnL0EAfTbSiX4NtndWQGSvH9CeRUN 6wzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hnwB06qHFVpiyjYkVj8hLBRnRlHSm7STOnmVqd/nWMs=; b=f4/dRMExaAzArSHC8kHPFnt8sqvVVzuzS5kXvscp4rXe80G4Ibc90TXwH0t0eoWuPA fjQRQ7s9K2jA+NoqTPBD7gMWy6YB97bzgmHvVswAc+Qi9ncgwyn1jy0JjPbNJfCV63Lh W6mDSmPfEfKdeXxgoI1clC91QunaJTPksKa8sX9i4CJ8fm3QbObLVjiOhuwGb09dIuFh s6qi3thw0vs2j7VyYPEVHFpMNfKSky2p43nRxUXQSDArMuwzr2S1SOgnouY+b3MEf9L2 iyz7xTwKNXn7miKLZG7cwrHXeDyar1pMvZJECyAA+B6aXwROuBgOPaTw0vrrXdXciZf2 m7Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=NfGmDTqX; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e19-20020a056402089300b00458cbb6b6easi13497423edy.167.2022.10.19.13.15.53; Wed, 19 Oct 2022 13:16:20 -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=@google.com header.s=20210112 header.b=NfGmDTqX; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231171AbiJSTwa (ORCPT + 99 others); Wed, 19 Oct 2022 15:52:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbiJSTw0 (ORCPT ); Wed, 19 Oct 2022 15:52:26 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A1FC1C77EB for ; Wed, 19 Oct 2022 12:52:20 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id n7so18295120plp.1 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=tSnge+SUR+5Lv4Gc0xBUpcRl57Z9HV3LTJfrrnUILbgO2pky4xScFNc+VWnos6/nWf jrYcdJKfLGvLaFnHuNaRRNZ8zQohtCfdplsx2rk+9PJFpWZtFHDWaBM/URaUawo1KbE+ MNwVfI27+emrMkIEzG1ZmPL+yqcmaIiXdqCbKb4nAJBWl556d/9GjfAZ4x2LyIK3cvpV qllXbR7rVZG8HKglRepYQdlbSr3SK/6dl9MIIhyghjGpOvPetyonBTplfVyG/dRh3pt0 +HNdSF4qotpoDRc33n9888OTqXCMgNvNV0v99tyt6lfuKnP0Wxr6Dp9DdTxop6FPz5kb ibyg== X-Gm-Message-State: ACrzQf04DDYfooq9QCWt5ujcNSmfcNjcbSpwEc1VTAmUqG40oQP55HUO fuO1FdwPJ5xf9KI6DeKGYfm75w== 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> X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 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 >