[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220802094128.38fba103.alex.williamson@redhat.com>
Date: Tue, 2 Aug 2022 09:41:28 -0600
From: Alex Williamson <alex.williamson@...hat.com>
To: Jason Gunthorpe <jgg@...dia.com>
Cc: Abhishek Sahu <abhsahu@...dia.com>,
Cornelia Huck <cohuck@...hat.com>,
Yishai Hadas <yishaih@...dia.com>,
Shameer Kolothum <shameerali.kolothum.thodi@...wei.com>,
Kevin Tian <kevin.tian@...el.com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Max Gurtovoy <mgurtovoy@...dia.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
linux-pm@...r.kernel.org, linux-pci@...r.kernel.org
Subject: Re: [PATCH v5 1/5] vfio: Add the device features for the low power
entry and exit
On Tue, 2 Aug 2022 11:04:52 -0300
Jason Gunthorpe <jgg@...dia.com> wrote:
> On Mon, Aug 01, 2022 at 12:42:53PM -0600, Alex Williamson wrote:
> > On Wed, 27 Jul 2022 11:37:02 +0530
> > Abhishek Sahu <abhsahu@...dia.com> wrote:
> >
> > > On 7/26/2022 10:53 PM, Jason Gunthorpe wrote:
> > > > On Tue, Jul 26, 2022 at 06:17:18PM +0530, Abhishek Sahu wrote:
> > > >> Thanks Alex for your thorough review of uAPI.
> > > >> I have incorporated all the suggestions.
> > > >> Following is the updated uAPI.
> > > >>
> > > >> /*
> > > >> * Upon VFIO_DEVICE_FEATURE_SET, allow the device to be moved into a low power
> > > >> * state with the platform-based power management. Device use of lower power
> > > >> * states depends on factors managed by the runtime power management core,
> > > >> * including system level support and coordinating support among dependent
> > > >> * devices. Enabling device low power entry does not guarantee lower power
> > > >> * usage by the device, nor is a mechanism provided through this feature to
> > > >> * know the current power state of the device. If any device access happens
> > > >> * (either from the host or through the vfio uAPI) when the device is in the
> > > >> * low power state, then the host will move the device out of the low power
> > > >> * state as necessary prior to the access. Once the access is completed, the
> > > >> * device may re-enter the low power state. For single shot low power support
> > > >> * with wake-up notification, see
> > > >> * VFIO_DEVICE_FEATURE_LOW_POWER_ENTRY_WITH_WAKEUP below. Access to mmap'd
> > > >> * device regions is disabled on LOW_POWER_ENTRY and may only be resumed after
> > > >> * calling LOW_POWER_EXIT.
> > > >> */
> > > >> #define VFIO_DEVICE_FEATURE_LOW_POWER_ENTRY 3
> > > >>
> > > >> /*
> > > >> * This device feature has the same behavior as
> > > >> * VFIO_DEVICE_FEATURE_LOW_POWER_ENTRY with the exception that the user
> > > >> * provides an eventfd for wake-up notification.
> > > >
> > > > It feels like this should be one entry point instead of two.
> > > >
> > > > A flag "automatic re-sleep" and an optional eventfd (-1 means not
> > > > provided) seems to capture both of these behaviors in a bit clearer
> > > > and extendable way.
> >
> > I think the mutual exclusion between re-entrant mode and one-shot is
> > quite a bit more subtle in the version below, so I don't particularly
> > find this cleaner. Potentially we could have variant drivers support
> > one w/o the other in the previously proposed model as well. It's
> > interesting to see this suggestion since since we seem to have a theme
> > of making features single purpose elsewhere. Thanks,
>
> It is still quite single purpose, just
> VFIO_DEVICE_LOW_POWER_REENTERY_DISABLE is some minor customization of
> that single purpose.
>
> Either the flag is set or not, it isn't subtle..
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,
Alex
Powered by blists - more mailing lists