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 6A181C433F5 for ; Sun, 24 Apr 2022 08:07:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BE7AD6B0074; Sun, 24 Apr 2022 04:07:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B97FA6B0075; Sun, 24 Apr 2022 04:07:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A5FF46B0078; Sun, 24 Apr 2022 04:07:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 974656B0074 for ; Sun, 24 Apr 2022 04:07:56 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 6543327D9F for ; Sun, 24 Apr 2022 08:07:56 +0000 (UTC) X-FDA: 79391044152.23.8A5CD96 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by imf03.hostedemail.com (Postfix) with ESMTP id B13A820028 for ; Sun, 24 Apr 2022 08:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650787675; x=1682323675; h=date:from:to:cc:subject:message-id:reply-to:references: mime-version:in-reply-to; bh=Jg69NAeROVkmxoEWc411QwNioJnF4WnIiJ0sHVRfPPE=; b=XHYTvW1qjud5ocYMq94bKV2rlKw+EacdHuBYr/dpAF9aEFrAXPcYkSkf SYO3ENCRWl+YXnLoepTeD6igVsK2npmlZTI6Wo6DxZ6Wk0vPslKEsbOrf 923RkN9bdr71yTHRgkwdAvqikHtwRJjm/GxGDpi2Sq8EmSaCrFqExSJ+O 6SqRxXIZHXGi9n+n+dL7I1VS4PYAl0CCq/KwSvhesjOaIL5+QezjB2c3z y/kyG7Z7B1m+LGFz/el+I3YLremLs+VY88it/o07/SRdUC2uOT87zNzZH GqaufHUA1svSCRiQmgXlRo3fSkYL4Tv1gNpbiaQ3RNRttcBbMKc+Yb+8c A==; X-IronPort-AV: E=McAfee;i="6400,9594,10326"; a="262611973" X-IronPort-AV: E=Sophos;i="5.90,286,1643702400"; d="scan'208";a="262611973" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2022 01:07:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,286,1643702400"; d="scan'208";a="704146191" Received: from chaop.bj.intel.com (HELO localhost) ([10.240.192.101]) by fmsmga001.fm.intel.com with ESMTP; 24 Apr 2022 01:07:45 -0700 Date: Sun, 24 Apr 2022 16:07:37 +0800 From: Chao Peng To: Paolo Bonzini Cc: Sean Christopherson , Quentin Perret , Andy Lutomirski , Steven Price , kvm list , Linux Kernel Mailing List , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Linux API , qemu-devel@nongnu.org, Jonathan Corbet , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , the arch/x86 maintainers , "H. Peter Anvin" , Hugh Dickins , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Mike Rapoport , "Maciej S . Szmigiero" , Vlastimil Babka , Vishal Annapurve , Yu Zhang , "Kirill A. Shutemov" , "Nakajima, Jun" , Dave Hansen , Andi Kleen , David Hildenbrand , Marc Zyngier , Will Deacon Subject: Re: [PATCH v5 00/13] KVM: mm: fd-based approach for supporting KVM guest private memory Message-ID: <20220424080737.GA4207@chaop.bj.intel.com> Reply-To: Chao Peng References: <80aad2f9-9612-4e87-a27a-755d3fa97c92@www.fastmail.com> <83fd55f8-cd42-4588-9bf6-199cbce70f33@www.fastmail.com> <20220422105612.GB61987@chaop.bj.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B13A820028 X-Stat-Signature: ra71jsyeiy87ey81eeaum8f4g58537h5 X-Rspam-User: Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=XHYTvW1q; spf=none (imf03.hostedemail.com: domain of chao.p.peng@linux.intel.com has no SPF policy when checking 192.55.52.93) smtp.mailfrom=chao.p.peng@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com X-HE-Tag: 1650787672-283466 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, Apr 22, 2022 at 01:06:25PM +0200, Paolo Bonzini wrote: > On 4/22/22 12:56, Chao Peng wrote: > > /* memfile notifier flags */ > > #define MFN_F_USER_INACCESSIBLE 0x0001 /* memory allocated in the file is inaccessible from userspace (e.g. read/write/mmap) */ > > #define MFN_F_UNMOVABLE 0x0002 /* memory allocated in the file is unmovable */ > > #define MFN_F_UNRECLAIMABLE 0x0003 /* memory allocated in the file is unreclaimable (e.g. via kswapd or any other pathes) */ > > You probably mean BIT(0/1/2) here. Right, it's BIT(n), Thanks. Chao > > Paolo > > > When memfile_notifier is being registered, memfile_register_notifier will > > need check these flags. E.g. for MFN_F_USER_INACCESSIBLE, it fails when > > previous mmap-ed mapping exists on the fd (I'm still unclear on how to do > > this). When multiple consumers are supported it also need check all > > registered consumers to see if any conflict (e.g. all consumers should have > > MFN_F_USER_INACCESSIBLE set). Only when the register succeeds, the fd is > > converted into a private fd, before that, the fd is just a normal (shared) > > one. During this conversion, the previous data is preserved so you can put > > some initial data in guest pages (whether the architecture allows this is > > architecture-specific and out of the scope of this patch).