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 X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D14AFC2BD09 for ; Wed, 4 Dec 2019 14:04:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AB5EF205F4 for ; Wed, 4 Dec 2019 14:04:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727981AbfLDOEZ (ORCPT ); Wed, 4 Dec 2019 09:04:25 -0500 Received: from mga05.intel.com ([192.55.52.43]:26902 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727828AbfLDOEZ (ORCPT ); Wed, 4 Dec 2019 09:04:25 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Dec 2019 06:04:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,277,1571727600"; d="scan'208";a="218933982" Received: from yuanwan1-mobl.ccr.corp.intel.com ([10.249.174.225]) by fmsmga001.fm.intel.com with ESMTP; 04 Dec 2019 06:04:22 -0800 Message-ID: <2991d01601fdbcf25d745a387eda74926f1192b2.camel@intel.com> Subject: Re: [PATCH] ACPI: PM: Avoid attaching ACPI PM domain to certain devices From: Zhang Rui To: "Rafael J. Wysocki" , Linux ACPI Cc: LKML , Linux PM , "Brandt, Todd E" Date: Wed, 04 Dec 2019 22:04:23 +0800 In-Reply-To: <1773028.iBGNyVBcMc@kreacher> References: <1773028.iBGNyVBcMc@kreacher> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-12-04 at 02:54 +0100, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > Certain ACPI-enumerated devices represented as platform devices in > Linux, like fans, require special low-level power management handling > implemented by their drivers that is not in agreement with the ACPI > PM domain behavior. That leads to problems with managing ACPI fans > during system-wide suspend and resume. > > For this reason, make acpi_dev_pm_attach() skip the affected devices > by adding a list of device IDs to avoid to it and putting the IDs of > the affected devices into that list. > > Fixes: e5cc8ef31267 (ACPI / PM: Provide ACPI PM callback routines for > subsystems) > Reported-by: Zhang Rui > Cc: 3.10+ # 3.10+ > Signed-off-by: Rafael J. Wysocki > --- > > Rui, > > Please test this on the machine(s) affected by the fan suspend/resume > issues. Sure, Todd and I will re-run stress test with this patch applied when 5.5-rc1 released. thanks, rui > > I don't really see any cleaner way to address this problem, because > the > ACPI PM domain should not be used with the devices in question even > if > the driver that binds to them is not loaded. > > Cheers, > Rafael > > --- > drivers/acpi/device_pm.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > Index: linux-pm/drivers/acpi/device_pm.c > =================================================================== > --- linux-pm.orig/drivers/acpi/device_pm.c > +++ linux-pm/drivers/acpi/device_pm.c > @@ -1314,9 +1314,19 @@ static void acpi_dev_pm_detach(struct de > */ > int acpi_dev_pm_attach(struct device *dev, bool power_on) > { > + /* > + * Skip devices whose ACPI companions match the device IDs > below, > + * because they require special power management handling > incompatible > + * with the generic ACPI PM domain. > + */ > + static const struct acpi_device_id special_pm_ids[] = { > + {"PNP0C0B", }, /* Generic ACPI fan */ > + {"INT3404", }, /* Fan */ > + {} > + }; > struct acpi_device *adev = ACPI_COMPANION(dev); > > - if (!adev) > + if (!adev || !acpi_match_device_ids(adev, special_pm_ids)) > return 0; > > /* > > >