Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp502793ioo; Thu, 26 May 2022 08:14:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxglZNMQD0u+9EYQoDx57OCEchlgv0UEXYO5N4mrdyeoMNNBfSe2ONeGGxvtNZIc/7g22fu X-Received: by 2002:a17:907:3e9d:b0:6fe:e980:d3de with SMTP id hs29-20020a1709073e9d00b006fee980d3demr18721285ejc.586.1653578060606; Thu, 26 May 2022 08:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653578060; cv=none; d=google.com; s=arc-20160816; b=fiEp9qNmq2XQnky2flApEuCFE+/e/HtSMxyrF95oL83cRd5kKqsHG+fa6nmEGmFXR6 GHPP5R9j3GDfQolWsBtObwLyeYn0QO13p9z1j95GRXL94aQlYxauAs2ioIvl0HWm0vLG XjMuPTVj2O48kaaOegV3RG/h2Ep9OeIjS+FW+UUvb2VnOPiVVuD6j0VL+C8375ryacmE JCJ33ohiuv/j6+Ca764OocuoZ2ycPzq90Je6VCC/9HfTPfGEV/GnotBMbnat3aOKd/xu BMVA7aofkh5f0WbracWXBxlW6JbW56vbyibBimkeYoRaER+K+QbDWIluBED8jKr5E8m7 xzfw== 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:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=442/sEhT/KjozGhioXB11LvxDiU/RtvP7q/byJd9TZ0=; b=oMzjgKjAH/wT/Nm8/wazzP3aO37B2uNtP2lfRX92IpYNmxmnG/PIIsDWzo5wJyWVaf yzKN8Ttur5nxKQhrtPHjxKfLDrS0q2WVPfGJssCSSXUOGqkQqkPBXXc6oMNOCKAuHiNV V9qNNS3cwWMTIucfHvQdl3OKcWTfsF1gStZxkFWhuCEUB3TwFlq/bgjgnB7N5agYUT+/ jZmFNGO/bGs5QzliIE/B+cNaPmq3sC93SuPFye1mo//sqTk/JczZRBfQ8RqX21qNxsqo +aSGP9QIuniE0d6l8+5U0W+hgF9KxHIdlfk+yXO5xk2xH+NOxN5UcpM5IDg1WsXot/Jo 6ZfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=h6jpBhuH; 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=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 dn24-20020a05640222f800b0042ac6410cb1si37838edb.110.2022.05.26.08.13.53; Thu, 26 May 2022 08:14:20 -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=@redhat.com header.s=mimecast20190719 header.b=h6jpBhuH; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344817AbiEZJdc (ORCPT + 99 others); Thu, 26 May 2022 05:33:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235166AbiEZJd3 (ORCPT ); Thu, 26 May 2022 05:33:29 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C0417C8BDD for ; Thu, 26 May 2022 02:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653557607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=442/sEhT/KjozGhioXB11LvxDiU/RtvP7q/byJd9TZ0=; b=h6jpBhuHdWPXM7l53ZtMAUqU2dYuGiXQ0ZN6crlshzRNpTD5BiF3LUrQF6VGK3t0R0kPAM I+E+8PFGrpNsfLmhYoZEAutiLt8dVH1PXzVYeStGd8I0PRjDoVjB5VZpThLu24zBOBze9C 2Kydda/qBh8K4qW2N8ooBvcIu30OIdE= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-551-s4KE7ksuNOyzkWwSx5kOpg-1; Thu, 26 May 2022 05:33:26 -0400 X-MC-Unique: s4KE7ksuNOyzkWwSx5kOpg-1 Received: by mail-ed1-f70.google.com with SMTP id bm4-20020a0564020b0400b0042be0b4ba34so196990edb.20 for ; Thu, 26 May 2022 02:33:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:subject:in-reply-to :content-transfer-encoding; bh=442/sEhT/KjozGhioXB11LvxDiU/RtvP7q/byJd9TZ0=; b=uOv0LQhEK6A2ftIjS90Ppb7GQcc+lFvaq0G5Gv6y9IHZYenS2D7HJ02kmBj45g4DhP RXZFR+NqTZkaZRq/Ri9JFsZ1sI60IGGltaf4PsZTo8HLYvIEI1IduyqAefRDe9lrHYXZ 65Ysw5McZ7+uDL5aqsT0oZjQujVKNdUTFupZS0V5oxTtXYoag/af+NK7c6zLGneKWrfQ U15BoZZGG5hiM1eXau01GLUpHGPY6YZsmOjjUAL8gUTdGhYF3tv4gmDbAvMXu4NnE4td LOrAn7sjMPsdilyBBFIvx+ArF/ujWl0KD2UlWYlZwmMg3XLZZuKPGifivauz2cxbpaWH B5Bw== X-Gm-Message-State: AOAM533//fGbQfq7E/x94sqaa0RMWXvmgFUgWjHPgF4Fpn7FYHQmoRzf soCJnT5KBcD1Uj3ejelq1MwblFsR8rj9gkRXwv8hwVo6G4P+Dg9TfXcsDyZPQaP6fIxcKCZ7/WA 0rQKY02Np9PIKqz0NPp9MQxTS X-Received: by 2002:a05:6402:d0e:b0:413:3d99:f2d6 with SMTP id eb14-20020a0564020d0e00b004133d99f2d6mr38958423edb.189.1653557604946; Thu, 26 May 2022 02:33:24 -0700 (PDT) X-Received: by 2002:a05:6402:d0e:b0:413:3d99:f2d6 with SMTP id eb14-20020a0564020d0e00b004133d99f2d6mr38958392edb.189.1653557604732; Thu, 26 May 2022 02:33:24 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e? ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.googlemail.com with ESMTPSA id eb21-20020a170907281500b006fecf23fecdsm346256ejc.127.2022.05.26.02.33.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 May 2022 02:33:23 -0700 (PDT) Message-ID: <70cec00b-428f-9310-96b6-c6257fe36dec@redhat.com> Date: Thu, 26 May 2022 11:33:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Content-Language: en-US To: Lai Jiangshan , David Matlack Cc: Sean Christopherson , LKML , Lai Jiangshan , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , X86 ML , "H. Peter Anvin" , Marcelo Tosatti , Avi Kivity , kvm list References: <20220415103414.86555-1-jiangshanlai@gmail.com> From: Paolo Bonzini Subject: Re: [PATCH] kvm: x86/svm/nested: Cache PDPTEs for nested NPT in PAE paging mode In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,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 5/26/22 10:38, Lai Jiangshan wrote: >> (Although the APM does say that "modern processors" do not pre-load >> PDPTEs.) This changed between the Oct 2020 and Nov 2021, so I suppose the change was done in Zen 3. > Oh, I also missed the fact that L1 is the host when emulating it. > > The code is for host-mode (L1)'s nested_cr3 which is using the > traditional PAE PDPTEs loading and checking. > > So using caches is the only correct way, right? The caching behavior for NPT PDPTEs does not matter too much. What matters is that a PDPTE with reserved bits should cause a #NPF at usage time rather than a VMentry failure or a #NPF immediately after VMentry. Paolo