Re: [RFC][PATCH] x86: nit: wrong page size in init_memory_mapping() printks

From: Borislav Petkov
Date: Wed Feb 11 2015 - 07:11:57 EST


On Tue, Feb 10, 2015 at 01:20:30PM -0800, Dave Hansen wrote:
>
> From: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
>
> With 32-bit non-PAE kernels, we have 2 page sizes available
> (at most): 4k and 4M.
>
> Enabling PAE replaces that 4M size with a 2M one (which 64-bit
> systems use too).
>
> But, when booting a 32-bit non-PAE kernel, in one of our
> early-boot printouts, we say:
>
> [ 0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff]
> [ 0.000000] [mem 0x00000000-0x000fffff] page 4k
> [ 0.000000] init_memory_mapping: [mem 0x37000000-0x373fffff]
> [ 0.000000] [mem 0x37000000-0x373fffff] page 2M
> [ 0.000000] init_memory_mapping: [mem 0x00100000-0x36ffffff]
> [ 0.000000] [mem 0x00100000-0x003fffff] page 4k
> [ 0.000000] [mem 0x00400000-0x36ffffff] page 2M
> [ 0.000000] init_memory_mapping: [mem 0x37400000-0x377fdfff]
> [ 0.000000] [mem 0x37400000-0x377fdfff] page 4k
>
> Which is obviously wrong. There is no 2M page available. This
> is probably because of a badly-named variable: in the map_range
> code: PG_LEVEL_2M.
>
> Instead of renaming all the PG_LEVEL_2M's. This patch just
> fixes the printout:
>
> [ 0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff]
> [ 0.000000] [mem 0x00000000-0x000fffff] page 4k
> [ 0.000000] init_memory_mapping: [mem 0x37000000-0x373fffff]
> [ 0.000000] [mem 0x37000000-0x373fffff] page 4M
> [ 0.000000] init_memory_mapping: [mem 0x00100000-0x36ffffff]
> [ 0.000000] [mem 0x00100000-0x003fffff] page 4k
> [ 0.000000] [mem 0x00400000-0x36ffffff] page 4M
> [ 0.000000] init_memory_mapping: [mem 0x37400000-0x377fdfff]
> [ 0.000000] [mem 0x37400000-0x377fdfff] page 4k
> [ 0.000000] BRK [0x03206000, 0x03206fff] PGTABLE
>
>
> Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>

Looks ok to me considering that we're missing a PG_LEVEL_4M thing
completely which would need to be handled depending on X86_PAE and CR4
PSE and PAE bits. Probably not worth the trouble though.

Acked-by: Borislav Petkov <bp@xxxxxxx>

--
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/