Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4502951imw; Tue, 19 Jul 2022 07:50:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tdZzSyaRfINR/6QGNfrxa3lReD5AIzrD1FgI01UVcLp49aoRmvQVCbbHQASBvnkrZFZVsp X-Received: by 2002:a17:902:7049:b0:16c:b1f4:e00e with SMTP id h9-20020a170902704900b0016cb1f4e00emr28703312plt.113.1658242212018; Tue, 19 Jul 2022 07:50:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658242212; cv=none; d=google.com; s=arc-20160816; b=kIuxBRhLq8I3w6wtsF6CmgcKCHxubcB33RFXk4DWIa1DnuT2ikksz05LCgOJn164mn EVmVcFve+KQ6FUb3+yW6gdmQWEeV6XZ2zHu9BC/jN+u0WT8C8LhVPamU5c8xFy5s33NB rixQmFf7AT4V3riMjLTYdBCc4aZE2XCRFLS0FBAJZNfHonjXc4kj1eUZG7PALXv3ULa3 rJ1Z+HavRC04dLk01o8xjx2ymtCGCVJkf5lf0CIDHcvblChaHjKWHGnFPJqzIZtbvTXj Zm0EKiRocuWQxRxULvCnPY4pjpImM9dXMji8rnY7r6JB0ISAsbkviaKY/2JhAvnRQvPo ucCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=rwdeFKVPUuOBakf6ZqpYMe7Er/6fZBwzs6Z/OaKnR+A=; b=vpI1FVx8WDExxYooWNZNgnbqY6wf+eSsOqdsVynCDWDTSwvTzCemhCX0ygpYmslAjE Y3+xL04f8khgpC2vMR4rZHMHyY/I5WzRFxGnGzdFPNMgJ2rxC7PBkqc12/Ft+3aHm4bV 3Mwj0hgej2JbTFwbjuzKypMzw7GG1hGEgr5rfjeq7oZYOyCqtwks6ugSBMcJV4+M3cxW GqshkXaBeSlx++ctVSsKUk7TdCXaG8jbeEL+VsUVLfrn1pVLxSnmchNexvUvJjQ3G7PA HG5GkEFav5Jx4rC0n9FQTYFEmJhfbkg+oR5ICIonW0wiYTcddB3TYLHtq8NcMU3U9gYJ 8jow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OzzfxIk0; 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 18-20020a631552000000b003fe22d6bdc4si19629655pgv.802.2022.07.19.07.49.56; Tue, 19 Jul 2022 07:50:12 -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=OzzfxIk0; 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 S237937AbiGSObE (ORCPT + 99 others); Tue, 19 Jul 2022 10:31:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239667AbiGSO3p (ORCPT ); Tue, 19 Jul 2022 10:29:45 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7273161B1F; Tue, 19 Jul 2022 07:17:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658240264; x=1689776264; h=date:from:to:cc:subject:message-id:reply-to:references: mime-version:in-reply-to; bh=uCiOnx7XhlhIdPTfR9PaYhGj+08ZCZ+aPucYOLw91eY=; b=OzzfxIk0a+IGaEkdENZ8GOJ0xXoWWjSt7xK9IOEN6umzrYBSCDXMqCBV aBFucqvgSeS1mk9zaPmZn9Sa+57cbgvT8bwAMNsYP1V0UXwi1pJPFwbZB AZdHjoLHdHcgfBBAcVIrfmkeXvlE8YUt7Z37jiR7k4wspDU6D2gXEkPlq /1zgyN5PMFKMefTfwqWQ2mzE+QBRsIwrpJ5gULnNtA/9rv++l3JU+5loD MSRs4eHjdpdesroG5ym1A71mzr616YEFm8qOIBEBfvralXIkDvcJdXcR3 JmLhnsDBf0iceZuc6kBwGDg9BtaDjBerWKjWAKV0IUxEzV2hoHmYONnNF g==; X-IronPort-AV: E=McAfee;i="6400,9594,10412"; a="287247161" X-IronPort-AV: E=Sophos;i="5.92,284,1650956400"; d="scan'208";a="287247161" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2022 07:17:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,284,1650956400"; d="scan'208";a="655777767" Received: from chaop.bj.intel.com (HELO localhost) ([10.240.193.75]) by fmsmga008.fm.intel.com with ESMTP; 19 Jul 2022 07:17:33 -0700 Date: Tue, 19 Jul 2022 22:12:43 +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 13/14] KVM: Enable and expose KVM_MEM_PRIVATE Message-ID: <20220719141243.GB84779@chaop.bj.intel.com> Reply-To: Chao Peng References: <20220706082016.2603916-1-chao.p.peng@linux.intel.com> <20220706082016.2603916-14-chao.p.peng@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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 Tue, Jul 19, 2022 at 11:55:24AM +0200, Gupta, Pankaj wrote: ... > > @@ -4712,12 +4813,10 @@ static long kvm_vm_ioctl(struct file *filp, > > (u32 __user *)(argp + offsetof(typeof(mem), flags)))) > > goto out; > > - if (flags & KVM_MEM_PRIVATE) { > > - r = -EINVAL; > > - goto out; > > - } > > - > > - size = sizeof(struct kvm_userspace_memory_region); > > + if (flags & KVM_MEM_PRIVATE) > > + size = sizeof(struct kvm_userspace_memory_region_ext); > > Not sure if we use kvm_userspace_memory_region_ext or kvm_user_mem_region, > just for readability. Somehow, but majorly for code maintainability, kvm_user_mem_region is designed to be the alias of kvm_userspace_memory_region_ext so in the code we can access the 'unpacked' fields using something like 'mem.usersapce_addr' instead of 'mem.region.userspace_addr'. Chao > > > + else > > + size = sizeof(struct kvm_userspace_memory_region); > > if (copy_from_user(&mem, argp, size)) > > goto out;