* [Patch v2] x86/head/64: remove redundant check on level2_kernel_pgt's _PAGE_PRESENT bit
@ 2024-05-23 8:37 Wei Yang
2024-05-23 10:33 ` Kirill A . Shutemov
0 siblings, 1 reply; 3+ messages in thread
From: Wei Yang @ 2024-05-23 8:37 UTC (permalink / raw)
To: tglx, mingo, bp, dave.hansen
Cc: x86, linux-kernel, Wei Yang, Kirill A . Shutemov, Ingo Molnar,
Steve Wahl
This patch tries to remove a redundant check on kernel code's PMD
_PAGE_PRESENT attribute before fix up.
Current process looks like this:
pmd in [0, _text)
unset _PAGE_PRESENT
pmd in [_text, _end]
if (_PAGE_PRESENT)
fix up delta
pmd in (_end, 512)
unset _PAGE_PRESENT
Since we have compiled in _PAGE_PRESENT in this page table, it is not
necessary to check _PAGE_PRESENT again before fixing up delta
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
CC: Ingo Molnar <mingo@kernel.org>
CC: Steve Wahl <steve.wahl@hpe.com>
---
v2: adjust the change log to emphasize the redundant check
---
arch/x86/kernel/head64.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index a817ed0724d1..bac33ec19aa2 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -260,8 +260,7 @@ unsigned long __head __startup_64(unsigned long physaddr,
/* fixup pages that are part of the kernel image */
for (; i <= pmd_index((unsigned long)_end); i++)
- if (pmd[i] & _PAGE_PRESENT)
- pmd[i] += load_delta;
+ pmd[i] += load_delta;
/* invalidate pages after the kernel image */
for (; i < PTRS_PER_PMD; i++)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Patch v2] x86/head/64: remove redundant check on level2_kernel_pgt's _PAGE_PRESENT bit
2024-05-23 8:37 [Patch v2] x86/head/64: remove redundant check on level2_kernel_pgt's _PAGE_PRESENT bit Wei Yang
@ 2024-05-23 10:33 ` Kirill A . Shutemov
2024-05-23 12:26 ` Wei Yang
0 siblings, 1 reply; 3+ messages in thread
From: Kirill A . Shutemov @ 2024-05-23 10:33 UTC (permalink / raw)
To: Wei Yang
Cc: tglx, mingo, bp, dave.hansen, x86, linux-kernel, Ingo Molnar, Steve Wahl
On Thu, May 23, 2024 at 08:37:52AM +0000, Wei Yang wrote:
> This patch tries to remove a redundant check on kernel code's PMD
> _PAGE_PRESENT attribute before fix up.
Tries? s/This patch tries to r/R/
> Current process looks like this:
>
> pmd in [0, _text)
> unset _PAGE_PRESENT
> pmd in [_text, _end]
> if (_PAGE_PRESENT)
> fix up delta
> pmd in (_end, 512)
> unset _PAGE_PRESENT
>
> Since we have compiled in _PAGE_PRESENT in this page table, it is not
> necessary to check _PAGE_PRESENT again before fixing up delta
level2_kernel_pgt compiled with _PAGE_PRESENT set. The check is
redundant.
--
Kiryl Shutsemau / Kirill A. Shutemov
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch v2] x86/head/64: remove redundant check on level2_kernel_pgt's _PAGE_PRESENT bit
2024-05-23 10:33 ` Kirill A . Shutemov
@ 2024-05-23 12:26 ` Wei Yang
0 siblings, 0 replies; 3+ messages in thread
From: Wei Yang @ 2024-05-23 12:26 UTC (permalink / raw)
To: Kirill A . Shutemov
Cc: Wei Yang, tglx, mingo, bp, dave.hansen, x86, linux-kernel,
Ingo Molnar, Steve Wahl
Thanks for comment.
On Thu, May 23, 2024 at 01:33:28PM +0300, Kirill A . Shutemov wrote:
>On Thu, May 23, 2024 at 08:37:52AM +0000, Wei Yang wrote:
>> This patch tries to remove a redundant check on kernel code's PMD
>> _PAGE_PRESENT attribute before fix up.
>
>Tries? s/This patch tries to r/R/
Will use this one.
>
>> Current process looks like this:
>>
>> pmd in [0, _text)
>> unset _PAGE_PRESENT
>> pmd in [_text, _end]
>> if (_PAGE_PRESENT)
>> fix up delta
>> pmd in (_end, 512)
>> unset _PAGE_PRESENT
>>
>> Since we have compiled in _PAGE_PRESENT in this page table, it is not
>> necessary to check _PAGE_PRESENT again before fixing up delta
>
>level2_kernel_pgt compiled with _PAGE_PRESENT set. The check is
>redundant.
>
Will use this one, thanks
>
>--
> Kiryl Shutsemau / Kirill A. Shutemov
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-23 12:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-23 8:37 [Patch v2] x86/head/64: remove redundant check on level2_kernel_pgt's _PAGE_PRESENT bit Wei Yang
2024-05-23 10:33 ` Kirill A . Shutemov
2024-05-23 12:26 ` Wei Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®