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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 755DBC433EF for ; Fri, 31 Dec 2021 02:34:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D083C6B0099; Thu, 30 Dec 2021 21:34:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CB7FC6B009A; Thu, 30 Dec 2021 21:34:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7FEB6B009B; Thu, 30 Dec 2021 21:34:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0075.hostedemail.com [216.40.44.75]) by kanga.kvack.org (Postfix) with ESMTP id A87936B0099 for ; Thu, 30 Dec 2021 21:34:21 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 629FE89D54 for ; Fri, 31 Dec 2021 02:34:21 +0000 (UTC) X-FDA: 78976520322.01.532F482 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf08.hostedemail.com (Postfix) with ESMTP id 7FC98160007 for ; Fri, 31 Dec 2021 02:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1640918060; x=1672454060; h=date:from:to:cc:subject:message-id:reply-to:references: mime-version:in-reply-to; bh=3xgj6YPF/dL11Z/52845rvYXUsZ6jR0j7Y9+NOsvBzY=; b=H9cS/0ZFQqARJG80UXtcloXhr1Bdxaeeyt7vRabG5OcpXaJwqyhE6FEp s0SbjD/4Cb7T3Ui5RbvGrxjgakawFhh1pziEgbyN9X+0VJcnORW3/SMcI 6SHKRuhJEbxA3m7gJHx2w0ZwkvQQkhaWoynpH3XxHxO+KmnoqO9rZTncF NT7qQDTpY8SUXsGQ6+qP9TuPSLyMEuKH9FFLWYFqy5IxBrYYO2kES1Nql V4eRfWvtfXzNxTZ9BKzvUinCFde+VjeV1/gnbXwi5WERBhI9AO13M/H5H 7OrStJdglD9LquGcDgq6b6eh4kUjGPcD8/53Ne5nuGBcL/mtvVSiESbgi Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10213"; a="266011638" X-IronPort-AV: E=Sophos;i="5.88,250,1635231600"; d="scan'208";a="266011638" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Dec 2021 18:34:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,250,1635231600"; d="scan'208";a="666706992" Received: from chaop.bj.intel.com (HELO localhost) ([10.240.192.101]) by fmsmga001.fm.intel.com with ESMTP; 30 Dec 2021 18:34:10 -0800 Date: Fri, 31 Dec 2021 10:33:34 +0800 From: Chao Peng To: Sean Christopherson 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 , 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, john.ji@intel.com, susie.li@intel.com, jun.nakajima@intel.com, dave.hansen@intel.com, ak@linux.intel.com, david@redhat.com Subject: Re: [PATCH v3 kvm/queue 11/16] KVM: Add kvm_map_gfn_range Message-ID: <20211231023334.GA7255@chaop.bj.intel.com> Reply-To: Chao Peng References: <20211223123011.41044-1-chao.p.peng@linux.intel.com> <20211223123011.41044-12-chao.p.peng@linux.intel.com> <20211224041351.GB44042@chaop.bj.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211224041351.GB44042@chaop.bj.intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 7FC98160007 X-Stat-Signature: bf41c43gm5aid3czujiphnukex9gnp36 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b="H9cS/0ZF"; spf=none (imf08.hostedemail.com: domain of chao.p.peng@linux.intel.com has no SPF policy when checking 192.55.52.88) smtp.mailfrom=chao.p.peng@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspamd-Server: rspam10 X-HE-Tag: 1640918049-211146 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Dec 24, 2021 at 12:13:51PM +0800, Chao Peng wrote: > On Thu, Dec 23, 2021 at 06:06:19PM +0000, Sean Christopherson wrote: > > On Thu, Dec 23, 2021, Chao Peng wrote: > > > This new function establishes the mapping in KVM page tables for a > > > given gfn range. It can be used in the memory fallocate callback for > > > memfd based memory to establish the mapping for KVM secondary MMU when > > > the pages are allocated in the memory backend. > > > > NAK, under no circumstance should KVM install SPTEs in response to allocating > > memory in a file. The correct thing to do is to invalidate the gfn range > > associated with the newly mapped range, i.e. wipe out any shared SPTEs associated > > with the memslot. > > Right, thanks. BTW, I think the current fallocate() callback is just useless as long as we don't want to install KVM SPTEs in response to allocating memory in a file. The invalidation of the shared SPTEs should be notified through mmu_notifier of the shared memory backend, not memfd_notifier of the private memory backend. Thanks, Chao