Message ID | 20250402160721.97596-3-kalyazin@amazon.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 0DD79C28B20 for <linux-mm@archiver.kernel.org>; Wed, 2 Apr 2025 16:08:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 83A9D280008; Wed, 2 Apr 2025 12:08:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E892280001; Wed, 2 Apr 2025 12:08:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B148280008; Wed, 2 Apr 2025 12:08:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 453F9280001 for <linux-mm@kvack.org>; Wed, 2 Apr 2025 12:08:00 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0C8AD161CEA for <linux-mm@kvack.org>; Wed, 2 Apr 2025 16:08:00 +0000 (UTC) X-FDA: 83289585120.01.F575DED Received: from smtp-fw-9106.amazon.com (smtp-fw-9106.amazon.com [207.171.188.206]) by imf17.hostedemail.com (Postfix) with ESMTP id EBA5E40002 for <linux-mm@kvack.org>; Wed, 2 Apr 2025 16:07:57 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=amazon.com header.s=amazon201209 header.b=vu2lPLqX; spf=pass (imf17.hostedemail.com: domain of "prvs=1800b2f01=kalyazin@amazon.co.uk" designates 207.171.188.206 as permitted sender) smtp.mailfrom="prvs=1800b2f01=kalyazin@amazon.co.uk"; dmarc=pass (policy=quarantine) header.from=amazon.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743610078; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=UqLHY0tozEGhyxnF+okEAbfVCr65ECLQO5uKTF2y+bU=; b=0tX2mEsgvK3HgpnHvQd37n+3BqO27Imegv87j63UOEsh8G0488njAaGawPzFCOH8TWB+c/ SycWQqGmucQKQftiOp9RsQm2XFxIaKIdfM9nniwXDgZGW0mLSeo3SUUkE347acF325CCjC BXWzgGTsqtLzsFqgWku3mou8oCTXxPs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743610078; a=rsa-sha256; cv=none; b=Flgm973hj2pZAvqbsFN12LCRyBN0MzJAr7Ka8XdH1x+JHfzgv4OGx9aVcfhT6L6ihnEHFY G79k96QBSDGodBsc4ZJ7jwjgH41meFem9vbzfykiLL6NU0k0MDUvCNF9i5X2+6UGB1r6on BPMkaJg9o/z2shpD7BrHKnYtMlKeVwA= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=amazon.com header.s=amazon201209 header.b=vu2lPLqX; spf=pass (imf17.hostedemail.com: domain of "prvs=1800b2f01=kalyazin@amazon.co.uk" designates 207.171.188.206 as permitted sender) smtp.mailfrom="prvs=1800b2f01=kalyazin@amazon.co.uk"; dmarc=pass (policy=quarantine) header.from=amazon.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1743610078; x=1775146078; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UqLHY0tozEGhyxnF+okEAbfVCr65ECLQO5uKTF2y+bU=; b=vu2lPLqXSHchnY773LyR96szF5ESI0NLAAmhw22BIfjcBi+WvhX1o/u4 TnAUdUmfXKpGb9lKSuAVekTYKx97BRz5V5+UeCiAMQDxqMql7psnR2Et5 W1IzvDpbnLdP8ztiNIUXiiVrH5K1Ow1VnkDBsj6SKxv+yLp0X0Af/Zhdx Q=; X-IronPort-AV: E=Sophos;i="6.15,182,1739836800"; d="scan'208";a="812710781" Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO smtpout.prod.us-west-2.prod.farcaster.email.amazon.dev) ([10.25.36.210]) by smtp-border-fw-9106.sea19.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2025 16:07:51 +0000 Received: from EX19MTAUWA002.ant.amazon.com [10.0.38.20:29109] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.27.18:2525] with esmtp (Farcaster) id 0dbab0ac-a3ac-4e29-911c-8594f554e27d; Wed, 2 Apr 2025 16:07:50 +0000 (UTC) X-Farcaster-Flow-ID: 0dbab0ac-a3ac-4e29-911c-8594f554e27d Received: from EX19D020UWC001.ant.amazon.com (10.13.138.157) by EX19MTAUWA002.ant.amazon.com (10.250.64.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1544.14; Wed, 2 Apr 2025 16:07:50 +0000 Received: from EX19MTAUWA002.ant.amazon.com (10.250.64.202) by EX19D020UWC001.ant.amazon.com (10.13.138.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1544.14; Wed, 2 Apr 2025 16:07:49 +0000 Received: from email-imr-corp-prod-pdx-all-2b-f5cd2367.us-west-2.amazon.com (10.25.36.210) by mail-relay.amazon.com (10.250.64.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1544.14 via Frontend Transport; Wed, 2 Apr 2025 16:07:49 +0000 Received: from dev-dsk-kalyazin-1a-a12e27e2.eu-west-1.amazon.com (dev-dsk-kalyazin-1a-a12e27e2.eu-west-1.amazon.com [172.19.103.116]) by email-imr-corp-prod-pdx-all-2b-f5cd2367.us-west-2.amazon.com (Postfix) with ESMTPS id 1F660C061B; Wed, 2 Apr 2025 16:07:47 +0000 (UTC) From: Nikita Kalyazin <kalyazin@amazon.com> To: <akpm@linux-foundation.org>, <pbonzini@redhat.com>, <shuah@kernel.org> CC: <kvm@vger.kernel.org>, <linux-kselftest@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>, <lorenzo.stoakes@oracle.com>, <david@redhat.com>, <ryan.roberts@arm.com>, <quic_eberman@quicinc.com>, <jthoughton@google.com>, <peterx@redhat.com>, <graf@amazon.de>, <jgowans@amazon.com>, <roypat@amazon.co.uk>, <derekmn@amazon.com>, <nsaenz@amazon.es>, <xmarcalx@amazon.com>, <kalyazin@amazon.com> Subject: [PATCH v2 2/5] KVM: guest_memfd: add kvm_gmem_vma_is_gmem Date: Wed, 2 Apr 2025 16:07:18 +0000 Message-ID: <20250402160721.97596-3-kalyazin@amazon.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250402160721.97596-1-kalyazin@amazon.com> References: <20250402160721.97596-1-kalyazin@amazon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: EBA5E40002 X-Stat-Signature: uokoonhj4tr4isnjg9raqaepdrdmium5 X-HE-Tag: 1743610077-257792 X-HE-Meta: U2FsdGVkX1/6R7jetHY/X4YsRn/TMcWHOg4ZGw9bm2paODoQauqNgKPC24CFBCVMUX3NWfpQrX0nuh6WbJBXapYbPUZ1OqcqQparq6UCiuIiJl9r8+U+y9aEPjQ2I552naqm9M5RBCHV42OM14d7VICVnRdDWPP+CeQY/HXMBnVgAAZDoCAoBN9kcG0Bdl1IULgIaHQM7kODpU0wuOzBHv3p/VBf1Gi5joTYMg0sPRlgNoyOgJ3grqlNopG8z+GXyd1swRLU/qAZ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2IAKd4g6BgpD2imqH3vwK6nH2411aKRws1/0iJU+GvVXqCxTN5vTgzhT5nWrhFsklTqXWxoVnejixCO2fkDOlAy/sVtf3lEIDuGD8lkeZmRlVVZ69w6o8Yzff0+F3Mjj29HefZ9U99IC1q6WrxJMumxS+a11+uBJPSxZgoBFxLztWURbO4mOe1WAlbrtYQhnFrJKtw= 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
KVM: guest_memfd: support for uffd minor
|
expand
|
diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c index fbf89e643add..26b1734b9623 100644 --- a/virt/kvm/guest_memfd.c +++ b/virt/kvm/guest_memfd.c @@ -416,6 +416,11 @@ static int kvm_gmem_mmap(struct file *file, struct vm_area_struct *vma) return 0; } + +bool kvm_gmem_vma_is_gmem(struct vm_area_struct *vma) +{ + return vma->vm_ops == &kvm_gmem_vm_ops; +} #else #define kvm_gmem_mmap NULL #endif /* CONFIG_KVM_GMEM_SHARED_MEM */ diff --git a/virt/kvm/kvm_mm.h b/virt/kvm/kvm_mm.h index acef3f5c582a..09fcdf18a072 100644 --- a/virt/kvm/kvm_mm.h +++ b/virt/kvm/kvm_mm.h @@ -73,6 +73,7 @@ int kvm_gmem_create(struct kvm *kvm, struct kvm_create_guest_memfd *args); int kvm_gmem_bind(struct kvm *kvm, struct kvm_memory_slot *slot, unsigned int fd, loff_t offset); void kvm_gmem_unbind(struct kvm_memory_slot *slot); +bool kvm_gmem_vma_is_gmem(struct vm_area_struct *vma); #else static inline void kvm_gmem_init(struct module *module) {
It will be used to distinguish the vma type in userfaultfd code. Signed-off-by: Nikita Kalyazin <kalyazin@amazon.com> --- virt/kvm/guest_memfd.c | 5 +++++ virt/kvm/kvm_mm.h | 1 + 2 files changed, 6 insertions(+)