Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp815824ioo; Thu, 26 May 2022 15:54:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwimpju8DefJsxPfp6T2xrx5Xeg5WH0GM5niAz4ht1usHw/jiN4t4XWnfi8l/CPzI37ds5W X-Received: by 2002:a17:902:c950:b0:161:84b3:2d4f with SMTP id i16-20020a170902c95000b0016184b32d4fmr39940281pla.55.1653605692039; Thu, 26 May 2022 15:54:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653605692; cv=none; d=google.com; s=arc-20160816; b=BBcIab+iYUrW9iTvXr7RtdxaGFkKzRDqcQrPhZizTl0754eL4a68hGXRsmqo0mAQqh YjWBCGlO5sef6IjOrnvCLsVfdJ76Djz1qYXHGP5HxTASwXef1vkP/wpiHHZwKKMAibyF S0baPySJFcNRcprjZqImBFRA2X4hvJKUjF5dH1nMqYjEoljrc4lOC/uFzqFRZsSlKOhr EsOkx5J5qB2UW2t607x8lOMiqZv80NOO6hFuDI/n5vtOJ3qr4CfUR/gyxIuilYkrmHTg 95It3dwiw7ZIptudYp3khEpm4Jya9ES/LeGvAxGqZwEyBkXFRHkg5/50RrbSKPqOh24X 9tWg== 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=nuQuuCBVbrPqmTSYx6tUR7yIqqFNAWXTE4+uB81J2UE=; b=VIyE9bvi9Cto2zJtz/pHAtAOOxdbT4ZoWXDJ5AO6Qm/dAwZ9/kua9RQD+GM22Q89az 1A+r7qYM6AmqnZVDFvbz17oHnkUNYkj/9/xKQWV3PFZ22e3vKth2G0ofQ+GdTG5BgRi7 SonA0T8O1P+SqbS6/VjOzHKNUzB/PYbCPIg9+PSqVRpLDDCjZVl6Yw2dyqmSKKUmeuAy g5GSTrHsnCfCBipf/akZYr22vC55WEVEO0QbiDQlWC/Occvvme9vcwIdAjLAFY6TgBkO DfwYDV4kvrKSKs18KbYmY2M+qlXyFzb3i7rR1V33clHAd2qDGfkU0y770CpWZhyR4p7t 6vcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="fq/Q21s/"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r6-20020a1709028bc600b001638abc149fsi681444plo.457.2022.05.26.15.54.40; Thu, 26 May 2022 15:54:52 -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=@gmail.com header.s=20210112 header.b="fq/Q21s/"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346451AbiEZJP2 (ORCPT + 99 others); Thu, 26 May 2022 05:15:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235707AbiEZJPZ (ORCPT ); Thu, 26 May 2022 05:15:25 -0400 Received: from mail-yw1-x112f.google.com (mail-yw1-x112f.google.com [IPv6:2607:f8b0:4864:20::112f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63785C6E4F; Thu, 26 May 2022 02:15:24 -0700 (PDT) Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-2ff90e0937aso8950437b3.4; Thu, 26 May 2022 02:15:24 -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=nuQuuCBVbrPqmTSYx6tUR7yIqqFNAWXTE4+uB81J2UE=; b=fq/Q21s/iUO8ofTLAKo+TyWwAM0uPaQWr2DmHRxlMTOo6FtN9wf+Rgww1VeueHQhMp 5vfaZJlEkoEvcjBxpyR+U5SljFerjhyPOi3RIOuOjHsP5M7Im5QP+UMEkjzrzRD5eC3k xiNYXeTXoJj8dm0AK1rW4jyOTBINck/t08WOeDuOI6g16GuVMZM3YWMNb+C2IbyiXDtF RYb8LSgkpVczXfQ1KJRGRAJDo2Q/CGgqBVVhxShFzChmEycFNeYfWmsq1lOIhRTsxmUy F5EMwGnP67ppXHDB+tt2lGAHI26HuKQQ3NHCMSyRNsC+QKrawpLc+nN8OF0FC5i+fY12 pNVA== 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=nuQuuCBVbrPqmTSYx6tUR7yIqqFNAWXTE4+uB81J2UE=; b=q5M3FQd/DyOpremlwlsZcrmxSf+qAKhiD78b9tvtmfLgYnqogQE25Qcf538BhRx8gn qScR8d6J8TRC2GmCZk1YXM5GPns+OmvaHq+2XWgqHT2Oc7k9nBfXvkhib2C5F/aNUVSL wvf2gmGjWYWzVF/6Ab2D2eIHVdqW7viUpDlAzA7omemPusT02TDSezEkV4IGEYJq70k0 yVmycuLNH3TVdJ8m1E7WSKr6HFI6VUZDCh3OhN820NmAB/Tx49BX3F79RGCHC5m3oMO0 Pk5iVC//0gKPa2V7WktWop/XEk5ttjK6iFh73rbrReqLE+4s8kZ3Kuz90+wpjNpxzNcJ rc9g== X-Gm-Message-State: AOAM533+OlskOYISSN0fDvmtY27zYgUqZaKjGBdFGC2Ik4dx/i8R/B0C JqClINqmlkUyFMfh5oz/aWt0zyeB0k9FK4106rw= X-Received: by 2002:a0d:f743:0:b0:2fe:e466:a482 with SMTP id h64-20020a0df743000000b002fee466a482mr38540814ywf.151.1653556523683; Thu, 26 May 2022 02:15:23 -0700 (PDT) MIME-Version: 1.0 References: <20220503150735.32723-1-jiangshanlai@gmail.com> <20220503150735.32723-5-jiangshanlai@gmail.com> In-Reply-To: From: Lai Jiangshan Date: Thu, 26 May 2022 17:15:12 +0800 Message-ID: Subject: Re: [PATCH V2 4/7] KVM: X86/MMU: Activate special shadow pages and remove old logic To: David Matlack Cc: LKML , "open list:KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)" , Paolo Bonzini , Sean Christopherson , Lai Jiangshan , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , X86 ML , "H. Peter Anvin" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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, May 17, 2022 at 8:16 AM David Matlack wrote: > > This comment does not explain why FNAME(fetch) might pass these values > to allocate special shadow pages. How about adjust it to something like > this: > > /* > * Initialize the guest walker with default values. These values will > * be used in cases where KVM shadows a guest page table structure > * with more levels than what the guest. For example, KVM shadows > * 2-level non-PAE guests with 3-level PAE paging. > * > * Note, the gfn is technically ignored for these special shadow > * pages, but it's more consistent to always pass 0 to > * kvm_mmu_get_page(). > */ The comment is copied into V3 with slightly changed. > > > + for (i = 2; i < PT_MAX_FULL_LEVELS; i++) { > > s/2/PT32_ROOT_LEVEL/ > Did in v3 Thanks Lai