Re: [PATCH v10 10/13] x86/mm: Initialize LAM_SUP
From: Maciej Wieczor-Retman
Date: Tue Feb 24 2026 - 04:09:55 EST
On 2026-02-23 at 12:43:06 -0800, Dave Hansen wrote:
>On 2/4/26 11:20, Maciej Wieczor-Retman wrote:
>> From: Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx>
>>
>> To make use of KASAN's tag based mode on x86, Linear Address Masking
>> (LAM) needs to be enabled. To do that the 28th bit in CR4 has to be set.
>
>I don't think we need to know the bit number in the changelog.
Okay, I can leave it out.
>
>> Set the bit in early memory initialization.
>
>Why does it need to be done early?
I recall it wouldn't get propagated to other cpus if it's done later. To be fair
it was a long time ago when I dealt with this so I don't remember the exact
place that was considered too far, I can find it if this exact placement is a
problem.
>> When launching secondary CPUs the LAM bit gets lost. To avoid this add
>> it in a mask in head_64.S. The bitmask permits some bits of CR4 to pass
>> from the primary CPU to the secondary CPUs without being cleared.
>
>Why does it get lost? Is it special somehow or is this normal for the
>other CR4 bits? It sounds like it is normal, so let's lead with that.
Yes, I think it's normal, I'll rewrite the text. Thanks!
--
Kind regards
Maciej Wieczór-Retman