Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1241982pxb; Thu, 21 Oct 2021 19:15:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRfAKJaWbg3SjldIq7mIbfL1iD2n3fqyqUOxDdecCLUj3x4NTm/KhOjWo7xd8yIKs3x75n X-Received: by 2002:a17:906:3f83:: with SMTP id b3mr11874797ejj.233.1634868944539; Thu, 21 Oct 2021 19:15:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634868944; cv=none; d=google.com; s=arc-20160816; b=l1Ff3ehiVmqR6f2qwcumXy0o+lkCYDyuC/y9AG64d2NEQYxKsNlaY68r10RP8XTUDp 9SvUfFIYpulaIqfhtOZdV7JP4y6ABOXLG36+9b7Zz7eeDRsN6stdATu1iEDXyIS2nZIO Qm3A7kooPb1IecX7zePoaZNaEJkXZXqTlvfP4I2xgUKT9EZSJBkAYyoYvaC2h3jn1xbx Nvu1V7wuN2vQL1VeLhO6YaouxLl8ixdA4GoHIqx44X6Ac1KpPDM3+tfIvMXHsUPbh7Gm dcV2Whs61hS5CC6my5zAg0kJIhUF/jwdlbB/lMIZaPjhzFa+e8TS12iiduAmhwLNKEfI wMbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Kd9RbEF+r4Kt9Rh7US30RNyY/dvqExss0dHw6wQ+3eU=; b=E7x9+MYHaL18cSXURzZWhH5zdinyZ7sqjosaDTdQR/04nJxdci8YzjRH48DVQW91K6 ymvHqJ5iWtrSQQbW5t6uwP10/DW4GbauOA5jzSIJcWXt2ZKIdFOk8qfz95MCjaAaoLft d54xAI4UAq5mXsCx2K0c0Jus3Dk5mCiR9HH7aA/7FEJ/zQkrmk2lAGck7nM6dyRMMUF2 EScOHB67fGzcueDYdM8yFKI1N4PhPSGWLE9ge0IRHRdcf/KRNwRDdAcjWw26Vn3/f+RT XkqxpdvZm7XLZbTKEDVaMvHCagWijc5Tj4fCY3VHNRF6MWMz1BrfPHoDTDya1gR+Jw5T Qq2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SMfmKCyi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z17si14543484edd.257.2021.10.21.19.15.21; Thu, 21 Oct 2021 19:15:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SMfmKCyi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232382AbhJVCNb (ORCPT + 99 others); Thu, 21 Oct 2021 22:13:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232370AbhJVCNa (ORCPT ); Thu, 21 Oct 2021 22:13:30 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6079CC061764; Thu, 21 Oct 2021 19:11:13 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id y67so3420652iof.10; Thu, 21 Oct 2021 19:11:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Kd9RbEF+r4Kt9Rh7US30RNyY/dvqExss0dHw6wQ+3eU=; b=SMfmKCyikObqIIuzB27Kwn8Jh1DdlqOFAkhgQHaHz6wKGqqKo5guO9XZtrAjcTK3Vd hdonnFXpUBOROaKPQSkvrsWdg14UJ+In7vpXKD1SUf5lgGV+l8qakkuwEWMxcvltJWdB yVwBOHuVZqXwlir+Ii8XtwKl+z+sry6mBBGBT6RHjyJFxs6YRezflsf2jtUKiKJZyuPe 8fOR7YGXjP+2rN1uODV4xHzki9qr/7oddY5ZHBLX+P4gJcY7dle/rTjZoyb7B+fekVwc 6Q1XQVnWrCEkuOSRp3kklM7B87fcrULw+W+HnpM+r0kXzpXxh/L2dwq5nHLjB6E6L5tY W78w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Kd9RbEF+r4Kt9Rh7US30RNyY/dvqExss0dHw6wQ+3eU=; b=xWkf45o7/i8XZX332jQ2LLPBR/hXmx8iLS35D7DSCJ9cl1cm47BItktd1TiBFqqms/ Z9RCo0s42HPhhGPXCh6NuqG4olHCS51jF+xu8gIKoYoe9Z/fm0+F/yxXegyNuGDQML7m UUVtLUYi7mO+uxrD+puH9wbrU11yBEvi/PgGwjWJoqAwDeDaV6ljkonHwV8nxsVodYYu +RpJj9sD/kkppEbiHmYo3PDKJ4srC7SGc+U4be0gzrDzRXYZgPeiebdSEptYfetTAbum L2sb+sfF7mrBHSpOJIUTuSUKdQG2omTeveULpCW4Nf5Ak1LTP6+H8urDv07RCXw8+NRW dNIg== X-Gm-Message-State: AOAM532+NvRlMwbrq2qyNnPB52xFj4NJ6VQIXX3exsbUQNznF1vWwOQP BBi7U+LMkNxpL13x65a6+YJBY+9hEPjNfHCZg2Y= X-Received: by 2002:a5d:80d6:: with SMTP id h22mr3211325ior.152.1634868672251; Thu, 21 Oct 2021 19:11:12 -0700 (PDT) MIME-Version: 1.0 References: <20211019110154.4091-1-jiangshanlai@gmail.com> <20211019110154.4091-3-jiangshanlai@gmail.com> <593cdae9-c49d-6977-24d5-191f723188d7@redhat.com> In-Reply-To: <593cdae9-c49d-6977-24d5-191f723188d7@redhat.com> From: Lai Jiangshan Date: Fri, 22 Oct 2021 10:11:01 +0800 Message-ID: Subject: Re: [PATCH 2/4] KVM: X86: Cache CR3 in prev_roots when PCID is disabled To: Paolo Bonzini Cc: LKML , kvm@vger.kernel.org, Lai Jiangshan , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , X86 ML , "H. Peter Anvin" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 22, 2021 at 1:43 AM Paolo Bonzini wrote: > > * If CR4.PCIDE is changed 1 -> 0, the guest TLB must be flushed. > * If CR4.PCIDE is changed 0 -> 1, there is no need to flush the TLB > * according to the SDM; however, stale prev_roots could be reused > * reused incorrectly by MOV to CR3 with NOFLUSH=1, so we free them > * all. KVM_REQ_MMU_RELOAD is fit for the both cases; it > * is slow, but changing CR4.PCIDE is a rare case. > There is a double "reused" separated by "\". > > > Can you confirm the above comments are accurate? > Yes, they are better and consistent with what I meant, only one redundant "reused" in the comments. thanks Lai