Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5205831pxb; Sun, 13 Feb 2022 11:39:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUN9Y77etP3ZxU16tHJo1IH9mG4wMkjkUr52lXyB8iGQkmqo9rfV1axs9vaMsTI2OtAaxz X-Received: by 2002:a17:906:518f:: with SMTP id y15mr8660230ejk.18.1644781179249; Sun, 13 Feb 2022 11:39:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644781179; cv=none; d=google.com; s=arc-20160816; b=sT5xWgawWTFywcj6OvNoxxbMFZ62KWf5kMzOLvqeejisfWnTMJcIwMoGTO5TsTqux3 fzlKynaaijGHWdo4BHixd0iOsrlJmlsl1fEGu4oeW5YJDZomto3MDsXBZ0dEhrnVmkzz IftdOPIqqBH5RjgwyuhKY7nDf6nBgTp+SMI+P6csrRnuH6zHz9dKXP+30L2klbzq6xCa /w4Bn/KIr891JvA84EsnH8wOrZDo6KWFb1Hw5dnqVPTlCYsWFtapGBMyhj9xxFi53ixd 4FXmKXYqFSEo7Eup0U5l82herd/DIc2oemi3TIeS6AE8VtzS1qnEL800fSbZGA0pY58Y aDTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:sender:dkim-signature; bh=3Nvd1S4LyyfGcKGyWJQAtm0zoyG/g+vMhgrQ69JVjA8=; b=a2GNNAYXfDw0y0XU08InaEhumHp4+OQe3lV25eMy/0fD4mTb6PPagtAdVZTow/Cqy9 FPbQI511lczotdNCHYCEQVXpvMbO4LxXUPDYKRTxHOPMk+9D06CCGAS6JJllecIFM7Sv unAvM8ssYdx2uFGTFzaWAfeZSRvEMeOn2n84dj7COi419jBeGN+ZYNlRpDnZ0hyIDel0 hdg786Nh5oWfgUpNguhjSf2g7fOR3gkQBYBqek3gSJc3SIWP3G4h4QXIGqSQH76UE05E ha5q9Zvcm1YA5LKxYGFwLeqs9wRg5obv8sRI8awGl6032wynWEILQBdOeHeD4KmslDfS 4e9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=njXXlzot; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id do16si8325867ejc.783.2022.02.13.11.39.09; Sun, 13 Feb 2022 11:39:39 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=njXXlzot; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350269AbiBKQGJ (ORCPT + 93 others); Fri, 11 Feb 2022 11:06:09 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350104AbiBKQGG (ORCPT ); Fri, 11 Feb 2022 11:06:06 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7831721F; Fri, 11 Feb 2022 08:06:04 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id da4so17164383edb.4; Fri, 11 Feb 2022 08:06:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=3Nvd1S4LyyfGcKGyWJQAtm0zoyG/g+vMhgrQ69JVjA8=; b=njXXlzotE3kdWn0eZuJWxBX9/ISQ28oiOEq8KWzpZXdAWMcrN6dktqQGGRmLFSYBEj 3pA7Ew0SZXLdlfAWmj1CFmEbTHMVrbFHD+OveX5v1sZphHey/j8ylt17+eXV6phfTT06 oNoGogx/rWmsNXhABo80DVMZxu909IC5kohBe/uhiqa+cbKEsc0s6LhL7mfqePwUSJSZ eHJBm/XPJ5DR+smLjh0G7b7dzJFAzBWxMwgzUPeIr9FgA9J8TQLoq0ThOaov6uDiKv8k zF4He85tn88tbGDjivGCG7f5Vq5Sb3K4DY2gy1fXToFdUUYVDH1sf8DEgvZk+9AiVbUD xlTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=3Nvd1S4LyyfGcKGyWJQAtm0zoyG/g+vMhgrQ69JVjA8=; b=b/M3DJeX93zxXuQdxVi2hmKQbz6vQXjaWyeEVegfIWADi9Oa+nKszhk0lbk5e15I6+ t8W6xJm+38FCzDwfpsabb4/MvHOiqIJLFhOtJ6F0m8bVG66tYI/Z2I1RH169jlVFL4eO cc64MpKEKcJX7nU7JLANsfyt4Xjph4oq0G3l9KZTH57OXUvc/Zd6ohG0hS84sfr0hC8s tZjfamw2yMhRG83IeDQi7wOVmAuN97qZa65NW6ht9ud37pICuqmfKidj8TPrrSpVke+v KaNk+2cjUiWLtyTzT4ccDmSM7tFw7DYCP3q+Gru8EFtirNXjA5k0aiMKP4gN4T8ZnE+f z/GA== X-Gm-Message-State: AOAM532/Nsum5HkEli6hgUgjQ8fvLMuAoUlu6mdihX+hFOYrZrv/Ins9 0CMRu0ql4bAtprzRBCXX2EU= X-Received: by 2002:a05:6402:1e8b:: with SMTP id f11mr2755602edf.322.1644595562909; Fri, 11 Feb 2022 08:06:02 -0800 (PST) Received: from ?IPV6:2001:b07:6468:f312:63a7:c72e:ea0e:6045? ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.googlemail.com with ESMTPSA id h16sm8097198ejj.56.2022.02.11.08.06.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Feb 2022 08:06:02 -0800 (PST) Sender: Paolo Bonzini Message-ID: <7ccb16e5-579e-b3d9-cedc-305152ef9b8f@redhat.com> Date: Fri, 11 Feb 2022 17:06:00 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [RFC PATCH 4/6] KVM: X86: Introduce role.level_promoted Content-Language: en-US To: Sean Christopherson , Lai Jiangshan Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Lai Jiangshan , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" References: <20211210092508.7185-1-jiangshanlai@gmail.com> <20211210092508.7185-5-jiangshanlai@gmail.com> From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 1/4/22 23:14, Sean Christopherson wrote: > Alternatively, should we mark passthrough shadow pages as direct=1? That would > naturally handle this code, and for things like reexecute_instruction()'s usage > of kvm_mmu_unprotect_page(), I don't think passthrough shadow pages should be > considered indirect, e.g. zapping them won't help and the shadow page can't become > unsync. So the main difference between direct and passthrough shadow pages is that passthrough pages can have indirect children. A direct page maps the page at sp->gfn, while a passthrough page maps the page _table_ at sp->gfn. Is this correct? If so, I think there is a difference between a passthrough page that maps a level-2 page from level-4, and a passthrough page that maps a level-3 page from level-4. This means that a single bit in the role is not enough. One way to handle this could be to have a single field "direct_levels" that subsumes both "direct" and "passthrough". direct && !passthrough would correspond to "direct_levels == level", while !direct && !passthrough would correspond to "direct_levels == 0". Paolo