[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALzav=c9yw2B=1Y6kK2ZuxdBCnwuTHyOyA4VGT8_rLv2Wg5r4A@mail.gmail.com>
Date: Fri, 31 Oct 2025 16:12:50 -0700
From: David Matlack <dmatlack@...gle.com>
To: Vipin Sharma <vipinsh@...gle.com>
Cc: bhelgaas@...gle.com, alex.williamson@...hat.com, pasha.tatashin@...een.com,
jgg@...pe.ca, graf@...zon.com, pratyush@...nel.org,
gregkh@...uxfoundation.org, chrisl@...nel.org, rppt@...nel.org,
skhawaja@...gle.com, parav@...dia.com, saeedm@...dia.com,
kevin.tian@...el.com, jrhilke@...gle.com, david@...hat.com,
jgowans@...zon.com, dwmw2@...radead.org, epetron@...zon.de,
junaids@...gle.com, linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
kvm@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [RFC PATCH 08/21] vfio/pci: Retrieve preserved VFIO device for
Live Update Orechestrator
On Fri, Oct 17, 2025 at 5:07 PM Vipin Sharma <vipinsh@...gle.com> wrote:
> static int vfio_pci_liveupdate_retrieve(struct liveupdate_file_handler *handler,
> u64 data, struct file **file)
> {
...
> + filep = anon_inode_getfile_fmode("[vfio-cdev]", &vfio_device_fops, df,
> + O_RDWR, FMODE_PREAD | FMODE_PWRITE);
It's a little weird that we have to use an anonymous inode when
restoring cdev file descriptors. Do we care not about the association
between VFIO cdev files and their inodes?
If we wanted to have the cdev inode we could have the user pass a file
path to ioctl(LIVEUPDATE_SESSION_RESTORE_FD)? File handlers can use
that to find the inode to use when creating a struct file. This would
avoid the anonymous inode and also ensure that restoring the fd obeys
the same filesystem permissions as opening a new fd (I think?).
Pasha this would be a uAPI change to LUO. What do you think?
Sami, Jason, what are you planning to do for iommufd?
> + if (IS_ERR(filep)) {
> + err = PTR_ERR(filep);
> + goto err_anon_inode;
> + }
> +
> + /* Paired with the put in vfio_device_fops_release() */
> + if (!vfio_device_try_get_registration(device)) {
> + err = -ENODEV;
> + goto err_get_registration;
> + }
> +
> + put_device(&device->device);
> +
> + /*
> + * Use the pseudo fs inode on the device to link all mmaps
> + * to the same address space, allowing us to unmap all vmas
> + * associated to this device using unmap_mapping_range().
> + */
> + filep->f_mapping = device->inode->i_mapping;
Most of this code already exists in vfio_device_fops_cdev_open(). I'll
work on sharing the code in the next version.
Powered by blists - more mailing lists