Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp35939imi; Wed, 20 Jul 2022 16:28:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1szv1+XHNxxQI7ixLAqejhlkcefcpdAXm+Skinoi+khLvIFTG5AwurP2gF11LenZM+plAOc X-Received: by 2002:a17:906:730b:b0:72b:2f3d:299a with SMTP id di11-20020a170906730b00b0072b2f3d299amr37242614ejc.583.1658359712122; Wed, 20 Jul 2022 16:28:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658359712; cv=none; d=google.com; s=arc-20160816; b=qrazBi9IfajcciBQ/AKliw9wJsHrsHnd1SsGSU3CPW8ia4r2JMILqbLlr6C6Mmzh07 r31+NRrLCG8uQOOfr42S8Nfyt2KlXujlirKoPLSZzB0SGKmsyOnanqAIS5ROefs1BklC F07VzNukFf+3pbFGF5/b/V898ltmYtkrLybtwRzRz8kKdb2NEDxFKdBT/yr5OVXhVmVS gJj8eTTAhJB54rh7GBHNN9TFkZiyLPkInXUenaRdRzPh+P2rMdde03+4WbXmzrO04m7z JZZfWcLTDnmxMkCWKTEqde26vYtIoMkOoN23CWbl1mMmdm8ECuyGRBNdT9lVImz+wM65 SD4A== 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=Nszl3bsf2mnME2IbrRKNWdpEyNRDpL7edLFc4oh5rQk=; b=RQbHzXeGJuxTAuDf/TFqNiu9XDKyj9j2jySlwbjY0j+ThfwMNgb8Z6OFMhm3AFK6S+ NhRbIQDruRaTx91W4U6TErwdDMCY01JBfeYKdhIk+G6sekTGXYdF6xraOD0NjjmrCLsG Yk04vVlC2JsX2Uk5X+BKSV7n+DXYeB3y8iH1NhwsOqz10VSq6mcCeMF43QQLp/7sJQd8 CHb8KKBwvfSd4ycvhWgu32jS61XgrfqkU9GqOikhCN3wmTjKKW7pPjvIP9+HJ5+y2q3h m/h1yxAirXXGF5dUGBrPUN8YcDgG4ZtLQibDaFY1U7N8d5NG5u1r1CyftxihBXbeWBNG W/UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=FwlOpTY1; 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 m18-20020a056402431200b0043ba2380800si417546edc.491.2022.07.20.16.28.05; Wed, 20 Jul 2022 16:28:32 -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=FwlOpTY1; 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 S231613AbiGTXJI (ORCPT + 99 others); Wed, 20 Jul 2022 19:09:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231583AbiGTXIv (ORCPT ); Wed, 20 Jul 2022 19:08:51 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B35C7390E for ; Wed, 20 Jul 2022 16:08:22 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id q16so8111pgq.6 for ; Wed, 20 Jul 2022 16:08:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Nszl3bsf2mnME2IbrRKNWdpEyNRDpL7edLFc4oh5rQk=; b=FwlOpTY1Xy5ZtTxSMQshR8kwWNBaEnIm9ywPyxdMxe3T/XxFEM/rXOZ8shtzx6jRRS 91M8w+897Sjn6+U9yhdoQBbOHvUIZbnudqyVKqIbiFL3KIAItk6n7+SblQBLvdTN309V 3g30TPedV8pjIQUF/c55Q9haSHOBERI23VMmBXMMfrJh6ECBxww0/hu+TOsLKCzYQ+gw GdGAnrtzEzMI3WfqML65BzsZafuMe/PQ0gjEW6sraCLwWPSVKqu83KinR/xUkg5DZP6e 1lFSj7wj5ru0N/Lu8b5OfGt3wIdl4NxJaMaNB7fu16Hj/vtrqiGttQ3ijzZC5VLTZ10Y P4jA== 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=Nszl3bsf2mnME2IbrRKNWdpEyNRDpL7edLFc4oh5rQk=; b=zTWdGULtPL9nqj8VJpwiHP6iZtSllVGxTnm3Pm5Yl+c5TmQzDibkH96qlziZlqVJXg xFPToYw9C2FrBIboUvs/Nw9WiE+69ocKl7QdQB+rAM+c7e4exBlvIxiOFlpMO1yZSlpW fw7NmJVhAl10WiKviFF4nDa9bzx6uYaSZCEuxaEHkhjGjfPWQTsvMQ+r9j3giYc3bIEV 63vLHBWoJ2KPHqfUwqeuEoNZ+TgdDp+VgvR7+k0qorI3JysKxh4Ik1xCBsu3PSF6cMls xb26peMx3FHx3+pWcoIz4AENxafbHljz3JC27zSakBBbDqjQyHx9ZCuFhqSLU3H0BjY8 YL3A== X-Gm-Message-State: AJIora+/XUxuP4Q3b4Xd+XmY/w7qi+vbv4OK0B0KGT/hqykJ8xEPp6M3 4KwbRGqBV/hGIoSyTegwjwrhtyTJ1gELDX35hVmuFA== X-Received: by 2002:a62:1a8b:0:b0:528:d505:1a06 with SMTP id a133-20020a621a8b000000b00528d5051a06mr41267868pfa.78.1658358501699; Wed, 20 Jul 2022 16:08:21 -0700 (PDT) MIME-Version: 1.0 References: <20220519153713.819591-1-chao.p.peng@linux.intel.com> <20220519153713.819591-7-chao.p.peng@linux.intel.com> <20220624090246.GA2181919@chaop.bj.intel.com> <20220630222140.of4md7bufd5jv5bh@amd.com> <4fe3b47d-e94a-890a-5b87-6dfb7763bc7e@intel.com> <5d0b9341-78b5-0959-2517-0fb1fe83a205@intel.com> In-Reply-To: <5d0b9341-78b5-0959-2517-0fb1fe83a205@intel.com> From: Vishal Annapurve Date: Wed, 20 Jul 2022 16:08:10 -0700 Message-ID: Subject: Re: [PATCH v6 6/8] KVM: Handle page fault for private memory To: Xiaoyao Li Cc: Sean Christopherson , Michael Roth , Chao Peng , "Nikunj A. Dadhania" , kvm list , LKML , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, qemu-devel@nongnu.org, Paolo Bonzini , Jonathan Corbet , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86 , "H . Peter Anvin" , Hugh Dickins , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Mike Rapoport , Steven Price , "Maciej S . Szmigiero" , Vlastimil Babka , Yu Zhang , "Kirill A . Shutemov" , Andy Lutomirski , Jun Nakajima , Dave Hansen , Andi Kleen , David Hildenbrand , aarcange@redhat.com, ddutile@redhat.com, dhildenb@redhat.com, Quentin Perret , mhocko@suse.com 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, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 > > Hmm, so a new slot->arch.page_attr array shouldn't be necessary, KVM can instead > > update slot->arch.lpage_info on shared<->private conversions. Detecting whether > > a given range is partially mapped could get nasty if KVM defers tracking to the > > backing store, but if KVM itself does the tracking as was previously suggested[*], > > then updating lpage_info should be relatively straightfoward, e.g. use > > xa_for_each_range() to see if a given 2mb/1gb range is completely covered (fully > > shared) or not covered at all (fully private). > > > > [*] https://lore.kernel.org/all/YofeZps9YXgtP3f1@google.com > > Yes, slot->arch.page_attr was introduced to help identify whether a page > is completely shared/private at given level. It seems XARRAY can serve > the same purpose, though I know nothing about it. Looking forward to > seeing the patch of using XARRAY. > > yes, update slot->arch.lpage_info is good to utilize the existing logic > and Isaku has applied it to slot->arch.lpage_info for 2MB support patches. Chao, are you planning to implement these changes to ensure proper handling of hugepages partially mapped as private/shared in subsequent versions of this series? Or is this something left to be handled by the architecture specific code? Regards, Vishal