Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp400381imi; Thu, 21 Jul 2022 03:24:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v0bdykYoSdyAjEYr+cHzwsnJGfabC8dx3J+OjdMm8WDZgg9KZmmKKu5oUZveVvbTCetYUv X-Received: by 2002:a05:6808:3021:b0:335:182f:a66a with SMTP id ay33-20020a056808302100b00335182fa66amr4311319oib.295.1658399058615; Thu, 21 Jul 2022 03:24:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658399058; cv=none; d=google.com; s=arc-20160816; b=k4PVhqUXrr/Wn1UFysYaQ38FmEjNZpnEidaP2jCma8IHUVPWc9PRq9F2CMZq9BJBv5 R+BLtAj+s4RpZhuX4uWCN0svnEUWi68HzvBWfUVmRH1cOjtzHD5ZSOaN7p1KG3y7eoj/ 4zm57ZsVFlkdF/0bfBSwy7v5U2+qFnt/l99NHoFKTzb6V8RRAAh9W1XRCP+skUdVX6wQ Ulw9H1MPBCG/CFMP9SsQSDD25tNLj2u+htvhMSDOx0BurN0tCSpZ1Jdxpwl4SRGe9cOe 6o++sObvn3m4f/dQNDy4/s//8B7X/eWoSzWORc6z16jS8XYPN0upOMGREbl7K8idDhWo y5fA== 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:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=MSlvy4NJIOPTojEOT0cLhsUyDkOZ69G7WvNu72wmJRM=; b=N3StId/BTMO0nMQ5BDpgI2dZwbpTnGnpRy2IppDNTVo1MmlpAiZ81tBIgV7Gp4/j2t jr5ucyuZNLkWKSLVwmbFIqZ76BsIVr+hkm7uGQt5kd7IZ98hw501EEG71l+b44ST8HEW UaUGiUqayynHV5c1OVab8u9JCc+yOUbSfWvUaC9VXYY5TsbU3/K84+9CGlTZcOwN7CpS I8av8r0xhNoH1QSTcokS46zcXZrA4EG1Vb0qNC21qz6VUT8FNRAG0r7tvsIp+RMfgAUO VjbDYs7DPR5YFjOwSewWfSGuPraoIQE5YEDnHcv4ZvzfrlFG+dxf5/k35QOd7Zzk8Ze7 vDsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hTz9YotS; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a05683033ed00b0060bccccbad6si1147902otu.161.2022.07.21.03.24.05; Thu, 21 Jul 2022 03:24:18 -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=@intel.com header.s=Intel header.b=hTz9YotS; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232771AbiGUJub (ORCPT + 99 others); Thu, 21 Jul 2022 05:50:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232763AbiGUJu0 (ORCPT ); Thu, 21 Jul 2022 05:50:26 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F62F3A480; Thu, 21 Jul 2022 02:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658397026; x=1689933026; h=date:from:to:cc:subject:message-id:reply-to:references: mime-version:in-reply-to; bh=Ac+0RLuL49DbuWul8+wP6iRaArHsOfPE0tmeiZTP7OA=; b=hTz9YotS9xWFXknZGPbV5OQvu8sG0LrT5rFevNkwwiIgKl6KwmDsQYRC 1TcBzqSLV5bi8LdQ1YXvkhw19UIsscuzprhts6aeemNB+1Sp5LRIFi8/z sZQTus0dU8u165S/MHo5Z+qv2WRisKjvSYsjG6iruBw7hgnxXK86+nc7W s8Jz5ywGQDwv3m2xJaX4Eqbl/td8a8kbfSpe/6Q362yFc3C1s8mUacbs9 js/KZrommMztWrZ0ecc+oSf1FtOjH2oFM6+xZ+ydi/gsnPDrnMDShmbnE c0IGYgBTSP/m2Exoznwsuh9tCWa7PA4JGU80KIxHRUKUDXgfBjxa343bZ g==; X-IronPort-AV: E=McAfee;i="6400,9594,10414"; a="287752644" X-IronPort-AV: E=Sophos;i="5.92,289,1650956400"; d="scan'208";a="287752644" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2022 02:50:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,289,1650956400"; d="scan'208";a="626050085" Received: from chaop.bj.intel.com (HELO localhost) ([10.240.193.75]) by orsmga008.jf.intel.com with ESMTP; 21 Jul 2022 02:50:12 -0700 Date: Thu, 21 Jul 2022 17:45:23 +0800 From: Chao Peng To: Vishal Annapurve Cc: Xiaoyao Li , Sean Christopherson , Michael Roth , "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 Subject: Re: [PATCH v6 6/8] KVM: Handle page fault for private memory Message-ID: <20220721094523.GC153288@chaop.bj.intel.com> Reply-To: Chao Peng 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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 Wed, Jul 20, 2022 at 04:08:10PM -0700, Vishal Annapurve wrote: > > > 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? Ah, the topic gets moved to a different place. I should update here. There were more discussions under TDX KVM patch series and I actually just sent out the draft code for this: https://lkml.org/lkml/2022/7/20/610 That patch is based on UPM v7 here. If I can get more feedbacks there then I will include an udpated version in UPM v8. If you have bandwdith, you can also play with that patch, any feedback is welcome. Chao > > Regards, > Vishal