Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2669712pxp; Mon, 7 Mar 2022 22:17:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzxuchv+5AhCjG8v8xy3at4R1yCCVsp+8xdykQEB/zwdOuIIySafre5+5KREKhXjQ7EO8mN X-Received: by 2002:a63:445c:0:b0:375:9c0c:c360 with SMTP id t28-20020a63445c000000b003759c0cc360mr12782387pgk.588.1646720269607; Mon, 07 Mar 2022 22:17:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646720269; cv=none; d=google.com; s=arc-20160816; b=WVQ+MSIzaBgEhPObp9iA06yrkTChbxqwiUaGAk3fEDZXzXu28+Rex6adnSuMig+8+h X3o8sNZCErSUJvWcOdsFshZ2d6bVEEl7tE5rXTyrB/ISl4bmx7fK32iZLQcaC/xMKO7z ZoW4MtPJvRLFCuuONNlnjZLuRJfR0MvW2jnt693PHuxHrkMbMHsaCmmA+lX0Bg1yhOj+ iHQcL3IxKMdUXuoo9IyY/6trDSTZ1NVKCgW+LQpNfUcR8zvH5f6i55FdDChDGIvkgSaP LFavbuSnfL8J/+hTUrExb0GkkfVx5iUzY6/aWOaZeIGmdR5g1dujqj5r/1wJ82+h5cY1 gUIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=W1ZWI/KZ5oicDLFomzogeZBi/q+sACDYGrOk1XLHlZ4=; b=uVt4wZOg+Z1z3Ia/ANtOpC0aZQhR6lJNDCcfxWHuH7N7gnMtFQvOmlM1Wn1BxLWKoF cBujpj+rXDQNBfV5irpxaO6ZXnLK+CpJYP38MibF6QE4+MvO7CFl+Vb6Nfw0z3OQpoN0 3sgTFD25hWhalRuOTHvDV2IfQBFENBLWdrM2G2WWlgsksVFAo8mgFIyu/owaEhCAa4AB c7BqQjcTsWqGTdOjRsaNXbsdCh1rDlXnrkpVQUXnYIwkQC6gezL74VdgUyvNcZi01z5K qlSvUqewMCzZONniGt5+l0mNKDiBGGuXVq7R1MayYdhuX21Ff8irhCjqCAC/ngO47/ZB kq1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ULmH3UEB; 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 q12-20020a17090311cc00b0015196106816si15485342plh.269.2022.03.07.22.17.33; Mon, 07 Mar 2022 22:17:49 -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=@intel.com header.s=Intel header.b=ULmH3UEB; 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 S1344306AbiCHBrH (ORCPT + 99 others); Mon, 7 Mar 2022 20:47:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344303AbiCHBrG (ORCPT ); Mon, 7 Mar 2022 20:47:06 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26D373B2AB; Mon, 7 Mar 2022 17:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646703970; x=1678239970; h=date:from:to:cc:subject:message-id:reply-to:references: mime-version:in-reply-to; bh=mHBCi6qAEBh/nnklYLjjX0eLK1S8y5VX77Z1SPbc3yQ=; b=ULmH3UEBLdccUYzQgIXK0dw+/n2E3nyWqtarEdlbrhI/qPGrgDozMej3 XODS3M2TAfukAkmK28C/7WUE0m1FhZjKGwWOTFcwYncWUriBNuf861Ulf iUyHGFEzYSzu3RuSaZoVHJPydGtvyptuDeqiiJV/dHXEEM8dXiCigeN4k 21t2qgVVI4kp+GcymcBYFJOgQVmLRTk204HJtYUamYpzzVCivVu+UDlse GCL/Uk+aGnFehCVIXjUnXei17+5UOF35VCeP4KvKm+F61+qcCCQHVj5Lb o4tcvZwbTSsawDGzU0RQ7xla5jUUDx8PeI7/GkFpW4lAUfXrDClF5GKrs w==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="252132725" X-IronPort-AV: E=Sophos;i="5.90,163,1643702400"; d="scan'208";a="252132725" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 17:46:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,163,1643702400"; d="scan'208";a="495276231" Received: from chaop.bj.intel.com (HELO localhost) ([10.240.192.101]) by orsmga003.jf.intel.com with ESMTP; 07 Mar 2022 17:46:02 -0800 Date: Tue, 8 Mar 2022 09:45:45 +0800 From: Chao Peng To: Vlastimil Babka Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, qemu-devel@nongnu.org, Paolo Bonzini , Jonathan Corbet , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , Hugh Dickins , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Yu Zhang , "Kirill A . Shutemov" , luto@kernel.org, jun.nakajima@intel.com, dave.hansen@intel.com, ak@linux.intel.com, david@redhat.com Subject: Re: [PATCH v4 03/12] mm: Introduce memfile_notifier Message-ID: <20220308014545.GA43625@chaop.bj.intel.com> Reply-To: Chao Peng References: <20220118132121.31388-1-chao.p.peng@linux.intel.com> <20220118132121.31388-4-chao.p.peng@linux.intel.com> <9ac9a88f-54b4-a49f-0857-c3094d3e0d2b@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9ac9a88f-54b4-a49f-0857-c3094d3e0d2b@suse.cz> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H2,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 Mon, Mar 07, 2022 at 04:42:08PM +0100, Vlastimil Babka wrote: > On 1/18/22 14:21, Chao Peng wrote: > > This patch introduces memfile_notifier facility so existing memory file > > subsystems (e.g. tmpfs/hugetlbfs) can provide memory pages to allow a > > third kernel component to make use of memory bookmarked in the memory > > file and gets notified when the pages in the memory file become > > allocated/invalidated. > > > > It will be used for KVM to use a file descriptor as the guest memory > > backing store and KVM will use this memfile_notifier interface to > > interact with memory file subsystems. In the future there might be other > > consumers (e.g. VFIO with encrypted device memory). > > > > It consists two sets of callbacks: > > - memfile_notifier_ops: callbacks for memory backing store to notify > > KVM when memory gets allocated/invalidated. > > - memfile_pfn_ops: callbacks for KVM to call into memory backing store > > to request memory pages for guest private memory. > > > > Userspace is in charge of guest memory lifecycle: it first allocates > > pages in memory backing store and then passes the fd to KVM and lets KVM > > register each memory slot to memory backing store via > > memfile_register_notifier. > > > > The supported memory backing store should maintain a memfile_notifier list > > and provide routine for memfile_notifier to get the list head address and > > memfile_pfn_ops callbacks for memfile_register_notifier. It also should call > > memfile_notifier_fallocate/memfile_notifier_invalidate when the bookmarked > > memory gets allocated/invalidated. > > > > Signed-off-by: Kirill A. Shutemov > > Process nitpick: > Here and in patch 4/12 you have Kirill's S-o-b so there should probably be > also "From: Kirill ..." as was in v3? Or in case you modified the original > patches so much to become the primary author, you should add > "Co-developed-by: Kirill ..." here before his S-o-b. Thanks. 3/12 is vastly rewritten so the latter case can be applied. 4/12 should keep Kirill as the primary author. Chao