Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3464541ioo; Wed, 25 May 2022 00:50:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlZ+rz6BUFsasmvaLKWWNyl+c5U7cM7WqexB3ZJc8nWe0Br1RcajTpoxh3ZnM96qFeFku3 X-Received: by 2002:a17:907:629c:b0:6e1:6ad:5dd8 with SMTP id nd28-20020a170907629c00b006e106ad5dd8mr27444083ejc.641.1653465019012; Wed, 25 May 2022 00:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653465019; cv=none; d=google.com; s=arc-20160816; b=NZrt1Tzh6JXcolKSpn62KcN/2my0P09AveONwONWyhk6sRY+l+m0gQeTN+rlBUdM0F JeSUd1jU+q8K85Esm8ti34aNsL1Oj2JDvw7c2L/557fm9phTkNdcvq6poyouxBrNTPF6 BOang9Mjt8T9k87VOJ3BXJuQZiroCxGs1H8Mg1btY5LxXA/L3OF3iwv0v1BQ6fn7wMfw JXI5EnJHkM/GBuHv19Lbh0qdoegMDvOuCb3tAa5yahz19XQzQrSKUkCL0cbi5nv7P+F/ UK9F5upUvLArtjnFW+FoDL2CalWfNG0VXaZBB/jlusg3F4rILwith2HjbBCHOSRfRjMU TMDA== 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=rMLYZe5seQUfoZme6gT+f7ho5aBgGSwYKaK8wl4oIOI=; b=lZRs2pvXrmaaehsZ6mJj5FqTfSkScBN7wwsFRXE0NTISUde4TedhZQLZfq1b3gGN1x 0qe3MyCWmW9+MYwhfnlWHmJ1ssLKmqbew4LasmNumj/IpPIkBkRBkZesIL7XWbpQ/84a BcfWfc65p+oXB+GeqdkVzUDDVF2/oC7xqL8kaFfPHiAv8dFNEzz78Zo0TymovkluFTNT 2+DbKaGNteE3yU8zqqEJ2FKdCmE97lElRPoUTsBlGt1T6eur1nVWQWAS6K72cfjTNdp9 oLs1J7P4JfTODeTTDn2SnxjBmB1GZh8RclPYzDaF/GIiKdB8g/GaXycNaFtiu4m+UMkY asKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Jdq0OntS; 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 hc12-20020a170907168c00b006f3ffc76930si14372358ejc.1007.2022.05.25.00.49.51; Wed, 25 May 2022 00:50:19 -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=Jdq0OntS; 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 S241835AbiEXVAt (ORCPT + 99 others); Tue, 24 May 2022 17:00:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241820AbiEXVAr (ORCPT ); Tue, 24 May 2022 17:00:47 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C880149FA7 for ; Tue, 24 May 2022 14:00:46 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id l14so17910923pjk.2 for ; Tue, 24 May 2022 14:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=rMLYZe5seQUfoZme6gT+f7ho5aBgGSwYKaK8wl4oIOI=; b=Jdq0OntSmdnICnvNK2eFTZxT61bSqvUXQKXNf9sJcTRf6WWrBI+p4+ISllQFwJOYiq mGYoUFqlXDn6F1g3U+eGkdn550HQp8EJEboxtOxs2Ln9QjKkD8HEyKMYpVKCj+9tATmj IKsIL/6t+sfWkYUM2dBTcj/oA4hFiZpdvq/KfscvVifP5AjUm6zpXX5uqgWZ0yLr3Pt9 dejr/Cf8Y4DD457wcFdMbI1WD+bI2+st8wBumCl8GDAOUjYpf5kT7ehM72/4x375R6sL p2y+G4mwQuYEgZ3Yq7ypvdDOlh0DAS6XiW8U2JuDPPWtfHaW05JO35mUXAK+wdBsShux C8VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=rMLYZe5seQUfoZme6gT+f7ho5aBgGSwYKaK8wl4oIOI=; b=bdtLaZslql/lVLemEKqurw1YX97duYnuPD0JAL3yQ7poGW81wmbygCeIuwkVFWUQ/f y9+K6E3YoUPDBsWVpopwiAGQmM9f+dhf9OTigiGMM15hFPGDTfOmKaDt/gkTeauCGl6m SrlAqky76rtwEO+RtoJ9Grw994qBFtHyM1NI1iXdp2E7a2u7CBKEW0iTTFnks0cnCiNE eiEfWSY/hsSGpPHkLXI2UvdfYEUuaE6HQd+/i3laBlzSWsPFZrXem5R3aZrqlS+bdylD e8nRLvk1jSa8sYyrNfDGY+wHZQoOO4QrNgS62N195gQuwpKdXjD1iFCJw5tEMjr2fUQa cOrQ== X-Gm-Message-State: AOAM533jIQKYu+RR++e2mcqLehu/QzITfvh1Vm9boDyLzjp3campUdCf WnIED+pR67AOwVm1oDtOXh2VTA== X-Received: by 2002:a17:902:b703:b0:158:2667:7447 with SMTP id d3-20020a170902b70300b0015826677447mr28871066pls.92.1653426046115; Tue, 24 May 2022 14:00:46 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id r18-20020a170903411200b001619b47ae61sm7565011pld.245.2022.05.24.14.00.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 May 2022 14:00:45 -0700 (PDT) Date: Tue, 24 May 2022 21:00:42 +0000 From: Sean Christopherson To: Lei Wang Cc: pbonzini@redhat.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, chenyi.qiang@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 2/8] KVM: VMX: Add proper cache tracking for PKRS Message-ID: References: <20220424101557.134102-1-lei4.wang@intel.com> <20220424101557.134102-3-lei4.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220424101557.134102-3-lei4.wang@intel.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, T_SCC_BODY_TEXT_LINE,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 Sun, Apr 24, 2022, Lei Wang wrote: > From: Chenyi Qiang > > Add PKRS caching into the standard register caching mechanism in order > to take advantage of the availability checks provided by regs_avail. > > This is because vcpu->arch.pkrs will be rarely acceesed by KVM, only in > the case of host userspace MSR reads and GVA->GPA translation in > following patches. It is unnecessary to keep it up-to-date at all times. > > It also should be noted that the potential benefits of this caching are > tenuous because the MSR read is not a hot path. it's nice-to-have so that > we don't hesitate to rip it out in the future if there's a strong reason > to drop the caching. The patch looks fine, but this needs to be moved to the end of the series. Definitely after "KVM: VMX: Expose PKS to guest", and maybe even after "KVM: VMX: Enable PKS for nested VM". If there's a bug with the caching logic, I want to be able to bisect to that. By implementing caching before any of the other PKS support, a bug in either the caching or the virtualization will bisect to the PKS virtualization