Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1451045rwd; Thu, 8 Jun 2023 19:02:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6GvvUmXCfToV/FEzBlIQJa628F3GxlbgL2QiR3jePHvFgVTDScMlCiad1y3ahYVlF+/1LU X-Received: by 2002:a17:902:7594:b0:1ad:bc86:851 with SMTP id j20-20020a170902759400b001adbc860851mr19284pll.45.1686276121053; Thu, 08 Jun 2023 19:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686276121; cv=none; d=google.com; s=arc-20160816; b=WQahpbeFvGSgccSWvKy2K2sr8ZyjpLfi2kbIMFTSAJd7kFSPJOGumb7pn/R4eDKo20 Qocf3hLwRjBwjX825vuwqf9oiNdoyRP997RinIjg6PzgruPsmKj5d4gppP2pCArNkEeq INuKfYXJdvccnrzGi7khaiY8KpeBVAguFBuBn1iZhc9mvRzLviU114vBrawugBZSpH0v 83OHbW8uCSzpyYMlblWbXtO270lyTmpWLcxJMbvNggDkORnX6ioUM187PrmERmGMrpYI e6ZGw+FCeFqJs11dGdEbL5hu3HW4P3c0AuVd8YK9VqUiuFcKJOliIQ5Z61Lj6Dgwctwz p6gg== 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=054mTRUxEPdtrb7ivXoRErsU3vYGjbAVch0JPzI16Wk=; b=eFaFfdOgAEgYVTP+sEd2mbwbEX/0UH3WWWAD+kPjsgBBP+qsKwtIEH/JHanD3At9Qp 8M1Y1S3tBN5GkkUgPVV/uLwIA5RkZexG+01b8Xy1IcONUFrbpRoeQx4RkDc04kiMI2GR 0k5hvHL3RHTSVRXWXXnlX1YB2YfEFYX1NPn/PdgQ9ivSwYah4w2Qhb3MLeP2Bu8Md56q AQQPsoVsmgJX7sPRwWUOrj8/keZ8707XBY/8WJ1dzr/hz55U5ShBVkxR7h4aXIw2p5pR M0s2Mk7KPy4ueoXPfi3GwuEcOcD86KlX4FvdRgb0eGLdO3eIEJlkBms8VrcFfTDaqHpy gsaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=mzyv1nhS; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kz6-20020a170902f9c600b0019cec50618csi1855389plb.159.2023.06.08.19.01.45; Thu, 08 Jun 2023 19:02:01 -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=@gmail.com header.s=20221208 header.b=mzyv1nhS; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237785AbjFIBdw (ORCPT + 99 others); Thu, 8 Jun 2023 21:33:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230094AbjFIBdu (ORCPT ); Thu, 8 Jun 2023 21:33:50 -0400 Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6A4A2D4F; Thu, 8 Jun 2023 18:33:49 -0700 (PDT) Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-38e04d1b2b4so226183b6e.3; Thu, 08 Jun 2023 18:33:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686274429; x=1688866429; 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=054mTRUxEPdtrb7ivXoRErsU3vYGjbAVch0JPzI16Wk=; b=mzyv1nhSqrQtWMqZ19Pfy7kurBOadwl8rtQunFwidyCXYv6u8yxOzuoszSWeRTY41P emftQ91W0R5azu4U5di8nXjR9q4wyR6lZwIL5ETJ2ZuFttgs2PCsN3Ta2Fr+behXZ/I0 zbAXi8+GTKq8MHROIs0qrna3vLTCLrUZiWavTasmVHKiiasrcB/jnyGCKYfDG8M6NJyv Et1hMRpKMB/RFn44WexRTr6foYRzN7tec51mgecJTQ6Fh6eF+IPnPvXc4sRiZPi15Cut yTYN8NiPej0aVRl/4IPFMbYKDTrE/Ao1jUks1TtguVr2uQhW5Ot3MIwZgua9aO8CL28T qW1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686274429; x=1688866429; 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=054mTRUxEPdtrb7ivXoRErsU3vYGjbAVch0JPzI16Wk=; b=F6+aydbfLkcMdIlPt1xY3onWpcF/C2GFHQqvNEp1ea6YWECbjUmYhoEJ+yatwIQ727 YhB0zasgd0etJuYEc8HpKv13izPkyukfCe40AHynLSjdslMvYv7IbxxZ+el+H9Bhti30 Hqc9K1WMvDsU6QitspCtssPl6vXf8vDTs/rkKEQRlNGVv1Nse9hHpoVvmJtxwSECi7C9 EvsD/nMSXjMiY7GGrzVoylCewUiPTXSaY58QlWdn0g5W0bkUdDZKhRAFP5ceSZh6qfXZ 7r+CiFdMbThjqDM0HrG0EOvTFkv5NCnQThVh4pk5A/mVaxmLYW7T2KJMb2sGie2uu5P3 QfOw== X-Gm-Message-State: AC+VfDw4e91s+iwJIT+Yys89Tq097WSGUKJyF5arWszhOJ1nnBpg3hh/ wCQkh7VJ4U7oNovw67Svoq1WZvlog/THyw== X-Received: by 2002:a05:6808:21a4:b0:398:36ac:44f1 with SMTP id be36-20020a05680821a400b0039836ac44f1mr269529oib.7.1686274428982; Thu, 08 Jun 2023 18:33:48 -0700 (PDT) Received: from localhost ([192.55.54.50]) by smtp.gmail.com with ESMTPSA id g16-20020a17090a7d1000b00259e553f59bsm2052031pjl.20.2023.06.08.18.33.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 18:33:48 -0700 (PDT) Date: Thu, 8 Jun 2023 18:33:46 -0700 From: Isaku Yamahata To: "kirill.shutemov@linux.intel.com" Cc: Isaku Yamahata , "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" Subject: Re: [PATCH v11 08/20] x86/virt/tdx: Get information about TDX module and TDX-capable memory Message-ID: <20230609013346.GN2244082@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> <20230608232919.GM2244082@ls.amr.corp.intel.com> <20230608235441.olqpkrwzu2hplepa@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230608235441.olqpkrwzu2hplepa@box.shutemov.name> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Fri, Jun 09, 2023 at 02:54:41AM +0300, "kirill.shutemov@linux.intel.com" wrote: > On Thu, Jun 08, 2023 at 04:29:19PM -0700, Isaku Yamahata wrote: > > 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. > > How KVM gets it from here? For now, TDX KVM patch series moves the tdsysinfo out of the function, and add a getter function of it. As long as KVM can access the info, it doesn't care how its memory is allocated. static or dynamic. -- Isaku Yamahata