From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00430C4332F for ; Mon, 17 Oct 2022 22:17:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 21C146B0072; Mon, 17 Oct 2022 18:17:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A4FD6B0075; Mon, 17 Oct 2022 18:17:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01DBA6B0078; Mon, 17 Oct 2022 18:17:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E34756B0072 for ; Mon, 17 Oct 2022 18:17:51 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9FEA3160F80 for ; Mon, 17 Oct 2022 22:17:51 +0000 (UTC) X-FDA: 80031854742.27.BB3879C Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf09.hostedemail.com (Postfix) with ESMTP id 040E9140033 for ; Mon, 17 Oct 2022 22:17:50 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id o21so9652065ple.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=vZK7gEJIy0b+xZ/cb5QVar2MOPFQrEz0aLjR99ROncSolZi2J9gSeF4woWH5ltImzg lzqsBXGlP4rkKVbOZnzhiWITdJZHbUCbTCLmiNl16d2c1v+0JpCPfWjr95HZ+Yq8y6zQ 6A/vntzdvBbOtR0D9UiJ7P9P1pDLcaxmDRbYfkOz/DGwyq+THrcsurM4HkFwopxznpvN NHBLqP+0/0Mv05ecseGCW7a2iiP6kx8RF8xVmgXFWk+iBoiyXZB/FzFg3FxmpWglRBVg tKT/+0bQKVVjqghIYGISNIKpT3/znw6G+nHk8M8VIH4MkrHpaapjQ10K0Fbn56QOMM3U SQ7Q== X-Gm-Message-State: ACrzQf16OoUOb8cm+PDW5FttncDN/NtnSqi2PKza9cngAZMmbaeAV/N0 GYx4hS7quni5BM1aJRDjMtA81Q== X-Google-Smtp-Source: AMsMyM5sOws5M1E82UjbITIFno8w/HG4mdjtUwGqdWDsxnzcg+d5uvozuCFcCUl9QhNTIh10tM+Etg== 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: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666045071; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TrR1U1OdGGBTNU+L/j5+q/HQQR5gcpgDZtfvTOOBt0M=; b=PjG59j/NMD0y4LaTEuxK+jFxkqgSBVYMnIfpkWolgqhKEF6pUn3PdEW8jnVY7sCXycuwWG no9KggZS9fLG0+ixU1qEL6vi+L1mi7BvtOCExkf40f4IRE3wql9Dw07ccJ3vSFiSCAQOLL VI4zBTJu7tTNGWhbLFEd8f7HPfvlBQA= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Pa9UF6Hi; spf=pass (imf09.hostedemail.com: domain of seanjc@google.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=seanjc@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666045071; a=rsa-sha256; cv=none; b=miCJi/PDNcwXK+r3BlJ0+q0y9MctsAVdpezhFzzXwHcRlqjLR1yc095PwGv0bc0XDobBD4 zwsczLcpKWkytyn3i1bBuHZaFXNQcQB4wZ1YHfVooXB62tBUucQLO8OTldJxTrBN2LlbK5 dQi0JTM/Vm1qQelUuY04yAnEg8pp8jY= X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 040E9140033 X-Rspam-User: Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Pa9UF6Hi; spf=pass (imf09.hostedemail.com: domain of seanjc@google.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=seanjc@google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: mdmdk89pnqoh1sds636h18en6naspk8i X-HE-Tag: 1666045070-608174 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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