Centos-kernel-stream-9/virt/kvm
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
..
Kconfig KVM: rename CONFIG_HAVE_KVM_GMEM_* to CONFIG_HAVE_KVM_ARCH_GMEM_* 2024-08-09 19:18:08 +02:00
Makefile.kvm KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory 2023-12-01 14:51:46 +01:00
async_pf.c mm/gup: remove vmas parameter from get_user_pages_remote() 2024-09-05 20:35:35 -04:00
async_pf.h
binary_stats.c KVM: stats: remove dead stores 2021-12-08 10:43:11 +01:00
coalesced_mmio.c KVM: destruct kvm_io_device while unregistering it from kvm_io_bus 2023-12-01 14:51:08 +01:00
coalesced_mmio.h
dirty_ring.c KVM: Discard zero mask with function kvm_dirty_ring_reset 2024-08-09 19:18:06 +02:00
eventfd.c KVM: clean up directives to compile out irqfds 2024-05-13 18:38:35 -04:00
guest_memfd.c mm, virt: merge AS_UNMOVABLE and AS_INACCESSIBLE 2024-12-09 12:25:25 -05:00
irqchip.c KVM: replace direct irq.h inclusion 2023-06-27 08:45:12 +03:00
kvm_main.c kvm: explicitly set FOLL_HONOR_NUMA_FAULT in hva_to_pfn_slow() 2024-10-01 11:20:48 -04:00
kvm_mm.h KVM: Drop unused @may_block param from gfn_to_pfn_cache_invalidate_start() 2024-05-13 23:58:51 -04:00
pfncache.c KVM: Validate hva in kvm_gpc_activate_hva() to fix __kvm_gpc_refresh() WARN 2024-08-09 19:18:07 +02:00
vfio.c KVM: Treat the device list as an rculist 2024-06-27 07:33:52 -04:00
vfio.h