[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191114081638.GH30906@MiWiFi-R3L-srv>
Date: Thu, 14 Nov 2019 16:16:38 +0800
From: Baoquan He <bhe@...hat.com>
To: Masayoshi Mizuma <msys.mizuma@...il.com>
Cc: Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
Masayoshi Mizuma <m.mizuma@...fujitsu.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 4/4] x86/mm/KASLR: Adjust the padding size for the
direct mapping.
On 11/12/19 at 03:47pm, Masayoshi Mizuma wrote:
> Your suggesion makes it simpler, thanks!
> So I'll modify calc_direct_mapping_size() as following.
> Does it make sense?
Yeah, it looks good to me. Thanks.
>
> static inline unsigned long calc_direct_mapping_size(void)
> {
> unsigned long size_tb, memory_tb;
>
> memory_tb = DIV_ROUND_UP(max_pfn << PAGE_SHIFT, 1UL << TB_SHIFT) +
> CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING;
>
> #ifdef CONFIG_MEMORY_HOTPLUG
> if (boot_params.max_addr) {
> unsigned long maximum_tb;
>
> maximum_tb = DIV_ROUND_UP(boot_params.max_addr,
> 1UL << TB_SHIFT);
>
> if (maximum_tb > memory_tb)
> memory_tb = maximum_tb;
> }
> #endif
> size_tb = 1 << (MAX_PHYSMEM_BITS - TB_SHIFT);
>
> /*
> * Adapt physical memory region size based on available memory
> */
> if (memory_tb < size_tb)
> size_tb = memory_tb;
>
> return size_tb;
> }
Powered by blists - more mailing lists