Re: [PATCH v5 1/5] vfio: Add the device features for the low power entry and exit

From: Abhishek Sahu
Date: Wed Aug 03 2022 - 02:32:27 EST


On 8/2/2022 10:31 PM, Jason Gunthorpe wrote:
> On Tue, Aug 02, 2022 at 10:57:55AM -0600, Alex Williamson wrote:
>> On Tue, 2 Aug 2022 13:35:04 -0300
>> Jason Gunthorpe <jgg@xxxxxxxxxx> wrote:
>>
>>> On Tue, Aug 02, 2022 at 09:41:28AM -0600, Alex Williamson wrote:
>>>
>>>> The subtlety is that there's a flag and a field and the flag can only
>>>> be set if the field is set, the flag can only be clear if the field is
>>>> clear, so we return -EINVAL for the other cases? Why do we have both a
>>>> flag and a field? This isn't like we're adding a feature later and the
>>>> flag needs to indicate that the field is present and valid. It's just
>>>> not a very clean interface, imo. Thanks,
>>>
>>> That isn't how I read Abhishek's proposal.. The eventfd should always
>>> work and should always behave as described "The notification through
>>> the provided eventfd will be generated only when the device has
>>> entered and is resumed from a low power state"
>>>
>>> If userspace provides it without LOW_POWER_REENTERY_DISABLE then it
>>> still generates the events.
>>>
>>> The linkage to LOW_POWER_REENTERY_DISABLE is only that userspace
>>> probably needs to use both elements together to generate the
>>> auto-reentry behavior. Kernel should not enforce it.
>>>
>>> Two fields, orthogonal behaviors.
>>
>> What's the point of notifying userspace that the device was resumed if
>> it might already be suspended again by the time userspace responds to
>> the eventfd?
>
> I don't know - the eventfds is counting so it does let userspace
> monitor frequency of auto-sleeping.
>
> In any case the point is to make simple kernel APIs, not cover every
> combination with a use case. Decoupling is simpler than coupling.
>
> Jason


Thanks Alex and Jason for your inputs.

It seems, I can use the original uAPI where we will have 2 variants
of ENTRY.

Since already kernel merge window is started, so I will wait for
v5.20-rc1 (or v6.0-rc1) and then I will rebase and test my patches on
the updated kernel.

Regards,
Abhishek