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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C670FC83003 for ; Thu, 8 Jun 2023 23:29:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237132AbjFHX33 (ORCPT ); Thu, 8 Jun 2023 19:29:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229653AbjFHX3X (ORCPT ); Thu, 8 Jun 2023 19:29:23 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5787030F0; Thu, 8 Jun 2023 16:29:22 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-65311774e52so905951b3a.3; Thu, 08 Jun 2023 16:29:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686266962; x=1688858962; 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=6RGbjUYsdaohPZQXqH0ffB3I+/zH7l+P+guRk55pY3o=; b=GKUqaxYpA9sPWVTJUqhY/WvUJd0oMJh68pPhWRdgURVT0nWmLLk+PH0CZGMNu9NA5Z bRiLFi1+g5t3OToeIuLBoxouHAfU/mDzBROQ7M/Tsef1mypcXnCe8LHxoBxLOrnM6ZbM 4qfiJ87XgvvzdG45loNAZ4ywZD1ZcvLtxj+IIyoilamuFhZLXVq+SmbFp1cwklOXpCuI yEEPvPJpyQ5KGkMGD6k2sp8h4rNxvLBHg68PEehqHNEXuLkCIioiOmhVzjyKekLNCh4n fp6Ni/Frzf10PCiBBZbi7+BkpecMiiJJcRMZP40H3H/+HasliRX+d3grVqDxmZpSIs9v CZKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686266962; x=1688858962; 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=6RGbjUYsdaohPZQXqH0ffB3I+/zH7l+P+guRk55pY3o=; b=MiE5LnXODgV5mhJxBZDTIka27DotXVcxRQFyg6FKH3EK7TJCtTqzNTe4h4IWUFMhmI PvlBd5FNYtXfr8GqonUNF9hNfemc0gjtPoDD+SFM+ArbtUtnisVuRPme684Llew5o+N3 +FFHbxAJOCOVrQxawwYFyu7pHWIiGtvO3UdV3LCAa7EtoOgE5rCNvxNFnhKUralf2VAp +YPGUhS+OAvDwoB5AK9W9T98ryZ+LY4wTFXaLB8j4SK7oE91YqLKBHykevFvBgMSq/22 s34BE5PLegLgGfVoy39h/wuThp+6P4arovCfDkpJ3xJXpxNG71GRDtq5+Tzp4TuXOgQp +FDw== X-Gm-Message-State: AC+VfDxOd0Pxg0fgTEQvOJwyrZ7dcebMBrGhu1dfGdw2579MeVxFGBSl aN2StNjsSV2ElSW9MHegiS0= X-Google-Smtp-Source: ACHHUZ5BemoIUtUyIQMWaimD9moPUg4gS1XMy0WBlsJ68BJAUvGHQpvMYcO3s/oFNl28ctNzJaryZw== X-Received: by 2002:a05:6a20:e617:b0:105:dafa:fec2 with SMTP id my23-20020a056a20e61700b00105dafafec2mr4523293pzb.53.1686266961618; Thu, 08 Jun 2023 16:29:21 -0700 (PDT) Received: from localhost ([192.55.54.50]) by smtp.gmail.com with ESMTPSA id q24-20020a62e118000000b0063b85893633sm1535576pfh.197.2023.06.08.16.29.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 16:29:20 -0700 (PDT) Date: Thu, 8 Jun 2023 16:29:19 -0700 From: Isaku Yamahata To: "kirill.shutemov@linux.intel.com" Cc: "Huang, Kai" , "kvm@vger.kernel.org" , "Hansen, Dave" , "david@redhat.com" , "bagasdotme@gmail.com" , "ak@linux.intel.com" , "Wysocki, Rafael J" , "linux-kernel@vger.kernel.org" , "Chatre, Reinette" , "Christopherson,, Sean" , "pbonzini@redhat.com" , "tglx@linutronix.de" , "linux-mm@kvack.org" , "Yamahata, Isaku" , "Luck, Tony" , "peterz@infradead.org" , "Shahar, Sagi" , "imammedo@redhat.com" , "Gao, Chao" , "Brown, Len" , "sathyanarayanan.kuppuswamy@linux.intel.com" , "Huang, Ying" , "Williams, Dan J" , isaku.yamahata@gmail.com Subject: Re: [PATCH v11 08/20] x86/virt/tdx: Get information about TDX module and TDX-capable memory Message-ID: <20230608232919.GM2244082@ls.amr.corp.intel.com> References: <50386eddbb8046b0b222d385e56e8115ed566526.1685887183.git.kai.huang@intel.com> <20230608002725.xc25dantcwdxsuil@box.shutemov.name> <19ea7470e9d6fa698f9ad7caff3279873e530a0b.camel@intel.com> <20230608114128.vu75wlcojpyjak22@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230608114128.vu75wlcojpyjak22@box.shutemov.name> Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Thu, Jun 08, 2023 at 02:41:28PM +0300, "kirill.shutemov@linux.intel.com" wrote: > On Thu, Jun 08, 2023 at 02:40:27AM +0000, Huang, Kai wrote: > > On Thu, 2023-06-08 at 03:27 +0300, kirill.shutemov@linux.intel.com wrote: > > > On Mon, Jun 05, 2023 at 02:27:21AM +1200, Kai Huang wrote: > > > > For now both 'tdsysinfo_struct' and CMRs are only used during the module > > > > initialization. But because they are both relatively big, declare them > > > > inside the module initialization function but as static variables. > > > > > > This justification does not make sense to me. static variables will not be > > > freed after function returned. They will still consume memory. > > > > > > I think you need to allocate/free memory dynamically, if they are too big > > > for stack. > > > > > > I do need to keep tdsysinfo_struct as it will be used by KVM too. > > Will you pass it down to KVM from this function? Will KVM use the struct > after the function returns? KVM needs tdsysinfo_struct to create guest TD. It doesn't require 1024-alignment. -- Isaku Yamahata