Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp169879rwo; Fri, 21 Jul 2023 10:02:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlGd3Qt+68KmlUHWK88AaKJLLaPCUrOYvz5ALAEjwgb+5OrJs7GBCK0FboWUH/4Xg0GtD/sN X-Received: by 2002:a05:6a20:cd:b0:137:7add:b7cd with SMTP id 13-20020a056a2000cd00b001377addb7cdmr2607088pzh.17.1689958943287; Fri, 21 Jul 2023 10:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689958943; cv=none; d=google.com; s=arc-20160816; b=rsZe8Unuh8UYPJKECUetUvIWLo6kT8nxDlBRNl3/xzlJdpLmx01FT5PWTx/dm2Zq8Z K8zfSbdVluwy0ksuyWLbbEM4wb5FOh4trmSluHloo/6qaZjjoryIOQtebz0RcXKziDHM YKV3ksNHrSjwB0o7pRW8zj34R9cQTBoqPs9t7a2UD7+7BFNS4zN+xyyLGzlzZ29iF8tH V1fxw+mMNbsZB/hrTsD4hrBdAHaluOs6JRtJnMz9tejOLZyhORBlSkn011h1W27ifxL6 VqhUE0il21SclGapeMYozyQBhREliEMnD0/ih3IXp21rRW9F+Me2obGVMCppG5jgXXP6 rKMw== 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=u2QTvHpsphu6fVKinaQ98USt3OI1DUIGOu0ZYUs8Xws=; fh=DMhChBLtZGLVu8ofPru04YrCq9B96cGIpqNZD/m8c74=; b=GtbNKTIKiLBpfaHx0TVUiAj68jaXRE2rqRJ5ETTDRGd2T5dXMr+x9bbURvvThmD+gt S+7ODWTcHWliSvVb6cZFpSIJt+LYZJDfM4WlrSydkNOdagCIVviGi7iAk96Nj64pAWMF i9HeBtcp8LTjF4U1oBxxvtK66GK0oGO8S1jgWzWmL38EwlUbPsg7SgZ5chthVVRpzAL3 L8IYchvYukw2zYBmldkxPa9vpre78y8txmJQsIA3L0XT8HnO8WLUvARtcH0JKE3G7dGE 9V5/nawsVJ3vV5kr+5fuKpjlXNNNYWSyH78WJxIUpoSUkyQYfG5+2h0RgyHt7gFFKuXy OdZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mALJtu7L; 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 p3-20020a634f43000000b0055baed7e7e9si3366452pgl.653.2023.07.21.10.02.02; Fri, 21 Jul 2023 10:02:23 -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=mALJtu7L; 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 S231159AbjGUP47 (ORCPT + 99 others); Fri, 21 Jul 2023 11:56:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231910AbjGUP4x (ORCPT ); Fri, 21 Jul 2023 11:56:53 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E028930DD; Fri, 21 Jul 2023 08:56:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689955011; x=1721491011; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=JA5Qpp5YniYsJOdvvzjD9DRgmiiQbKmX74OklM/B+X4=; b=mALJtu7LjeM0JcR8onfUefKFAbQQo3Xx1NPkCAqN8d9ulOGGRixej3bR 9RNyBjpI4q2wEWGslD3X8VdZlP1cLEk5pjMQsPQ9v8y7bI9pHwm/NFtIu bNPKl1B+0tZnUGh36Ccu7PIvf5rBfvfT6ueje5L+K6i5XyjxWjoOxMu/4 Bfq6I7Hin3vVbNnrvtBatmqhjFPd5gaEv16cej4X5mB6+/DUE3G/n6a0V UqhE7WJ4UF1DBn0fNMSDGCchjB//u/WgRy3TukYfh9ELl89YUPs/pn+n/ OZ8ZESW7qIluzxo4RloTeD9ZAjuZDluIQx53zdmjX4kOW4riWZPqrPZEy Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10778"; a="351933271" X-IronPort-AV: E=Sophos;i="6.01,222,1684825200"; d="scan'208";a="351933271" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2023 08:56:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10778"; a="795008982" X-IronPort-AV: E=Sophos;i="6.01,222,1684825200"; d="scan'208";a="795008982" Received: from xiaoyaol-hp-g830.ccr.corp.intel.com (HELO [10.93.6.77]) ([10.93.6.77]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2023 08:56:40 -0700 Message-ID: Date: Fri, 21 Jul 2023 23:56:36 +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 08/29] KVM: Introduce per-page memory attributes 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-9-seanjc@google.com> From: Xiaoyao Li In-Reply-To: <20230718234512.1690985-9-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,URIBL_BLOCKED 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: > +4.140 KVM_SET_MEMORY_ATTRIBUTES > +----------------------------------------- > + > +:Capability: KVM_CAP_MEMORY_ATTRIBUTES > +:Architectures: x86 > +:Type: vm ioctl > +:Parameters: struct kvm_memory_attributes(in/out) > +:Returns: 0 on success, <0 on error > + > +Sets memory attributes for pages in a guest memory range. Parameters are > +specified via the following structure:: > + > + struct kvm_memory_attributes { > + __u64 address; > + __u64 size; > + __u64 attributes; > + __u64 flags; > + }; > + > +The user sets the per-page memory attributes to a guest memory range indicated > +by address/size, and in return KVM adjusts address and size to reflect the > +actual pages of the memory range have been successfully set to the attributes. > +If the call returns 0, "address" is updated to the last successful address + 1 > +and "size" is updated to the remaining address size that has not been set > +successfully. The user should check the return value as well as the size to > +decide if the operation succeeded for the whole range or not. The user may want > +to retry the operation with the returned address/size if the previous range was > +partially successful. This does not match with the implementation. Please fix either one to make them consistent.