Re: [PATCH 07/28] KVM: x86/mmu: rename and clarify BYTE_MASK

From: Sean Christopherson

Date: Thu Apr 30 2026 - 14:41:30 EST


On Thu, Apr 30, 2026, Paolo Bonzini wrote:
> The BYTE_MASK macro is the central point of the black magic
> in update_permission_bitmask(). Rename it to something
> that relates to how it is used, and add a comment explaining
> how it works.
>
> Using shifts instead of powers of two was actually suggested by
> David Hildenbrand back in 2017 for clarity[1] but I evidently
> forgot his suggestion when applying to kvm.git.

Never underestimate your love for decimal-based bitmasks :-)

> static void update_permission_bitmask(struct kvm_mmu *mmu, bool ept)
> {
> unsigned byte;

Rename this as well? It's "fine" here, but it gets quite awkward when
"KVM: x86/mmu: introduce ACC_READ_MASK" makes permissions[] an array of shorts,
not bytes.

No idea what to call it...