Re: [PATCH v7 8/9] vfio/pci: Extend VFIO_DEVICE_GET_PCI_HOT_RESET_INFO for vfio device cdev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 14, 2023 at 01:05:45PM +0000, Liu, Yi L wrote:
> > -EAGAIN basically means the kernel internally malfunctioned - eg it
> > allocated too little space for the actual size of devices. That is no
> > longer possible in this version so it should never return -EAGAIN.
> 
> I still have one doubt. Per my understanding, this is to handle newly
> plugged devices during the info reporting path. I don’t think holding
> dev_set lock can prevent it. but maybe -ENOSPC is enough. @Alex,
> what about your opinion?

If the device was plug instantly before we computed the size we returned
ENOSPC

If it was plugged instantly after we computed the size we returned
EAGAIN

Here we just resolve this race consistently to always return ENOSPC,
which always means we ran out of space in the user provided buffer.

> > -	kfree(devices);
> > -	return ret;
> > +	if (fill.count != fill.devices - arg->devices)
> 
> Should be "if (fill.count != (fill.devices - arg->devices) / sizeof(arg->devices[0]))" 😊

devices is already a typed pointer so the compiler computes the
/sizeof() itself

Your version  above is needed if it was void *

Jason



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux