Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2308621ybi; Mon, 1 Jul 2019 09:45:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyr+FtO8No4jGcEZD3tEFuwtwHOgrEbMiizlaUdP8lK9XsefEjEGq73mDfHtKpx65oYEAOE X-Received: by 2002:a17:90a:28e4:: with SMTP id f91mr197727pjd.99.1561999522591; Mon, 01 Jul 2019 09:45:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561999522; cv=none; d=google.com; s=arc-20160816; b=Pd7INq/dw56MXDR05wf+wVMqmcmhBPlgxgwnXCdVAYmda3KgV2FyxCC7JnGf1WNljn rt8kHAxlVcTCn+70LzVYKfv5P70rSQvTPdHZ9j+veiEwOInEHPjfdafBb0oZmOOXn6wt X+gZ9CHGsLLI4UcqPJI0ZYOdNM37FFjbioOTBX5bCCHNeXHKphPSljzJnYlWAaB6Aqfk OFg+T/TAi8qgv2MncK51NiBerPSuesAmsy4ATzp4UngW7oxWZDyP1Aq62hupOU1Pj0xl pPTlfAs460K4+XBrQtvhUEkjrpsfgyeFaS9N70opt50QAEPgsbIAiZjH1C1HqCMSaiNk E8zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=6jara1U7wL+t4n4027Uzy9UK8dRMo6zsMhM1Ob59sSw=; b=UJ0KeZD9dLWLR56XbCVMhWDICJ5T8kYlF7kt+CjvA+4LK45Pa6FZRQUnZxRSN0B6LA GQ0zRJ1YxL/5PTYqwXaZtxi61ALilI/UIoummUP1XH6keu/YyguPS8UCjck2XW/J3LsX afADQzxD9BAegITDtaP3wlU2FucrJu3TDYzXIohYSFKJL5nsYqCE8d2WCn7Id1RKsiq6 NYVtlbOiBQhiF8xydc5XSmfQPVKxJyj41+HWy4lM3nYlvqA8pTT6tK096DxSsscAkMMq mK01q9lwj+agw8A9J2GVEqBIqgRfBYA6loU0kntVoxp1CambXy91DKbj6oXe5XIuuq1p m94g== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j59si10628893plb.176.2019.07.01.09.45.06; Mon, 01 Jul 2019 09:45:22 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730189AbfGAQP4 (ORCPT + 99 others); Mon, 1 Jul 2019 12:15:56 -0400 Received: from mga06.intel.com ([134.134.136.31]:41527 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726863AbfGAQP4 (ORCPT ); Mon, 1 Jul 2019 12:15:56 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Jul 2019 09:15:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,440,1557212400"; d="scan'208";a="184279656" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.157]) by fmsmga001.fm.intel.com with SMTP; 01 Jul 2019 09:15:50 -0700 Received: by lahna (sSMTP sendmail emulation); Mon, 01 Jul 2019 19:15:50 +0300 Date: Mon, 1 Jul 2019 19:15:50 +0300 From: Mika Westerberg To: "Rafael J. Wysocki" Cc: Linux PM , Linux PCI , Linux ACPI , LKML , Bjorn Helgaas , Andy Shevchenko , Hans De Goede , "Robert R. Howell" Subject: Re: [PATCH v2 1/5] PM: ACPI/PCI: Resume all devices during hibernation Message-ID: <20190701161550.GA2640@lahna.fi.intel.com> References: <4976412.ihyb9sT5jY@kreacher> <6191578.xJk2HsE5MX@kreacher> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6191578.xJk2HsE5MX@kreacher> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 01, 2019 at 12:44:25PM +0200, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Both the PCI bus type and the ACPI PM domain avoid resuming > runtime-suspended devices with DPM_FLAG_SMART_SUSPEND set during > hibernation (before creating the snapshot image of system memory), > but that turns out to be a mistake. It leads to functional issues > and adds complexity that's hard to justify. > > For this reason, resume all runtime-suspended PCI devices and all > devices in the ACPI PM domains before creating a snapshot image of > system memory during hibernation. > > Fixes: 05087360fd7a (ACPI / PM: Take SMART_SUSPEND driver flag into account) > Fixes: c4b65157aeef (PCI / PM: Take SMART_SUSPEND driver flag into account) > Link: https://lore.kernel.org/linux-acpi/917d4399-2e22-67b1-9d54-808561f9083f@uwyo.edu/T/#maf065fe6e4974f2a9d79f332ab99dfaba635f64c > Reported-by: Robert R. Howell > Tested-by: Robert R. Howell > Signed-off-by: Rafael J. Wysocki > --- > > -> v2: No changes. > > --- > drivers/acpi/device_pm.c | 13 +++++++------ > drivers/pci/pci-driver.c | 16 ++++++++-------- > 2 files changed, 15 insertions(+), 14 deletions(-) > > Index: linux-pm/drivers/acpi/device_pm.c > =================================================================== > --- linux-pm.orig/drivers/acpi/device_pm.c > +++ linux-pm/drivers/acpi/device_pm.c > @@ -1155,13 +1155,14 @@ EXPORT_SYMBOL_GPL(acpi_subsys_resume_ear > int acpi_subsys_freeze(struct device *dev) > { > /* > - * This used to be done in acpi_subsys_prepare() for all devices and > - * some drivers may depend on it, so do it here. Ideally, however, > - * runtime-suspended devices should not be touched during freeze/thaw > - * transitions. > + * Resume all runtime-suspended devices before creating a snapshot > + * image of system memory, because the restore kernel generally cannot > + * be expected to always handle them consistently and they need to be > + * put into the runtime-active metastate during system resume anyway, > + * so it is better to ensure that the state saved in the image will be > + * alwyas consistent with that. alwyas -> always > */ > - if (!dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND)) > - pm_runtime_resume(dev); > + pm_runtime_resume(dev); > > return pm_generic_freeze(dev); > } > Index: linux-pm/drivers/pci/pci-driver.c > =================================================================== > --- linux-pm.orig/drivers/pci/pci-driver.c > +++ linux-pm/drivers/pci/pci-driver.c > @@ -1012,15 +1012,15 @@ static int pci_pm_freeze(struct device * > } > > /* > - * This used to be done in pci_pm_prepare() for all devices and some > - * drivers may depend on it, so do it here. Ideally, runtime-suspended > - * devices should not be touched during freeze/thaw transitions, > - * however. > + * Resume all runtime-suspended devices before creating a snapshot > + * image of system memory, because the restore kernel generally cannot > + * be expected to always handle them consistently and they need to be > + * put into the runtime-active metastate during system resume anyway, > + * so it is better to ensure that the state saved in the image will be > + * alwyas consistent with that. ditto > */ > - if (!dev_pm_smart_suspend_and_suspended(dev)) { > - pm_runtime_resume(dev); > - pci_dev->state_saved = false; > - } > + pm_runtime_resume(dev); > + pci_dev->state_saved = false; > > if (pm->freeze) { > int error; > > >