Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp849365pxb; Thu, 21 Oct 2021 10:37:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySuf405CWRrzFr/vKedYoTjFfHzt/QTFqMV8ymtVb6/ds6oYRWG96zkIW0acjiQDb6yOg/ X-Received: by 2002:a17:906:6d0a:: with SMTP id m10mr8925766ejr.90.1634837832462; Thu, 21 Oct 2021 10:37:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634837832; cv=none; d=google.com; s=arc-20160816; b=Te/BMMotrZk9ZkpsnK5RiIgJyfq7Rs9ikiRRzV0ow2YA8+8+ZTgyCeF9SS6lSohVR0 l00EAqUPfzNZXq46M5MXrmHWTeltBpzrH99DF2XEd83RTQNUCygvSjPbjqKSvbaa4gZK aqCLqHpk2q4VpDInrDMNWwMcw5EzyNJmdg2TjRklc+opBkzl4AYr0b82smZOOMnBmxjl ex6rsliiusnFapdbFKYn9yLK9xX260rpB7V5ZWSIKR7UvXI6Gnxqb96g8q+Z9DNpWRDJ HiUzgsgubAAbhjIt9L75URs2Fqp0LJqcKDXQ9Z/MMfWm92vBZ6DS1FnjynlV/1njrynZ 5Flg== 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=7kvYcqlsDZVFRQNQI1c9X3eJYnsZcG9jtWbow6imt78=; b=x4C71+TirLIjLthIADoQLvtzJlKNZgAt/8paT2/Cpv1jivFS8Y/YCmGCrNiv6+Em/l O6lFmLZgCvcsULIySLROPXt03IfyanZPYfHwRiCONLbEq4BowT3nJhC8snUdrG0XUE5J 7Rims/WmiDXVY8iCeiXmhxlTF/F4k34vIgl1iwZReIrhM15I6h4Fq8CXRDU7HvNrTd74 SnmocWYb/8YEMkUvmNCJlSX9VpnSfTtNgXe0sl/IAdcV0f3Zlim06XoheUsYouGFcvGm bqTGbqK75WlWooISkFn8eqn2IIRWDr7TzSdvzZ0+U8fu7o7p1iCo9tKUSmA4sAnNxO9e XMHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=dw55ti12; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b1si8599682ejl.25.2021.10.21.10.36.46; Thu, 21 Oct 2021 10:37:12 -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=@google.com header.s=20210112 header.b=dw55ti12; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231803AbhJURfT (ORCPT + 99 others); Thu, 21 Oct 2021 13:35:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231220AbhJURfS (ORCPT ); Thu, 21 Oct 2021 13:35:18 -0400 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1ADA3C061764 for ; Thu, 21 Oct 2021 10:33:02 -0700 (PDT) Received: by mail-ot1-x32d.google.com with SMTP id y15-20020a9d460f000000b0055337e17a55so1274818ote.10 for ; Thu, 21 Oct 2021 10:33:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7kvYcqlsDZVFRQNQI1c9X3eJYnsZcG9jtWbow6imt78=; b=dw55ti12SIJyKmryST8ORpjtgrtUtfPsVXQw/pMBi9Fm8DUq9ffCXFX186IGeoWlh6 7XicZh+gfmBz22PNDamnVz1EssLHFmyFO767MD39932nJ2km/fRO0qBK/mpjXNW06A7R /+4E7qQh4THnfGTGhtY7fxfEul4KSsfROoBUR4rNFN2J3beelDCl+jJuMyU/5n1oqh7z NP2+dLVZQSyLH/eazkKuDpNUGQQxYDUq67OxoVcIOa3kTK51mupjQ1V+vrknN1jqcPUG oqy8oPWbNKjAo2NcEt2ajXvzu5DuQwG0zgeVB/fWT2fg2bDFfA8PBfYQK1fDGrLLjN0m y/MQ== 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=7kvYcqlsDZVFRQNQI1c9X3eJYnsZcG9jtWbow6imt78=; b=WOJ7YoqR3v8VX6BbJEWbGhqmFxEO4yuTH/U2vH8Y4dcF+DaeMLjCFms7acJwrMtreY fsEmI2IF8jM1RJUWVjNvnhjYo2X/Teajmk08c1tK6qv1blPXlwslpXxk69IbYJyQnBNw c9z1VcA62DvgSXNQ4EGQy7A/OItBZYd/4G3dIPmb3ZqrwNB3V/m6PJlYbshzHtyFi1Oc w8Y3CTTcjy6MnKc6wUI+K3nZ5ftHcxDoOLzxXPqFrJcmb70zo/VAERQy0ww0w6B0igsX 7P9nkJ6ZbE7OvzEUaKvPwOpF9xdsGkEjakj4pjH5Nlj3cxx7KveRxSZfXqXi2nci5ndA dSog== X-Gm-Message-State: AOAM533NLHDy07Y12wUP7WPjfh0uVO9kDFqSnXqdBEd8ZN91FSb6h/fA MtpA22jWnK+gE50D6pajb7KulsFwOUVxBe+4O1qGaQ== X-Received: by 2002:a9d:458a:: with SMTP id x10mr5997128ote.267.1634837581215; Thu, 21 Oct 2021 10:33:01 -0700 (PDT) MIME-Version: 1.0 References: <20211019110154.4091-1-jiangshanlai@gmail.com> <20211019110154.4091-2-jiangshanlai@gmail.com> <55abc519-b528-ddaa-120d-8d157b520623@linux.alibaba.com> <945500f6-27e1-ed81-2b7d-c709cb1d4b33@redhat.com> In-Reply-To: <945500f6-27e1-ed81-2b7d-c709cb1d4b33@redhat.com> From: Jim Mattson Date: Thu, 21 Oct 2021 10:32:49 -0700 Message-ID: Subject: Re: [PATCH 1/4] KVM: X86: Fix tlb flush for tdp in kvm_invalidate_pcid() To: Paolo Bonzini Cc: Sean Christopherson , Lai Jiangshan , Lai Jiangshan , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Vitaly Kuznetsov , Wanpeng Li , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 21, 2021 at 10:13 AM Paolo Bonzini wrote: > > On 21/10/21 16:52, Sean Christopherson wrote: > >> I think the EPT violation happens*after* the cr3 write. So the instruction to be > >> emulated is not "cr3 write". The emulation will queue fault into guest though, > >> recursive EPT violation happens since the cr3 exceeds maxphyaddr limit. > > Doh, you're correct. I think my mind wandered into thinking about what would > > happen with PDPTRs and forgot to get back to normal MOV CR3. > > > > So yeah, the only way to correctly handle this would be to intercept CR3 loads. > > I'm guessing that would have a noticeable impact on guest performance. > > Ouch... yeah, allow_smaller_maxphyaddr already has bad performance, but > intercepting CR3 loads would be another kind of slow. Can we kill it? It's only half-baked as it is. Or are we committed to it now?