Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1954606rwb; Fri, 5 Aug 2022 10:28:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Bc8Kv5X+DnNCdE9UAHzVlPOwhzxcq44Zqx6uR3rpY2ZfIZ46rVhGr5+4rSUypikiTjQ/W X-Received: by 2002:a17:902:ec8e:b0:16d:d156:2bf1 with SMTP id x14-20020a170902ec8e00b0016dd1562bf1mr7452473plg.17.1659720483363; Fri, 05 Aug 2022 10:28:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659720483; cv=none; d=google.com; s=arc-20160816; b=f2B0TC5S5YFHUhVxr6E1ssEWjFPHwzjWRzqavk8IvXoik1q8GHwfGTGNz3q+CABmAL 3Y7lQkNgA7sYQn2KafUvJu06CXlxJ5SaRDaccGgm+NlwjFns6l+qlokbJB2MhlknK4Wu kEV8N/tYvmJ3rU9RRQc6MvuwqP5j5QsAEN661DTxYah+x0O1jLGQjES04MpmCKoyGESE dWuVfn59KCMRhB1QybGupgc+aTdMoU0arUKkJQHrQeHcfB7RFOWWKx50nakz3ISwF0MF C3cXMa6fwqXhVcnsf1+1iuzNdpnDd+AYnpgNvrpJF5ti+DrXSFNRidT9uNM8HP9HZ/YN wOVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ayC5Aj5ZEIbBe3heCJHiAuulFotI2NDsTl7tbcxRnjg=; b=NlB7wP0F1FtFlYwdm8mELgLJdGOsalOMWtNsnmnH04ALyTOH5LlzMNVuoJQw0d88ND /jPhc37dmNKOBaktBf1xVvqx1/ieJXOTK/VNGdlrKqDgkvQdVP8udOGCoV5N/9hQDOHF pKkcthQQ7TJ9uzX0iQzazVeqO+va3Zhl+R0FpiLOskE7vjZXciAMp4GOKvt8ZiZ9CB6+ jR7xE2uDfHd31vnuQDuTjWMpmq9sUpXPXhGYGru8q2CfN1EEMFxrkhKw0Sbm1wVacKI0 3Ek94rCvMIJlmnZSJhKgRcA4nuVXIJT/HQj2lwmjaSvqCTsRDvCpw7Qki3nDwno68Oix EY9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="AXUFX/HY"; 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 l12-20020a65448c000000b00412a34ca92esi3298050pgq.153.2022.08.05.10.27.47; Fri, 05 Aug 2022 10:28:03 -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="AXUFX/HY"; 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 S240958AbiHEROi (ORCPT + 99 others); Fri, 5 Aug 2022 13:14:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235425AbiHEROg (ORCPT ); Fri, 5 Aug 2022 13:14:36 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3614193ED for ; Fri, 5 Aug 2022 10:14:35 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id l64so3232275pge.0 for ; Fri, 05 Aug 2022 10:14:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=ayC5Aj5ZEIbBe3heCJHiAuulFotI2NDsTl7tbcxRnjg=; b=AXUFX/HYWc/q9iPMEulV5W5UM3XASF/4uUQg5+JdN8ThT9AhCCNoaudUqCyXnM7NrQ O9kKMAYxssIfMZtqwXcQVBDFZ7phGoGIbTEu+HLQMAVmHtAm9q9dPvBb18H11vo+3Vzs ZCl3rYKfLfEaWfceuYiKRPOXiPqjUUfwSy2T87st4tnVrWThL/egDGC2F2jlfe9G3GP0 jTeFJ0rzfyCyC4iLiGQHj9VXwyMZrgas4DXZlAmq1LzFgN3UoB/gHoLZ4KCrV+P+4nKz iHXm4R1nUUciQs3PXif2YVCjHEwvHAOu5yfSGVhrLaXLGd8bgv+d+1YeYJDFKMj/q/OS sLdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=ayC5Aj5ZEIbBe3heCJHiAuulFotI2NDsTl7tbcxRnjg=; b=VWEK0cBuaRxUeW4+G2p4z4ihir3u4/a0zxYA9fh39Uc071qksBLtd9IDUbYxle/Yw4 HwtQGbILb4C+ObOkP5wVSWaVItXp+axer7W8+pyZc1S9yHvqZ/5DQADEfZrnJ0H+4vF6 aGnyL/JQlF29b/1aA7DSHb7CVthOgOOnTyiYKz1+m7irI2D09e9d3OmRBaC0qLKl+hd+ GNfX04s9iUTqDl2bgASKRymNPGdhqVxMQAN43YY5Qd9IQ+3F60spL3cfzmIYF7WLoLf0 HueI2LkUm3NHCrEqPJcbniQBaPw/JWW9V92dF/R2/g8Z2qriTcG2N8aeofOIm34dPczK Saiw== X-Gm-Message-State: ACgBeo2lAvZE+U4IXSrFaoKGnsriyT4fuc+wllSBzcjmbK/DWTqEoTv2 2HzMfXMipHp16Z5piQc67ZBpfA== X-Received: by 2002:a05:6a00:892:b0:52b:c986:c781 with SMTP id q18-20020a056a00089200b0052bc986c781mr7916668pfj.64.1659719675216; Fri, 05 Aug 2022 10:14:35 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id h14-20020a17090a130e00b001f22647cb56sm5812707pja.27.2022.08.05.10.14.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 10:14:34 -0700 (PDT) Date: Fri, 5 Aug 2022 17:14:30 +0000 From: Sean Christopherson To: David Matlack Cc: "Huang, Kai" , "Yamahata, Isaku" , kvm list , LKML , Isaku Yamahata , Paolo Bonzini , "Aktas, Erdem" , "Shahar, Sagi" Subject: Re: [RFC PATCH v6 037/104] KVM: x86/mmu: Allow non-zero value for non-present SPTE Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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,FSL_HELO_FAKE,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 Fri, Aug 05, 2022, David Matlack wrote: > 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. Hmm, I agree with Kai on this specific point. Will it cause functional problems? No. Is KVM technically broken? IMO, yes, because the intent of the code is to ensure bit 63 is set for all SPTEs that are not-present (and not misconfigured) in hardware. I 100% agree on patches doing too much, but in this particular case it's easy to capture the above semantics in a shortlog: KVM: x86/mmu: Set bit 63 (EPT's SUPPRESS_VE) in all not-present SPTEs