Re: [PATCH v3 3/5] mm: x86: Invoke hypercall when page encryption status is changed
From: Ashish Kalra
Date: Tue Jun 29 2021 - 23:10:34 EST
Hello Boris, Paolo,
On Thu, Jun 10, 2021 at 08:30:52PM +0200, Borislav Petkov wrote:
> On Tue, Jun 08, 2021 at 06:06:26PM +0000, Ashish Kalra wrote:
> > +void notify_range_enc_status_changed(unsigned long vaddr, int npages,
> > + bool enc)
>
> You don't need to break this line.
>
> > @@ -285,12 +333,13 @@ static void __init __set_clr_pte_enc(pte_t *kpte, int level, bool enc)
> > static int __init early_set_memory_enc_dec(unsigned long vaddr,
> > unsigned long size, bool enc)
> > {
> > - unsigned long vaddr_end, vaddr_next;
> > + unsigned long vaddr_end, vaddr_next, start;
> > unsigned long psize, pmask;
> > int split_page_size_mask;
> > int level, ret;
> > pte_t *kpte;
> >
> > + start = vaddr;
> > vaddr_next = vaddr;
> > vaddr_end = vaddr + size;
> >
> > @@ -345,6 +394,8 @@ static int __init early_set_memory_enc_dec(unsigned long vaddr,
> >
> > ret = 0;
> >
> > + notify_range_enc_status_changed(start, PAGE_ALIGN(size) >> PAGE_SHIFT,
> > + enc);
>
> Ditto.
>
> > out:
> > __flush_tlb_all();
> > return ret;
> > diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
> > index 156cd235659f..9729cb0d99e3 100644
> > --- a/arch/x86/mm/pat/set_memory.c
> > +++ b/arch/x86/mm/pat/set_memory.c
> > @@ -2020,6 +2020,13 @@ static int __set_memory_enc_dec(unsigned long addr, int numpages, bool enc)
> > */
> > cpa_flush(&cpa, 0);
> >
> > + /*
> > + * Notify hypervisor that a given memory range is mapped encrypted
> > + * or decrypted. The hypervisor will use this information during the
> > + * VM migration.
> > + */
>
> Simplify that comment:
>
> /*
> * Notify the hypervisor about the encryption status change of the memory
> * range. It will use this information during the VM migration.
> */
>
>
> With those nitpicks fixed:
>
> Reviewed-by: Borislav Petkov <bp@xxxxxxx>
>
> Paulo, if you want me to take this, lemme know, but I think it'll
> conflict with patch 5 so perhaps it all should go together through the
> kvm tree...
>
Will these patches be merged into 5.14 ?
I have posted another version (v5) for patch 5 after more review comments
from Boris, so please pull in all these patches together.
Thanks,
Ashish
> Thx.
>
> --
> Regards/Gruss,
> Boris.
>
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpeople.kernel.org%2Ftglx%2Fnotes-about-netiquette&data=04%7C01%7CAshish.Kalra%40amd.com%7C142a30170b8145b44a2f08d92c3de599%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637589466634224968%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=nCXHGP8%2F9on0DurrLLbBT0MivMWXfNqwS73rKkqclUM%3D&reserved=0