Re: [PATCH 2/3] x86/mm: introduce __PAGE_KERNEL_GLOBAL

From: Dave Hansen
Date: Fri Feb 16 2018 - 15:00:47 EST


On 02/16/2018 11:54 AM, Nadav Amit wrote:
>> But I don't really want to hide that gunk in a macro like that. It
>> might make more sense as a static inline. I'll give that a shot and resent.
> Since determining whether PTI is on is done in several places in the kernel,
> maybe there should a single function to determine whether PTI is on,
> something like:
>
> static inline bool is_pti_on(void)
> {
> return IS_ENABLED(CONFIG_PAGE_TABLE_ISOLATION) &&
> static_cpu_has(X86_FEATURE_PTI);
> }

We should be able to do it with disabled-features.h and the X86_FEATURE
bit. I'll look into it.