[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <848a6836-1f54-4775-0b87-e926d7b7991d@intel.com>
Date: Mon, 18 Jun 2018 09:28:27 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>,
Tom Lendacky <thomas.lendacky@....com>
Cc: Kai Huang <kai.huang@...ux.intel.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCHv3 15/17] x86/mm: Implement sync_direct_mapping()
> index 17383f9677fa..032b9a1ba8e1 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -731,6 +731,8 @@ kernel_physical_mapping_init(unsigned long paddr_start,
> pgd_changed = true;
> }
>
> + sync_direct_mapping();
> +
> if (pgd_changed)
> sync_global_pgds(vaddr_start, vaddr_end - 1);
>
> @@ -1142,10 +1144,13 @@ void __ref vmemmap_free(unsigned long start, unsigned long end,
> static void __meminit
> kernel_physical_mapping_remove(unsigned long start, unsigned long end)
> {
> + int ret;
> start = (unsigned long)__va(start);
> end = (unsigned long)__va(end);
>
> remove_pagetable(start, end, true, NULL);
> + ret = sync_direct_mapping();
> + WARN_ON(ret);
> }
I understand why you implemented it this way, I really do. It's
certainly the quickest way to hack something together and make a
standalone piece of code. But, I don't think it's maintainable.
For instance, this call to sync_direct_mapping() could be entirely
replaced by a call to:
for_each_keyid(k)...
remove_pagetable(start + offset_per_keyid * k,
end + offset_per_keyid * k,
true, NULL);
No?
> int __ref arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
> @@ -1290,6 +1295,7 @@ void mark_rodata_ro(void)
> (unsigned long) __va(__pa_symbol(rodata_end)),
> (unsigned long) __va(__pa_symbol(_sdata)));
>
> + sync_direct_mapping();
> debug_checkwx();
Huh, checking the return code in some cases and not others. Curious.
Why is it that way?
Powered by blists - more mailing lists