Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5171544rwi; Mon, 17 Oct 2022 16:54:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM575rTU7U9O65cBk4nWM/jgFp7Yza0Rayzx4yq3N3E1SY5l2b0f0JbNeKULFgvBlKwsuhwt X-Received: by 2002:a05:6402:2d8:b0:458:c152:67bd with SMTP id b24-20020a05640202d800b00458c15267bdmr172748edx.308.1666050861801; Mon, 17 Oct 2022 16:54:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666050861; cv=none; d=google.com; s=arc-20160816; b=dpWoBAPbpB9d8y2lNW8i131qYZbHGjYVS7TeiJqR20VPDGhqo1+fkLk7MnfZwBMmg2 nVsJEkMwVH+ocUoDuQDQ3PSXUM4bwkfjpmx1hU82iuhVl3iBBcvjRTyRNYZ0y5JXhNFT AG1z8ulo6+qiwXoePo8ZtBmend1dAub8Ys9uIB380bA57+yedtqyEVn9S+60mlWXlE3Y sjoFSEkRbEK829uWjOxmVPwkQBxhKg7vJ++jO9t+BuAKnSIaui4dEZwoY5mELf2Slmka 1JMg1g9w+rk1mzD4AmxmRj68vtFAfNp27G+uLzHo7V928A0EZWNwuG2I8c+536j+UPy5 LWMw== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=TrR1U1OdGGBTNU+L/j5+q/HQQR5gcpgDZtfvTOOBt0M=; b=KvMOGUlDIyFeT2QvSf6QP8xWxfCiE9A8dxTlT4I0+49rp5w5e4X5jWiAiM1pTXyGcp RNcMQjbvvgeSNoxegVVTZ6rmY3bYKRVQ5hx+eE1dwCNqcuoYS4lskAWMf7zYDcZujWPW afLFGVbcaKMTdp+p2dco0LT+kvtIK05AOTh1we1sA6XDqW0gzgatklYplu5n6ciA/Jks k2FG7TOPrxgcGL7xh1y7lLT+qIYfIphLLUFHogI+xQKNRNZdN5IInV63wfHYRzydIa7V Xyd+Ww7sLt9+j/nFaN0sh1XY7u0kuYvlgTmy88WRHJcNwCM9dJwucaUEpzRYbAktsG3S 9XZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Pa9UF6Hi; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cx13-20020a05640222ad00b00456c221ffd5si9579577edb.478.2022.10.17.16.53.56; Mon, 17 Oct 2022 16:54:21 -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=@google.com header.s=20210112 header.b=Pa9UF6Hi; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229660AbiJQWRy (ORCPT + 99 others); Mon, 17 Oct 2022 18:17:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229984AbiJQWRw (ORCPT ); Mon, 17 Oct 2022 18:17:52 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6156C6C96D for ; Mon, 17 Oct 2022 15:17:50 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id gf8so12219117pjb.5 for ; Mon, 17 Oct 2022 15:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=TrR1U1OdGGBTNU+L/j5+q/HQQR5gcpgDZtfvTOOBt0M=; b=Pa9UF6Hi2q1b744+/zFgnMjVA7j2pgI5ymLqfYIjscYUAYCF5ZXYRaOr8OH7B7Xd9F /HznXiV0rMC5mH6t0PX9UTIUMnvfTMra5P8j8/Err3N0tWueZMfcGzGtxNdF72RRSt7o NHpkNbOoj5ABhkcBEje6If6JGJVChr/yUqpTjUi6oHUQYtvQcn2Qq0A0mMJRwm7jwCpU txbpSRtq6Deb3lMYIB2V2HXjwUD/dBV3FD8oYF4YSQczKnAO+mdCYqOZu/+92E+l+c3z qnP5v2XAfcbbMH4rprLDtpkgxOqarwr2vDP6sOEKWp3p6bnA4ZtbMgRsXFz+JSka9OPZ iKaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=TrR1U1OdGGBTNU+L/j5+q/HQQR5gcpgDZtfvTOOBt0M=; b=Unob49Lr6+7FsKg4vBa9leMZxp9FgDsuM/S4kYWHDmZl0h8iLuoeygUNMTpz3kZLLq aZBo1rdxDFORP1LHSlZiMTazJ1jroEbKYj+vtpWrzjyEjB7QPI0OxquaAncTXZfga5jV fq80mjFdbGE4gdanmlDidS/hnE8o5MtlW7IY6/NCOEHRrXcMn/K0rB9KBpPiWVUYXVl8 Sb3beutF86f/lfbxc7N676Q6aN56nSJCW0DJo3GJZvbc0IfDEdDe7STm01gasozrQcIV x+BfExNt8C3aFdCV4Ko6HYK1UJ8eg/B1x+IdYJFJFDSe/WL8a8Hq1lXk/CNGWESoYPyq PSKQ== X-Gm-Message-State: ACrzQf2oJRMteSwbngA84ulrR9vu/bFr8abWAA0TAq1TE1cM2xFQBB3s leN3m2hC9/5c342M81LiRhchKQ== X-Received: by 2002:a17:903:1c2:b0:185:47ce:f4d2 with SMTP id e2-20020a17090301c200b0018547cef4d2mr14097565plh.101.1666045069741; Mon, 17 Oct 2022 15:17:49 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id p13-20020a17090a74cd00b0020ad46d277bsm9992889pjl.42.2022.10.17.15.17.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 15:17:49 -0700 (PDT) Date: Mon, 17 Oct 2022 22:17:45 +0000 From: Sean Christopherson To: Fuad Tabba Cc: Chao Peng , 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, Paolo Bonzini , Jonathan Corbet , 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 , wei.w.wang@intel.com Subject: Re: [PATCH v8 5/8] KVM: Register/unregister the guest private memory regions Message-ID: References: <20220915142913.2213336-1-chao.p.peng@linux.intel.com> <20220915142913.2213336-6-chao.p.peng@linux.intel.com> <20221012023516.GA3218049@chaop.bj.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Mon, Oct 17, 2022, Fuad Tabba wrote: > Hi, > > > > > +#ifdef CONFIG_HAVE_KVM_PRIVATE_MEM > > > > +#define KVM_MEM_ATTR_SHARED 0x0001 > > > > +static int kvm_vm_ioctl_set_mem_attr(struct kvm *kvm, gpa_t gpa, gpa_t size, > > > > + bool is_private) > > > > +{ > > > > > > I wonder if this ioctl should be implemented as an arch-specific > > > ioctl. In this patch it performs some actions that pKVM might not need > > > or might want to do differently. > > > > I think it's doable. We can provide the mem_attr_array kind thing in > > common code and let arch code decide to use it or not. Currently > > mem_attr_array is defined in the struct kvm, if those bytes are > > unnecessary for pKVM it can even be moved to arch definition, but that > > also loses the potential code sharing for confidential usages in other > > non-architectures, e.g. if ARM also supports such usage. Or it can be > > provided through a different CONFIG_ instead of > > CONFIG_HAVE_KVM_PRIVATE_MEM. > > This sounds good. Thank you. I like the idea of a separate Kconfig, e.g. CONFIG_KVM_GENERIC_PRIVATE_MEM or something. I highly doubt there will be any non-x86 users for multiple years, if ever, but it would allow testing the private memory stuff on ARM (and any other non-x86 arch) without needing full pKVM support and with only minor KVM modifications, e.g. the x86 support[*] to test UPM without TDX is shaping up to be trivial. [*] https://lore.kernel.org/all/Y0mu1FKugNQG5T8K@google.com