Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9695022rwp; Thu, 20 Jul 2023 08:27:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlGBe9/4bWxSYpEW/xasnA2G3spccB18bO9JmvNOGCeZf3xYGBj+nm+VNGtJuLqxmYqT+jI5 X-Received: by 2002:a05:6a00:a0b:b0:66a:4a45:e023 with SMTP id p11-20020a056a000a0b00b0066a4a45e023mr3002804pfh.26.1689866845709; Thu, 20 Jul 2023 08:27:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689866845; cv=none; d=google.com; s=arc-20160816; b=0o54kBGRlNe8vNkwGGNwpGjUKasGpwqg0v6ODya9735nrBFgUon1rlVW9GOvDsG2F0 t2TSkQgpdUhARTfHw0LlYoG5MjOM6oNS8Y0SLtNCCKIeJxqyZCjm4vnN9m0DGtvYYFg3 ibvVU45k1haumTTWRiO0ZMVoxUg0Xe2AZiRIE4YLG7Gy+h+rMFNp5IoMiBRUERFuBPy1 0VmS1Se2Tx4AKiWgfiPWbFlxoYeLW7ErLZImvpTrZ46C/zRW8NUVO8u8cJiPA+n4jQwc 3QIiBrz533mJLLSwjtUq0eu3aLaYJDXvvqQ4nwY0wkxkwfvR5D5YqIyNurcot0hFF8xf xZ8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=2x0SJUc7KGDzKWAXgHcpqVGlI1TAunWJm+sN3jDsmw4=; fh=DMhChBLtZGLVu8ofPru04YrCq9B96cGIpqNZD/m8c74=; b=ydbCooYld03QcxNBz56hXPLQs74ibi/U/RS34wXuea0Ej15p4O8XeKZtqUa0Tv/8FO n+ht3bplyLIpIy4t0EOVXfjngOlS3kDyf4S4kwCJtWifFTLeS2our+Zfo9we6p0W5Ded 3wgvbWOoVfuBHF5mErAXhMloWSzYtVrGX4TD1TDYYXFLaBoLrubTGUt6fxpLEaGNOk1G 4JvwfLi03+QoHBmEjg/LJgLN8/j0/HHMEBM/YGjQkoLgHn4Ve1csRbUAAReKWGJom0r/ eDJmjRo51tUTwuNfrBd72qzUlEYIfPuPUH0yLW2N97VxdBBEqqUr22VmPM/KNvt1Z69m YDpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Rcpot/vV"; 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 fj19-20020a056a003a1300b0066871b54e15si1119670pfb.359.2023.07.20.08.27.13; Thu, 20 Jul 2023 08:27:25 -0700 (PDT) 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="Rcpot/vV"; 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 S231723AbjGTOq3 (ORCPT + 99 others); Thu, 20 Jul 2023 10:46:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbjGTOq2 (ORCPT ); Thu, 20 Jul 2023 10:46:28 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14D092127; Thu, 20 Jul 2023 07:46:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689864388; x=1721400388; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=K1NwaJnTR9TKmGdPrMBjNm/Xn1+Yu2b1Z2uzK/Twzrs=; b=Rcpot/vVybToIWtgA0TXdPpqxO21KgUHOmUM0CT/q5lVuKa7A67n0i0L 2OUnXSLjv60IFOVxPOu88R+0zb1KsWa4QAo8yKEaC8uXSmqqykfXzziI7 2FvowXTwm4vFr5TQuOdYQYF7Q1Y7nZSj7SYud7KaiCFIG0KQkdGqEuXGV bEGjjrlzIj5yUh9jZHFjdwhe0ljLlw9eQRdQeboFcTvxsCFGDCniH/DTi W2cIIzRD3anxJZPJp2w7M/cOFEr8Pjb2561MB0cSOzYn2lQLT9VTrA3/+ NQ6FfnE/DJHiQ0bcvuUg9yrEQCZUNVdnaA3/xnQ1Vm9Vw7W/t6KYVp7z+ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10777"; a="364218123" X-IronPort-AV: E=Sophos;i="6.01,219,1684825200"; d="scan'208";a="364218123" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2023 07:46:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10777"; a="971059338" X-IronPort-AV: E=Sophos;i="6.01,219,1684825200"; d="scan'208";a="971059338" Received: from xiaoyaol-hp-g830.ccr.corp.intel.com (HELO [10.93.6.77]) ([10.93.6.77]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2023 07:45:52 -0700 Message-ID: <83eb5c50-7287-7845-ffc3-a7c58e638ea5@intel.com> Date: Thu, 20 Jul 2023 22:45:48 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.13.0 Subject: Re: [RFC PATCH v11 12/29] KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory Content-Language: en-US To: Sean Christopherson , Paolo Bonzini , Marc Zyngier , Oliver Upton , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Matthew Wilcox (Oracle)" , Andrew Morton , Paul Moore , James Morris , "Serge E. Hallyn" Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Peng , Fuad Tabba , Jarkko Sakkinen , Yu Zhang , Vishal Annapurve , Ackerley Tng , Maciej Szmigiero , Vlastimil Babka , David Hildenbrand , Quentin Perret , Michael Roth , Wang , Liam Merwick , Isaku Yamahata , "Kirill A . Shutemov" References: <20230718234512.1690985-1-seanjc@google.com> <20230718234512.1690985-13-seanjc@google.com> From: Xiaoyao Li In-Reply-To: <20230718234512.1690985-13-seanjc@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_BLOCKED,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 7/19/2023 7:44 AM, Sean Christopherson wrote: > @@ -5134,6 +5167,16 @@ static long kvm_vm_ioctl(struct file *filp, > case KVM_GET_STATS_FD: > r = kvm_vm_ioctl_get_stats_fd(kvm); > break; > + case KVM_CREATE_GUEST_MEMFD: { > + struct kvm_create_guest_memfd guest_memfd; > + > + r = -EFAULT; > + if (copy_from_user(&guest_memfd, argp, sizeof(guest_memfd))) > + goto out; > + > + r = kvm_gmem_create(kvm, &guest_memfd); > + break; > + } Does it need a new CAP to indicate the support of guest_memfd? This is patch series introduces 3 new CAPs and it seems any one of them can serve as the indicator of guest_memfd. +#define KVM_CAP_USER_MEMORY2 230 +#define KVM_CAP_MEMORY_ATTRIBUTES 231 +#define KVM_CAP_VM_TYPES 232 or we just go and try the ioctl, the return value will tell the result?