Centos-kernel-stream-9/virt
Rafael Aquini 288fab6492 mm, virt: merge AS_UNMOVABLE and AS_INACCESSIBLE
JIRA: https://issues.redhat.com/browse/RHEL-27745
Conflicts:
  * virt/kvm/guest_memfd.c: difference in the hunk due to RHEL missing upstream
    commit 1d23040caa8b ("KVM: guest_memfd: Use AS_INACCESSIBLE when creating
    guest_memfd inode") which would end up being reverted with this follow-up fix.

This patch is a backport of the following upstream commit:
commit 27e6a24a4cf3d25421c0f6ebb7c39f45fc14d20f
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Thu Jul 11 13:56:54 2024 -0400

    mm, virt: merge AS_UNMOVABLE and AS_INACCESSIBLE

    The flags AS_UNMOVABLE and AS_INACCESSIBLE were both added just for guest_memfd;
    AS_UNMOVABLE is already in existing versions of Linux, while AS_INACCESSIBLE was
    acked for inclusion in 6.11.

    But really, they are the same thing: only guest_memfd uses them, at least for
    now, and guest_memfd pages are unmovable because they should not be
    accessed by the CPU.

    So merge them into one; use the AS_INACCESSIBLE name which is more comprehensive.
    At the same time, this fixes an embarrassing bug where AS_INACCESSIBLE was used
    as a bit mask, despite it being just a bit index.

    The bug was mostly benign, because AS_INACCESSIBLE's bit representation (1010)
    corresponded to setting AS_UNEVICTABLE (which is already set) and AS_ENOSPC
    (except no async writes can happen on the guest_memfd).  So the AS_INACCESSIBLE
    flag simply had no effect.

    Fixes: 1d23040caa8b ("KVM: guest_memfd: Use AS_INACCESSIBLE when creating guest_memfd inode")
    Fixes: c72ceafbd12c ("mm: Introduce AS_INACCESSIBLE for encrypted/confidential memory")
    Cc: linux-mm@kvack.org
    Acked-by: Vlastimil Babka <vbabka@suse.cz>
    Acked-by: David Hildenbrand <david@redhat.com>
    Tested-by: Michael Roth <michael.roth@amd.com>
    Reviewed-by: Michael Roth <michael.roth@amd.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Rafael Aquini <raquini@redhat.com>
2024-12-09 12:25:25 -05:00
..
kvm mm, virt: merge AS_UNMOVABLE and AS_INACCESSIBLE 2024-12-09 12:25:25 -05:00
lib
Makefile