Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1676537rwl; Thu, 5 Jan 2023 17:59:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXtMmR9txUnpPMq3mohr68VWue26VZBj05sptYaIzP4GqP23xNC45aGUAHy6qyAOt6Kp63h6 X-Received: by 2002:aa7:db91:0:b0:484:9e05:b356 with SMTP id u17-20020aa7db91000000b004849e05b356mr42526160edt.27.1672970364015; Thu, 05 Jan 2023 17:59:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672970363; cv=none; d=google.com; s=arc-20160816; b=QXDgar+CrLGGgUvvYTaMHH3FYhiQaDabby87w6VmMdftDNIraE4l3ntB91fme7fkTG tVSj7r50eYrGDGo1NrHllVXqAK9HeMJ/8LxqJrHvC7VM9i25eR4t/WM+LBWFuFYMRo4Y ItNEIRDfLSE6Ij13D4eJkt+XTrYnT+g/O1FjFpr+n5V3wwKJ1cpNPwcD/9ULbeD8BZVB bzxbVp7iuVepmGP/HzSwx9IGxEmPuGmFmpvBWQNwveJ2p6EG3Nh82zX1bvzMIn7cYR9w pZgeAh0s4SOmC+lECNyJJo93FfZCls5lQ6upfkEpFl1/jZeA3fJA7EiKP7eLd0wcsYNd Ve7A== 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=UpVMk2Dd9I4vOTdEu8HrQBo7c2QIPMfLOnbWvVFoEe8=; b=tsgc4SiWtYJ+FT1/pbSflbI6RkctTte+iamBXNL0HCEhczsz1/dZqMOITEdvF09OyP +pUWdsWQiOny5zO0432ALfH/5lJsXdXa2z6jz0voR6aoQ60FzhJCd+T9D8/t4XWYecbu kFa7oEclvYYkjhslH0DxFw72HwyTc16BWiso2YW8cOnFhi5m1QMpc+PBUpbVfHZdlQvT bGuJEms1605O86Wn+k0zwZ2VQpqvCfLNBl4lzk9BLCd1BCITGz6gVSMy3iklboDgh3VD IWwIDVmJ9bPkaob548tkhqPll7c2B+13NcbgBFasqhRMIhxsjEv2n7qXKkC8HyAqAWls P9+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VVRMf023; 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 i27-20020a50871b000000b0046b2327bf88si39732edb.76.2023.01.05.17.59.11; Thu, 05 Jan 2023 17:59:23 -0800 (PST) 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=VVRMf023; 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 S230319AbjAFBpw (ORCPT + 55 others); Thu, 5 Jan 2023 20:45:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbjAFBpu (ORCPT ); Thu, 5 Jan 2023 20:45:50 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC9663C0EB; Thu, 5 Jan 2023 17:45:49 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id p24so196895plw.11; Thu, 05 Jan 2023 17:45:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=UpVMk2Dd9I4vOTdEu8HrQBo7c2QIPMfLOnbWvVFoEe8=; b=VVRMf023mEb+lXLvmYBe0prP7T1MkHBxI0ieybJRA3FV6TxfdPFe91YGH5vWJdmhAO PwilYacb9BwcGW3yWNCR/Rv91+44hniVBZoKUBnEssAP3z26dbfYc6FZ9/l3X+jJe8Ig +nArDYp50AU0+z6YD0QAh6iQ7Tl9ly+P2Uke/fE8z4Y1aKZYZmkY/dS3UQrO+YfADUFo vfl0w6mUqa2TnOeowLSirwXxVzSANaC+ErGzIjFudAI/C19xBamJg55YhpQr1sJV4aJt hWt1FtmYmcOC/F38j4YXcYwi8wEvpC/kBNxtqtRB+cLftgtVLHj73twgONj0CCjVx3CQ jJ2w== 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:subject:date:message-id :reply-to; bh=UpVMk2Dd9I4vOTdEu8HrQBo7c2QIPMfLOnbWvVFoEe8=; b=0+iLsU4SjW5RXLLZSkpOvkKGXA+J2CCvIx7kqA/Q+5G0kjBTVcN0H/Ljt20SSfzwqR CWPxjR0WjQmzwLcgkIyJVZbcWvyU03qiwbECXI+K7KmJ8FQOxkuBGcgll0i1nF6DpQJd 23Db9kIZKAoH+j08zQ0mKrIavJKoZ90/ezQG42hdcDizPnNi+veZupzAmlu0vm9Jevg3 iSgJ1g4sflJ8ztu9Z8/R7a/0wWIwccujseZU7OfVNXxu8cKueEvQYmoa8Tqe4lBeUOEX PAACyEfTEQIpwPYvISkB2d9Lh/A2RPuTS80x5bmz48NqSAYJiyoAMWKTPrk5r6t4XiYd MmVA== X-Gm-Message-State: AFqh2kqkvHGyhYXauga4OwHJ/XkVN7XsbDPRf1YYJQlat0wCYUQNXGJN ckMNTBbjbsmmBtt8z6ANB9t3YfQrCqJGZPjQELbZJQbX X-Received: by 2002:a17:902:cecb:b0:190:f88e:255 with SMTP id d11-20020a170902cecb00b00190f88e0255mr4090961plg.114.1672969548950; Thu, 05 Jan 2023 17:45:48 -0800 (PST) MIME-Version: 1.0 References: <20221213125538.81209-1-jiangshanlai@gmail.com> In-Reply-To: <20221213125538.81209-1-jiangshanlai@gmail.com> From: Lai Jiangshan Date: Fri, 6 Jan 2023 09:45:37 +0800 Message-ID: Subject: Re: [PATCH] kvm: x86/mmu: Remove FNAME(is_self_change_mapping) To: linux-kernel@vger.kernel.org Cc: Paolo Bonzini , Sean Christopherson , Lai Jiangshan , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , kvm@vger.kernel.org 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 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, Dec 13, 2022 at 8:54 PM Lai Jiangshan wrote: > > From: Lai Jiangshan > > FNAME(is_self_change_mapping) has two functionalities. > > If the fault is on a huge page but at least one of the pagetable on > the walk is also on the terminal huge page, disable the huge page > mapping for the fault. > > If the fault is modifying at least one of the pagetable on the walk, > set something to tell the emulator. > > The first functionality is much better handled by kvm_mmu_hugepage_adjust() > now, and it has a defect that it blindly disables the huge page mapping > rather than trying to reduce the size of the huge page first. > > Huang Hang reported that when a guest is writing to a 1G page, but > only a 4K page is mapped because of the first functionality in a case > in which we think a 2M page should be mapped. The 1G page includes > a pagetable on the pagetable-walk, but the narrowed 2M page doesn't. > > To fix the problem, remove FNAME(is_self_change_mapping) for its first > functionality is already and better handled by kvm_mmu_hugepage_adjust(), > and re-implement the second functionality in FNAME(fetch). > > Reported-by: Huang Hang > Signed-off-by: Lai Jiangshan > --- Hello, Ping. Thanks Lai