Received: by 2002:a17:90a:2044:0:0:0:0 with SMTP id n62csp1141198pjc; Thu, 9 May 2019 14:42:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyh2Mj7qc1CJAux8R1hhbuKHrCAzC6CgQhYxJKtcbEzC4gaX12H4RP/TNNCC28XFaVhhJmI X-Received: by 2002:a62:604:: with SMTP id 4mr8690235pfg.38.1557438152254; Thu, 09 May 2019 14:42:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557438152; cv=none; d=google.com; s=arc-20160816; b=SEI6OcIe9AL39erkIkbybvJaVYnqFoOy2DMWDeFNsHlBhpJ6GSJxvmm68zYtluun/Y ammXFWztAoPrah+ppp2qOeDhqEsAyfC5qMRNUhMm8qiJeLAmytW6ZESyGcIkLR1pl6Th Ch2E7GmiyAgwLRtT9nHfCZm4t0o4yx3Zm8xTw0K22aVboJxBST6qACYb7GxF8KLIVvLh B4Rw+ecMIChZUTim9+WCyyaBiWg/flYhH6bEAEWkdcoFtkQ7S9uUYyFU8b9trMxYEte5 Td1L6JL9lkvxdOTC1FSLa0w9iUljVs79GME64WBXdZLFdzf/EhL+fZQdcplW3TTWJqUX Ia+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=rWqUG/1Q13/Mgi8WYJUSOwOl7Nvw/G1FqiVogS2PJUU=; b=mjg1GCnPfBflWKo+vBpnkZgFYbovebtoQU7CIkIczLu9PYPzrr3IDADfahMJXBa+Wv 1iFkD18beVVksH+UIhBUfZ8487nDJAMBT24CCIA7njImp0gUP3rIvPUfdh8cuF+4a5p8 rvs3LB2XYclo6+ACmMmSuOml5fKBJMREWCwgz0qHamYdo4RZolSPagQfToPDEa8Iz2ce UgyLU8/GgZMXjbwM95BbN12rJhhGXzb9ocPXYIOWUe/uhAq0d1aDkIziRS7UcOdX9OV+ s6yJ2Sfnm5G3K7z/meAp6nljQtYQnWoAeivPEuiLLwFhX93s+pBGvAKjVnc6l05gUt1d JRHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e7si4768731pge.593.2019.05.09.14.42.15; Thu, 09 May 2019 14:42:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726790AbfEIVkD (ORCPT + 99 others); Thu, 9 May 2019 17:40:03 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:42511 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726219AbfEIVkC (ORCPT ); Thu, 9 May 2019 17:40:02 -0400 Received: by mail-oi1-f195.google.com with SMTP id k9so3056636oig.9; Thu, 09 May 2019 14:40:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rWqUG/1Q13/Mgi8WYJUSOwOl7Nvw/G1FqiVogS2PJUU=; b=LFEtzodD7pm6u/S9cgqcjmWu4IoOF6tDGg734x3h8Bjq2RKSs1UyB4/A7aOwPLdsOr dmKEvg1Lf0ZNIc8c3u/fY4BOOLV73SzUI0b4zTLa7Vk1Dvzoe0aLURF/ze+Zl+nnHSqb oODTpv2m2GCYYGV4VNsyI/QlHnfG6lfvPs4JgHTMUYAPOYOPtkcxtQw9kJQW90Di+I1g wXxmQJ9x0SwsTJmGzN6KbU3L6XeHfeSTEbMJPo21GqGpeCPAzU9lAhZtKkvgXh3igcDn cREPrbSVm8tzblININGRky6LHTWSFSm8xqZwVjXGkXXD4bJkmNV/nvKBQvW9hqo0IGuk LXcA== X-Gm-Message-State: APjAAAV3yms4BoeIbdDO2UysgYJLcc9s3mG+OFWzVjXPSKXwzVm19NRM fz8yTKEpOrb/sl9N4DhZZFfT7TikHl/CcDa6ovw= X-Received: by 2002:aca:f4c3:: with SMTP id s186mr2791143oih.68.1557438002008; Thu, 09 May 2019 14:40:02 -0700 (PDT) MIME-Version: 1.0 References: <064701C3-2BD4-4D93-891D-B7FBB5040FC4@canonical.com> <20190509095601.GA19041@lst.de> <225CF4F7-C8E1-4C66-B362-97E84596A54E@canonical.com> <20190509103142.GA19550@lst.de> <31b7d7959bf94c15a04bab0ced518444@AUSX13MPC101.AMER.DELL.COM> <20190509192807.GB9675@localhost.localdomain> <20190509211608.GC9675@localhost.localdomain> In-Reply-To: <20190509211608.GC9675@localhost.localdomain> From: "Rafael J. Wysocki" Date: Thu, 9 May 2019 23:39:50 +0200 Message-ID: Subject: Re: [PATCH] nvme-pci: Use non-operational power state instead of D3 on Suspend-to-Idle To: Keith Busch Cc: "Rafael J. Wysocki" , Mario Limonciello , Kai-Heng Feng , Christoph Hellwig , Jens Axboe , Sagi Grimberg , Linux PM , Rafael Wysocki , Linux Kernel Mailing List , linux-nvme , Keith Busch Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 9, 2019 at 11:21 PM Keith Busch wrote: > > On Thu, May 09, 2019 at 10:54:04PM +0200, Rafael J. Wysocki wrote: > > On Thu, May 9, 2019 at 9:33 PM Keith Busch wrote: > > > #include > > > @@ -2851,6 +2852,8 @@ static int nvme_suspend(struct device *dev) > > > struct pci_dev *pdev = to_pci_dev(dev); > > > struct nvme_dev *ndev = pci_get_drvdata(pdev); > > > > > > + if (!pm_suspend_via_firmware()) > > > + return nvme_set_power(&ndev->ctrl, ndev->ctrl.npss); > > > > You probably want to call pci_save_state(pdev) in the branch above to > > prevent pci_pm_suspend_noirq() from calling pci_prepare_to_sleep() > > going forward, so I would write this routine as > > > > if (pm_suspend_via_firmware()) { > > nvme_dev_disable(ndev, true); > > return 0; > > } > > > > pci_save_state(pdev) > > return nvme_set_power(&ndev->ctrl, ndev->ctrl.npss); > > Ah, good point. I'll make sure that's added and will wait to see hear if > there's any other feedback. > > I am trying to test the paths by faking out PS capabilities, and have > a question on how to force each: > > Running "rtcwake -m freeze ...", that takes the !pm_suspend_via_firmware() > path as I expected. > > But trying to test the original path, I thought using "-m mem" would > have been a suspend via firmware, but that is still returning false. > > Is that expected? Yes, if s2idle is the default on that platform. You should be able to switch over to S3 by writing "deep" into /sys/power/mem_sleep as long as it is supported on that platform at all. > I've only tried this on one platform so far, so might > just be this particular one is missing a firmware capability. You can check that by looking into /sys/power/mem_sleep (if there is only "[s2idle]" in there, S3 is not supported).