vfio/mlx5: Allow loading of larger images than 512 MB
authorYishai Hadas <yishaih@nvidia.com>
Sun, 8 Jan 2023 15:44:23 +0000 (17:44 +0200)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 23 Jan 2023 18:26:29 +0000 (11:26 -0700)
commit83ff6095ecf8bafd095a921a2267227519f510f8
treec3b9a6cf31f18aabb545217f768aee1bb2cc3068
parentc9c4c070e0fe2551f82b20bbf14e4dbde88e573d
vfio/mlx5: Allow loading of larger images than 512 MB

Allow loading of larger images than 512 MB by dropping the arbitrary
hard-coded value that we have today and move to use the max device
loading value which is for now 4GB.

As part of that we move to use the GFP_KERNEL_ACCOUNT option upon
allocating the persistent data of mlx5 and rely on the cgroup to provide
the memory limit for the given user.

The GFP_KERNEL_ACCOUNT option lets the memory allocator know that this
is untrusted allocation triggered from userspace and should be a subject
of kmem accounting, and as such it is controlled by the cgroup
mechanism.

Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20230108154427.32609-3-yishaih@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/mlx5/cmd.c
drivers/vfio/pci/mlx5/main.c