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 669E1C43334 for ; Wed, 13 Jul 2022 23:52:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231697AbiGMXwd (ORCPT ); Wed, 13 Jul 2022 19:52:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230371AbiGMXwc (ORCPT ); Wed, 13 Jul 2022 19:52:32 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31ABE52DF2; Wed, 13 Jul 2022 16:52:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657756351; x=1689292351; h=date:from:to:cc:subject:message-id:reply-to:references: mime-version:in-reply-to; bh=d4b95Nutiv+fVkeoTmmbeGdels6G19ALZ7QCpFCTTwc=; b=ec0iUFs99XSrMBcTD4mfXpTGHIwEqAsiwpuU0GWzLKvYLXib/Azi8/Ly 9SiWuFCJyvAZfo7rLKu5nf79sZvP+XJ6uh10Bz4eaKKMTjP83DO/NRwwk m2H19M4PddgwWJsAoRb8+MPNz4kFHILwnuhNGexn3kqyeiEwcLlDCXmaR f/0qxuApQRvbaQdu1Pxx0cgYHtScpq0DVs3CUY6sQAG+li45pLMiuilKj 9aEC94fvRy0+sWgWzOfKcnrFNwVTXXH0vp4CRxjh+iFcQB6PrH+VabVvQ mFbVzKYeTFIA9a93CFf+yAD4urjaNXi2VrlFY5v1J6eCWO7OiDlGD4o6Y w==; X-IronPort-AV: E=McAfee;i="6400,9594,10407"; a="371685475" X-IronPort-AV: E=Sophos;i="5.92,269,1650956400"; d="scan'208";a="371685475" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2022 16:52:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,269,1650956400"; d="scan'208";a="593176855" Received: from chaop.bj.intel.com (HELO localhost) ([10.240.192.101]) by orsmga007.jf.intel.com with ESMTP; 13 Jul 2022 16:52:20 -0700 Date: Thu, 14 Jul 2022 07:49:03 +0800 From: Chao Peng To: "Gupta, Pankaj" Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, qemu-devel@nongnu.org, linux-kselftest@vger.kernel.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 , Shuah Khan , Mike Rapoport , Steven Price , "Maciej S . Szmigiero" , Vlastimil Babka , Vishal Annapurve , Yu Zhang , "Kirill A . Shutemov" , luto@kernel.org, jun.nakajima@intel.com, dave.hansen@intel.com, ak@linux.intel.com, david@redhat.com, aarcange@redhat.com, ddutile@redhat.com, dhildenb@redhat.com, Quentin Perret , Michael Roth , mhocko@suse.com, Muchun Song Subject: Re: [PATCH v7 04/14] mm/shmem: Support memfile_notifier Message-ID: <20220713234903.GA2881285@chaop.bj.intel.com> Reply-To: Chao Peng References: <20220706082016.2603916-1-chao.p.peng@linux.intel.com> <20220706082016.2603916-5-chao.p.peng@linux.intel.com> <20220713074458.GB2831541@chaop.bj.intel.com> <74097857-1908-2ff2-1e54-bf7e658ea6c6@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <74097857-1908-2ff2-1e54-bf7e658ea6c6@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On Wed, Jul 13, 2022 at 12:01:13PM +0200, Gupta, Pankaj wrote: > > > > > +#ifdef CONFIG_MIGRATION > > > > +static int shmem_migrate_page(struct address_space *mapping, > > > > + struct page *newpage, struct page *page, > > > > + enum migrate_mode mode) > > > > +{ > > > > + struct inode *inode = mapping->host; > > > > + struct shmem_inode_info *info = SHMEM_I(inode); > > > > + > > > > + if (info->memfile_node.flags & MEMFILE_F_UNMOVABLE) > > > > + return -EOPNOTSUPP; > > > > + return migrate_page(mapping, newpage, page, mode); > > > > > > Wondering how well page migrate would work for private pages > > > on shmem memfd based backend? > > > > From high level: > > - KVM unset MEMFILE_F_UNMOVABLE bit to indicate it capable of > > migrating a page. > > - Introduce new 'migrate' callback(s) to memfile_notifier_ops for KVM > > to register. > > - The callback is hooked to migrate_page() here. > > - Once page migration requested, shmem calls into the 'migrate' > > callback(s) to perform additional steps for encrypted memory (For > > TDX we will call TDH.MEM.PAGE.RELOCATE). > > Yes, that would require additional (protocol specific) handling for private > pages. Was trying to find where "MEMFILE_F_UNMOVABLE" flag is set currently? It's set with memfile_register_notifier() in patch 13. > > Thanks, > Pankaj