Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1117694ioo; Fri, 27 May 2022 01:42:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXM1nBwQQrbQwS+5Y4RIwE6NJKuzKqILRnU3QlIV70EVaxLjAYhatZAvRLgVAcyKYiSUVe X-Received: by 2002:a17:907:2cc3:b0:6f8:5a21:4d62 with SMTP id hg3-20020a1709072cc300b006f85a214d62mr1845340ejc.256.1653640959871; Fri, 27 May 2022 01:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653640959; cv=none; d=google.com; s=arc-20160816; b=pumZCLk0RR0iUNiY8GJDa3WPkyXj5c6S9DbH1yQK+kiYP83rvGiTUCFXxJPdZzLu6P SJVXj/BCT47G4enbvC175ePzaZ+cI5I6hzb5HOR3hPbuFJRc+gCbFkl6H6HoY1dKVbDi ej33eYyWl/pur82kd9vsY7bCpUfWK1+sYOZiuqGINVV+aw1Udp9ppW83R+p6YKwC7aQi wLNhjG4OajHjMG6k4154BJVdQDgHovcQ2NQ6DN7Mm8sVctarGW0Su1BSjdknQkB56mr/ U/2Ei4D1C+Tbik2yVCfc3Ftk/bE4EIgMKxML00GC+TUbWc7O6Vt1In9sf9AibOHGDZex y6TQ== 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=kxgT774Qxw4EYAS+7FY5ihsIiTdaohje5ogQP3Nlw3Y=; b=bbWugaGl+W9iB8ekBN/JgCtg6xv/7P1H8Kl37+9PwIE6VcwcsUwL14/bJSCjtsq992 YU0/gUu1BBbCgZX40p83+0F4XKWOtHPUrG6oNtlJ+KMUt21v4mz5kGGByPjafoW0+aS8 HmOjMSgcsKJRVTUwAnsxA68G8vb/7FY+qw2jsq3jYtJUjMHzc19z1lSrjq1t5EvCfNYg gmyYtehzEMhGn/wS1gw+KpTwhbL9littcaA/M6QvDfMpHhi9odkfVbwKJS5+5WZQUB8y 9BSF2G5waHHFjaX4baXwbhkHRabs7eP+hYPdEHjtHJxH+1m0ie4Rpa7KJVOcubrjGW3O sPyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IFoKDCnH; 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 x19-20020a05640226d300b0042bb1eac23fsi4251523edd.463.2022.05.27.01.42.13; Fri, 27 May 2022 01:42:39 -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=IFoKDCnH; 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 S1346843AbiEZJMl (ORCPT + 99 others); Thu, 26 May 2022 05:12:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240989AbiEZJMi (ORCPT ); Thu, 26 May 2022 05:12:38 -0400 Received: from mail-yw1-x112c.google.com (mail-yw1-x112c.google.com [IPv6:2607:f8b0:4864:20::112c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91D9B6BFE7; Thu, 26 May 2022 02:12:35 -0700 (PDT) Received: by mail-yw1-x112c.google.com with SMTP id 00721157ae682-2ff7b90e635so8846647b3.5; Thu, 26 May 2022 02:12:35 -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=kxgT774Qxw4EYAS+7FY5ihsIiTdaohje5ogQP3Nlw3Y=; b=IFoKDCnHMITS1rmf6GIDh0SET6EK6ERswWD44RknloIwWbnABxHBvG0ltlA/h/F20d F1egXvDuPV3Rc+fQpE3hMRr8Lt1goyKzW/+xf77bFqmNQE7KOYDL4i1sbVZUV9d1iV5E pCHEcVwRve02gBXrom4fW+zdOsWGJBZCiXyjjWixdHaGy4mLzn/vygrI/Y3Kzem/H7+C pdwVCpbk2tewPP/dLwZM7CRWAoVm2aLbj9cuX0RG4CtZekIwJY9MiQMJGAZvoqzyZLJ1 m0etk1RqQSPdlDZBTzJcwfFdCLfZlDkELIzYCUxbl+NqxTUClYqNnpkiGJTTnqoZPM+f lvHA== 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=kxgT774Qxw4EYAS+7FY5ihsIiTdaohje5ogQP3Nlw3Y=; b=r0Qdv3ZcLKrhzscEI5+hIeU+gViQmHLlYsif9tu/j8wxXuUTP0hMfkZSjN7g5Rm0ta YJq2DF7U+R0VOCzVPy7fn24mj6EbzPgGZpJNiF7Cwy2booEsKtCRtMH0Dqzh9n1Ccyzn L1HSVGgjSUcCDsHB/H9dOn1/hVM1Zt9v9Q0WmgAQ6DeVVu/GxkUOZal/co4Kk4BbkSq7 MZAW56fYBM7W5wROcLHDC79PkM0Yt0VDzg+vF42NIH9k8tz2EQYK0CPYVN5coskhSf87 GNHXd6HYS2/vHs7RdWtltaHr2wBOy3uvsPcj0f+rKXtnA3vlt1sWqASV84ZqCsO2Hdbn Vn3A== X-Gm-Message-State: AOAM532Ml282B7pwhGEgsq9QRa4VwAmMPch0IPiR3WI4wzaddIZWKahN WezH8VMDUqBIGf6VPhkfF9JeIoXdkYkmqZb5t00= X-Received: by 2002:a81:b80d:0:b0:2ff:db8b:333a with SMTP id v13-20020a81b80d000000b002ffdb8b333amr20453256ywe.17.1653556354906; Thu, 26 May 2022 02:12:34 -0700 (PDT) MIME-Version: 1.0 References: <20220503150735.32723-1-jiangshanlai@gmail.com> <20220503150735.32723-4-jiangshanlai@gmail.com> In-Reply-To: From: Lai Jiangshan Date: Thu, 26 May 2022 17:12:23 +0800 Message-ID: Subject: Re: [PATCH V2 3/7] KVM: X86/MMU: Link PAE root pagetable with its children 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 Wed, May 18, 2022 at 12:42 AM David Matlack wrote: > > Ah of course. e.g. FNAME(fetch) will call is_shadow_present_pte() on PAE > PDPTEs. > > Could you also update the comment above SPTE_MMU_PRESENT_MASK? Right now it > says: "Use bit 11, as it is ignored by all flavors of SPTEs and checking a low > bit often generates better code than for a high bit, e.g. 56+." I think it > would be helpful to also meniton that SPTE_MMU_PRESENT_MASK is also used in > PDPTEs which only ignore bits 11:9. > Hello Thank you for the review. I think using BUILD_BUG_ON() in the place that requires the constraint can avoid exploding comments in the definition since it is a build time check and there are not too many constraints. So I didn't change it in V3. Or better (still using build-time check rather than comments): #define PT_PTE_IGNORE_BITS xxxx #define PAE_PTE_IGNORE_BITS xxxx #define EPT_PTE_IGNORE_BITS xxxx static_assert(PT_PTE_IGNORE_BITS & PAE_PTE_IGNORE_BITS & EPT_PTE_IGNORE_BITS & SPTE_MMU_PRESENT_MASK); Thanks Lai