[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ce8923c7-a3df-470e-acb1-d12f6c47dea5@intel.com>
Date: Thu, 3 Jul 2025 07:53:05 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Adrian Hunter <adrian.hunter@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>, pbonzini@...hat.com,
seanjc@...gle.com, vannapurve@...gle.com
Cc: Tony Luck <tony.luck@...el.com>, Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
x86@...nel.org, H Peter Anvin <hpa@...or.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, rick.p.edgecombe@...el.com,
kirill.shutemov@...ux.intel.com, kai.huang@...el.com,
reinette.chatre@...el.com, xiaoyao.li@...el.com,
tony.lindgren@...ux.intel.com, binbin.wu@...ux.intel.com,
isaku.yamahata@...el.com, yan.y.zhao@...el.com, chao.gao@...el.com
Subject: Re: [PATCH 1/2] x86/tdx: Eliminate duplicate code in tdx_clear_page()
On 7/3/25 07:39, Adrian Hunter wrote:
> On 03/07/2025 17:14, Dave Hansen wrote:
>> On 7/3/25 04:40, Adrian Hunter wrote:
>>> tdx_clear_page() and reset_tdx_pages() duplicate the TDX page clearing
>>> logic. Keep the tdx_clear_page() prototype but call reset_tdx_pages() for
>>> the implementation.
>> Why keep the old prototype?
> What prototype would you prefer?
My first reaction is that there should be _one_ function that does the
erratum-related clearing. I'd rather have the KVM sites use the slightly
cumbersome paddr/size arguments than have two functions.
Worst, case, have two functions that have similar names to make it clear
that they are doing the same thing.
It is *NOT* clear that:
tdx_clear_page()
and
reset_tdx_pages()
are doing the exact same thing.
I think I'd probably rename reset_tdx_pages() to tdx_reset_paddr() and
then use it in KVM like this:
tdx_quirk_reset_paddr(page_to_phys(page), PAGE_SIZE);
The alternative would be to retain a function that keeps the 'struct
page' as an argument. Something like:
tdx_quirk_reset_paddr(unsigned long base, unsigned long size)
and
tdx_quirk_reset_page(struct page *page)
But the way proposed in this patch is very much a half measure.
Powered by blists - more mailing lists