Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4870878rwb; Tue, 17 Jan 2023 06:35:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXuxMZCWhXnLgmttZL2z7t2VVm6xYb0ijPQny+oUtuL/JBrIeJI8APyrdaPW01rO/msz9aYj X-Received: by 2002:a05:6402:1f85:b0:45c:835c:eab7 with SMTP id c5-20020a0564021f8500b0045c835ceab7mr3444565edc.37.1673966111160; Tue, 17 Jan 2023 06:35:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673966111; cv=none; d=google.com; s=arc-20160816; b=XoriuDwdrdbNA4DRNc9DX7HXNkJG5nIrzCndGczTYsvpDQ3q18cCqEeRU/14EyJPDa Rti+9AUy9bOwD4BHKPEnapcqAR3CvtyEbmJev4JjvZslf8NJwcDr4u0Op4nqrlSqX9uH RdtSXapR13eo6JitcIyqKwV+nCPT7ridmjMniaGhjQ2JuaAai4c7c6OnrlXfDid9s1Qb dQsZsJiYN+VcgN7dKThnI/zy07oByZPqbYKJ6a9SpF+G8/6773oQQTUfs8n/V++OAXVR 3e+tgXR+UBvANVES6addwKPbz879KtKWaH4PMk5QL77ki2OVj3BtlyWMVkGTLECJfA+h bQGg== 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=nfWfqKr/PVzcb/oJc3L8XNTuez212taZGy6pj2oYdLY=; b=FroPsReXV9qA+p0EsOZy5tfIygI3GMNsHoW/AS7gkMmPlu3PGH5wgBnPAFE9NsrXj2 mqu+ksmwubLdqOlQ8lVW6td5QUSC6zwoIPVfYbKIDxhQRxZ2if9HLKEAPTsQ9llVjF4V klrOtqvv183Nu6lsIi7kliC6yUXcUjd3rgihrWBRMLk/5TyYzrI5zLusGpU5+487Qg+9 u2ehWWyEAK/1DSGxQXuH07Ki/xdeKIw6MGX9huVGLLkTIm3k5LWAIlEnArExzMrx/0GR lV8uQAcraP6BPk0IQw3nQ0B42eMWfBvUtdRPTJoxtSOhi6tT4C2V5+9YqnrzZWUUyiHa 18PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FVs309ql; 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 cs10-20020a0564020c4a00b00499cf6bd2fasi22157315edb.66.2023.01.17.06.34.59; Tue, 17 Jan 2023 06:35:11 -0800 (PST) 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=FVs309ql; 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 S229642AbjAQNio (ORCPT + 48 others); Tue, 17 Jan 2023 08:38:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229673AbjAQNie (ORCPT ); Tue, 17 Jan 2023 08:38:34 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 477EB59C6; Tue, 17 Jan 2023 05:38:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673962713; x=1705498713; h=date:from:to:cc:subject:message-id:reply-to:references: mime-version:in-reply-to; bh=1YxIhrDQKE2lDqlUyO/ARVgD5QjeSGAHzdlrkVl5mCo=; b=FVs309qlXE78B/GssbtiD3lcrLHRsXs0LWTpSX3bPI1VX5MnhjUqEIyK QJP44sF2pnZSLspTukaj9oFzkmWPYZs3egj9PjEHMp9FwXrtSlaw6bh0R zuaJ0c0tz0Wpy8vbZwPYZi7J/IEz7OIRGv23X16xlv9gHmII35eDXs09H AA6G/MZqhrLlu1MmC1ZWljcI0i6v3EuwGGflRY8N5YV8TjTfiXQxShVxj VswTR/Vo1DTBFZubbZyH7zsITbqoxlUgBG8I2rgZ+/L6Y6YZtzz36AwK1 gyxy9TC4vkKGuug6kKK9iG3tV8jjTys5v09lApvjGZ24gjyZ//07LfFWg g==; X-IronPort-AV: E=McAfee;i="6500,9779,10592"; a="324748849" X-IronPort-AV: E=Sophos;i="5.97,224,1669104000"; d="scan'208";a="324748849" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jan 2023 05:38:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10592"; a="783240137" X-IronPort-AV: E=Sophos;i="5.97,224,1669104000"; d="scan'208";a="783240137" Received: from chaop.bj.intel.com (HELO localhost) ([10.240.192.105]) by orsmga004.jf.intel.com with ESMTP; 17 Jan 2023 05:38:03 -0800 Date: Tue, 17 Jan 2023 21:30:15 +0800 From: Chao Peng To: Binbin Wu Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, qemu-devel@nongnu.org, Paolo Bonzini , Jonathan Corbet , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Arnd Bergmann , Naoya Horiguchi , Miaohe Lin , 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 , tabba@google.com, Michael Roth , mhocko@suse.com, wei.w.wang@intel.com Subject: Re: [PATCH v10 2/9] KVM: Introduce per-page memory attributes Message-ID: <20230117133015.GE273037@chaop.bj.intel.com> Reply-To: Chao Peng References: <20221202061347.1070246-1-chao.p.peng@linux.intel.com> <20221202061347.1070246-3-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=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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, Jan 17, 2023 at 11:21:10AM +0800, Binbin Wu wrote: > > On 12/2/2022 2:13 PM, Chao Peng wrote: > > In confidential computing usages, whether a page is private or shared is > > necessary information for KVM to perform operations like page fault > > handling, page zapping etc. There are other potential use cases for > > per-page memory attributes, e.g. to make memory read-only (or no-exec, > > or exec-only, etc.) without having to modify memslots. > > > > Introduce two ioctls (advertised by KVM_CAP_MEMORY_ATTRIBUTES) to allow > > userspace to operate on the per-page memory attributes. > > - KVM_SET_MEMORY_ATTRIBUTES to set the per-page memory attributes to > > a guest memory range. > > - KVM_GET_SUPPORTED_MEMORY_ATTRIBUTES to return the KVM supported > > memory attributes. > > > > KVM internally uses xarray to store the per-page memory attributes. > > > > Suggested-by: Sean Christopherson > > Signed-off-by: Chao Peng > > Link: https://lore.kernel.org/all/Y2WB48kD0J4VGynX@google.com/ > > --- > > Documentation/virt/kvm/api.rst | 63 ++++++++++++++++++++++++++++ > > arch/x86/kvm/Kconfig | 1 + > > include/linux/kvm_host.h | 3 ++ > > include/uapi/linux/kvm.h | 17 ++++++++ > > Should the changes introduced in this file also need to be added in > tools/include/uapi/linux/kvm.h ? Yes I think. But I'm hesitate to include in this patch or not. I see many commits sync kernel kvm.h to tools's copy. Looks that is done periodically and with a 'pull' model. Chao