Re: [PATCHv8 00/11] Linear Address Masking enabling

From: Dave Hansen
Date: Tue Sep 20 2022 - 12:06:40 EST


On 9/20/22 06:14, Jason Gunthorpe wrote:
> For this I would rather have a function that queries the format of the
> page table under the mm_struct and we have enum values like
> INTEL_NORMAL and INTEL_LAM as possible values.
>
> The iommu driver will block incompatible page table formats, and when
> it starts up it should assert something that blocks changing the
> format.

That doesn't sound too bad. Except, please don't call it a "page table
format". The format of the page tables does not change with LAM. It's
entirely how the CPU interprets addresses that changes.

I guess someone could make an argument that, with LAM, there is a "hole"
that can't be filled in and _that_ constitutes a format change, but
that'd be a stretch.

The thing that matters when LAM is on is that some CPU might be stashing
addresses somewhere that only have meaning when you interpret them with
LAM rules. That's really a property of the mm, not of the page tables.

Oh, and please don't call things "INTEL_WHATEVER". It looks silly and
confuses the heck out of people when a second CPU vendor needs to use
the same code.