Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1916795rwb; Fri, 5 Aug 2022 09:51:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR4x8KF6YclAuOE08hJ5+s/XHQCB74Dq9cI0BRtlfZLmPvK6G3ATyJPQcrgz8+rYAUd5uu6Y X-Received: by 2002:a63:1e10:0:b0:41a:ee1c:290a with SMTP id e16-20020a631e10000000b0041aee1c290amr6394426pge.196.1659718300721; Fri, 05 Aug 2022 09:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659718300; cv=none; d=google.com; s=arc-20160816; b=gqCKEvjplvmhUEQ19+z+ZWkrQey46dB1oeLMYDxX/dULzO/LZm+w72BrqJ78BKiPTL 3MTuBD6uvpLuB4n6cotlAGiVlXi6oAKtjge7YQvV0hVHbHhJkKSBTFeTVquiYfu82pub p25Lv5FeQp3Du0Z3enm6CBlSsB3zvB44zawDIZhkvvCTJPkvukOfyB+hwKoBsRLhqlJ3 zK3t/c7Y/N9ab7me6WHhuWIH++wlWjSXTRwacfJAaxe6Xh1i66LbHMI2G25XttYcG6Z4 4inf1fAAHleujdSMYXOoCk8yoiVgcAt+mUDlDnovx8E4mE6/qnDHkJq64+iZ68izbqeM uMNw== 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=v4S4GpdOqCe9ywueQ5iRWEaheO0mHSYsO11UhtnP4Kw=; b=lXORQMEHXfGTsyUrHySfQi46UflBv59Y/G/+QDWni8N9ezYzr6rHlzgg748XNNHLut Au9y6qH5nw2Odri6u4dwxdOeAt7v7pmCtiEgnfQ6Ac12IP4MDuS6PTMxI8qW1sDDqN8X H6896a3HDnAUp5MwgiMl9AOU2tsFu7ZmF7JJ8FVBFYBGJu79NHGgF+/V3urGvsDMV2ib 99kbRdAtwi9qnW/MTP1IuVv5dcuJaH30JkgP5PjNQot+sD8ld+kLTMWuXNFc+iV4ScK0 S14m6bF2RNdpF17qdmvA2tZyz+XUWb80OUiH/rEP90DJ/9fo4/4y2Vin8LEARvNmnjtz vvrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=eiMdbmKw; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u10-20020a63234a000000b0041bf692455csi3582988pgm.144.2022.08.05.09.51.25; Fri, 05 Aug 2022 09:51:40 -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=@google.com header.s=20210112 header.b=eiMdbmKw; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240663AbiHEQql (ORCPT + 99 others); Fri, 5 Aug 2022 12:46:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233121AbiHEQqh (ORCPT ); Fri, 5 Aug 2022 12:46:37 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F05F422B06 for ; Fri, 5 Aug 2022 09:46:34 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id m22so4163212lfl.9 for ; Fri, 05 Aug 2022 09:46:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=v4S4GpdOqCe9ywueQ5iRWEaheO0mHSYsO11UhtnP4Kw=; b=eiMdbmKw/RMPYU34GsfGF9tqVlLo0yhNy07CN3kvU9+gvJKdS6LGyZajM6t6MC++b+ EaarukS4tP9X663Y3KYt/fmJ3MIexUsBcUrsJmphJ89P10rYnNY/4IJa0yemwbNv+QyT 4aSNtPSvgbaUpfxRgBXeP/sCkwBFjTC3BW0oA2FrnPmcbDbShytiKU7e1tSFLK0lrP/F LOekxXj0Ew1YLwuoqh6PBtBwlPFqxtOSu9sG2R2GR3wizZvXcSMqZ2ynziODrpMiZBKJ xH9hnywLvKq5boHLg0HlblFIqSx72j4//oOEs4H9SCU/LjaxGg18LA00agBBPKsvkXeR VQHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=v4S4GpdOqCe9ywueQ5iRWEaheO0mHSYsO11UhtnP4Kw=; b=vXWzq/vZbi75b0tsYesU26YJHIuz0sMtLuxrUg9caiNxUysfI9SyFHxWjYIID5CWv4 oX0bgC+kDQPvo6swdldw0uYSRjTZyDQC0QWQkYCqo0yYJ+EFBfwIOrGdSI4F8uMXU8R3 qmpMf5mb7cpmUGzxY0+7l4Rq2wBFwLE/RjD04KB2RkwTewF3CABXTR4PpxFyiP0AcPXp oUuyW71L0sEWb5718Ikvcp46kyu7BbOKWzZ1FJspMOADPC72y0Tlss576jaR9zyRIywN X1aGF19wDi7wZsCEQPKXm7m6IH4+OIzeVhV4dr0yrO3Coyae93mWvweT219tSu5zdDFR Fdmg== X-Gm-Message-State: ACgBeo188HenYzpIab83PyR/aN2wSeMXCx8olzs7DDdsrqTF6RW1vgMZ 44Fh0ILXNSOIndjXnCoO73iY/yH8gZA7sAuT4XngYQ== X-Received: by 2002:a19:ab02:0:b0:48b:3f9:add1 with SMTP id u2-20020a19ab02000000b0048b03f9add1mr2724754lfe.329.1659717993081; Fri, 05 Aug 2022 09:46:33 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Matlack Date: Fri, 5 Aug 2022 09:46:06 -0700 Message-ID: Subject: Re: [RFC PATCH v6 037/104] KVM: x86/mmu: Allow non-zero value for non-present SPTE To: "Huang, Kai" Cc: "Yamahata, Isaku" , kvm list , LKML , Isaku Yamahata , Paolo Bonzini , "Aktas, Erdem" , "Christopherson,, Sean" , "Shahar, Sagi" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Thu, Aug 4, 2022 at 5:04 PM Huang, Kai wrote: > > > > In addition to the suggestions above, I'd suggest breaking this patch > > > up, since it is doing multiple things: > > > > > > 1. Patch initialize shadow page tables to EMPTY_SPTE (0) and > > > replace TDP MMU hard-coded 0 with EMPTY_SPTE. > > > 2. Patch to change FNAME(sync_page) to not assume EMPTY_SPTE is 0. > > > 3. Patch to set bit 63 in EMPTY_SPTE. > > > 4. Patch to set bit 63 in REMOVED_SPTE. > > I think 1/2 can be separate patches, but 3/4 should be done together. > > Patch 3 alone is broken as when TDP MMU zaps SPTE and replaces it with REMOVED_SPTE, it loses bit 63. This is not what we want. We always want bit 63 set if it is supposed to be set to a non-present SPTE. How is patch 3 alone be broken? The TDX support that depends on bit 63 does not exist at this point in the series, i.e. setting bit 63 is entirely optional and only done in preparation for future patches. > > But I also don't see splitting to 3 patches is absolutely worth to do as doing above in one patch is also fine to me. Splitting patches up into logically independent changes makes it a lot easier to review, and therefore reduces the chances of bugs. Smaller changes also makes it easier for patches to get through the review process, because reviewers can sign-off on specific patches with Reviewed-by tags while discussion continues on patches that still need more work. If the patches are too large, it makes it more difficult to collect Reviewed-by tags because the entire patch has to be correct. Case in point, the above patch description has 9 paragraphs because the patch is doing so many different things. It's difficult to keep track of all of the different changes this patch aims to accomplish when reviewing the code.