[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <SA1PR21MB1335244866EFEB269445DBDBBF10A@SA1PR21MB1335.namprd21.prod.outlook.com>
Date: Fri, 11 Aug 2023 19:08:10 +0000
From: Dexuan Cui <decui@...rosoft.com>
To: Dave Hansen <dave.hansen@...el.com>,
"x86@...nel.org" <x86@...nel.org>,
"ak@...ux.intel.com" <ak@...ux.intel.com>,
"arnd@...db.de" <arnd@...db.de>, "bp@...en8.de" <bp@...en8.de>,
"brijesh.singh@....com" <brijesh.singh@....com>,
"dan.j.williams@...el.com" <dan.j.williams@...el.com>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
"hpa@...or.com" <hpa@...or.com>,
"jane.chu@...cle.com" <jane.chu@...cle.com>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
KY Srinivasan <kys@...rosoft.com>,
"luto@...nel.org" <luto@...nel.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"rostedt@...dmis.org" <rostedt@...dmis.org>,
"sathyanarayanan.kuppuswamy@...ux.intel.com"
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
"seanjc@...gle.com" <seanjc@...gle.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"tony.luck@...el.com" <tony.luck@...el.com>,
"wei.liu@...nel.org" <wei.liu@...nel.org>, jason <jason@...c4.com>,
"nik.borisov@...e.com" <nik.borisov@...e.com>,
"Michael Kelley (LINUX)" <mikelley@...rosoft.com>
CC: "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Tianyu Lan <Tianyu.Lan@...rosoft.com>,
"rick.p.edgecombe@...el.com" <rick.p.edgecombe@...el.com>,
Anthony Davis <andavis@...hat.com>,
Mark Heslin <mheslin@...hat.com>,
vkuznets <vkuznets@...hat.com>,
"xiaoyao.li@...el.com" <xiaoyao.li@...el.com>
Subject: RE: [PATCH RESEND v9 2/2] x86/tdx: Support vmalloc() for
tdx_enc_status_changed()
> From: Dave Hansen <dave.hansen@...el.com>
> Sent: Friday, August 11, 2023 7:10 AM
> [...]
> This creates two different paths for vmalloc() and the direct map.
> There are two different ways to do va=>pa conversion, for instance.
> Here's a single loop that works for both cases:
>
> unsigned long step = end - start;
> unsigned long addr;
>
> /* Step through page-by-page for vmalloc() mappings: */
> if (is_vmalloc_addr((void *)vaddr))
> step = PAGE_SIZE;
>
> for (addr = start; addr < end; addr += step) {
> phys_addr_t start_pa = slow_virt_to_phys(addr);
> phys_addr_t end_pa = start_pa + step;
>
> if (!tdx_enc_status_changed_phys(start_pa, end_pa, enc))
> return false;
> }
>
> Note that this also doesn't abuse 'start' by making it a loop variable.
> It also, uh, uses a for() loop.
>
> The only downside is that it costs a page table walk for direct map
> virt=>phys conversion. I can live with that.
Your version is concise and more readable.
Thanks for improving the patch! I'll use this in v10 shortly.
Powered by blists - more mailing lists