Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2624319imn; Tue, 2 Aug 2022 09:45:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sCRNkMylooO8L3CLQxjYq0TbIyt0YElk1mNl+86IcMCmXjFgw27xMHLTOS7tTULs5l4/Bv X-Received: by 2002:a63:1e5f:0:b0:419:d6bf:b9d7 with SMTP id p31-20020a631e5f000000b00419d6bfb9d7mr17941851pgm.593.1659458712578; Tue, 02 Aug 2022 09:45:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659458712; cv=none; d=google.com; s=arc-20160816; b=lWur3oDs6Io3MiGB2oNtGIC6gY7ullSGQXllfzpYBsc7Gx7xphPYh3C6dzkDuJF9r2 CBT7YP3XQ/mfSQ8MnQo4Sm/FUqFHMJjfvrNIqDeakO0/qkaNQ5bj6NGRWSb1SSqoeRdR JXx8oX5vEjJbjsZhM6g6Mwypu2hXYClipgeISKSZYofSA3DXbakupK3VoHbUXKQnFtPq e4km1er5J3KCgdqShY0W6YXr86I8hwkOrx3sPG1ERFAYlD1cXrq8vuHcUols67hJdOHW hRInJkLjLSJrhDWCZjkpvyu68u1l9YdhO/krCrWqfqVQPS4HLSLyZRUkcWudNJLC+1cs y05A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=Vpq/mpo2WNFVjK/1SFKm7AqhW/wtXa+ryiiWx9FIdwo=; b=mnJSW91074lzGVN6xNvhkHmDbW+b6jLLsRCikjdm4BaNdFyx60QbpOIsFPZScKrtuG LEJRp0OT86TfqlF+4pAf9cBexnj4k8JbiyGM6xKfYo3RNsytal4vzHzAHCh92Yfsq101 3V9O6QYhg4icgO9ow3uS4T2ohHt044nap8Xgsg2yUmrfKX18VVodLzWhFuebA8JXZXWC Yu/FUO/80blretlRS5FFFAbuo6mf8vVyT/4p4ijwwxnC+3OpgtrWAbTHXuKxc9yk3WIa N2Q7UVG5ZPVikZAVRTbBfYn+b/7tyzmc1bDMlZJ3Kw1OzsUOkZUDhljuXdmnL1+BIX01 xS0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AvuR4RB2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w20-20020a63fb54000000b0041a8d6b47a8si15745071pgj.699.2022.08.02.09.44.57; Tue, 02 Aug 2022 09:45:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AvuR4RB2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231911AbiHBPlu (ORCPT + 99 others); Tue, 2 Aug 2022 11:41:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229670AbiHBPln (ORCPT ); Tue, 2 Aug 2022 11:41:43 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7DD9F281 for ; Tue, 2 Aug 2022 08:41:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659454901; 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=AvuR4RB2q7M0mvsgL3nvTsNVJdn1sLmAncd6+X6dYflerdsJSryiVC8urCB4UC3lVvIPeE AgnLfgzaLQO6TE2xF6sU9ErTw79aJtcjWqE5voRaR2DxAB66JI0OExurxCD0qRib4yZVlT by3r63sRy1pAxGKTKIwp2qLgHfjJf9w= Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-267-9h4UgmIEMUK82oksiwH1sg-1; Tue, 02 Aug 2022 11:41:31 -0400 X-MC-Unique: 9h4UgmIEMUK82oksiwH1sg-1 Received: by mail-il1-f199.google.com with SMTP id d6-20020a056e020c0600b002deca741bc2so2608844ile.18 for ; Tue, 02 Aug 2022 08:41:30 -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=DtP69S35D09OvNKX8tgMMJw0TFG2Q+4NA1ogz10ejTcXR+Jv8C1eoN9F9lgLVdL+gg sC6BwiFz5RjgVe84Cv8wmnS2fbtLuyic//nxC3I+lv6rmbOTzPNnKYEAfeHT8apB/ibY Od+H7sPanLUtwE7OlyIJIUW3rQ38e3veJyuMRK8qzSAklnDk5aGXpe9NZUyckx6ttOeG TnBMZj0vJAO79eDdwx/CSVROKMsYp0Klp+52R0gCH5tCG+zayGKfzvuSI7Vzua5ckNrY 2uyPst7Gy1wcydSjutr8qeBAuLOS9n20EAT8vaxHksy3jpAcdfsy8f+m8Rvybq8csOdW RG8w== X-Gm-Message-State: ACgBeo3QSI0NqbPyaf/OXRK5Wxy0J9fw31Y+WjjBrxIDxEzvYCDa5fZ3 UVkbLh738zgs+BpUmmFb4aZ35h+of5oyIzLv6HA1nUXpbOOqHLtRIJtfkof2HB9BAru2rSgsJI2 sfvqBIyurQpO0YNmTGyUittSW X-Received: by 2002:a05:6e02:e14:b0:2de:60af:e408 with SMTP id a20-20020a056e020e1400b002de60afe408mr6063700ilk.170.1659454890372; Tue, 02 Aug 2022 08:41:30 -0700 (PDT) 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 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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