Re: [PATCHv3 OPTIONAL 8/8] x86/mm: Extend LAM to support to LAM_U48

Peter Zijlstra
2022-06-16T10:01:23Z

On Fri, Jun 10, 2022 at 05:35:27PM +0300, Kirill A. Shutemov wrote:
> LAM_U48 allows to encode 15 bits of tags into address.
>
> LAM_U48 steals bits above 47-bit for tags and makes it impossible for
> userspace to use full address space on 5-level paging machine.
>
> Make these features mutually exclusive: whichever gets enabled first
> blocks the other one.

This patch is broken in that it doesn't fix untag_pointer()

*If* you really want to continue down this road; you'll need something
like:

#define untagged_addr(mm, addr) ({ \
u64 __addr = (__force u64)(addr); \
s64 sign = (s64)__addr >> 63; \
__addr ^= sign; \
__addr &= (mm)->context.untag_mask[sign & 1]; \
__addr ^= sign; \
(__force __typeof__(addr))__addr; \
})

Which uses a different mask for kernel and user pointers.

Anyway, without this U48 patch on, the mask could be a constant, no need
to keep this variable, we can unconditionally unmask U57.

Let me go reply to that other mail too.