From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C744EC433EF for ; Wed, 20 Jul 2022 23:09:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230496AbiGTXJH (ORCPT ); Wed, 20 Jul 2022 19:09:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231603AbiGTXIv (ORCPT ); Wed, 20 Jul 2022 19:08:51 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B4EA73919 for ; Wed, 20 Jul 2022 16:08:22 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id 6so2212765pgb.13 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=oAch7SrhNFQX/6hvM7ovBX6W+vmBOiFN7FB7FFW9UShil4nP3Nxey2Nwm+gPHGfbFR qUXvWZHUznxqTKwqX9DhTd6lMmTffjqkriQw7MEu+5GBqtA8291zcfl+ATPs4bGQ9OFM beaqSwubUxvgP0PbqIJyqG4Yv8Ma9virfXlRLBHa60810HIHDa3s2aUpxbcGAscMq5AC 5+VbyJMOPwqWAiBsKN1Ar7Wy7v99gBXe0/ZS5tVO24b7vICHZXDBOdBrBfN5C/qieMMA vCv+6+IGb3PviV+XpQIVpr9L512xk6/+CCorInaWSbtSSTxKQ6lwke0jM+WhQ+dpg7a4 ze8A== X-Gm-Message-State: AJIora+whIgf/sp8/I2LQ2Z40pUXuyaxKbYbmm38HHfior6o+tZ2Cur8 oT2OLZaldyiuMTSyzCwMLWr16E1VTQSwZsLNPxFmUQ== X-Google-Smtp-Source: AGRyM1sVSu2sWaA6KhwjXATdLIcan8zoTwRzYetVEkO/NR0+movB4Kj6gdLqTbANspAPpdn1ss3XaAW1x7VvJRw8slU= 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" Precedence: bulk List-ID: X-Mailing-List: linux-api@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