From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7964C19F2C for ; Tue, 2 Aug 2022 15:41:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230333AbiHBPls (ORCPT ); Tue, 2 Aug 2022 11:41:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235032AbiHBPlf (ORCPT ); Tue, 2 Aug 2022 11:41:35 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 617C1B0F for ; Tue, 2 Aug 2022 08:41:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659454892; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Vpq/mpo2WNFVjK/1SFKm7AqhW/wtXa+ryiiWx9FIdwo=; b=OszbwqrfR7TiJi1I8vrPWCO2EKTzC5w+yCkQmbo1ctg8gsMy/YKwz8vleU6D8OKxid8MJ2 kCronqdSAYZA1+/8JfaUTM4Cm5bAySnoNgZ65QpjYuN1DYSxclMCQeK8YwsbtX2rRxiSBa Ka5iu51LkyG34dotqLdpPTm7Pq8CTWg= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-624--exLGfEcO_SDly3CynX_EQ-1; Tue, 02 Aug 2022 11:41:31 -0400 X-MC-Unique: -exLGfEcO_SDly3CynX_EQ-1 Received: by mail-il1-f198.google.com with SMTP id o5-20020a056e02102500b002ddcc65029cso8736787ilj.8 for ; Tue, 02 Aug 2022 08:41:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=Vpq/mpo2WNFVjK/1SFKm7AqhW/wtXa+ryiiWx9FIdwo=; b=mIot9Vk71C+dDMRUh0XemY24u63oF9GmR+7TJ86u7y9LA6Qg1M8I8zd+3i+rP96nll 5ebfk503HMJtdgr1KWlrtM2+Yw1OrC8bPS5p/VZygS95vr9Lb8008nau6qs1mi5l6Z10 94JeHBwgsPU2ayV91z0RlbDM30Kxkha+aoAX8/fjL35x4iYkarpBjozr/TNiUeJv/CxA iwIU8u9V/ZgGyVM30VIpxEJ9LHJVdSjRHpT1Q0s2v8tj5NbKjjoIH8IvaxPlb+0FBd+o 06AF8x+uNSLYlHFrbhvqZ2+idtSZf1v0rFw+j7UpDFDYxkkj189EyJnFnG+iAmw/nygx 4CWg== X-Gm-Message-State: ACgBeo3cvkDcEm6T4GQCvRKAGqDDz7jU372WovAPahRae5IPpPYXSmQA F46KscmlcmZKGG0PExoTvimmu7pB/JDAELsIeOOLpre7oM+R6JvNYWX5hLRbJcvMLp2bnSMGfoE ma/1wVWQ9UwZPHDGr8Oq+ X-Received: by 2002:a05:6e02:e14:b0:2de:60af:e408 with SMTP id a20-20020a056e020e1400b002de60afe408mr6063694ilk.170.1659454890372; Tue, 02 Aug 2022 08:41:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR7b9a7RjKkWMNOiP3M5XstmTpCDl0M45uztCly2mRb5G/+mIzsYnvwcX6X02nRrNDdeg1moeA== X-Received: by 2002:a05:6e02:e14:b0:2de:60af:e408 with SMTP id a20-20020a056e020e1400b002de60afe408mr6063688ilk.170.1659454890099; Tue, 02 Aug 2022 08:41:30 -0700 (PDT) Received: from redhat.com ([38.15.36.239]) by smtp.gmail.com with ESMTPSA id y10-20020a02730a000000b003427170b558sm2309947jab.57.2022.08.02.08.41.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 08:41:29 -0700 (PDT) Date: Tue, 2 Aug 2022 09:41:28 -0600 From: Alex Williamson To: Jason Gunthorpe Cc: Abhishek Sahu , Cornelia Huck , Yishai Hadas , Shameer Kolothum , Kevin Tian , "Rafael J . Wysocki" , Max Gurtovoy , Bjorn Helgaas , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-pm@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH v5 1/5] vfio: Add the device features for the low power entry and exit Message-ID: <20220802094128.38fba103.alex.williamson@redhat.com> In-Reply-To: References: <20220719121523.21396-1-abhsahu@nvidia.com> <20220719121523.21396-2-abhsahu@nvidia.com> <20220721163445.49d15daf.alex.williamson@redhat.com> <20220725160928.43a17560.alex.williamson@redhat.com> <20220726172356.GH4438@nvidia.com> <20220801124253.11c24d91.alex.williamson@redhat.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Tue, 2 Aug 2022 11:04:52 -0300 Jason Gunthorpe 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 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