Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp219760iob; Mon, 2 May 2022 17:35:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmMHz0I+jqJ3JuXpuisIYtjZ9w1L1UwfrBKDZaa2T5bWgrjgWVyFRLUm5+AqTbQiHE7kC3 X-Received: by 2002:a17:90b:3650:b0:1ca:a667:b17c with SMTP id nh16-20020a17090b365000b001caa667b17cmr1953523pjb.180.1651538129271; Mon, 02 May 2022 17:35:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651538129; cv=none; d=google.com; s=arc-20160816; b=Hx6qnGUo1QU4rS1Zvnn8sOmloSCAb0sqwq6lyBeOJIsXkOiMc0uGm+PdLCg6TJ5w5Y ecM03XEZULvLZvFM4+Y8Iv5EAs5S0qso0WaNWwJYqgqkZE/fiVUvdoJUY87U24g2BO2E qo6L71UUzlerXq8HlfwaaQfh1pKPKlNYQC5yqSBygtsaG4tgowGm31XICm/kDrL1KgUy h0H1Kx9BHb/OkL9JCLsSmT+h63qenQZWHSq1gYvAjRMx9pEvPynl2quzvu4tq/995H1I 8DzBN4dExgr2js0046x8mddXVkMw4S6M/bzzpZFgnJVvtLQDm4v8IXtCzEDbBHKTPbI0 nnWw== 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=wBht/QJpKirnQLRjfU3qpuPFg9KVLlBJOHxobySJY84=; b=v+Je8apr9iETOEfHhMIt0z5ccmxOYXT3Qsz1HsmkTkrQs7he1WQEfkXgQSVuSvOpMy jpVE/zVu3D9tm0VBU6xGmnvPiOgcUF3xkMLG5pp/NA7+jCPvYy8V5W6WsjzPZ7EXjCdx EiVrH8ZEX5VJsw85mPRlxrkxga2TwcS15CoYG3tc7BQeRTajjyHLRdBif8MjLNKL43lC iuZwskIdB29tz1RPhuEzsfMBpkRyPaozC+O6QT9jBPuLmFjc2JLh6+1ukFdFhY0LWATH fpCbPJdY2mB7wsy5ic500qUBbHawVD0lxLFN3f2UHRYw+Ns2CAx/LD0lkPCwQhnC2mNA NHzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=r7pzjeEk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g1-20020a635201000000b003ab45d6e89dsi15602377pgb.218.2022.05.02.17.35.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 17:35:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=r7pzjeEk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E64503BF9D; Mon, 2 May 2022 17:27:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379923AbiD2SXG (ORCPT + 99 others); Fri, 29 Apr 2022 14:23:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230109AbiD2SXC (ORCPT ); Fri, 29 Apr 2022 14:23:02 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F4E3D0A96 for ; Fri, 29 Apr 2022 11:19:43 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id m14-20020a17090a34ce00b001d5fe250e23so7975367pjf.3 for ; Fri, 29 Apr 2022 11:19:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wBht/QJpKirnQLRjfU3qpuPFg9KVLlBJOHxobySJY84=; b=r7pzjeEkU56Xb/PrhsyeDT3rj09eyhkVOOf0c9svwGplQYdNJteW3ugc9U+C8hivVT 3Mrr0tnEK/GrhuqlPEIeeQs3+x1u8NuGrbxafMRv4MHcs6KPq8HlXZAedK+JwJ1cvL5S V1mtlsbCRaz1aGXyrKHvizHqdvZTw4DHpcXI2A5x+PftjUVXFrczZzXU/MGYemogzsk3 vz37LiqE8poSl+Wp+M/APmNHWeRuSE/tTYhpsjnq2P9cUumI3ezmDpne8lCw77Yc1Au0 mxgaVRaoMfyIZHLISRiDb2E0MIAP43ZmJy/rD9V7X2XmW9swkIWlKd67VwVeY+9GwgK7 lNXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wBht/QJpKirnQLRjfU3qpuPFg9KVLlBJOHxobySJY84=; b=CLAo/1QjLqf2ziWM/fKH4vCEpj/zW5SPJXLeh8jdF5V6eDLf3atTBsJzkU5lfDCp+M SSZd+DQNRHddvvHtX8xuCBNOjxnvht5DEUajj/UhUWUvV+yVqTpwj/E2OgDvd7y4OLp6 AQhNrXCR+Kw5Zo189gHL6NTgVLrsggDBhaE7+5HUURuCI6iIoh+NRFNM9sZrAFDmoXgS UmJ30dsgupKf8BKr6rF3M2H63uCDRQerrFsVm6wlnS4s3+crwj2i9lg7dFQJAYxkhg9/ /7y0PTdScuMU0IN03dS4QQirtvSFsklFGkEr4Rh2aLWfwdf9/5ekyHhpWP0lK2G6OfWD x9lg== X-Gm-Message-State: AOAM530qTJ5YhTj2kzORVudMuqyJrhPYD5PAx8wJGKmZY30Cc9wtWWeE Aomp5Kgi20yzOESdK+YHO/Jwz6Fn2zKYjQ== X-Received: by 2002:a17:903:1109:b0:15e:7c4b:5045 with SMTP id n9-20020a170903110900b0015e7c4b5045mr641211plh.3.1651256382703; Fri, 29 Apr 2022 11:19:42 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id u19-20020a63b553000000b003c14af50616sm6518855pgo.46.2022.04.29.11.19.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 11:19:41 -0700 (PDT) Date: Fri, 29 Apr 2022 18:19:38 +0000 From: Sean Christopherson To: Dave Hansen Cc: Kai Huang , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com, len.brown@intel.com, tony.luck@intel.com, rafael.j.wysocki@intel.com, reinette.chatre@intel.com, dan.j.williams@intel.com, peterz@infradead.org, ak@linux.intel.com, kirill.shutemov@linux.intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, isaku.yamahata@intel.com Subject: Re: [PATCH v3 13/21] x86/virt/tdx: Allocate and set up PAMTs for TDMRs Message-ID: References: <3664ab2a8e0b0fcbb4b048b5c3aa5a6e85f9618a.camel@intel.com> <5984b61f-6a4a-c12a-944d-f4a78bdefc3d@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 Fri, Apr 29, 2022, Dave Hansen wrote: > On 4/29/22 07:30, Sean Christopherson wrote: > > On Fri, Apr 29, 2022, Dave Hansen wrote: > ... > >> A *good* way (although not foolproof) is to launch a TDX VM early > >> in boot before memory gets fragmented or consumed. You might even > >> want to recommend this in the documentation. > > > > What about providing a kernel param to tell the kernel to do the > > allocation during boot? > > I think that's where we'll end up eventually. But, I also want to defer > that discussion until after we have something merged. > > Right now, allocating the PAMTs precisely requires running the TDX > module. Running the TDX module requires VMXON. VMXON is only done by > KVM. KVM isn't necessarily there during boot. So, it's hard to do > precisely today without a bunch of mucking with VMX. Meh, it's hard only if we ignore the fact that the PAMT entry size isn't going to change for a given TDX module, and is extremely unlikely to change in general. Odds are good the kernel can hardcode a sane default and Just Work. Or provide the assumed size of a PAMT entry via module param. If the size ends up being wrong, log an error, free the reserved memory, and move on with TDX setup with the correct size. > You can arm-wrestle the distro folks who hate adding command-line tweaks > when the time comes. ;) Sure, you just find me the person that's going to run TDX guests with an off-the-shelf distro kernel :-D