diff options
author | Rik van Riel <riel@surriel.com> | 2025-06-06 13:10:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-06-27 11:13:42 +0100 |
commit | 1d6fcac42153018707fb715aeb0c7fd11ab4bf50 (patch) | |
tree | ce7e2f07b4a023b8f6fc1cc2d1bde9c505fd4eb0 /net/lapb/lapb_out.c | |
parent | 0f34182e1ecd73251b773fec9e2f457d1de38cd9 (diff) |
x86/mm: Fix early boot use of INVPLGB
[ Upstream commit cb6075bc62dc6a9cd7ab3572758685fdf78e3e20 ]
The INVLPGB instruction has limits on how many pages it can invalidate
at once. That limit is enumerated in CPUID, read by the kernel, and
stored in 'invpgb_count_max'. Ranged invalidation, like
invlpgb_kernel_range_flush() break up their invalidations so
that they do not exceed the limit.
However, early boot code currently attempts to do ranged
invalidation before populating 'invlpgb_count_max'. There is a
for loop which is basically:
for (...; addr < end; addr += invlpgb_count_max*PAGE_SIZE)
If invlpgb_kernel_range_flush is called before the kernel has read
the value of invlpgb_count_max from the hardware, the normally
bounded loop can become an infinite loop if invlpgb_count_max is
initialized to zero.
Fix that issue by initializing invlpgb_count_max to 1.
This way INVPLGB at early boot time will be a little bit slower
than normal (with initialized invplgb_count_max), and not an
instant hang at bootup time.
Fixes: b7aa05cbdc52 ("x86/mm: Add INVLPGB support code")
Signed-off-by: Rik van Riel <riel@surriel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://lore.kernel.org/all/20250606171112.4013261-3-riel%40surriel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/lapb/lapb_out.c')
0 files changed, 0 insertions, 0 deletions