[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <92aba287-c839-8841-a9f7-28a2c0b3097a@intel.com>
Date: Mon, 9 Jan 2023 16:47:50 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: "Huang, Kai" <kai.huang@...el.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: "Luck, Tony" <tony.luck@...el.com>,
"bagasdotme@...il.com" <bagasdotme@...il.com>,
"ak@...ux.intel.com" <ak@...ux.intel.com>,
"Wysocki, Rafael J" <rafael.j.wysocki@...el.com>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"Christopherson,, Sean" <seanjc@...gle.com>,
"Chatre, Reinette" <reinette.chatre@...el.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"Shahar, Sagi" <sagis@...gle.com>,
"imammedo@...hat.com" <imammedo@...hat.com>,
"Gao, Chao" <chao.gao@...el.com>,
"Brown, Len" <len.brown@...el.com>,
"sathyanarayanan.kuppuswamy@...ux.intel.com"
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
"Huang, Ying" <ying.huang@...el.com>,
"Williams, Dan J" <dan.j.williams@...el.com>
Subject: Re: [PATCH v8 08/16] x86/virt/tdx: Add placeholder to construct TDMRs
to cover all TDX memory regions
On 1/9/23 16:40, Huang, Kai wrote:
> On Fri, 2023-01-06 at 11:24 -0800, Dave Hansen wrote:
...
>> Also, tdmr_sz and max_tdmrs can both be derived from 'sysinfo'. Do they
>> really need to be stored here?
>
> It's not mandatory to keep them here. I did it mainly because I want to avoid
> passing 'sysinfo' as argument for almost all functions related to constructing
> TDMRs.
I don't think it hurts readability that much. On the contrary, it makes
it more clear what data is needed for initialization.
>> If so, I think I'd probably do something
>> like this with the structure:
>>
>> struct tdmr_info_list {
>> struct tdmr_info *tdmrs;
>> int nr_consumed_tdmrs; // How many @tdmrs are in use
>>
>> /* Metadata for freeing this structure: */
>> int tdmr_sz; // Size of one 'tdmr_info' (has a flex array)
>> int max_tdmrs; // How many @tdmrs are allocated
>> };
>>
>> Modulo whataver folks are doing for comments these days.
>
> Looks nice to me. Will use. A slight thing is 'tdmr_sz' is also used to get
> the TDMR at a given index, but not just freeing the structure.
>
> Btw, is C++ style comment "//" OK in kernel code?
It's OK with me, but I don't think there's much consensus on it.
Probably best to stick with normal arch/x86 style for now.
Powered by blists - more mailing lists